From b14cc0417d92a34303383e8790309306401b0d77 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 10 Dec 2014 12:27:54 +0530 Subject: [PATCH 1/9] Display tax amount after discount, if there is any discount amount --- .../sales_taxes_and_charges.json | 251 +++++++++--------- 1 file changed, 126 insertions(+), 125 deletions(-) diff --git a/erpnext/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.json b/erpnext/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.json index 7bde84ff0c..d820c871a5 100644 --- a/erpnext/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.json +++ b/erpnext/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.json @@ -1,155 +1,156 @@ { - "autoname": "INVTD.######", - "creation": "2013-04-24 11:39:32", - "docstatus": 0, - "doctype": "DocType", + "autoname": "INVTD.######", + "creation": "2013-04-24 11:39:32", + "docstatus": 0, + "doctype": "DocType", "fields": [ { - "fieldname": "charge_type", - "fieldtype": "Select", - "in_list_view": 1, - "label": "Type", - "oldfieldname": "charge_type", - "oldfieldtype": "Select", - "options": "\nActual\nOn Net Total\nOn Previous Row Amount\nOn Previous Row Total", - "permlevel": 0, + "fieldname": "charge_type", + "fieldtype": "Select", + "in_list_view": 1, + "label": "Type", + "oldfieldname": "charge_type", + "oldfieldtype": "Select", + "options": "\nActual\nOn Net Total\nOn Previous Row Amount\nOn Previous Row Total", + "permlevel": 0, "reqd": 1 - }, + }, { - "depends_on": "eval:[\"On Previous Row Amount\", \"On Previous Row Total\"].indexOf(doc.charge_type)!==-1", - "fieldname": "row_id", - "fieldtype": "Data", - "hidden": 0, - "label": "Reference Row #", - "oldfieldname": "row_id", - "oldfieldtype": "Data", + "depends_on": "eval:[\"On Previous Row Amount\", \"On Previous Row Total\"].indexOf(doc.charge_type)!==-1", + "fieldname": "row_id", + "fieldtype": "Data", + "hidden": 0, + "label": "Reference Row #", + "oldfieldname": "row_id", + "oldfieldtype": "Data", "permlevel": 0 - }, + }, { - "fieldname": "description", - "fieldtype": "Small Text", - "in_list_view": 1, - "label": "Description", - "oldfieldname": "description", - "oldfieldtype": "Small Text", - "permlevel": 0, - "print_width": "300px", - "reqd": 1, + "fieldname": "description", + "fieldtype": "Small Text", + "in_list_view": 1, + "label": "Description", + "oldfieldname": "description", + "oldfieldtype": "Small Text", + "permlevel": 0, + "print_width": "300px", + "reqd": 1, "width": "300px" - }, + }, { - "fieldname": "col_break_1", - "fieldtype": "Column Break", - "permlevel": 0, + "fieldname": "col_break_1", + "fieldtype": "Column Break", + "permlevel": 0, "width": "50%" - }, + }, { - "fieldname": "account_head", - "fieldtype": "Link", - "in_list_view": 0, - "label": "Account Head", - "oldfieldname": "account_head", - "oldfieldtype": "Link", - "options": "Account", - "permlevel": 0, - "reqd": 1, + "fieldname": "account_head", + "fieldtype": "Link", + "in_list_view": 0, + "label": "Account Head", + "oldfieldname": "account_head", + "oldfieldtype": "Link", + "options": "Account", + "permlevel": 0, + "reqd": 1, "search_index": 1 - }, + }, { - "default": ":Company", - "fieldname": "cost_center", - "fieldtype": "Link", - "in_list_view": 0, - "label": "Cost Center", - "oldfieldname": "cost_center_other_charges", - "oldfieldtype": "Link", - "options": "Cost Center", + "default": ":Company", + "fieldname": "cost_center", + "fieldtype": "Link", + "in_list_view": 0, + "label": "Cost Center", + "oldfieldname": "cost_center_other_charges", + "oldfieldtype": "Link", + "options": "Cost Center", "permlevel": 0 - }, + }, { - "fieldname": "rate", - "fieldtype": "Float", - "in_list_view": 1, - "label": "Rate", - "oldfieldname": "rate", - "oldfieldtype": "Currency", - "permlevel": 0, + "fieldname": "rate", + "fieldtype": "Float", + "in_list_view": 1, + "label": "Rate", + "oldfieldname": "rate", + "oldfieldtype": "Currency", + "permlevel": 0, "reqd": 1 - }, + }, { - "fieldname": "tax_amount", - "fieldtype": "Currency", - "in_list_view": 1, - "label": "Amount", - "oldfieldname": "tax_amount", - "oldfieldtype": "Currency", - "options": "Company:company:default_currency", - "permlevel": 0, - "read_only": 1, + "fieldname": "tax_amount", + "fieldtype": "Currency", + "in_list_view": 1, + "label": "Amount", + "oldfieldname": "tax_amount", + "oldfieldtype": "Currency", + "options": "Company:company:default_currency", + "permlevel": 0, + "read_only": 1, "reqd": 0 - }, + }, { - "fieldname": "total", - "fieldtype": "Currency", - "label": "Total", - "oldfieldname": "total", - "oldfieldtype": "Currency", - "options": "Company:company:default_currency", - "permlevel": 0, + "fieldname": "total", + "fieldtype": "Currency", + "label": "Total", + "oldfieldname": "total", + "oldfieldtype": "Currency", + "options": "Company:company:default_currency", + "permlevel": 0, "read_only": 1 - }, + }, { - "allow_on_submit": 0, - "description": "If checked, the tax amount will be considered as already included in the Print Rate / Print Amount", - "fieldname": "included_in_print_rate", - "fieldtype": "Check", - "label": "Is this Tax included in Basic Rate?", - "no_copy": 0, - "permlevel": 0, - "print_hide": 1, - "print_width": "150px", - "report_hide": 1, + "allow_on_submit": 0, + "description": "If checked, the tax amount will be considered as already included in the Print Rate / Print Amount", + "fieldname": "included_in_print_rate", + "fieldtype": "Check", + "label": "Is this Tax included in Basic Rate?", + "no_copy": 0, + "permlevel": 0, + "print_hide": 1, + "print_width": "150px", + "report_hide": 1, "width": "150px" - }, + }, { - "fieldname": "tax_amount_after_discount_amount", - "fieldtype": "Currency", - "hidden": 1, - "label": "Tax Amount After Discount Amount", - "options": "Company:company:default_currency", - "permlevel": 0, + "depends_on": "eval:parent.discount_amount", + "fieldname": "tax_amount_after_discount_amount", + "fieldtype": "Currency", + "hidden": 0, + "label": "Tax Amount After Discount Amount", + "options": "Company:company:default_currency", + "permlevel": 0, "read_only": 1 - }, + }, { - "fieldname": "item_wise_tax_detail", - "fieldtype": "Small Text", - "hidden": 1, - "label": "Item Wise Tax Detail", - "oldfieldname": "item_wise_tax_detail", - "oldfieldtype": "Small Text", - "permlevel": 0, + "fieldname": "item_wise_tax_detail", + "fieldtype": "Small Text", + "hidden": 1, + "label": "Item Wise Tax Detail", + "oldfieldname": "item_wise_tax_detail", + "oldfieldtype": "Small Text", + "permlevel": 0, "read_only": 1 - }, + }, { - "fieldname": "parenttype", - "fieldtype": "Data", - "hidden": 1, - "in_filter": 1, - "label": "Parenttype", - "oldfieldname": "parenttype", - "oldfieldtype": "Data", - "permlevel": 0, - "print_hide": 1, + "fieldname": "parenttype", + "fieldtype": "Data", + "hidden": 1, + "in_filter": 1, + "label": "Parenttype", + "oldfieldname": "parenttype", + "oldfieldtype": "Data", + "permlevel": 0, + "print_hide": 1, "search_index": 1 } - ], - "hide_heading": 1, - "idx": 1, - "istable": 1, - "modified": "2014-05-30 03:43:39.740638", - "modified_by": "Administrator", - "module": "Accounts", - "name": "Sales Taxes and Charges", - "owner": "Administrator", + ], + "hide_heading": 1, + "idx": 1, + "istable": 1, + "modified": "2014-12-10 12:26:41.222471", + "modified_by": "Administrator", + "module": "Accounts", + "name": "Sales Taxes and Charges", + "owner": "Administrator", "permissions": [] -} +} \ No newline at end of file From 35ebe1bf781160c628503f4a285fce8c2a7c2dcf Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 10 Dec 2014 12:42:32 +0530 Subject: [PATCH 2/9] Tax amount in POS invoice print format --- erpnext/accounts/print_format/pos_invoice/pos_invoice.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/print_format/pos_invoice/pos_invoice.json b/erpnext/accounts/print_format/pos_invoice/pos_invoice.json index 83174b6c29..50b72d5399 100644 --- a/erpnext/accounts/print_format/pos_invoice/pos_invoice.json +++ b/erpnext/accounts/print_format/pos_invoice/pos_invoice.json @@ -3,9 +3,9 @@ "doc_type": "Sales Invoice", "docstatus": 0, "doctype": "Print Format", - "html": "\n\n

