Merge branch 'develop' into refactor-call-popup

This commit is contained in:
Suraj Shetty 2019-07-17 13:23:54 +05:30 committed by GitHub
commit 9eb091162a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 752 additions and 2406 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";
frm.add_custom_button(__(button), function() {
@ -33,10 +41,10 @@ frappe.ui.form.on('Accounting Dimension', {
document_type: function(frm) {
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) => {
if (r.document_type) {
if (r && r.document_type) {
frm.set_df_property('document_type', 'description', "Document type is already set as dimension");
}
});

View File

@ -38,6 +38,7 @@
"default": "0",
"fieldname": "disabled",
"fieldtype": "Check",
"hidden": 1,
"label": "Disable",
"read_only": 1
},
@ -54,7 +55,7 @@
"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",
"module": "Accounts",
"name": "Accounting Dimension",

View File

@ -155,7 +155,7 @@ def get_doctypes_with_dimensions():
return doclist
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:
return [d.fieldname for d in accounting_dimensions]

View File

@ -91,13 +91,13 @@ class GLEntry(Document):
if account_type == "Profit and Loss" \
and dimension.mandatory_for_pl and not dimension.disabled:
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))
if account_type == "Balance Sheet" \
and dimension.mandatory_for_bs and not dimension.disabled:
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))

View File

@ -592,7 +592,6 @@ def get_bom_items_as_dict(bom, company, qty=1, fetch_exploded=1, fetch_scrap_ite
bom_item.idx,
item.item_name,
sum(bom_item.{qty_field}/ifnull(bom.quantity, 1)) * %(qty)s as qty,
item.description,
item.image,
bom.project,
item.stock_uom,
@ -621,17 +620,22 @@ def get_bom_items_as_dict(bom, company, qty=1, fetch_exploded=1, fetch_scrap_ite
where_conditions="",
is_stock_item=is_stock_item,
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""")
items = frappe.db.sql(query, { "parent": bom, "qty": qty, "bom": bom, "company": company }, as_dict=True)
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)
else:
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",
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)
for item in items:

View File

@ -621,4 +621,5 @@ erpnext.patches.v12_0.delete_priority_property_setter
execute:frappe.delete_doc("DocType", "Project Task")
erpnext.patches.v11_1.update_default_supplier_in_item_defaults
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

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

View File

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

View File

@ -16,20 +16,6 @@ frappe.query_reports["Customer Credit Balance"] = {
"label": __("Customer"),
"fieldtype": "Link",
"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 = []
outstanding_amt = get_customer_outstanding(d.name, filters.get("company"),
ignore_outstanding_sales_order=d.bypass_credit_limit_check_at_sales_order,
cost_center=filters.get("cost_center"))
ignore_outstanding_sales_order=d.bypass_credit_limit_check_at_sales_order)
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,
bypass_credit_limit_check_at_sales_order, is_frozen, disabled from `tabCustomer` %s
""" % conditions, filters, as_dict=1)

File diff suppressed because it is too large Load Diff