Merge branch 'develop' into batch_bom_operations

This commit is contained in:
Govind S Menokee 2019-07-17 22:40:02 +05:30 committed by GitHub
commit ce42c53c1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
32 changed files with 909 additions and 2773 deletions

View File

@ -10,6 +10,14 @@ frappe.ui.form.on('Accounting Dimension', {
}); });
} }
frm.set_query('document_type', () => {
return {
filters: {
name: ['not in', ['Accounting Dimension', 'Project', 'Cost Center']]
}
};
});
let button = frm.doc.disabled ? "Enable" : "Disable"; let button = frm.doc.disabled ? "Enable" : "Disable";
frm.add_custom_button(__(button), function() { frm.add_custom_button(__(button), function() {
@ -33,10 +41,10 @@ frappe.ui.form.on('Accounting Dimension', {
document_type: function(frm) { document_type: function(frm) {
frm.set_value('label', frm.doc.document_type); frm.set_value('label', frm.doc.document_type);
frm.set_value('fieldname', frappe.scrub(frm.doc.document_type)); frm.set_value('fieldname', frappe.model.scrub(frm.doc.document_type));
frappe.db.get_value('Accounting Dimension', {'document_type': frm.doc.document_type}, 'document_type', (r) => { frappe.db.get_value('Accounting Dimension', {'document_type': frm.doc.document_type}, 'document_type', (r) => {
if (r.document_type) { if (r && r.document_type) {
frm.set_df_property('document_type', 'description', "Document type is already set as dimension"); frm.set_df_property('document_type', 'description', "Document type is already set as dimension");
} }
}); });

View File

@ -38,6 +38,7 @@
"default": "0", "default": "0",
"fieldname": "disabled", "fieldname": "disabled",
"fieldtype": "Check", "fieldtype": "Check",
"hidden": 1,
"label": "Disable", "label": "Disable",
"read_only": 1 "read_only": 1
}, },
@ -54,7 +55,7 @@
"label": "Mandatory For Profit and Loss Account" "label": "Mandatory For Profit and Loss Account"
} }
], ],
"modified": "2019-07-07 18:56:19.517450", "modified": "2019-07-14 17:25:01.307948",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Accounting Dimension", "name": "Accounting Dimension",

View File

@ -155,7 +155,7 @@ def get_doctypes_with_dimensions():
return doclist return doclist
def get_accounting_dimensions(as_list=True): def get_accounting_dimensions(as_list=True):
accounting_dimensions = frappe.get_all("Accounting Dimension", fields=["label", "fieldname", "mandatory_for_pl", "mandatory_for_bs", "disabled"]) accounting_dimensions = frappe.get_all("Accounting Dimension", fields=["label", "fieldname", "mandatory_for_pl", "mandatory_for_bs", "disabled"], filters={"disabled": 0})
if as_list: if as_list:
return [d.fieldname for d in accounting_dimensions] return [d.fieldname for d in accounting_dimensions]

View File

@ -91,13 +91,13 @@ class GLEntry(Document):
if account_type == "Profit and Loss" \ if account_type == "Profit and Loss" \
and dimension.mandatory_for_pl and not dimension.disabled: and dimension.mandatory_for_pl and not dimension.disabled:
if not self.get(dimension.fieldname): if not self.get(dimension.fieldname):
frappe.throw(_("{0} is required for 'Profit and Loss' account {1}.") frappe.throw(_("Accounting Dimension <b>{0}</b> is required for 'Profit and Loss' account {1}.")
.format(dimension.label, self.account)) .format(dimension.label, self.account))
if account_type == "Balance Sheet" \ if account_type == "Balance Sheet" \
and dimension.mandatory_for_bs and not dimension.disabled: and dimension.mandatory_for_bs and not dimension.disabled:
if not self.get(dimension.fieldname): if not self.get(dimension.fieldname):
frappe.throw(_("{0} is required for 'Balance Sheet' account {1}.") frappe.throw(_("Accounting Dimension <b>{0}</b> is required for 'Balance Sheet' account {1}.")
.format(dimension.label, self.account)) .format(dimension.label, self.account))

View File

@ -601,7 +601,7 @@ def get_outstanding_reference_documents(args):
condition += " and company = {0}".format(frappe.db.escape(args.get("company"))) condition += " and company = {0}".format(frappe.db.escape(args.get("company")))
outstanding_invoices = get_outstanding_invoices(args.get("party_type"), args.get("party"), outstanding_invoices = get_outstanding_invoices(args.get("party_type"), args.get("party"),
args.get("party_account"), filters=args, condition=condition, limit=100) args.get("party_account"), filters=args, condition=condition)
for d in outstanding_invoices: for d in outstanding_invoices:
d["exchange_rate"] = 1 d["exchange_rate"] = 1

View File

@ -451,6 +451,10 @@ def make_customer_and_address(customers):
def add_customer(data): def add_customer(data):
customer = data.get('full_name') or data.get('customer')
if frappe.db.exists("Customer", customer.strip()):
return customer.strip()
customer_doc = frappe.new_doc('Customer') customer_doc = frappe.new_doc('Customer')
customer_doc.customer_name = data.get('full_name') or data.get('customer') customer_doc.customer_name = data.get('full_name') or data.get('customer')
customer_doc.customer_pos_id = data.get('customer_pos_id') customer_doc.customer_pos_id = data.get('customer_pos_id')

View File

@ -88,6 +88,12 @@ frappe.query_reports["Accounts Payable"] = {
} }
} }
}, },
{
"fieldname":"payment_terms_template",
"label": __("Payment Terms Template"),
"fieldtype": "Link",
"options": "Payment Terms Template"
},
{ {
"fieldname":"supplier_group", "fieldname":"supplier_group",
"label": __("Supplier Group"), "label": __("Supplier Group"),

View File

@ -77,6 +77,12 @@ frappe.query_reports["Accounts Payable Summary"] = {
"fieldtype": "Link", "fieldtype": "Link",
"options": "Supplier" "options": "Supplier"
}, },
{
"fieldname":"payment_terms_template",
"label": __("Payment Terms Template"),
"fieldtype": "Link",
"options": "Payment Terms Template"
},
{ {
"fieldname":"supplier_group", "fieldname":"supplier_group",
"label": __("Supplier Group"), "label": __("Supplier Group"),

View File

@ -541,6 +541,10 @@ class ReceivablePayableReport(object):
where supplier_group=%s)""") where supplier_group=%s)""")
values.append(self.filters.get("supplier_group")) values.append(self.filters.get("supplier_group"))
if self.filters.get("payment_terms_template"):
conditions.append("party in (select name from tabSupplier where payment_terms=%s)")
values.append(self.filters.get("payment_terms_template"))
if self.filters.get("cost_center"): if self.filters.get("cost_center"):
lft, rgt = frappe.get_cached_value("Cost Center", lft, rgt = frappe.get_cached_value("Cost Center",
self.filters.get("cost_center"), ['lft', 'rgt']) self.filters.get("cost_center"), ['lft', 'rgt'])

View File

@ -104,6 +104,9 @@ def get_balance_on(account=None, date=None, party_type=None, party=None, company
# get balance of all entries that exist # get balance of all entries that exist
date = nowdate() date = nowdate()
if account:
acc = frappe.get_doc("Account", account)
try: try:
year_start_date = get_fiscal_year(date, verbose=0)[1] year_start_date = get_fiscal_year(date, verbose=0)[1]
except FiscalYearError: except FiscalYearError:
@ -118,7 +121,7 @@ def get_balance_on(account=None, date=None, party_type=None, party=None, company
allow_cost_center_in_entry_of_bs_account = get_allow_cost_center_in_entry_of_bs_account() allow_cost_center_in_entry_of_bs_account = get_allow_cost_center_in_entry_of_bs_account()
if cost_center and allow_cost_center_in_entry_of_bs_account: if cost_center and (allow_cost_center_in_entry_of_bs_account or acc.report_type =='Profit and Loss'):
cc = frappe.get_doc("Cost Center", cost_center) cc = frappe.get_doc("Cost Center", cost_center)
if cc.is_group: if cc.is_group:
cond.append(""" exists ( cond.append(""" exists (
@ -132,20 +135,13 @@ def get_balance_on(account=None, date=None, party_type=None, party=None, company
if account: if account:
acc = frappe.get_doc("Account", account)
if not frappe.flags.ignore_account_permission: if not frappe.flags.ignore_account_permission:
acc.check_permission("read") acc.check_permission("read")
if acc.report_type == 'Profit and Loss':
if not allow_cost_center_in_entry_of_bs_account and acc.report_type == 'Profit and Loss':
# for pl accounts, get balance within a fiscal year # for pl accounts, get balance within a fiscal year
cond.append("posting_date >= '%s' and voucher_type != 'Period Closing Voucher'" \ cond.append("posting_date >= '%s' and voucher_type != 'Period Closing Voucher'" \
% year_start_date) % year_start_date)
elif allow_cost_center_in_entry_of_bs_account:
# for all accounts, get balance within a fiscal year if maintain cost center in balance account is checked
cond.append("posting_date >= '%s' and voucher_type != 'Period Closing Voucher'" \
% year_start_date)
# different filter for group and ledger - improved performance # different filter for group and ledger - improved performance
if acc.is_group: if acc.is_group:
cond.append("""exists ( cond.append("""exists (
@ -734,7 +730,6 @@ def get_children(doctype, parent, company, is_root=False):
parent_fieldname = 'parent_' + doctype.lower().replace(' ', '_') parent_fieldname = 'parent_' + doctype.lower().replace(' ', '_')
fields = [ fields = [
'name as value', 'name as value',
'root_type',
'is_group as expandable' 'is_group as expandable'
] ]
filters = [['docstatus', '<', 2]] filters = [['docstatus', '<', 2]]
@ -742,11 +737,11 @@ def get_children(doctype, parent, company, is_root=False):
filters.append(['ifnull(`{0}`,"")'.format(parent_fieldname), '=', '' if is_root else parent]) filters.append(['ifnull(`{0}`,"")'.format(parent_fieldname), '=', '' if is_root else parent])
if is_root: if is_root:
fields += ['report_type', 'account_currency'] if doctype == 'Account' else [] fields += ['root_type', 'report_type', 'account_currency'] if doctype == 'Account' else []
filters.append(['company', '=', company]) filters.append(['company', '=', company])
else: else:
fields += ['account_currency'] if doctype == 'Account' else [] fields += ['root_type', 'account_currency'] if doctype == 'Account' else []
fields += [parent_fieldname + ' as parent'] fields += [parent_fieldname + ' as parent']
acc = frappe.get_list(doctype, fields=fields, filters=filters) acc = frappe.get_list(doctype, fields=fields, filters=filters)

View File

@ -323,7 +323,7 @@ class calculate_taxes_and_totals(object):
self._set_in_company_currency(self.doc, ["total_taxes_and_charges", "rounding_adjustment"]) self._set_in_company_currency(self.doc, ["total_taxes_and_charges", "rounding_adjustment"])
if self.doc.doctype in ["Quotation", "Sales Order", "Delivery Note", "Sales Invoice"]: if self.doc.doctype in ["Quotation", "Sales Order", "Delivery Note", "Sales Invoice"]:
self.doc.base_grand_total = flt(self.doc.grand_total * self.doc.conversion_rate) \ self.doc.base_grand_total = flt(self.doc.grand_total * self.doc.conversion_rate, self.doc.precision("base_grand_total")) \
if self.doc.total_taxes_and_charges else self.doc.base_net_total if self.doc.total_taxes_and_charges else self.doc.base_net_total
else: else:
self.doc.taxes_and_charges_added = self.doc.taxes_and_charges_deducted = 0.0 self.doc.taxes_and_charges_added = self.doc.taxes_and_charges_deducted = 0.0

View File

@ -19,6 +19,10 @@ frappe.ui.form.on("Opportunity", {
} }
} }
}); });
if (frm.doc.opportunity_from && frm.doc.party_name){
frm.trigger('set_contact_link');
}
}, },
onload_post_render: function(frm) { onload_post_render: function(frm) {

View File

@ -594,7 +594,6 @@ def get_bom_items_as_dict(bom, company, qty=1, fetch_exploded=1, fetch_scrap_ite
bom_item.idx, bom_item.idx,
item.item_name, item.item_name,
sum(bom_item.{qty_field}/ifnull(bom.quantity, 1)) * %(qty)s as qty, sum(bom_item.{qty_field}/ifnull(bom.quantity, 1)) * %(qty)s as qty,
item.description,
item.image, item.image,
bom.project, bom.project,
item.stock_uom, item.stock_uom,
@ -623,17 +622,22 @@ def get_bom_items_as_dict(bom, company, qty=1, fetch_exploded=1, fetch_scrap_ite
where_conditions="", where_conditions="",
is_stock_item=is_stock_item, is_stock_item=is_stock_item,
qty_field="stock_qty", qty_field="stock_qty",
select_columns = """, bom_item.source_warehouse, bom_item.operation, bom_item.include_item_in_manufacturing, select_columns = """, bom_item.source_warehouse, bom_item.operation,
bom_item.include_item_in_manufacturing, bom_item.description,
(Select idx from `tabBOM Item` where item_code = bom_item.item_code and parent = %(parent)s limit 1) as idx""") (Select idx from `tabBOM Item` where item_code = bom_item.item_code and parent = %(parent)s limit 1) as idx""")
items = frappe.db.sql(query, { "parent": bom, "qty": qty, "bom": bom, "company": company }, as_dict=True) items = frappe.db.sql(query, { "parent": bom, "qty": qty, "bom": bom, "company": company }, as_dict=True)
elif fetch_scrap_items: elif fetch_scrap_items:
query = query.format(table="BOM Scrap Item", where_conditions="", select_columns=", bom_item.idx", is_stock_item=is_stock_item, qty_field="stock_qty") query = query.format(table="BOM Scrap Item", where_conditions="",
select_columns=", bom_item.idx, item.description", is_stock_item=is_stock_item, qty_field="stock_qty")
items = frappe.db.sql(query, { "qty": qty, "bom": bom, "company": company }, as_dict=True) items = frappe.db.sql(query, { "qty": qty, "bom": bom, "company": company }, as_dict=True)
else: else:
query = query.format(table="BOM Item", where_conditions="", is_stock_item=is_stock_item, query = query.format(table="BOM Item", where_conditions="", is_stock_item=is_stock_item,
qty_field="stock_qty" if fetch_qty_in_stock_uom else "qty", qty_field="stock_qty" if fetch_qty_in_stock_uom else "qty",
select_columns = ", bom_item.uom, bom_item.conversion_factor, bom_item.source_warehouse, bom_item.idx, bom_item.operation, bom_item.include_item_in_manufacturing") select_columns = """, bom_item.uom, bom_item.conversion_factor, bom_item.source_warehouse,
bom_item.idx, bom_item.operation, bom_item.include_item_in_manufacturing,
bom_item.description """)
items = frappe.db.sql(query, { "qty": qty, "bom": bom, "company": company }, as_dict=True) items = frappe.db.sql(query, { "qty": qty, "bom": bom, "company": company }, as_dict=True)
for item in items: for item in items:

View File

@ -623,3 +623,4 @@ execute:frappe.delete_doc("DocType", "Project Task")
erpnext.patches.v11_1.update_default_supplier_in_item_defaults erpnext.patches.v11_1.update_default_supplier_in_item_defaults
erpnext.patches.v12_0.update_due_date_in_gle erpnext.patches.v12_0.update_due_date_in_gle
erpnext.patches.v12_0.add_default_buying_selling_terms_in_company erpnext.patches.v12_0.add_default_buying_selling_terms_in_company
erpnext.patches.v12_0.update_ewaybill_field_position

View File

@ -0,0 +1,27 @@
from __future__ import unicode_literals
import frappe
from erpnext.regional.india.setup import make_custom_fields
def execute():
company = frappe.get_all('Company', filters = {'country': 'India'})
if not company:
return
field = frappe.db.get_value("Custom Field", {"dt": "Sales Invoice", "fieldname": "ewaybill"})
ewaybill_field = frappe.get_doc("Custom Field", field)
ewaybill_field.flags.ignore_validate = True
ewaybill_field.update({
'fieldname': 'ewaybill',
'label': 'e-Way Bill No.',
'fieldtype': 'Data',
'depends_on': 'eval:(doc.docstatus === 1)',
'allow_on_submit': 1,
'insert_after': 'tax_id',
'translatable': 0
})
ewaybill_field.save()

View File

@ -4,7 +4,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe import frappe
from frappe.utils import getdate from frappe.utils import getdate
from frappe.desk.doctype.auto_repeat.auto_repeat import get_next_schedule_date from frappe.automation.doctype.auto_repeat.auto_repeat import get_next_schedule_date
def execute(): def execute():
frappe.reload_doc('accounts', 'doctype', 'subscription') frappe.reload_doc('accounts', 'doctype', 'subscription')

View File

@ -126,7 +126,8 @@
"fieldname": "project_template", "fieldname": "project_template",
"fieldtype": "Link", "fieldtype": "Link",
"label": "From Template", "label": "From Template",
"options": "Project Template" "options": "Project Template",
"set_only_once": 1
}, },
{ {
"fieldname": "expected_start_date", "fieldname": "expected_start_date",
@ -442,7 +443,7 @@
"icon": "fa fa-puzzle-piece", "icon": "fa fa-puzzle-piece",
"idx": 29, "idx": 29,
"max_attachments": 4, "max_attachments": 4,
"modified": "2019-06-25 16:14:43.887151", "modified": "2019-07-16 11:11:12.343658",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Projects", "module": "Projects",
"name": "Project", "name": "Project",
@ -481,6 +482,7 @@
"quick_entry": 1, "quick_entry": 1,
"search_fields": "customer, status, priority, is_active", "search_fields": "customer, status, priority, is_active",
"show_name_in_global_search": 1, "show_name_in_global_search": 1,
"sort_field": "modified",
"sort_order": "DESC", "sort_order": "DESC",
"timeline_field": "customer", "timeline_field": "customer",
"track_seen": 1 "track_seen": 1

View File

@ -1,333 +1,85 @@
{ {
"allow_copy": 0, "creation": "2016-03-25 02:52:19.283003",
"allow_events_in_timeline": 0, "doctype": "DocType",
"allow_guest_to_view": 0, "editable_grid": 1,
"allow_import": 0, "engine": "InnoDB",
"allow_rename": 0, "field_order": [
"beta": 0, "user",
"creation": "2016-03-25 02:52:19.283003", "email",
"custom": 0, "image",
"docstatus": 0, "column_break_2",
"doctype": "DocType", "full_name",
"document_type": "", "welcome_email_sent",
"editable_grid": 1, "view_attachments",
"section_break_5",
"project_status"
],
"fields": [ "fields": [
{ {
"allow_bulk_edit": 0, "fieldname": "user",
"allow_in_quick_entry": 0, "fieldtype": "Link",
"allow_on_submit": 0, "in_list_view": 1,
"bold": 0, "label": "User",
"collapsible": 0, "options": "User",
"columns": 0, "reqd": 1,
"fieldname": "user", "search_index": 1
"fieldtype": "Link", },
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "User",
"length": 0,
"no_copy": 0,
"options": "User",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 1,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{ {
"allow_bulk_edit": 0, "fetch_from": "user.email",
"allow_in_quick_entry": 0, "fieldname": "email",
"allow_on_submit": 0, "fieldtype": "Read Only",
"bold": 0, "label": "Email"
"collapsible": 0, },
"columns": 0,
"fetch_from": "user.email",
"fieldname": "email",
"fieldtype": "Read Only",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Email",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{ {
"allow_bulk_edit": 0, "fetch_from": "user.user_image",
"allow_in_quick_entry": 0, "fieldname": "image",
"allow_on_submit": 0, "fieldtype": "Read Only",
"bold": 0, "hidden": 1,
"collapsible": 0, "in_global_search": 1,
"columns": 0, "label": "Image"
"fetch_from": "user.user_image", },
"fieldname": "image",
"fieldtype": "Read Only",
"hidden": 1,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 1,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Image",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{ {
"allow_bulk_edit": 0, "fieldname": "column_break_2",
"allow_in_quick_entry": 0, "fieldtype": "Column Break"
"allow_on_submit": 0, },
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "column_break_2",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{ {
"allow_bulk_edit": 0, "fetch_from": "user.full_name",
"allow_in_quick_entry": 0, "fieldname": "full_name",
"allow_on_submit": 0, "fieldtype": "Read Only",
"bold": 0, "label": "Full Name"
"collapsible": 0, },
"columns": 0,
"default": "user.full_name",
"fieldname": "full_name",
"fieldtype": "Read Only",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Full Name",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{ {
"allow_bulk_edit": 0, "default": "0",
"allow_in_quick_entry": 0, "fieldname": "welcome_email_sent",
"allow_on_submit": 0, "fieldtype": "Check",
"bold": 0, "label": "Welcome email sent"
"collapsible": 0, },
"columns": 0,
"fieldname": "welcome_email_sent",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Welcome email sent",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{ {
"allow_bulk_edit": 0, "columns": 1,
"allow_in_quick_entry": 0, "default": "0",
"allow_on_submit": 0, "fieldname": "view_attachments",
"bold": 0, "fieldtype": "Check",
"collapsible": 0, "in_list_view": 1,
"columns": 1, "label": "View attachments"
"fieldname": "view_attachments", },
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "View attachments",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{ {
"allow_bulk_edit": 0, "fieldname": "section_break_5",
"allow_in_quick_entry": 0, "fieldtype": "Section Break"
"allow_on_submit": 0, },
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "section_break_5",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{ {
"allow_bulk_edit": 0, "depends_on": "eval:parent.doctype == 'Project Update'",
"allow_in_quick_entry": 0, "fieldname": "project_status",
"allow_on_submit": 0, "fieldtype": "Text",
"bold": 0, "label": "Project Status"
"collapsible": 0,
"columns": 0,
"depends_on": "eval:parent.doctype == 'Project Update'",
"fieldname": "project_status",
"fieldtype": "Text",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Project Status",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
} }
], ],
"has_web_view": 0, "istable": 1,
"hide_heading": 0, "modified": "2019-07-15 19:37:26.942294",
"hide_toolbar": 0, "modified_by": "Administrator",
"idx": 0, "module": "Projects",
"image_view": 0, "name": "Project User",
"in_create": 0, "owner": "Administrator",
"is_submittable": 0, "permissions": [],
"issingle": 0, "sort_field": "modified",
"istable": 1, "sort_order": "DESC"
"max_attachments": 0,
"modified": "2019-01-17 17:10:05.339735",
"modified_by": "Administrator",
"module": "Projects",
"name": "Project User",
"name_case": "",
"owner": "Administrator",
"permissions": [],
"quick_entry": 0,
"read_only": 0,
"read_only_onload": 0,
"show_name_in_global_search": 0,
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 0,
"track_seen": 0,
"track_views": 0
} }

View File

@ -42,20 +42,6 @@ frappe.ui.form.on("Task", {
frappe.set_route("List", "Expense Claim"); frappe.set_route("List", "Expense Claim");
}, __("View"), true); }, __("View"), true);
} }
if (frm.perm[0].write) {
if (!["Closed", "Cancelled"].includes(frm.doc.status)) {
frm.add_custom_button(__("Close"), () => {
frm.set_value("status", "Closed");
frm.save();
});
} else {
frm.add_custom_button(__("Reopen"), () => {
frm.set_value("status", "Open");
frm.save();
});
}
}
} }
} }
}, },