\n\t{{ doc.company }}
\n\t{{ doc.select_print_heading or _(\"Invoice\") }}
\n

\n

\n\t{{ _(\"Receipt No\") }}: {{ doc.name }}
\n\t{{ _(\"Date\") }}: {{ doc.get_formatted(\"posting_date\") }}
\n\t{{ _(\"Customer\") }}: {{ doc.customer_name }}\n

\n\n
\n\n\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\n\t\n\t\t{%- for item in doc.entries -%}\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t{%- endfor -%}\n\t\n
{{ _(\"Item\") }}{{ _(\"Qty\") }}{{ _(\"Rate\") }}
\n\t\t\t\t{{ item.item_code }}\n\t\t\t\t{%- if item.item_name != item.item_code -%}\n\t\t\t\t\t
{{ item.item_name }}{%- endif -%}\n\t\t\t
{{ item.qty }}{{ item.amount }}
\n\n\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t{%- for row in doc.other_charges -%}\n\t\t{%- if not row.included_in_print_rate -%}\n\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t{%- endif -%}\n\t\t{%- endfor -%}\n\t\t{%- if doc.discount_amount -%}\n\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t{%- endif -%}\n\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\n
\n\t\t\t\t{{ _(\"Net Total\") }}\n\t\t\t\n\t\t\t\t{{ doc.get_formatted(\"net_total_export\") }}\n\t\t\t
\n\t\t\t\t{{ row.description }}\n\t\t\t\n\t\t\t\t{{ row.get_formatted(\"tax_amount\", doc) }}\n\t\t\t
\n\t\t\t\t{{ _(\"Discount\") }}\n\t\t\t\n\t\t\t\t{{ doc.get_formatted(\"discount_amount\") }}\n\t\t\t
\n\t\t\t\t{{ _(\"Grand Total\") }}\n\t\t\t\n\t\t\t\t{{ doc.get_formatted(\"grand_total_export\") }}\n\t\t\t
\n{% if doc.get(\"other_charges\", filters={\"included_in_print_rate\": 1}) %}\n
\n

Taxes Included:

\n\n\t\n\t\t{%- for row in doc.other_charges -%}\n\t\t{%- if row.included_in_print_rate -%}\n\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t{%- endif -%}\n\t\t{%- endfor -%}\n\t\n
\n\t\t\t\t{{ row.description }}\n\t\t\t\n\t\t\t\t{{ row.get_formatted(\"tax_amount\", doc) }}\n\t\t\t
\n{%- endif -%}\n
\n

{{ doc.terms or \"\" }}

\n

{{ _(\"Thank you, please visit again.\") }}

", + "html": "\n\n

\n\t{{ doc.company }}
\n\t{{ doc.select_print_heading or _(\"Invoice\") }}
\n

\n

\n\t{{ _(\"Receipt No\") }}: {{ doc.name }}
\n\t{{ _(\"Date\") }}: {{ doc.get_formatted(\"posting_date\") }}
\n\t{{ _(\"Customer\") }}: {{ doc.customer_name }}\n

\n\n
\n\n\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\n\t\n\t\t{%- for item in doc.entries -%}\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t{%- endfor -%}\n\t\n
{{ _(\"Item\") }}{{ _(\"Qty\") }}{{ _(\"Rate\") }}
\n\t\t\t\t{{ item.item_code }}\n\t\t\t\t{%- if item.item_name != item.item_code -%}\n\t\t\t\t\t
{{ item.item_name }}{%- endif -%}\n\t\t\t
{{ item.qty }}{{ item.amount }}
\n\n\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t{%- for row in doc.other_charges -%}\n\t\t{%- if not row.included_in_print_rate -%}\n\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t{%- endif -%}\n\t\t{%- endfor -%}\n\t\t{%- if doc.discount_amount -%}\n\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t{%- endif -%}\n\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\n
\n\t\t\t\t{{ _(\"Net Total\") }}\n\t\t\t\n\t\t\t\t{{ doc.get_formatted(\"net_total_export\") }}\n\t\t\t
\n\t\t\t\t{{ row.description }}\n\t\t\t\n\t\t\t\t{{ row.get_formatted(\"tax_amount\", doc) }}\n\t\t\t
\n\t\t\t\t{{ _(\"Discount\") }}\n\t\t\t\n\t\t\t\t{{ doc.get_formatted(\"discount_amount\") }}\n\t\t\t
\n\t\t\t\t{{ _(\"Grand Total\") }}\n\t\t\t\n\t\t\t\t{{ doc.get_formatted(\"grand_total_export\") }}\n\t\t\t
\n{% if doc.get(\"other_charges\", filters={\"included_in_print_rate\": 1}) %}\n
\n

Taxes Included:

\n\n\t\n\t\t{%- for row in doc.other_charges -%}\n\t\t{%- if row.included_in_print_rate -%}\n\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t{%- endif -%}\n\t\t{%- endfor -%}\n\t\n
\n\t\t\t\t{{ row.description }}\n\t\t\t\n\t\t\t\t{{ row.get_formatted(\"tax_amount_after_discount_amount\", doc) }}\n\t\t\t
\n{%- endif -%}\n
\n

{{ doc.terms or \"\" }}

\n

{{ _(\"Thank you, please visit again.\") }}

", "idx": 1, - "modified": "2014-07-22 02:08:26.603223", + "modified": "2014-12-10 12:37:10.854370", "modified_by": "Administrator", "module": "Accounts", "name": "POS Invoice", From 5cafcf66b0ee74ce198692536d2b242d71470d36 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 10 Dec 2014 23:59:04 +0530 Subject: [PATCH 3/9] Leave application fix --- erpnext/hr/doctype/leave_application/leave_application.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/hr/doctype/leave_application/leave_application.py b/erpnext/hr/doctype/leave_application/leave_application.py index e6742bb71f..bac688b6f1 100755 --- a/erpnext/hr/doctype/leave_application/leave_application.py +++ b/erpnext/hr/doctype/leave_application/leave_application.py @@ -204,14 +204,14 @@ def get_holidays(leave_app): tot_hol = frappe.db.sql("""select count(*) from `tabHoliday` h1, `tabHoliday List` h2, `tabEmployee` e1 where e1.name = %s and h1.parent = h2.name and e1.holiday_list = h2.name and h1.holiday_date between %s and %s""", (leave_app.employee, leave_app.from_date, - leave_app.to_date)) + leave_app.to_date))[0][0] # below line is needed. If an employee hasn't been assigned with any holiday list then above will return 0 rows. if not tot_hol: tot_hol = frappe.db.sql("""select count(*) from `tabHoliday` h1, `tabHoliday List` h2 where h1.parent = h2.name and h1.holiday_date between %s and %s and ifnull(h2.is_default,0) = 1 and h2.fiscal_year = %s""", - (leave_app.from_date, leave_app.to_date, leave_app.fiscal_year)) - return tot_hol and tot_hol[0][0] or 0 + (leave_app.from_date, leave_app.to_date, leave_app.fiscal_year))[0][0] + return tot_hol @frappe.whitelist() def get_total_leave_days(leave_app): From bef80bab0d2959904d63c96b7b4c0473361d706d Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 11 Dec 2014 16:27:18 +0530 Subject: [PATCH 4/9] Removed gross profit field from sales invoice --- .../doctype/sales_invoice/sales_invoice.js | 3 +-- .../doctype/sales_invoice/sales_invoice.json | 23 +------------------ 2 files changed, 2 insertions(+), 24 deletions(-) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js index cc841e2ffc..a50d69e97f 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js @@ -225,8 +225,7 @@ $.extend(cur_frm.cscript, new erpnext.accounts.SalesInvoiceController({frm: cur_ // Hide Fields // ------------ cur_frm.cscript.hide_fields = function(doc) { - par_flds = ['project_name', 'due_date', 'is_opening', 'source', 'total_advance', 'gross_profit', - 'gross_profit_percent', 'get_advances_received', + par_flds = ['project_name', 'due_date', 'is_opening', 'source', 'total_advance', 'get_advances_received', 'advance_adjustment_details', 'sales_partner', 'commission_rate', 'total_commission', 'advances', 'from_date', 'to_date']; diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json index 3dcf136d45..b27a2abc75 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json @@ -568,27 +568,6 @@ "print_hide": 0, "read_only": 1 }, - { - "fieldname": "gross_profit", - "fieldtype": "Currency", - "label": "Gross Profit", - "oldfieldname": "gross_profit", - "oldfieldtype": "Currency", - "options": "Company:company:default_currency", - "permlevel": 0, - "print_hide": 1, - "read_only": 1 - }, - { - "fieldname": "gross_profit_percent", - "fieldtype": "Float", - "label": "Gross Profit (%)", - "oldfieldname": "gross_profit_percent", - "oldfieldtype": "Currency", - "permlevel": 0, - "print_hide": 1, - "read_only": 1 - }, { "fieldname": "advances", "fieldtype": "Section Break", @@ -1213,7 +1192,7 @@ "icon": "icon-file-text", "idx": 1, "is_submittable": 1, - "modified": "2014-10-10 16:54:22.284284", + "modified": "2014-12-11 16:26:12.402110", "modified_by": "Administrator", "module": "Accounts", "name": "Sales Invoice", From 3a34cadcb23b00969ec7f15fdfc9d84be4104157 Mon Sep 17 00:00:00 2001 From: Neil Trini Lasrado Date: Wed, 10 Dec 2014 15:47:25 +0530 Subject: [PATCH 5/9] Fix - Total Fixed Cost with patch --- erpnext/manufacturing/doctype/bom/bom.js | 1 + erpnext/manufacturing/doctype/bom/bom.py | 5 ++++- erpnext/patches.txt | 1 + erpnext/patches/v4_2/recalculate_bom_costs.py | 17 +++++++++++++++++ 4 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 erpnext/patches/v4_2/recalculate_bom_costs.py diff --git a/erpnext/manufacturing/doctype/bom/bom.js b/erpnext/manufacturing/doctype/bom/bom.js index cb96478735..1b1dc62fb1 100644 --- a/erpnext/manufacturing/doctype/bom/bom.js +++ b/erpnext/manufacturing/doctype/bom/bom.js @@ -83,6 +83,7 @@ cur_frm.cscript.hour_rate = function(doc, dt, dn) { cur_frm.cscript.time_in_mins = cur_frm.cscript.hour_rate; +cur_frm.cscript.fixed_cycle_cost = cur_frm.cscript.hour_rate; cur_frm.cscript.item_code = function(doc, cdt, cdn) { get_bom_material_detail(doc, cdt, cdn); diff --git a/erpnext/manufacturing/doctype/bom/bom.py b/erpnext/manufacturing/doctype/bom/bom.py index e8a8682ceb..199ade94c4 100644 --- a/erpnext/manufacturing/doctype/bom/bom.py +++ b/erpnext/manufacturing/doctype/bom/bom.py @@ -285,7 +285,10 @@ class BOM(Document): if not d.hour_rate: d.hour_rate = flt(w[0]) - fixed_cost += flt(w[1]) + if d.fixed_cycle_cost == None: + d.fixed_cycle_cost= flt(w[1]) + + fixed_cost += d.fixed_cycle_cost if d.hour_rate and d.time_in_mins: d.operating_cost = flt(d.hour_rate) * flt(d.time_in_mins) / 60.0 diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 4c975815c5..33fa396649 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -89,3 +89,4 @@ erpnext.patches.v4_2.recalculate_bom_cost erpnext.patches.v4_2.fix_gl_entries_for_stock_transactions erpnext.patches.v4_2.update_requested_and_ordered_qty execute:frappe.delete_doc("DocType", "Contact Control") +erpnext.patches.v4_2.recalculate_bom_costs diff --git a/erpnext/patches/v4_2/recalculate_bom_costs.py b/erpnext/patches/v4_2/recalculate_bom_costs.py new file mode 100644 index 0000000000..8c887a83f0 --- /dev/null +++ b/erpnext/patches/v4_2/recalculate_bom_costs.py @@ -0,0 +1,17 @@ +# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors +# License: GNU General Public License v3. See license.txt + +from __future__ import unicode_literals +import frappe + +def execute(): + for d in frappe.db.sql("""select name from `tabBOM` where docstatus < 2 and total_fixed_cost IS NOT NULL""", as_dict=1): + try: + bom = frappe.get_doc('BOM', d.name) + bom.ignore_validate_update_after_submit = True + bom.calculate_cost() + bom.save() + frappe.db.commit() + except: + frappe.db.rollback() + \ No newline at end of file From 6ddc487fb63f526f4103fd158f272177ba7b4616 Mon Sep 17 00:00:00 2001 From: Neil Trini Lasrado Date: Thu, 11 Dec 2014 17:33:41 +0530 Subject: [PATCH 6/9] patch fix --- erpnext/patches/v4_2/recalculate_bom_costs.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/erpnext/patches/v4_2/recalculate_bom_costs.py b/erpnext/patches/v4_2/recalculate_bom_costs.py index 8c887a83f0..25fd7f3459 100644 --- a/erpnext/patches/v4_2/recalculate_bom_costs.py +++ b/erpnext/patches/v4_2/recalculate_bom_costs.py @@ -5,7 +5,9 @@ from __future__ import unicode_literals import frappe def execute(): - for d in frappe.db.sql("""select name from `tabBOM` where docstatus < 2 and total_fixed_cost IS NOT NULL""", as_dict=1): + for d in frappe.db.sql("""select bom.name from `tabBOM` bom where bom.docstatus < 2 and + exists(select bom_item.name from `tabBOM Operation` bom_op where + bom.name = bom_op.parent and bom_op.fixed_cycle_cost IS NOT NULL)""", as_dict=1): try: bom = frappe.get_doc('BOM', d.name) bom.ignore_validate_update_after_submit = True From 4b83403a63d8259a97eebef8ee7eed9c988fefa3 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 12 Dec 2014 11:28:58 +0530 Subject: [PATCH 7/9] Fixed bom patch --- erpnext/patches/v4_2/recalculate_bom_costs.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/erpnext/patches/v4_2/recalculate_bom_costs.py b/erpnext/patches/v4_2/recalculate_bom_costs.py index 25fd7f3459..c05fd03709 100644 --- a/erpnext/patches/v4_2/recalculate_bom_costs.py +++ b/erpnext/patches/v4_2/recalculate_bom_costs.py @@ -5,8 +5,8 @@ from __future__ import unicode_literals import frappe def execute(): - for d in frappe.db.sql("""select bom.name from `tabBOM` bom where bom.docstatus < 2 and - exists(select bom_item.name from `tabBOM Operation` bom_op where + for d in frappe.db.sql("""select bom.name from `tabBOM` bom where bom.docstatus < 2 and + exists(select bom_op.name from `tabBOM Operation` bom_op where bom.name = bom_op.parent and bom_op.fixed_cycle_cost IS NOT NULL)""", as_dict=1): try: bom = frappe.get_doc('BOM', d.name) @@ -16,4 +16,3 @@ def execute(): frappe.db.commit() except: frappe.db.rollback() - \ No newline at end of file From ad0bd4ca9299afec96a52be0ddacb7facc814eca Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 12 Dec 2014 12:49:45 +0530 Subject: [PATCH 8/9] Pull all customer's po no in delivery note when made from multiple sales order --- erpnext/selling/doctype/sales_order/sales_order.json | 3 ++- erpnext/selling/doctype/sales_order/sales_order.py | 8 ++++++++ erpnext/stock/doctype/delivery_note/delivery_note.json | 4 ++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/erpnext/selling/doctype/sales_order/sales_order.json b/erpnext/selling/doctype/sales_order/sales_order.json index 69693a7bed..6065ad5ad3 100644 --- a/erpnext/selling/doctype/sales_order/sales_order.json +++ b/erpnext/selling/doctype/sales_order/sales_order.json @@ -175,6 +175,7 @@ "fieldtype": "Data", "hidden": 0, "label": "PO No", + "no_copy": 1, "oldfieldname": "po_no", "oldfieldtype": "Data", "permlevel": 0, @@ -1020,7 +1021,7 @@ "idx": 1, "is_submittable": 1, "issingle": 0, - "modified": "2014-10-08 14:22:44.717108", + "modified": "2014-12-12 12:35:09.652211", "modified_by": "Administrator", "module": "Selling", "name": "Sales Order", diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py index 8153d8d839..604ac111a6 100644 --- a/erpnext/selling/doctype/sales_order/sales_order.py +++ b/erpnext/selling/doctype/sales_order/sales_order.py @@ -275,6 +275,14 @@ def make_material_request(source_name, target_doc=None): @frappe.whitelist() def make_delivery_note(source_name, target_doc=None): def set_missing_values(source, target): + if source.po_no: + if target.po_no: + target_po_no = target.po_no.split(", ") + target_po_no.append(source.po_no) + target.po_no = ", ".join(list(set(target_po_no))) if len(target_po_no) > 1 else target_po_no[0] + else: + target.po_no = source.po_no + target.ignore_pricing_rule = 1 target.run_method("set_missing_values") target.run_method("calculate_taxes_and_totals") diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.json b/erpnext/stock/doctype/delivery_note/delivery_note.json index 4a957ff804..2eeba50677 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.json +++ b/erpnext/stock/doctype/delivery_note/delivery_note.json @@ -178,7 +178,7 @@ { "fieldname": "po_no", "fieldtype": "Data", - "hidden": 1, + "hidden": 0, "label": "Customer's Purchase Order No", "no_copy": 0, "oldfieldname": "po_no", @@ -1013,7 +1013,7 @@ "idx": 1, "in_create": 0, "is_submittable": 1, - "modified": "2014-09-09 05:35:30.700911", + "modified": "2014-12-12 12:36:59.262500", "modified_by": "Administrator", "module": "Stock", "name": "Delivery Note", From a578f3e23a1dfd5dce1c3c09d280ccd4d98397f9 Mon Sep 17 00:00:00 2001 From: Pratik Vyas Date: Fri, 12 Dec 2014 17:22:09 +0600 Subject: [PATCH 9/9] bumped to version 4.13.1 --- erpnext/__version__.py | 2 +- erpnext/hooks.py | 2 +- setup.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/__version__.py b/erpnext/__version__.py index 25937f019d..485017227f 100644 --- a/erpnext/__version__.py +++ b/erpnext/__version__.py @@ -1 +1 @@ -__version__ = '4.13.0' +__version__ = '4.13.1' diff --git a/erpnext/hooks.py b/erpnext/hooks.py index e128019099..e299406e6c 100644 --- a/erpnext/hooks.py +++ b/erpnext/hooks.py @@ -4,7 +4,7 @@ app_publisher = "Web Notes Technologies Pvt. Ltd. and Contributors" app_description = "Open Source Enterprise Resource Planning for Small and Midsized Organizations" app_icon = "icon-th" app_color = "#e74c3c" -app_version = "4.13.0" +app_version = "4.13.1" error_report_email = "support@erpnext.com" diff --git a/setup.py b/setup.py index 3c4bc377f2..544873503b 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ from setuptools import setup, find_packages import os -version = "4.13.0" +version = "4.13.1" with open("requirements.txt", "r") as f: install_requires = f.readlines()