View File

@ -346,7 +346,7 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
update_auto_repeat_reference: function(doc) { update_auto_repeat_reference: function(doc) {
if (doc.auto_repeat) { if (doc.auto_repeat) {
frappe.call({ frappe.call({
method:"frappe.desk.doctype.auto_repeat.auto_repeat.update_reference", method:"frappe.automation.doctype.auto_repeat.auto_repeat.update_reference",
args:{ args:{
docname: doc.auto_repeat, docname: doc.auto_repeat,
reference:doc.name reference:doc.name

View File

@ -180,7 +180,7 @@ $.extend(erpnext.utils, {
make_subscription: function(doctype, docname) { make_subscription: function(doctype, docname) {
frappe.call({ frappe.call({
method: "frappe.desk.doctype.auto_repeat.auto_repeat.make_auto_repeat", method: "frappe.automation.doctype.auto_repeat.auto_repeat.make_auto_repeat",
args: { args: {
doctype: doctype, doctype: doctype,
docname: docname docname: docname

View File

@ -145,7 +145,7 @@ erpnext.utils.set_taxes_from_address = function(frm, triggered_from_field, billi
erpnext.utils.set_taxes = function(frm, triggered_from_field) { erpnext.utils.set_taxes = function(frm, triggered_from_field) {
if(frappe.meta.get_docfield(frm.doc.doctype, "taxes")) { if(frappe.meta.get_docfield(frm.doc.doctype, "taxes")) {
if(!erpnext.utils.validate_mandatory(frm, "Lead/Customer/Supplier", if(!erpnext.utils.validate_mandatory(frm, "Lead/Customer/Supplier",
frm.doc.customer || frm.doc.supplier || frm.doc.lead, triggered_from_field)) { frm.doc.customer || frm.doc.supplier || frm.doc.lead || frm.doc.party_name, triggered_from_field)) {
return; return;
} }

View File

@ -354,7 +354,7 @@ def make_custom_fields(update=True):
'fieldtype': 'Data', 'fieldtype': 'Data',
'depends_on': 'eval:(doc.docstatus === 1)', 'depends_on': 'eval:(doc.docstatus === 1)',
'allow_on_submit': 1, 'allow_on_submit': 1,
'insert_after': 'project', 'insert_after': 'tax_id',
'translatable': 0 'translatable': 0
} }
] ]

View File

@ -14,7 +14,7 @@ from erpnext.stock.stock_balance import update_bin_qty, get_reserved_qty
from frappe.desk.notifications import clear_doctype_notifications from frappe.desk.notifications import clear_doctype_notifications
from frappe.contacts.doctype.address.address import get_company_address from frappe.contacts.doctype.address.address import get_company_address
from erpnext.controllers.selling_controller import SellingController from erpnext.controllers.selling_controller import SellingController
from frappe.desk.doctype.auto_repeat.auto_repeat import get_next_schedule_date from frappe.automation.doctype.auto_repeat.auto_repeat import get_next_schedule_date
from erpnext.selling.doctype.customer.customer import check_credit_limit from erpnext.selling.doctype.customer.customer import check_credit_limit
from erpnext.stock.doctype.item.item import get_item_defaults from erpnext.stock.doctype.item.item import get_item_defaults
from erpnext.setup.doctype.item_group.item_group import get_item_group_defaults from erpnext.setup.doctype.item_group.item_group import get_item_group_defaults

View File

@ -16,20 +16,6 @@ frappe.query_reports["Customer Credit Balance"] = {
"label": __("Customer"), "label": __("Customer"),
"fieldtype": "Link", "fieldtype": "Link",
"options": "Customer" "options": "Customer"
}, }
{
"fieldname":"cost_center",
"label": __("Cost Center"),
"fieldtype": "Link",
"options": "Cost Center",
get_query: () => {
var company = frappe.query_report.get_filter_value('company');
return {
filters: {
'company': company
}
}
}
},
] ]
} }

View File

@ -21,8 +21,7 @@ def execute(filters=None):
row = [] row = []
outstanding_amt = get_customer_outstanding(d.name, filters.get("company"), outstanding_amt = get_customer_outstanding(d.name, filters.get("company"),
ignore_outstanding_sales_order=d.bypass_credit_limit_check_at_sales_order, ignore_outstanding_sales_order=d.bypass_credit_limit_check_at_sales_order)
cost_center=filters.get("cost_center"))
credit_limit = get_credit_limit(d.name, filters.get("company")) credit_limit = get_credit_limit(d.name, filters.get("company"))
@ -66,3 +65,4 @@ def get_details(filters):
return frappe.db.sql("""select name, customer_name, return frappe.db.sql("""select name, customer_name,
bypass_credit_limit_check_at_sales_order, is_frozen, disabled from `tabCustomer` %s bypass_credit_limit_check_at_sales_order, is_frozen, disabled from `tabCustomer` %s
""" % conditions, filters, as_dict=1) """ % conditions, filters, as_dict=1)

View File

@ -428,7 +428,7 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
update_auto_repeat_reference: function(doc) { update_auto_repeat_reference: function(doc) {
if (doc.auto_repeat) { if (doc.auto_repeat) {
frappe.call({ frappe.call({
method:"frappe.desk.doctype.auto_repeat.auto_repeat.update_reference", method:"frappe.automation.doctype.auto_repeat.auto_repeat.update_reference",
args:{ args:{
docname: doc.auto_repeat, docname: doc.auto_repeat,
reference:doc.name reference:doc.name

View File

@ -16,18 +16,47 @@ erpnext.stock.ItemDashboard = Class.extend({
this.content = $(frappe.render_template('item_dashboard')).appendTo(this.parent); this.content = $(frappe.render_template('item_dashboard')).appendTo(this.parent);
this.result = this.content.find('.result'); this.result = this.content.find('.result');
// move
this.content.on('click', '.btn-move', function() { this.content.on('click', '.btn-move', function() {
erpnext.stock.move_item(unescape($(this).attr('data-item')), $(this).attr('data-warehouse'), handle_move_add($(this), "Move")
null, $(this).attr('data-actual_qty'), null, function() { me.refresh(); });
}); });
this.content.on('click', '.btn-add', function() { this.content.on('click', '.btn-add', function() {
erpnext.stock.move_item(unescape($(this).attr('data-item')), null, $(this).attr('data-warehouse'), handle_move_add($(this), "Add")
$(this).attr('data-actual_qty'), $(this).attr('data-rate'),
function() { me.refresh(); });
}); });
function handle_move_add(element, action) {
let item = unescape(element.attr('data-item'));
let warehouse = unescape(element.attr('data-warehouse'));
let actual_qty = unescape(element.attr('data-actual_qty'));
let disable_quick_entry = Number(unescape(element.attr('data-disable_quick_entry')));
let entry_type = action === "Move" ? "Material Transfer": null;
if (disable_quick_entry) {
open_stock_entry(item, warehouse, entry_type);
} else {
if (action === "Add") {
let rate = unescape($(this).attr('data-rate'));
erpnext.stock.move_item(item, null, warehouse, actual_qty, rate, function() { me.refresh(); });
}
else {
erpnext.stock.move_item(item, warehouse, null, actual_qty, null, function() { me.refresh(); });
}
}
}
function open_stock_entry(item, warehouse, entry_type) {
frappe.model.with_doctype('Stock Entry', function() {
var doc = frappe.model.get_new_doc('Stock Entry');
if (entry_type) doc.stock_entry_type = entry_type;
var row = frappe.model.add_child(doc, 'items');
row.item_code = item;
row.s_warehouse = warehouse;
frappe.set_route('Form', doc.doctype, doc.name);
})
}
// more // more
this.content.find('.btn-more').on('click', function() { this.content.find('.btn-more').on('click', function() {
me.start += 20; me.start += 20;
@ -196,4 +225,4 @@ erpnext.stock.move_item = function(item, source, target, actual_qty, rate, callb
frappe.set_route('Form', doc.doctype, doc.name); frappe.set_route('Form', doc.doctype, doc.name);
}) })
}); });
} }

View File

@ -44,7 +44,9 @@ def get_data(item_code=None, warehouse=None, item_group=None,
for item in items: for item in items:
item.update({ item.update({
'item_name': frappe.get_cached_value("Item", item.item_code, 'item_name') 'item_name': frappe.get_cached_value("Item", item.item_code, 'item_name'),
'disable_quick_entry': frappe.get_cached_value("Item", item.item_code, 'has_batch_no')
or frappe.get_cached_value("Item", item.item_code, 'has_serial_no'),
}) })
return items return items

View File

@ -43,11 +43,13 @@
<div class="col-sm-2 text-right" style="margin-top: 8px;"> <div class="col-sm-2 text-right" style="margin-top: 8px;">
{% if d.actual_qty %} {% if d.actual_qty %}
<button class="btn btn-default btn-xs btn-move" <button class="btn btn-default btn-xs btn-move"
data-disable_quick_entry="{{ d.disable_quick_entry }}"
data-warehouse="{{ d.warehouse }}" data-warehouse="{{ d.warehouse }}"
data-actual_qty="{{ d.actual_qty }}" data-actual_qty="{{ d.actual_qty }}"
data-item="{{ escape(d.item_code) }}">{{ __("Move") }}</a> data-item="{{ escape(d.item_code) }}">{{ __("Move") }}</a>
{% endif %} {% endif %}
<button style="margin-left: 7px;" class="btn btn-default btn-xs btn-add" <button style="margin-left: 7px;" class="btn btn-default btn-xs btn-add"
data-disable_quick_entry="{{ d.disable_quick_entry }}"
data-warehouse="{{ d.warehouse }}" data-warehouse="{{ d.warehouse }}"
data-actual_qty="{{ d.actual_qty }}" data-actual_qty="{{ d.actual_qty }}"
data-item="{{ escape(d.item_code) }}" data-item="{{ escape(d.item_code) }}"

File diff suppressed because it is too large Load Diff

View File

@ -7,22 +7,22 @@ import json
def get_context(context): def get_context(context):
project_user = frappe.db.get_value("Project User", {"parent": frappe.form_dict.project, "user": frappe.session.user} , ["user", "view_attachments"], as_dict= True) project_user = frappe.db.get_value("Project User", {"parent": frappe.form_dict.project, "user": frappe.session.user} , ["user", "view_attachments"], as_dict= True)
if not project_user or frappe.session.user == 'Guest': if frappe.session.user != 'Administrator' and (not project_user or frappe.session.user == 'Guest'):
raise frappe.PermissionError raise frappe.PermissionError
context.no_cache = 1 context.no_cache = 1
context.show_sidebar = True context.show_sidebar = True
project = frappe.get_doc('Project', frappe.form_dict.project) project = frappe.get_doc('Project', frappe.form_dict.project)
project.has_permission('read') project.has_permission('read')
project.tasks = get_tasks(project.name, start=0, item_status='open', project.tasks = get_tasks(project.name, start=0, item_status='open',
search=frappe.form_dict.get("search")) search=frappe.form_dict.get("search"))
project.timesheets = get_timesheets(project.name, start=0, project.timesheets = get_timesheets(project.name, start=0,
search=frappe.form_dict.get("search")) search=frappe.form_dict.get("search"))
if project_user.view_attachments: if project_user and project_user.view_attachments:
project.attachments = get_attachments(project.name) project.attachments = get_attachments(project.name)
context.doc = project context.doc = project
@ -46,7 +46,7 @@ def get_tasks(project, start=0, search=None, item_status=None):
task.todo=task.todo[0] task.todo=task.todo[0]
task.todo.user_image = frappe.db.get_value('User', task.todo.owner, 'user_image') task.todo.user_image = frappe.db.get_value('User', task.todo.owner, 'user_image')
task.comment_count = len(json.loads(task._comments or "[]")) task.comment_count = len(json.loads(task._comments or "[]"))
task.css_seen = '' task.css_seen = ''
@ -86,7 +86,7 @@ def get_timesheets(project, start=0, search=None):
timesheet.info.css_seen = '' timesheet.info.css_seen = ''
if timesheet.info._seen: if timesheet.info._seen:
if frappe.session.user in json.loads(timesheet.info._seen): if frappe.session.user in json.loads(timesheet.info._seen):
timesheet.info.css_seen = 'seen' timesheet.info.css_seen = 'seen'
return timesheets return timesheets
@frappe.whitelist() @frappe.whitelist()