From e7bc2beea040d213d027af09195e598d16b92b25 Mon Sep 17 00:00:00 2001 From: Himanshu Date: Wed, 6 Feb 2019 15:55:49 +0530 Subject: [PATCH 01/20] Remove illegal character after break --- .../doctype/woocommerce_settings/woocommerce_settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/erpnext_integrations/doctype/woocommerce_settings/woocommerce_settings.py b/erpnext/erpnext_integrations/doctype/woocommerce_settings/woocommerce_settings.py index bb4f62a0993..1edc1029565 100644 --- a/erpnext/erpnext_integrations/doctype/woocommerce_settings/woocommerce_settings.py +++ b/erpnext/erpnext_integrations/doctype/woocommerce_settings/woocommerce_settings.py @@ -28,7 +28,7 @@ class WoocommerceSettings(Document): if not frappe.get_value("Custom Field",{"name":i[0]}) or not frappe.get_value("Custom Field",{"name":i[1]}): create_custom_field_id_and_check_status = True - break; + break if create_custom_field_id_and_check_status: From 48e206d9833b28deb4e9a8affdd61baf7d60523a Mon Sep 17 00:00:00 2001 From: Jamsheer Date: Thu, 21 Mar 2019 16:11:12 +0530 Subject: [PATCH 02/20] fix: Patient relation - patient link is not showing --- erpnext/healthcare/doctype/patient/patient.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/erpnext/healthcare/doctype/patient/patient.js b/erpnext/healthcare/doctype/patient/patient.js index de5bce0aa65..169281430ce 100644 --- a/erpnext/healthcare/doctype/patient/patient.js +++ b/erpnext/healthcare/doctype/patient/patient.js @@ -123,13 +123,13 @@ var btn_invoice_registration = function (frm) { frappe.ui.form.on('Patient Relation', { patient_relation_add: function(frm){ - frm.fields_dict['patient_relation'].grid.get_field('patient').get_query = function(frm){ + frm.fields_dict['patient_relation'].grid.get_field('patient').get_query = function(doc){ var patient_list = []; - if(!frm.doc.__islocal) patient_list.push(frm.doc.name); - $.each(frm.doc.patient_relation, function(idx, val){ + if(!doc.__islocal) patient_list.push(doc.name); + $.each(doc.patient_relation, function(idx, val){ if (val.patient) patient_list.push(val.patient); }); return { filters: [['Patient', 'name', 'not in', patient_list]] }; }; } -}); \ No newline at end of file +}); From a1a7beb12ed521c4cdf3766073c19f2d90a1671d Mon Sep 17 00:00:00 2001 From: Anurag Mishra Date: Fri, 5 Apr 2019 12:35:46 +0530 Subject: [PATCH 03/20] fix: Print Auditing print format --- .../bank_and_cash_payment_voucher.html | 53 ++++++++----------- .../journal_auditing_voucher.html | 50 ++++++++--------- .../purchase_auditing_voucher.html | 12 +++-- .../sales_auditing_voucher.html | 8 +-- 4 files changed, 59 insertions(+), 64 deletions(-) diff --git a/erpnext/accounts/print_format/bank_and_cash_payment_voucher/bank_and_cash_payment_voucher.html b/erpnext/accounts/print_format/bank_and_cash_payment_voucher/bank_and_cash_payment_voucher.html index 2eadb2a92ac..06f77b0f1da 100644 --- a/erpnext/accounts/print_format/bank_and_cash_payment_voucher/bank_and_cash_payment_voucher.html +++ b/erpnext/accounts/print_format/bank_and_cash_payment_voucher/bank_and_cash_payment_voucher.html @@ -30,10 +30,29 @@ Party Amount + + Debit + + {% for entries in doc.gl_entries %} + {% if entries.credit == 0.0 %} + + {{ entries.account }} + {{ entries.party_type }} + {{ entries.party }} + {{ entries.debit }} + + + Narration
{{ entries.remarks }} + + {% endif %} + {% endfor %} + + Total (debit) + {{ doc.gl_entries | sum(attribute='debit') }} + Credit - {% set total_credit = 0 -%} {% for entries in doc.gl_entries %} {% if entries.debit == 0.0 %} @@ -41,42 +60,16 @@ {{ entries.party_type }} {{ entries.party }} {{ entries.credit }} - {% set total_credit = total_credit + entries.credit -%} Narration
{{ entries.remarks }} + {% endif %} + {% endfor %} Total (credit) - {{total_credit}} + {{ doc.gl_entries | sum(attribute='credit') }} - {% endif %} - {% endfor %} - - - - - Debit - - {% set total_debit = 0 -%} - {% for entries in doc.gl_entries %} - {% if entries.credit == 0.0 %} - - {{ entries.account }} - {{ entries.party_type }} - {{ entries.party }} - {% set total_debit = total_debit + entries.debit -%} - {{ entries.debit }} - - - Narration
{{ entries.remarks }} - - - Total (debit) - {{total_debit}} - - {% endif %} - {% endfor %}
\ No newline at end of file diff --git a/erpnext/accounts/print_format/journal_auditing_voucher/journal_auditing_voucher.html b/erpnext/accounts/print_format/journal_auditing_voucher/journal_auditing_voucher.html index 4565559084a..566d444ae7a 100644 --- a/erpnext/accounts/print_format/journal_auditing_voucher/journal_auditing_voucher.html +++ b/erpnext/accounts/print_format/journal_auditing_voucher/journal_auditing_voucher.html @@ -3,14 +3,12 @@ .table-bordered td.top-bottom {border-top: none !important;border-bottom: none !important;} .table-bordered td.right{border-right: none !important;} .table-bordered td.left{border-left: none !important;} - -
{%- if not doc.get("print_heading") and not doc.get("select_print_heading") and doc.set("select_print_heading", _("Journal Entry")) -%}{%- endif -%} {{ add_header(0, 1, doc, letter_head, no_letterhead, print_settings) }} -
+
@@ -22,7 +20,7 @@
Voucher No: {{ doc.name }}
-
+
@@ -30,10 +28,26 @@ + + + + {% for entries in doc.gl_entries %} + {% if entries.credit == 0.0 %} + + + + + + + {% endif %} + {% endfor %} + + + + - {% set total_credit = 0 -%} {% for entries in doc.gl_entries %} {% if entries.debit == 0.0 %} @@ -41,36 +55,16 @@ - {% set total_credit = total_credit + entries.credit -%} - - - - {% endif %} {% endfor %} - + + - + - {% set total_debit = 0 -%} - {% for entries in doc.gl_entries %} - {% if entries.credit == 0.0 %} - - - - - {% set total_debit = total_debit + entries.debit -%} - - - - - - - {% endif %} - {% endfor %}
AccountParty Amount
Debit
{{ entries.account }}{{ entries.party_type }}{{ entries.party }}{{ entries.debit }}
Total (debit) {{ doc.gl_entries | sum(attribute='debit') }}
Credit
{{ entries.party_type }} {{ entries.party }} {{ entries.credit }}
Total (credit) {{total_credit}}
Total (credit) {{ doc.gl_entries | sum(attribute='credit') }}
DebitNarration: {{ doc.gl_entries[0].remarks }}
{{ entries.account }}{{ entries.party_type }}{{ entries.party }}{{ entries.debit }}
Total (debit) {{total_debit}}
\ No newline at end of file diff --git a/erpnext/accounts/print_format/purchase_auditing_voucher/purchase_auditing_voucher.html b/erpnext/accounts/print_format/purchase_auditing_voucher/purchase_auditing_voucher.html index 35852e1e1c8..342ce22b3a7 100644 --- a/erpnext/accounts/print_format/purchase_auditing_voucher/purchase_auditing_voucher.html +++ b/erpnext/accounts/print_format/purchase_auditing_voucher/purchase_auditing_voucher.html @@ -60,10 +60,16 @@ {% for tax in doc.taxes %} - + {% if tax.tax_amount_after_discount_amount!= 0 %} + + {% endfor %} + {% if doc.taxes_and_charges_added!= 0 %} + {% endif %} + {% if doc.taxes_and_charges_deducted!= 0 %} + {% endif %}
Tax and Charges: {{doc.taxes_and_charges}}
{{ tax.account_head }}: {{ tax.tax_amount_after_discount_amount }}
{{ tax.account_head }}: {{ tax.tax_amount_after_discount_amount }}
Taxes and Charges Added: {{ doc.taxes_and_charges_added }}
Taxes and Charges Deducted: {{ doc.taxes_and_charges_deducted }}
Total Taxes and Charges: {{ doc.total_taxes_and_charges }}
Net Payable: {{ doc.grand_total }}
@@ -76,8 +82,8 @@ Account Party Type Party - Credit Amount Debit Amount + Credit Amount {% for entries in doc.gl_entries %} @@ -85,8 +91,8 @@ {{ entries.account }} {{ entries.party_type }} {{ entries.party }} - {{ entries.credit }} {{ entries.debit }} + {{ entries.credit }} {% endfor %} diff --git a/erpnext/accounts/print_format/sales_auditing_voucher/sales_auditing_voucher.html b/erpnext/accounts/print_format/sales_auditing_voucher/sales_auditing_voucher.html index 04de83de708..4dc4b8a4a92 100644 --- a/erpnext/accounts/print_format/sales_auditing_voucher/sales_auditing_voucher.html +++ b/erpnext/accounts/print_format/sales_auditing_voucher/sales_auditing_voucher.html @@ -56,7 +56,9 @@ {% for tax in doc.taxes %} - + {% if tax.tax_amount_after_discount_amount!= 0 %} + + {% endif %} {% endfor %} @@ -70,8 +72,8 @@ - + {% for entries in doc.gl_entries %} @@ -79,8 +81,8 @@ - + {% endfor %} From 20090306f653a5cbad336d26b2d18bb39e41aa1a Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 5 Apr 2019 18:05:57 +0530 Subject: [PATCH 04/20] fix: Show standalone credit note in Accounts receivable report --- .../accounts_receivable.py | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py index b8c98542dc4..d49a33bd016 100755 --- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py +++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py @@ -194,10 +194,9 @@ class ReceivablePayableReport(object): self.payment_term_map = self.get_payment_term_detail(voucher_nos) for gle in gl_entries_data: - if self.is_receivable_or_payable(gle, self.dr_or_cr, future_vouchers): + if self.is_receivable_or_payable(gle, self.dr_or_cr, future_vouchers, return_entries): outstanding_amount, credit_note_amount, payment_amount = self.get_outstanding_amount( gle,self.filters.report_date, self.dr_or_cr, return_entries) - temp_outstanding_amt = outstanding_amount temp_credit_note_amt = credit_note_amount @@ -377,7 +376,7 @@ class ReceivablePayableReport(object): # returns a generator return self.get_gl_entries(party_type, report_date) - def is_receivable_or_payable(self, gle, dr_or_cr, future_vouchers): + def is_receivable_or_payable(self, gle, dr_or_cr, future_vouchers, return_entries): return ( # advance (not gle.against_voucher) or @@ -388,30 +387,37 @@ class ReceivablePayableReport(object): # sales invoice/purchase invoice (gle.against_voucher==gle.voucher_no and gle.get(dr_or_cr) > 0) or + # standalone credit notes + (gle.against_voucher==gle.voucher_no and gle.voucher_no in return_entries and not return_entries.get(gle.voucher_no)) or + # entries adjusted with future vouchers ((gle.against_voucher_type, gle.against_voucher) in future_vouchers) ) def get_return_entries(self, party_type): doctype = "Sales Invoice" if party_type=="Customer" else "Purchase Invoice" - return [d.name for d in frappe.get_all(doctype, filters={"is_return": 1, "docstatus": 1})] + return_entries = frappe._dict(frappe.get_all(doctype, + filters={"is_return": 1, "docstatus": 1}, fields=["name", "return_against"], as_list=1)) + return return_entries def get_outstanding_amount(self, gle, report_date, dr_or_cr, return_entries): payment_amount, credit_note_amount = 0.0, 0.0 reverse_dr_or_cr = "credit" if dr_or_cr=="debit" else "debit" - for e in self.get_gl_entries_for(gle.party, gle.party_type, gle.voucher_type, gle.voucher_no): - if getdate(e.posting_date) <= report_date and e.name!=gle.name: + if getdate(e.posting_date) <= report_date \ + and (e.name!=gle.name or (e.voucher_no in return_entries and not return_entries.get(e.voucher_no))): + amount = flt(e.get(reverse_dr_or_cr), self.currency_precision) - flt(e.get(dr_or_cr), self.currency_precision) if e.voucher_no not in return_entries: payment_amount += amount else: credit_note_amount += amount - outstanding_amount = (flt((flt(gle.get(dr_or_cr), self.currency_precision) - - flt(gle.get(reverse_dr_or_cr), self.currency_precision) - - payment_amount - credit_note_amount), self.currency_precision)) + voucher_amount = flt(gle.get(dr_or_cr), self.currency_precision) - flt(gle.get(reverse_dr_or_cr), self.currency_precision) + if gle.voucher_no in return_entries and not return_entries.get(gle.voucher_no): + voucher_amount = 0 + outstanding_amount = flt((voucher_amount - payment_amount - credit_note_amount), self.currency_precision) credit_note_amount = flt(credit_note_amount, self.currency_precision) return outstanding_amount, credit_note_amount, payment_amount From 76815cf2be775fd4ea7380dc7efe48bb2f493d27 Mon Sep 17 00:00:00 2001 From: Anurag Mishra Date: Fri, 5 Apr 2019 14:33:05 +0530 Subject: [PATCH 05/20] fix: removed before from accounts_controlle.pyr and fetch the gl from frontend --- .../bank_and_cash_payment_voucher.html | 9 +++++---- .../journal_auditing_voucher.html | 11 ++++++----- .../purchase_auditing_voucher.html | 5 +++-- .../sales_auditing_voucher.html | 3 ++- erpnext/controllers/accounts_controller.py | 6 ------ 5 files changed, 16 insertions(+), 18 deletions(-) diff --git a/erpnext/accounts/print_format/bank_and_cash_payment_voucher/bank_and_cash_payment_voucher.html b/erpnext/accounts/print_format/bank_and_cash_payment_voucher/bank_and_cash_payment_voucher.html index 06f77b0f1da..73d8f9b984c 100644 --- a/erpnext/accounts/print_format/bank_and_cash_payment_voucher/bank_and_cash_payment_voucher.html +++ b/erpnext/accounts/print_format/bank_and_cash_payment_voucher/bank_and_cash_payment_voucher.html @@ -7,6 +7,7 @@
+ {% set gl = frappe.get_list(doctype="GL Entry", fields=["account", "party_type", "party", "debit", "credit", "remarks"], filters={"voucher_type": doc.doctype, "voucher_no": doc.name}) %} {%- if not doc.get("print_heading") and not doc.get("select_print_heading") and doc.set("select_print_heading", _("Payment Entry")) -%}{%- endif -%} {{ add_header(0, 1, doc, letter_head, no_letterhead, print_settings) }} @@ -33,7 +34,7 @@
- {% for entries in doc.gl_entries %} + {% for entries in gl %} {% if entries.credit == 0.0 %} @@ -48,12 +49,12 @@ {% endfor %} - + - {% for entries in doc.gl_entries %} + {% for entries in gl %} {% if entries.debit == 0.0 %} @@ -68,7 +69,7 @@ {% endfor %} - +
Tax and Charges: {{doc.taxes_and_charges}}
{{ tax.account_head }}: {{ tax.tax_amount_after_discount_amount }}
{{ tax.account_head }}: {{ tax.tax_amount_after_discount_amount }}
Total Taxes and Charges: {{ doc.total_taxes_and_charges }}
Net Payable: {{ doc.grand_total }}
Account Party Type PartyCredit Amount Debit AmountCredit Amount
{{ entries.account }} {{ entries.party_type }} {{ entries.party }}{{ entries.credit }} {{ entries.debit }}{{ entries.credit }}
Debit
{{ entries.account }}
Total (debit) {{ doc.gl_entries | sum(attribute='debit') }}{{ gl | sum(attribute='debit') }}
Credit
{{ entries.account }}
Total (credit) {{ doc.gl_entries | sum(attribute='credit') }}{{ gl | sum(attribute='credit') }}
diff --git a/erpnext/accounts/print_format/journal_auditing_voucher/journal_auditing_voucher.html b/erpnext/accounts/print_format/journal_auditing_voucher/journal_auditing_voucher.html index 566d444ae7a..1a016e97bfd 100644 --- a/erpnext/accounts/print_format/journal_auditing_voucher/journal_auditing_voucher.html +++ b/erpnext/accounts/print_format/journal_auditing_voucher/journal_auditing_voucher.html @@ -5,6 +5,7 @@ .table-bordered td.left{border-left: none !important;}
+ {% set gl = frappe.get_list(doctype="GL Entry", fields=["account", "party_type", "party", "debit", "credit", "remarks"], filters={"voucher_type": doc.doctype, "voucher_no": doc.name}) %} {%- if not doc.get("print_heading") and not doc.get("select_print_heading") and doc.set("select_print_heading", _("Journal Entry")) -%}{%- endif -%} {{ add_header(0, 1, doc, letter_head, no_letterhead, print_settings) }} @@ -31,7 +32,7 @@ Debit - {% for entries in doc.gl_entries %} + {% for entries in gl %} {% if entries.credit == 0.0 %} {{ entries.account }} @@ -43,12 +44,12 @@ {% endfor %} Total (debit) - {{ doc.gl_entries | sum(attribute='debit') }} + {{ gl | sum(attribute='debit') }} Credit - {% for entries in doc.gl_entries %} + {% for entries in gl %} {% if entries.debit == 0.0 %} {{ entries.account }} @@ -60,10 +61,10 @@ {% endfor %} Total (credit) - {{ doc.gl_entries | sum(attribute='credit') }} + {{ gl | sum(attribute='credit') }} - Narration: {{ doc.gl_entries[0].remarks }} + Narration: {{ gl[0].remarks }}
diff --git a/erpnext/accounts/print_format/purchase_auditing_voucher/purchase_auditing_voucher.html b/erpnext/accounts/print_format/purchase_auditing_voucher/purchase_auditing_voucher.html index 342ce22b3a7..6c53a7ade51 100644 --- a/erpnext/accounts/print_format/purchase_auditing_voucher/purchase_auditing_voucher.html +++ b/erpnext/accounts/print_format/purchase_auditing_voucher/purchase_auditing_voucher.html @@ -1,5 +1,6 @@ {%- from "templates/print_formats/standard_macros.html" import add_header -%}
+ {% set gl = frappe.get_list(doctype="GL Entry", fields=["account", "party_type", "party", "debit", "credit", "remarks"], filters={"voucher_type": doc.doctype, "voucher_no": doc.name}) %} {%- if not doc.get("print_heading") and not doc.get("select_print_heading") and doc.set("select_print_heading", _("Purchase Invoice")) -%}{%- endif -%} {{ add_header(0, 1, doc, letter_head, no_letterhead, print_settings) }} @@ -62,7 +63,7 @@ {% for tax in doc.taxes %} {% if tax.tax_amount_after_discount_amount!= 0 %} {{ tax.account_head }}: {{ tax.tax_amount_after_discount_amount }} - + {% endif %} {% endfor %} {% if doc.taxes_and_charges_added!= 0 %} Taxes and Charges Added: {{ doc.taxes_and_charges_added }} @@ -85,7 +86,7 @@ Debit Amount Credit Amount - {% for entries in doc.gl_entries %} + {% for entries in gl %} {{ loop.index }} {{ entries.account }} diff --git a/erpnext/accounts/print_format/sales_auditing_voucher/sales_auditing_voucher.html b/erpnext/accounts/print_format/sales_auditing_voucher/sales_auditing_voucher.html index 4dc4b8a4a92..1c3fb6aee96 100644 --- a/erpnext/accounts/print_format/sales_auditing_voucher/sales_auditing_voucher.html +++ b/erpnext/accounts/print_format/sales_auditing_voucher/sales_auditing_voucher.html @@ -1,5 +1,6 @@ {%- from "templates/print_formats/standard_macros.html" import add_header -%}
+ {% set gl = frappe.get_list(doctype="GL Entry", fields=["account", "party_type", "party", "debit", "credit", "remarks"], filters={"voucher_type": doc.doctype, "voucher_no": doc.name}) %} {%- if not doc.get("print_heading") and not doc.get("select_print_heading") and doc.set("select_print_heading", _("Sales Invoice")) -%}{%- endif -%} {{ add_header(0, 1, doc, letter_head, no_letterhead, print_settings) }} @@ -75,7 +76,7 @@ Debit Amount Credit Amount - {% for entries in doc.gl_entries %} + {% for entries in gl %} {{ loop.index }} {{ entries.account }} diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index 86b1ab6ece8..34bbe7b9994 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -116,12 +116,6 @@ class AccountsController(TransactionBase): self.validate_non_invoice_documents_schedule() def before_print(self): - if self.doctype in ['Journal Entry', 'Payment Entry', 'Sales Invoice', 'Purchase Invoice']: - self.gl_entries = frappe.get_list("GL Entry", filters={ - "voucher_type": self.doctype, - "voucher_no": self.name - }, fields=["account", "party_type", "party", "debit", "credit", "remarks"]) - if self.doctype in ['Purchase Order', 'Sales Order', 'Sales Invoice', 'Purchase Invoice', 'Supplier Quotation', 'Purchase Receipt', 'Delivery Note', 'Quotation']: if self.get("group_same_items"): From 4753bd45193e510cbbd2354cbae55c0709cba968 Mon Sep 17 00:00:00 2001 From: Anurag Mishra Date: Mon, 8 Apr 2019 10:53:19 +0530 Subject: [PATCH 06/20] fix: UI on generating pdf in print format --- .../bank_and_cash_payment_voucher.html | 4 ++-- .../journal_auditing_voucher.html | 6 +++--- .../purchase_auditing_voucher.html | 8 ++++---- .../sales_auditing_voucher/sales_auditing_voucher.html | 8 ++++---- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/erpnext/accounts/print_format/bank_and_cash_payment_voucher/bank_and_cash_payment_voucher.html b/erpnext/accounts/print_format/bank_and_cash_payment_voucher/bank_and_cash_payment_voucher.html index 73d8f9b984c..7605550c4a7 100644 --- a/erpnext/accounts/print_format/bank_and_cash_payment_voucher/bank_and_cash_payment_voucher.html +++ b/erpnext/accounts/print_format/bank_and_cash_payment_voucher/bank_and_cash_payment_voucher.html @@ -12,12 +12,12 @@ and doc.set("select_print_heading", _("Payment Entry")) -%}{%- endif -%} {{ add_header(0, 1, doc, letter_head, no_letterhead, print_settings) }}
-
+
Voucher No: {{ doc.name }}
-
+
Date: {{ frappe.utils.formatdate(doc.creation) }}
diff --git a/erpnext/accounts/print_format/journal_auditing_voucher/journal_auditing_voucher.html b/erpnext/accounts/print_format/journal_auditing_voucher/journal_auditing_voucher.html index 1a016e97bfd..1b92385854b 100644 --- a/erpnext/accounts/print_format/journal_auditing_voucher/journal_auditing_voucher.html +++ b/erpnext/accounts/print_format/journal_auditing_voucher/journal_auditing_voucher.html @@ -10,12 +10,12 @@ and doc.set("select_print_heading", _("Journal Entry")) -%}{%- endif -%} {{ add_header(0, 1, doc, letter_head, no_letterhead, print_settings) }}
-
+
- +
Voucher No: {{ doc.name }}
Voucher No: {{ doc.name }}
-
+
Date: {{ frappe.utils.formatdate(doc.creation) }}
diff --git a/erpnext/accounts/print_format/purchase_auditing_voucher/purchase_auditing_voucher.html b/erpnext/accounts/print_format/purchase_auditing_voucher/purchase_auditing_voucher.html index 6c53a7ade51..397a70d0366 100644 --- a/erpnext/accounts/print_format/purchase_auditing_voucher/purchase_auditing_voucher.html +++ b/erpnext/accounts/print_format/purchase_auditing_voucher/purchase_auditing_voucher.html @@ -5,7 +5,7 @@ and doc.set("select_print_heading", _("Purchase Invoice")) -%}{%- endif -%} {{ add_header(0, 1, doc, letter_head, no_letterhead, print_settings) }}
-
+
@@ -14,7 +14,7 @@
Supplier Name: {{ doc.supplier }}
Due Date: {{ frappe.utils.formatdate(doc.due_date) }}
Mobile no: {{doc.contact_mobile}}
-
+
@@ -50,14 +50,14 @@
Voucher No: {{ doc.name }}
Date: {{ frappe.utils.formatdate(doc.creation) }}
-
+
Total Quantity: {{ doc.total_qty }}
Total: {{doc.total}}
Net Weight: {{ doc.total_net_weight }}
-
+
{% for tax in doc.taxes %} diff --git a/erpnext/accounts/print_format/sales_auditing_voucher/sales_auditing_voucher.html b/erpnext/accounts/print_format/sales_auditing_voucher/sales_auditing_voucher.html index 1c3fb6aee96..fe08a189ea8 100644 --- a/erpnext/accounts/print_format/sales_auditing_voucher/sales_auditing_voucher.html +++ b/erpnext/accounts/print_format/sales_auditing_voucher/sales_auditing_voucher.html @@ -5,7 +5,7 @@ and doc.set("select_print_heading", _("Sales Invoice")) -%}{%- endif -%} {{ add_header(0, 1, doc, letter_head, no_letterhead, print_settings) }}
-
+
Tax and Charges: {{doc.taxes_and_charges}}
@@ -14,7 +14,7 @@
Customer Name: {{ doc.customer }}
Due Date: {{ frappe.utils.formatdate(doc.due_date) }}
Mobile no: {{doc.contact_mobile}}
-
+
@@ -46,14 +46,14 @@
Voucher No: {{ doc.name }}
Date: {{ frappe.utils.formatdate(doc.creation) }}
-
+
Total Quantity: {{ doc.total_qty }}
Total: {{doc.total}}
Net Weight: {{ doc.total_net_weight }}
-
+
{% for tax in doc.taxes %} From 4ac386d0fe7c9ac1da3b2bf89377d6d8a8f77a96 Mon Sep 17 00:00:00 2001 From: Anurag Mishra Date: Mon, 8 Apr 2019 11:43:24 +0530 Subject: [PATCH 07/20] fix: Removed Extra page on generating pdf in print formats --- .../bank_and_cash_payment_voucher.html | 2 +- .../journal_auditing_voucher/journal_auditing_voucher.html | 2 +- .../purchase_auditing_voucher/purchase_auditing_voucher.html | 2 +- .../sales_auditing_voucher/sales_auditing_voucher.html | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/erpnext/accounts/print_format/bank_and_cash_payment_voucher/bank_and_cash_payment_voucher.html b/erpnext/accounts/print_format/bank_and_cash_payment_voucher/bank_and_cash_payment_voucher.html index 7605550c4a7..69e42c3bdbc 100644 --- a/erpnext/accounts/print_format/bank_and_cash_payment_voucher/bank_and_cash_payment_voucher.html +++ b/erpnext/accounts/print_format/bank_and_cash_payment_voucher/bank_and_cash_payment_voucher.html @@ -6,7 +6,7 @@ -
+
{% set gl = frappe.get_list(doctype="GL Entry", fields=["account", "party_type", "party", "debit", "credit", "remarks"], filters={"voucher_type": doc.doctype, "voucher_no": doc.name}) %} {%- if not doc.get("print_heading") and not doc.get("select_print_heading") and doc.set("select_print_heading", _("Payment Entry")) -%}{%- endif -%} diff --git a/erpnext/accounts/print_format/journal_auditing_voucher/journal_auditing_voucher.html b/erpnext/accounts/print_format/journal_auditing_voucher/journal_auditing_voucher.html index 1b92385854b..13515179816 100644 --- a/erpnext/accounts/print_format/journal_auditing_voucher/journal_auditing_voucher.html +++ b/erpnext/accounts/print_format/journal_auditing_voucher/journal_auditing_voucher.html @@ -4,7 +4,7 @@ .table-bordered td.right{border-right: none !important;} .table-bordered td.left{border-left: none !important;} -
+
{% set gl = frappe.get_list(doctype="GL Entry", fields=["account", "party_type", "party", "debit", "credit", "remarks"], filters={"voucher_type": doc.doctype, "voucher_no": doc.name}) %} {%- if not doc.get("print_heading") and not doc.get("select_print_heading") and doc.set("select_print_heading", _("Journal Entry")) -%}{%- endif -%} diff --git a/erpnext/accounts/print_format/purchase_auditing_voucher/purchase_auditing_voucher.html b/erpnext/accounts/print_format/purchase_auditing_voucher/purchase_auditing_voucher.html index 397a70d0366..a7c3bce0b4f 100644 --- a/erpnext/accounts/print_format/purchase_auditing_voucher/purchase_auditing_voucher.html +++ b/erpnext/accounts/print_format/purchase_auditing_voucher/purchase_auditing_voucher.html @@ -1,5 +1,5 @@ {%- from "templates/print_formats/standard_macros.html" import add_header -%} -
+
{% set gl = frappe.get_list(doctype="GL Entry", fields=["account", "party_type", "party", "debit", "credit", "remarks"], filters={"voucher_type": doc.doctype, "voucher_no": doc.name}) %} {%- if not doc.get("print_heading") and not doc.get("select_print_heading") and doc.set("select_print_heading", _("Purchase Invoice")) -%}{%- endif -%} diff --git a/erpnext/accounts/print_format/sales_auditing_voucher/sales_auditing_voucher.html b/erpnext/accounts/print_format/sales_auditing_voucher/sales_auditing_voucher.html index fe08a189ea8..ef4ada14a3e 100644 --- a/erpnext/accounts/print_format/sales_auditing_voucher/sales_auditing_voucher.html +++ b/erpnext/accounts/print_format/sales_auditing_voucher/sales_auditing_voucher.html @@ -1,5 +1,5 @@ {%- from "templates/print_formats/standard_macros.html" import add_header -%} -
+
{% set gl = frappe.get_list(doctype="GL Entry", fields=["account", "party_type", "party", "debit", "credit", "remarks"], filters={"voucher_type": doc.doctype, "voucher_no": doc.name}) %} {%- if not doc.get("print_heading") and not doc.get("select_print_heading") and doc.set("select_print_heading", _("Sales Invoice")) -%}{%- endif -%} From f492d5f61def944bebe82a9155289b7e43e4b673 Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Tue, 9 Apr 2019 15:19:10 +0530 Subject: [PATCH 08/20] fix: Validate variant attributes only if is_new --- erpnext/stock/doctype/item/item.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py index e93e7d9b615..8f93c3f7ff2 100644 --- a/erpnext/stock/doctype/item/item.py +++ b/erpnext/stock/doctype/item/item.py @@ -767,7 +767,7 @@ class Item(WebsiteGenerator): attributes.append(d.attribute) def validate_variant_attributes(self): - if self.variant_of and self.variant_based_on == 'Item Attribute': + if self.is_new() and self.variant_of and self.variant_based_on == 'Item Attribute': args = {} for d in self.attributes: if cstr(d.attribute_value).strip() == '': From b63adcbac72b39b7769a17482b3b58d0f69f74b7 Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Tue, 9 Apr 2019 18:41:31 +0530 Subject: [PATCH 09/20] feat: Allow items not in stock to be added in cart --- erpnext/shopping_cart/cart.py | 20 +++--- .../shopping_cart_settings.json | 61 +++++++++++++++++-- erpnext/templates/includes/product_page.js | 4 +- 3 files changed, 72 insertions(+), 13 deletions(-) diff --git a/erpnext/shopping_cart/cart.py b/erpnext/shopping_cart/cart.py index cc3205c7d70..0abe057af9a 100644 --- a/erpnext/shopping_cart/cart.py +++ b/erpnext/shopping_cart/cart.py @@ -51,7 +51,9 @@ def get_cart_quotation(doc=None): @frappe.whitelist() def place_order(): quotation = _get_cart_quotation() - quotation.company = frappe.db.get_value("Shopping Cart Settings", None, "company") + cart_settings = frappe.db.get_value("Shopping Cart Settings", None, + ["company", "allow_items_not_in_stock"], as_dict=1) + quotation.company = cart_settings.company if not quotation.get("customer_address"): throw(_("{0} is required").format(_(quotation.meta.get_label("customer_address")))) @@ -64,14 +66,16 @@ def place_order(): from erpnext.selling.doctype.quotation.quotation import _make_sales_order sales_order = frappe.get_doc(_make_sales_order(quotation.name, ignore_permissions=True)) - for item in sales_order.get("items"): - item.reserved_warehouse, is_stock_item = frappe.db.get_value("Item", - item.item_code, ["website_warehouse", "is_stock_item"]) - if is_stock_item: - item_stock = get_qty_in_stock(item.item_code, "website_warehouse") - if item.qty > item_stock.stock_qty[0][0]: - throw(_("Only {0} in stock for item {1}").format(item_stock.stock_qty[0][0], item.item_code)) + if not cart_settings.allow_items_not_in_stock: + for item in sales_order.get("items"): + item.reserved_warehouse, is_stock_item = frappe.db.get_value("Item", + item.item_code, ["website_warehouse", "is_stock_item"]) + + if is_stock_item: + item_stock = get_qty_in_stock(item.item_code, "website_warehouse") + if item.qty > item_stock.stock_qty[0][0]: + throw(_("Only {0} in stock for item {1}").format(item_stock.stock_qty[0][0], item.item_code)) sales_order.flags.ignore_permissions = True sales_order.insert() diff --git a/erpnext/shopping_cart/doctype/shopping_cart_settings/shopping_cart_settings.json b/erpnext/shopping_cart/doctype/shopping_cart_settings/shopping_cart_settings.json index 724c1e9ba26..898a1c39be8 100644 --- a/erpnext/shopping_cart/doctype/shopping_cart_settings/shopping_cart_settings.json +++ b/erpnext/shopping_cart/doctype/shopping_cart_settings/shopping_cart_settings.json @@ -1,5 +1,6 @@ { "allow_copy": 0, + "allow_events_in_timeline": 0, "allow_guest_to_view": 0, "allow_import": 0, "allow_rename": 0, @@ -19,6 +20,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "enabled", "fieldtype": "Check", "hidden": 0, @@ -51,6 +53,7 @@ "collapsible": 0, "columns": 0, "description": "", + "fetch_if_empty": 0, "fieldname": "display_settings", "fieldtype": "Section Break", "hidden": 0, @@ -84,6 +87,7 @@ "collapsible": 0, "columns": 0, "description": "", + "fetch_if_empty": 0, "fieldname": "show_attachments", "fieldtype": "Check", "hidden": 0, @@ -118,6 +122,7 @@ "columns": 0, "depends_on": "eval:doc.enabled==0", "description": "", + "fetch_if_empty": 0, "fieldname": "show_price", "fieldtype": "Check", "hidden": 0, @@ -150,6 +155,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "column_break_5", "fieldtype": "Column Break", "hidden": 0, @@ -181,6 +187,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "show_stock_availability", "fieldtype": "Check", "hidden": 0, @@ -214,6 +221,7 @@ "collapsible": 0, "columns": 0, "depends_on": "show_stock_availability", + "fetch_if_empty": 0, "fieldname": "show_quantity_in_website", "fieldtype": "Check", "hidden": 0, @@ -246,6 +254,40 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, + "fieldname": "allow_items_not_in_stock", + "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": "Allow items not in stock to be added to cart", + "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, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, "fieldname": "section_break_2", "fieldtype": "Section Break", "hidden": 0, @@ -276,6 +318,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "company", "fieldtype": "Link", "hidden": 0, @@ -309,6 +352,7 @@ "collapsible": 0, "columns": 0, "description": "Prices will not be shown if Price List is not set", + "fetch_if_empty": 0, "fieldname": "price_list", "fieldtype": "Link", "hidden": 0, @@ -342,6 +386,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "column_break_4", "fieldtype": "Column Break", "hidden": 0, @@ -373,6 +418,7 @@ "collapsible": 0, "columns": 0, "description": "", + "fetch_if_empty": 0, "fieldname": "default_customer_group", "fieldtype": "Link", "hidden": 0, @@ -405,6 +451,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "quotation_series", "fieldtype": "Select", "hidden": 0, @@ -437,6 +484,7 @@ "collapsible": 1, "collapsible_depends_on": "eval:doc.enable_checkout", "columns": 0, + "fetch_if_empty": 0, "fieldname": "section_break_8", "fieldtype": "Section Break", "hidden": 0, @@ -469,6 +517,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "enable_checkout", "fieldtype": "Check", "hidden": 0, @@ -503,6 +552,7 @@ "columns": 0, "default": "Orders", "description": "After payment completion redirect user to selected page.", + "fetch_if_empty": 0, "fieldname": "payment_success_url", "fieldtype": "Select", "hidden": 0, @@ -536,6 +586,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "column_break_11", "fieldtype": "Column Break", "hidden": 0, @@ -567,6 +618,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "payment_gateway_account", "fieldtype": "Link", "hidden": 0, @@ -605,8 +657,8 @@ "issingle": 1, "istable": 0, "max_attachments": 0, - "modified": "2018-05-31 03:11:58.911732", - "modified_by": "sushant@digithinkit.com", + "modified": "2019-04-09 18:29:43.270862", + "modified_by": "Administrator", "module": "Shopping Cart", "name": "Shopping Cart Settings", "owner": "Administrator", @@ -637,5 +689,6 @@ "show_name_in_global_search": 0, "sort_order": "ASC", "track_changes": 0, - "track_seen": 0 -} + "track_seen": 0, + "track_views": 0 +} \ No newline at end of file diff --git a/erpnext/templates/includes/product_page.js b/erpnext/templates/includes/product_page.js index ef69e200d9c..af98fc7987a 100644 --- a/erpnext/templates/includes/product_page.js +++ b/erpnext/templates/includes/product_page.js @@ -14,7 +14,9 @@ frappe.ready(function() { callback: function(r) { if(r.message) { if(r.message.cart_settings.enabled) { - $(".item-cart, .item-price, .item-stock").toggleClass("hide", (!!!r.message.product_info.price || !!!r.message.product_info.in_stock)); + let hide_add_to_cart = !r.message.product_info.price + || (!r.message.product_info.in_stock && !r.message.cart_settings.allow_items_not_in_stock); + $(".item-cart, .item-price, .item-stock").toggleClass('hide', hide_add_to_cart); } if(r.message.cart_settings.show_price) { $(".item-price").toggleClass("hide", false); From ff73090ad2994d04fc0f505f8872ee7a0f3912cb Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 9 Apr 2019 19:24:54 +0530 Subject: [PATCH 10/20] fix: Rounding Adjustment GL Entry --- .../sales_invoice/test_sales_invoice.py | 46 ++++++++++++++++++- erpnext/accounts/general_ledger.py | 8 +++- 2 files changed, 51 insertions(+), 3 deletions(-) diff --git a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py index 45a29505fc0..2164072bf3b 100644 --- a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py @@ -1361,7 +1361,7 @@ class TestSalesInvoice(unittest.TestCase): "included_in_print_rate": 1 }) si.save() - + si.submit() self.assertEqual(si.net_total, 19453.13) self.assertEqual(si.grand_total, 24900) self.assertEqual(si.total_taxes_and_charges, 5446.88) @@ -1383,6 +1383,50 @@ class TestSalesInvoice(unittest.TestCase): self.assertEqual(expected_values[gle.account][1], gle.debit) self.assertEqual(expected_values[gle.account][2], gle.credit) + def test_rounding_adjustment_2(self): + si = create_sales_invoice(rate=400, do_not_save=True) + for rate in [400, 600, 100]: + si.append("items", { + "item_code": "_Test Item", + "gst_hsn_code": "999800", + "warehouse": "_Test Warehouse - _TC", + "qty": 1, + "rate": rate, + "income_account": "Sales - _TC", + "cost_center": "_Test Cost Center - _TC" + }) + for tax_account in ["_Test Account VAT - _TC", "_Test Account Service Tax - _TC"]: + si.append("taxes", { + "charge_type": "On Net Total", + "account_head": tax_account, + "description": tax_account, + "rate": 9, + "cost_center": "_Test Cost Center - _TC", + "included_in_print_rate": 1 + }) + si.save() + si.submit() + self.assertEqual(si.net_total, 1271.19) + self.assertEqual(si.grand_total, 1500) + self.assertEqual(si.total_taxes_and_charges, 228.82) + self.assertEqual(si.rounding_adjustment, -0.01) + + expected_values = dict((d[0], d) for d in [ + [si.debit_to, 1500, 0.0], + ["_Test Account Service Tax - _TC", 0.0, 114.41], + ["_Test Account VAT - _TC", 0.0, 114.41], + ["Sales - _TC", 0.0, 1271.18] + ]) + + gl_entries = frappe.db.sql("""select account, debit, credit + from `tabGL Entry` where voucher_type='Sales Invoice' and voucher_no=%s + order by account asc""", si.name, as_dict=1) + + for gle in gl_entries: + self.assertEqual(expected_values[gle.account][0], gle.account) + self.assertEqual(expected_values[gle.account][1], gle.debit) + self.assertEqual(expected_values[gle.account][2], gle.credit) + def test_sales_invoice_with_shipping_rule(self): from erpnext.accounts.doctype.shipping_rule.test_shipping_rule \ import create_shipping_rule diff --git a/erpnext/accounts/general_ledger.py b/erpnext/accounts/general_ledger.py index a661c03b35b..36cba427186 100644 --- a/erpnext/accounts/general_ledger.py +++ b/erpnext/accounts/general_ledger.py @@ -135,9 +135,9 @@ def round_off_debit_credit(gl_map): .format(gl_map[0].voucher_type, gl_map[0].voucher_no, debit_credit_diff)) elif abs(debit_credit_diff) >= (1.0 / (10**precision)): - make_round_off_gle(gl_map, debit_credit_diff) + make_round_off_gle(gl_map, debit_credit_diff, precision) -def make_round_off_gle(gl_map, debit_credit_diff): +def make_round_off_gle(gl_map, debit_credit_diff, precision): round_off_account, round_off_cost_center = get_round_off_account_and_cost_center(gl_map[0].company) round_off_account_exists = False round_off_gle = frappe._dict() @@ -150,6 +150,10 @@ def make_round_off_gle(gl_map, debit_credit_diff): debit_credit_diff += flt(d.credit_in_account_currency) round_off_account_exists = True + if round_off_account_exists and abs(debit_credit_diff) <= (1.0 / (10**precision)): + gl_map.remove(round_off_gle) + return + if not round_off_gle: for k in ["voucher_type", "voucher_no", "company", "posting_date", "remarks", "is_opening"]: From 5eaf7d05174223d142ffc7442c40ecc3458075c6 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Thu, 11 Apr 2019 13:56:40 +0530 Subject: [PATCH 11/20] fix: Pending SO Items For Purchase Request not showing the so quantity correctly if so has duplicate items --- .../pending_so_items_for_purchase_request.py | 57 +++++++++++-------- 1 file changed, 33 insertions(+), 24 deletions(-) diff --git a/erpnext/selling/report/pending_so_items_for_purchase_request/pending_so_items_for_purchase_request.py b/erpnext/selling/report/pending_so_items_for_purchase_request/pending_so_items_for_purchase_request.py index 87216518c65..670b4e98bf3 100644 --- a/erpnext/selling/report/pending_so_items_for_purchase_request/pending_so_items_for_purchase_request.py +++ b/erpnext/selling/report/pending_so_items_for_purchase_request/pending_so_items_for_purchase_request.py @@ -47,9 +47,8 @@ def get_columns(): }, { "label": _("Material Request"), - "options": "Material Request", "fieldname": "material_request", - "fieldtype": "Link", + "fieldtype": "Data", "width": 140 }, { @@ -116,33 +115,43 @@ def get_data(): {"sales_order_item": ("!=",""), "docstatus": 1}, ["parent", "qty", "sales_order", "item_code"]) - grouped_records = {} + materials_request_dict = {} for record in mr_records: - grouped_records.setdefault(record.sales_order, []).append(record) + key = (record.sales_order, record.item_code) + if key not in materials_request_dict: + materials_request_dict.setdefault(key, { + 'qty': 0, + 'material_requests': [record.parent] + }) + + details = materials_request_dict.get(key) + details['qty'] += record.qty + + if record.parent not in details.get('material_requests'): + details['material_requests'].append(record.parent) pending_so=[] for so in sales_order_entry: # fetch all the material request records for a sales order item - mr_list = grouped_records.get(so.name) or [{}] - mr_item_record = ([mr for mr in mr_list if mr.get('item_code') == so.item_code] or [{}]) + key = (so.name, so.item_code) + materials_request = materials_request_dict.get(key) or {} - for mr in mr_item_record: - # check for pending sales order - if cint(so.net_qty) > cint(mr.get('qty')): - so_record = { - "item_code": so.item_code, - "item_name": so.item_name, - "description": so.description, - "sales_order_no": so.name, - "date": so.transaction_date, - "material_request": cstr(mr.get('parent')), - "customer": so.customer, - "territory": so.territory, - "so_qty": so.net_qty, - "requested_qty": cint(mr.get('qty')), - "pending_qty": so.net_qty - cint(mr.get('qty')), - "company": so.company - } - pending_so.append(so_record) + # check for pending sales order + if cint(so.net_qty) > cint(materials_request.get('qty')): + so_record = { + "item_code": so.item_code, + "item_name": so.item_name, + "description": so.description, + "sales_order_no": so.name, + "date": so.transaction_date, + "material_request": ','.join(materials_request.get('material_requests', [])), + "customer": so.customer, + "territory": so.territory, + "so_qty": so.net_qty, + "requested_qty": cint(materials_request.get('qty')), + "pending_qty": so.net_qty - cint(materials_request.get('qty')), + "company": so.company + } + pending_so.append(so_record) return pending_so \ No newline at end of file From 50db128ff17f684e17f106c3bb78f2064e0ee855 Mon Sep 17 00:00:00 2001 From: Anurag Mishra Date: Thu, 11 Apr 2019 16:07:38 +0530 Subject: [PATCH 12/20] fix: timesheet report not showing total amount correctly --- erpnext/projects/report/billing_summary.py | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/erpnext/projects/report/billing_summary.py b/erpnext/projects/report/billing_summary.py index 80bf926a54c..4906ba9d997 100644 --- a/erpnext/projects/report/billing_summary.py +++ b/erpnext/projects/report/billing_summary.py @@ -74,24 +74,17 @@ def get_data(filters): if time_start <= from_date and time_end >= from_date: total_hours, total_billable_hours, total_amount = get_billable_and_total_hours(activity, time_end, from_date, total_hours, total_billable_hours, total_amount) - - billable_hours_worked += total_billable_hours - hours_worked += total_hours - working_cost += total_amount - elif time_start >= from_date and time_end >= to_date: + elif time_start <= to_date and time_end >= to_date: total_hours, total_billable_hours, total_amount = get_billable_and_total_hours(activity, to_date, time_start, total_hours, total_billable_hours, total_amount) - - billable_hours_worked += total_billable_hours - hours_worked += total_hours - working_cost += total_amount elif time_start >= from_date and time_end <= to_date: total_hours, total_billable_hours, total_amount = get_billable_and_total_hours(activity, time_end, time_start, total_hours, total_billable_hours, total_amount) - billable_hours_worked += total_billable_hours - hours_worked += total_hours - working_cost += total_amount + + hours_worked += total_hours + billable_hours_worked += total_billable_hours + working_cost += total_amount row = { "employee": entries.employee, @@ -101,7 +94,6 @@ def get_data(filters): "total_hours": total_hours, "amount": total_amount } - if entries_exists: data.append(row) entries_exists = False From b42bbf1b6f6a9aeec100d9b3d3772ff0597ae986 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 10 Apr 2019 18:06:53 +0530 Subject: [PATCH 13/20] perf: Optimisation of project and task updation --- .../purchase_invoice/purchase_invoice.py | 3 +-- .../doctype/sales_invoice/sales_invoice.py | 3 +-- erpnext/projects/doctype/project/project.py | 24 ++++++++----------- erpnext/projects/doctype/task/task.py | 2 +- .../doctype/sales_order/sales_order.py | 3 +-- 5 files changed, 14 insertions(+), 21 deletions(-) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py index 450f2d0eb7b..53db2086768 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -789,9 +789,8 @@ class PurchaseInvoice(BuyingController): for d in self.items: if d.project and d.project not in project_list: project = frappe.get_doc("Project", d.project) - project.flags.dont_sync_tasks = True project.update_purchase_costing() - project.save() + project.db_update() project_list.append(d.project) def validate_supplier_invoice(self): diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index 489343c00c8..56d52069c69 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -1022,9 +1022,8 @@ class SalesInvoice(SellingController): def update_project(self): if self.project: project = frappe.get_doc("Project", self.project) - project.flags.dont_sync_tasks = True project.update_billed_amount() - project.save() + project.db_update() def verify_payment_amount_is_positive(self): diff --git a/erpnext/projects/doctype/project/project.py b/erpnext/projects/doctype/project/project.py index e3fd1a8622b..ebb15997962 100644 --- a/erpnext/projects/doctype/project/project.py +++ b/erpnext/projects/doctype/project/project.py @@ -30,11 +30,13 @@ class Project(Document): self.update_costing() - def __setup__(self): + def before_print(self): self.onload() def load_tasks(self): """Load `tasks` from the database""" + project_task_custom_fields = frappe.get_all("Custom Field", {"dt": "Project Task"}, "fieldname") + self.tasks = [] for task in self.get_tasks(): task_map = { @@ -47,7 +49,7 @@ class Project(Document): "task_weight": task.task_weight } - self.map_custom_fields(task, task_map) + self.map_custom_fields(task, task_map, project_task_custom_fields) self.append("tasks", task_map) @@ -149,7 +151,7 @@ class Project(Document): "task_weight": t.task_weight }) - self.map_custom_fields(t, task) + self.map_custom_fields(t, task, custom_fields) task.flags.ignore_links = True task.flags.from_project = True @@ -173,10 +175,6 @@ class Project(Document): for t in frappe.get_all("Task", ["name"], {"project": self.name, "name": ("not in", task_names)}): self.deleted_task_list.append(t.name) - def update_costing_and_percentage_complete(self): - self.update_percent_complete() - self.update_costing() - def is_row_updated(self, row, existing_task_data, fields): if self.get("__islocal") or not existing_task_data: return True @@ -186,10 +184,8 @@ class Project(Document): if row.get(field) != d.get(field): return True - def map_custom_fields(self, source, target): - project_task_custom_fields = frappe.get_all("Custom Field", {"dt": "Project Task"}, "fieldname") - - for field in project_task_custom_fields: + def map_custom_fields(self, source, target, custom_fields): + for field in custom_fields: target.update({ field.fieldname: source.get(field.fieldname) }) @@ -197,8 +193,6 @@ class Project(Document): def update_project(self): self.update_percent_complete() self.update_costing() - self.flags.dont_sync_tasks = True - self.save(ignore_permissions=True) def after_insert(self): if self.sales_order: @@ -233,6 +227,7 @@ class Project(Document): self.status = "Completed" elif not self.status == "Cancelled": self.status = "Open" + self.db_update() def update_costing(self): from_time_sheet = frappe.db.sql("""select @@ -260,6 +255,7 @@ class Project(Document): self.update_sales_amount() self.update_billed_amount() self.calculate_gross_margin() + self.db_update() def calculate_gross_margin(self): expense_amount = (flt(self.total_costing_amount) + flt(self.total_expense_claim) @@ -313,7 +309,7 @@ class Project(Document): def on_update(self): self.delete_task() self.load_tasks() - self.update_costing_and_percentage_complete() + self.update_project() self.update_dependencies_on_duplicated_project() def delete_task(self): diff --git a/erpnext/projects/doctype/task/task.py b/erpnext/projects/doctype/task/task.py index 12302789a9b..83d3b7de5ec 100755 --- a/erpnext/projects/doctype/task/task.py +++ b/erpnext/projects/doctype/task/task.py @@ -99,7 +99,7 @@ class Task(NestedSet): def update_project(self): if self.project and not self.flags.from_project: - frappe.get_doc("Project", self.project).update_project() + frappe.get_doc("Project", self.project).update_percent_complete() def check_recursion(self): if self.flags.ignore_recursion_check: return diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py index 8e81c13357c..bafe3c2cc6c 100755 --- a/erpnext/selling/doctype/sales_order/sales_order.py +++ b/erpnext/selling/doctype/sales_order/sales_order.py @@ -202,9 +202,8 @@ class SalesOrder(SellingController): if self.project: project = frappe.get_doc("Project", self.project) - project.flags.dont_sync_tasks = True project.update_sales_amount() - project.save() + project.db_update() def check_credit_limit(self): # if bypass credit limit check is set to true (1) at sales order level, From ea4c2c9e7df183b6f4e1702ab171e0d489a2d17b Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 12 Apr 2019 11:24:32 +0530 Subject: [PATCH 14/20] fix: task optimisation and test case fixes --- .../doctype/purchase_invoice/purchase_invoice.js | 9 +++++++-- erpnext/controllers/accounts_controller.py | 5 +++-- .../test_employee_onboarding.py | 1 + .../test_employee_separation.py | 9 +++------ erpnext/hr/doctype/expense_claim/expense_claim.py | 12 ++++++------ .../doctype/expense_claim/test_expense_claim.py | 15 ++++++++++----- erpnext/projects/doctype/project/project.py | 2 +- erpnext/projects/doctype/task/task.py | 2 +- .../doctype/purchase_receipt/purchase_receipt.py | 1 + 9 files changed, 33 insertions(+), 23 deletions(-) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js index 97b60365f88..8702a82cd6b 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js @@ -522,8 +522,13 @@ frappe.ui.form.on("Purchase Invoice", { }, onload: function(frm) { - if(frm.doc.__onload && !frm.doc.__onload.supplier_tds) { - me.frm.set_df_property("apply_tds", "read_only", 1); + if(frm.doc.__onload) { + if(frm.doc.supplier) { + frm.doc.apply_tds = frm.doc.__onload.supplier_tds ? 1 : 0; + } + if(!frm.doc.__onload.supplier_tds) { + frm.set_df_property("apply_tds", "read_only", 1); + } } erpnext.queries.setup_queries(frm, "Warehouse", function() { diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index 34bbe7b9994..e775263b6df 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -30,8 +30,9 @@ class AccountsController(TransactionBase): return self.__company_currency def onload(self): - self.get("__onload").make_payment_via_journal_entry \ - = frappe.db.get_single_value('Accounts Settings', 'make_payment_via_journal_entry') + if self.get("__onload"): + self.get("__onload").make_payment_via_journal_entry \ + = frappe.db.get_single_value('Accounts Settings', 'make_payment_via_journal_entry') if self.is_new(): relevant_docs = ("Quotation", "Purchase Order", "Sales Order", diff --git a/erpnext/hr/doctype/employee_onboarding/test_employee_onboarding.py b/erpnext/hr/doctype/employee_onboarding/test_employee_onboarding.py index ec640fc22b5..09bbcba0e4e 100644 --- a/erpnext/hr/doctype/employee_onboarding/test_employee_onboarding.py +++ b/erpnext/hr/doctype/employee_onboarding/test_employee_onboarding.py @@ -39,6 +39,7 @@ class TestEmployeeOnboarding(unittest.TestCase): # complete the task project = frappe.get_doc('Project', onboarding.project) + project.load_tasks() project.tasks[0].status = 'Closed' project.save() diff --git a/erpnext/hr/doctype/employee_separation/test_employee_separation.py b/erpnext/hr/doctype/employee_separation/test_employee_separation.py index 4c3e5667132..2fa114d3452 100644 --- a/erpnext/hr/doctype/employee_separation/test_employee_separation.py +++ b/erpnext/hr/doctype/employee_separation/test_employee_separation.py @@ -10,9 +10,9 @@ test_dependencies = ["Employee Onboarding"] class TestEmployeeSeparation(unittest.TestCase): def test_employee_separation(self): - employee = get_employee() + employee = frappe.db.get_value("Employee", {"status": "Active"}) separation = frappe.new_doc('Employee Separation') - separation.employee = employee.name + separation.employee = employee separation.company = '_Test Company' separation.append('activities', { 'activity_name': 'Deactivate Employee', @@ -23,7 +23,4 @@ class TestEmployeeSeparation(unittest.TestCase): separation.submit() self.assertEqual(separation.docstatus, 1) separation.cancel() - self.assertEqual(separation.project, "") - -def get_employee(): - return frappe.get_doc('Employee', {'employee_name': 'Test Researcher'}) \ No newline at end of file + self.assertEqual(separation.project, "") \ No newline at end of file diff --git a/erpnext/hr/doctype/expense_claim/expense_claim.py b/erpnext/hr/doctype/expense_claim/expense_claim.py index 09cdd547f5d..44879abf053 100644 --- a/erpnext/hr/doctype/expense_claim/expense_claim.py +++ b/erpnext/hr/doctype/expense_claim/expense_claim.py @@ -18,7 +18,7 @@ class ExpenseApproverIdentityError(frappe.ValidationError): pass class ExpenseClaim(AccountsController): def onload(self): - self.get("__onload").make_payment_via_journal_entry = frappe.db.get_single_value('Accounts Settings', + self.get("__onload").make_payment_via_journal_entry = frappe.db.get_single_value('Accounts Settings', 'make_payment_via_journal_entry') def validate(self): @@ -103,7 +103,7 @@ class ExpenseClaim(AccountsController): self.validate_account_details() payable_amount = flt(self.total_sanctioned_amount) - flt(self.total_advance_amount) - + # payable entry if payable_amount: gl_entry.append( @@ -233,7 +233,7 @@ class ExpenseClaim(AccountsController): expense.default_account = get_expense_claim_account(expense.expense_type, self.company)["account"] def update_reimbursed_amount(doc): - amt = frappe.db.sql("""select ifnull(sum(debit_in_account_currency), 0) as amt + amt = frappe.db.sql("""select ifnull(sum(debit_in_account_currency), 0) as amt from `tabGL Entry` where against_voucher_type = 'Expense Claim' and against_voucher = %s and party = %s """, (doc.name, doc.employee) ,as_dict=1)[0].amt @@ -288,7 +288,7 @@ def get_expense_claim_account(expense_claim_type, company): if not account: frappe.throw(_("Please set default account in Expense Claim Type {0}") .format(expense_claim_type)) - + return { "account": account } @@ -301,9 +301,9 @@ def get_advances(employee, advance_id=None): condition = 'name="{0}"'.format(frappe.db.escape(advance_id)) return frappe.db.sql(""" - select + select name, posting_date, paid_amount, claimed_amount, advance_account - from + from `tabEmployee Advance` where {0} """.format(condition), as_dict=1) diff --git a/erpnext/hr/doctype/expense_claim/test_expense_claim.py b/erpnext/hr/doctype/expense_claim/test_expense_claim.py index 075bc63345d..dcf0e68400d 100644 --- a/erpnext/hr/doctype/expense_claim/test_expense_claim.py +++ b/erpnext/hr/doctype/expense_claim/test_expense_claim.py @@ -13,19 +13,23 @@ test_dependencies = ['Employee'] class TestExpenseClaim(unittest.TestCase): def test_total_expense_claim_for_project(self): frappe.db.sql("""delete from `tabTask` where project = "_Test Project 1" """) + frappe.db.sql("""delete from `tabProject Task` where parent = "_Test Project 1" """) frappe.db.sql("""delete from `tabProject` where name = "_Test Project 1" """) - + frappe.db.sql("delete from `tabExpense Claim` where project='_Test Project 1'") frappe.get_doc({ "project_name": "_Test Project 1", "doctype": "Project", - "tasks" : - [{ "title": "_Test Project Task 1", "status": "Open" }] + }).save() + + task = frappe.get_doc({ + "doctype": "Task", + "subject": "_Test Project Task 1", + "project": "_Test Project 1" }).save() task_name = frappe.db.get_value("Task", {"project": "_Test Project 1"}) payable_account = get_payable_account("Wind Power LLC") - make_expense_claim(payable_account, 300, 200, "Wind Power LLC","Travel Expenses - WP", "_Test Project 1", task_name) self.assertEqual(frappe.db.get_value("Task", task_name, "total_expense_claim"), 200) @@ -103,9 +107,10 @@ def get_payable_account(company): return frappe.get_cached_value('Company', company, 'default_payable_account') def make_expense_claim(payable_account,claim_amount, sanctioned_amount, company, account, project=None, task_name=None): + employee = frappe.db.get_value("Employee", {"status": "Active"}) expense_claim = frappe.get_doc({ "doctype": "Expense Claim", - "employee": "_T-Employee-00001", + "employee": employee, "payable_account": payable_account, "approval_status": "Approved", "company": company, diff --git a/erpnext/projects/doctype/project/project.py b/erpnext/projects/doctype/project/project.py index ebb15997962..f52d8fde35c 100644 --- a/erpnext/projects/doctype/project/project.py +++ b/erpnext/projects/doctype/project/project.py @@ -241,7 +241,7 @@ class Project(Document): from_expense_claim = frappe.db.sql("""select sum(total_sanctioned_amount) as total_sanctioned_amount from `tabExpense Claim` where project = %s - and docstatus = 1""", self.name, as_dict=1)[0] + and docstatus = 1""", self.name, as_dict=1, debug=1)[0] self.actual_start_date = from_time_sheet.start_date self.actual_end_date = from_time_sheet.end_date diff --git a/erpnext/projects/doctype/task/task.py b/erpnext/projects/doctype/task/task.py index 83d3b7de5ec..12302789a9b 100755 --- a/erpnext/projects/doctype/task/task.py +++ b/erpnext/projects/doctype/task/task.py @@ -99,7 +99,7 @@ class Task(NestedSet): def update_project(self): if self.project and not self.flags.from_project: - frappe.get_doc("Project", self.project).update_percent_complete() + frappe.get_doc("Project", self.project).update_project() def check_recursion(self): if self.flags.ignore_recursion_check: return diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py index ed7f2ca4323..bcef940b344 100644 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py @@ -419,6 +419,7 @@ def make_purchase_invoice(source_name, target_doc=None): doc = frappe.get_doc(target) doc.ignore_pricing_rule = 1 + doc.run_method("onload") doc.run_method("set_missing_values") doc.run_method("calculate_taxes_and_totals") From 774b96495f79f4acab6c0b565e72be53af3ff0f3 Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Fri, 12 Apr 2019 12:38:04 +0530 Subject: [PATCH 15/20] fix: Set default value for Packing Unit as 0 The default value 1 assumes Items will be always packed in integer quantities. This is not the usual case. --- .../stock/doctype/item_price/item_price.json | 1804 +++++++++-------- 1 file changed, 916 insertions(+), 888 deletions(-) diff --git a/erpnext/stock/doctype/item_price/item_price.json b/erpnext/stock/doctype/item_price/item_price.json index 593f8b420d4..9e29ad08ee3 100644 --- a/erpnext/stock/doctype/item_price/item_price.json +++ b/erpnext/stock/doctype/item_price/item_price.json @@ -1,953 +1,981 @@ { - "allow_copy": 0, - "allow_guest_to_view": 0, - "allow_import": 1, - "allow_rename": 0, - "autoname": "", - "beta": 0, - "creation": "2013-05-02 16:29:48", - "custom": 0, - "description": "Multiple Item prices.", - "docstatus": 0, - "doctype": "DocType", - "document_type": "Setup", - "editable_grid": 0, - "engine": "InnoDB", + "allow_copy": 0, + "allow_events_in_timeline": 0, + "allow_guest_to_view": 0, + "allow_import": 1, + "allow_rename": 0, + "autoname": "", + "beta": 0, + "creation": "2013-05-02 16:29:48", + "custom": 0, + "description": "Multiple Item prices.", + "docstatus": 0, + "doctype": "DocType", + "document_type": "Setup", + "editable_grid": 0, + "engine": "InnoDB", "fields": [ { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "item_code", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 1, - "in_global_search": 1, - "in_list_view": 0, - "in_standard_filter": 1, - "label": "Item Code", - "length": 0, - "no_copy": 0, - "oldfieldname": "price_list_name", - "oldfieldtype": "Select", - "options": "Item", - "permlevel": 0, - "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, + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "item_code", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 1, + "in_global_search": 1, + "in_list_view": 0, + "in_standard_filter": 1, + "label": "Item Code", + "length": 0, + "no_copy": 0, + "oldfieldname": "price_list_name", + "oldfieldtype": "Select", + "options": "Item", + "permlevel": 0, + "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, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "uom", - "fieldtype": "Link", - "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": "UOM", - "length": 0, - "no_copy": 0, - "options": "UOM", - "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, + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "uom", + "fieldtype": "Link", + "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": "UOM", + "length": 0, + "no_copy": 0, + "options": "UOM", + "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, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "default": "1", - "description": "Quantity that must be bought or sold per UOM", - "fieldname": "packing_unit", - "fieldtype": "Int", - "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": "Packing Unit", - "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, + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "default": "0", + "description": "Quantity that must be bought or sold per UOM", + "fetch_if_empty": 0, + "fieldname": "packing_unit", + "fieldtype": "Int", + "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": "Packing Unit", + "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, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "default": "1", - "fieldname": "min_qty", - "fieldtype": "Int", - "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": "Minimum Qty ", - "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, + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "default": "1", + "fetch_if_empty": 0, + "fieldname": "min_qty", + "fieldtype": "Int", + "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": "Minimum Qty ", + "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, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "column_break_17", - "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, + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "column_break_17", + "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, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "item_name", - "fieldtype": "Data", - "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": "Item Name", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 1, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "item_name", + "fieldtype": "Data", + "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": "Item Name", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "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, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fetch_from": "item_code.brand", - "fieldname": "brand", - "fieldtype": "Read Only", - "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": "Brand", - "length": 0, - "no_copy": 0, - "options": "", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 1, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_from": "item_code.brand", + "fetch_if_empty": 0, + "fieldname": "brand", + "fieldtype": "Read Only", + "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": "Brand", + "length": 0, + "no_copy": 0, + "options": "", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "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, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "item_description", - "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": "Item Description", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 1, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "item_description", + "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": "Item Description", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "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, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "price_list_details", - "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, - "label": "Price List", - "length": 0, - "no_copy": 0, - "options": "fa fa-tags", - "permlevel": 0, - "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, + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "price_list_details", + "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, + "label": "Price List", + "length": 0, + "no_copy": 0, + "options": "fa fa-tags", + "permlevel": 0, + "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, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "price_list", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 1, - "in_list_view": 0, - "in_standard_filter": 1, - "label": "Price List", - "length": 0, - "no_copy": 0, - "options": "Price List", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "price_list", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 1, + "in_list_view": 0, + "in_standard_filter": 1, + "label": "Price List", + "length": 0, + "no_copy": 0, + "options": "Price List", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 1, - "collapsible": 0, - "columns": 0, - "depends_on": "eval:doc.selling == 1", - "fieldname": "customer", - "fieldtype": "Link", - "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": "Customer", - "length": 0, - "no_copy": 0, - "options": "Customer", - "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, + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 1, + "collapsible": 0, + "columns": 0, + "depends_on": "eval:doc.selling == 1", + "fetch_if_empty": 0, + "fieldname": "customer", + "fieldtype": "Link", + "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": "Customer", + "length": 0, + "no_copy": 0, + "options": "Customer", + "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, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "eval:doc.buying == 1", - "fieldname": "supplier", - "fieldtype": "Link", - "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": "Supplier", - "length": 0, - "no_copy": 0, - "options": "Supplier", - "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, + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "eval:doc.buying == 1", + "fetch_if_empty": 0, + "fieldname": "supplier", + "fieldtype": "Link", + "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": "Supplier", + "length": 0, + "no_copy": 0, + "options": "Supplier", + "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, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "column_break_3", - "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, + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "column_break_3", + "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, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "buying", - "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": "Buying", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 1, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "buying", + "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": "Buying", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "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, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "selling", - "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": "Selling", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 1, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "selling", + "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": "Selling", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "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, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "item_details", - "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, - "label": "", - "length": 0, - "no_copy": 0, - "options": "fa fa-tag", - "permlevel": 0, - "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, + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "item_details", + "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, + "label": "", + "length": 0, + "no_copy": 0, + "options": "fa fa-tag", + "permlevel": 0, + "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, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 1, - "collapsible": 0, - "columns": 0, - "fieldname": "currency", - "fieldtype": "Link", - "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": "Currency", - "length": 0, - "no_copy": 0, - "options": "Currency", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 1, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 1, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "currency", + "fieldtype": "Link", + "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": "Currency", + "length": 0, + "no_copy": 0, + "options": "Currency", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "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, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "col_br_1", - "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, - "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, + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "col_br_1", + "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, + "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, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "price_list_rate", - "fieldtype": "Currency", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 1, - "in_global_search": 1, - "in_list_view": 1, - "in_standard_filter": 0, - "label": "Rate", - "length": 0, - "no_copy": 0, - "oldfieldname": "ref_rate", - "oldfieldtype": "Currency", - "options": "currency", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "price_list_rate", + "fieldtype": "Currency", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 1, + "in_global_search": 1, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Rate", + "length": 0, + "no_copy": 0, + "oldfieldname": "ref_rate", + "oldfieldtype": "Currency", + "options": "currency", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "section_break_15", - "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, + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_break_15", + "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, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "default": "Today", - "fieldname": "valid_from", - "fieldtype": "Date", - "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": "Valid From ", - "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, + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "default": "Today", + "fetch_if_empty": 0, + "fieldname": "valid_from", + "fieldtype": "Date", + "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": "Valid From ", + "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, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "default": "0", - "fieldname": "lead_time_days", - "fieldtype": "Int", - "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": "Lead Time in days", - "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, + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "default": "0", + "fetch_if_empty": 0, + "fieldname": "lead_time_days", + "fieldtype": "Int", + "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": "Lead Time in days", + "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, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "column_break_18", - "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, + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "column_break_18", + "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, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "valid_upto", - "fieldtype": "Date", - "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": "Valid Upto ", - "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, + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "valid_upto", + "fieldtype": "Date", + "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": "Valid Upto ", + "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, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "section_break_24", - "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, + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_break_24", + "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, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "note", - "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": "Note", - "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, + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "note", + "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": "Note", + "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, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "reference", - "fieldtype": "Data", - "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": "Reference", - "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, + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "reference", + "fieldtype": "Data", + "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": "Reference", + "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, - "hide_heading": 0, - "hide_toolbar": 0, - "icon": "fa fa-flag", - "idx": 1, - "image_view": 0, - "in_create": 0, - "is_submittable": 0, - "issingle": 0, - "istable": 0, - "max_attachments": 0, - "modified": "2018-08-29 06:27:16.102833", - "modified_by": "Administrator", - "module": "Stock", - "name": "Item Price", - "name_case": "Title Case", - "owner": "Administrator", + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "icon": "fa fa-flag", + "idx": 1, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2019-04-12 12:33:54.621527", + "modified_by": "Administrator", + "module": "Stock", + "name": "Item Price", + "name_case": "Title Case", + "owner": "Administrator", "permissions": [ { - "amend": 0, - "cancel": 0, - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "if_owner": 0, - "import": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Sales Master Manager", - "set_user_permissions": 0, - "share": 1, - "submit": 0, + "amend": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Sales Master Manager", + "set_user_permissions": 0, + "share": 1, + "submit": 0, "write": 1 - }, + }, { - "amend": 0, - "cancel": 0, - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "if_owner": 0, - "import": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Purchase Master Manager", - "set_user_permissions": 0, - "share": 1, - "submit": 0, + "amend": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Purchase Master Manager", + "set_user_permissions": 0, + "share": 1, + "submit": 0, "write": 1 } - ], - "quick_entry": 1, - "read_only": 0, - "read_only_onload": 0, - "show_name_in_global_search": 0, - "sort_order": "ASC", - "title_field": "item_code", - "track_changes": 1, - "track_seen": 0, + ], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_order": "ASC", + "title_field": "item_code", + "track_changes": 1, + "track_seen": 0, "track_views": 0 } \ No newline at end of file From 313ed4feeb46a7b4e0480bab74d3ae333872bc8d Mon Sep 17 00:00:00 2001 From: Anurag Mishra Date: Fri, 12 Apr 2019 15:11:06 +0530 Subject: [PATCH 16/20] fix: handle for party type member in payment entry --- erpnext/accounts/doctype/payment_entry/payment_entry.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.py b/erpnext/accounts/doctype/payment_entry/payment_entry.py index 443c8fb9805..b0c70a18cbf 100644 --- a/erpnext/accounts/doctype/payment_entry/payment_entry.py +++ b/erpnext/accounts/doctype/payment_entry/payment_entry.py @@ -536,9 +536,13 @@ class PaymentEntry(AccountsController): @frappe.whitelist() def get_outstanding_reference_documents(args): + if isinstance(args, string_types): args = json.loads(args) + if args.get('party_type') == 'Member': + return + # confirm that Supplier is not blocked if args.get('party_type') == 'Supplier': supplier_status = get_supplier_block_status(args['party']) From 819e24dddebf2b6c405211bfda2162ad613dba17 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 12 Apr 2019 15:11:11 +0530 Subject: [PATCH 17/20] fix: supplier wise sales analytics report --- .../supplier_wise_sales_analytics.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/erpnext/stock/report/supplier_wise_sales_analytics/supplier_wise_sales_analytics.py b/erpnext/stock/report/supplier_wise_sales_analytics/supplier_wise_sales_analytics.py index 2a02b469fb0..6a86889aa3d 100644 --- a/erpnext/stock/report/supplier_wise_sales_analytics/supplier_wise_sales_analytics.py +++ b/erpnext/stock/report/supplier_wise_sales_analytics/supplier_wise_sales_analytics.py @@ -94,9 +94,13 @@ def get_suppliers_details(filters): item_supplier_map.setdefault(d.item_code, []).append(d.supplier) if supplier: + invalid_items = [] for item_code, suppliers in iteritems(item_supplier_map): if supplier not in suppliers: - del item_supplier_map[item_code] + invalid_items.append(item_code) + + for item_code in invalid_items: + del item_supplier_map[item_code] return item_supplier_map From c5c9dc5f6d82a3f17cab5d29c34733c45d154276 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Fri, 12 Apr 2019 16:58:51 +0530 Subject: [PATCH 18/20] fix: user permissions are not working on stock ledger report --- erpnext/stock/report/stock_ledger/stock_ledger.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/erpnext/stock/report/stock_ledger/stock_ledger.py b/erpnext/stock/report/stock_ledger/stock_ledger.py index ef9fbe41c02..a6210a697a9 100644 --- a/erpnext/stock/report/stock_ledger/stock_ledger.py +++ b/erpnext/stock/report/stock_ledger/stock_ledger.py @@ -22,12 +22,8 @@ def execute(filters=None): for sle in sl_entries: item_detail = item_details[sle.item_code] - data.append([sle.date, sle.item_code, item_detail.item_name, item_detail.item_group, - item_detail.brand, item_detail.description, sle.warehouse, - item_detail.stock_uom, sle.actual_qty, sle.qty_after_transaction, - (sle.incoming_rate if sle.actual_qty > 0 else 0.0), - sle.valuation_rate, sle.stock_value, sle.voucher_type, sle.voucher_no, - sle.batch_no, sle.serial_no, sle.project, sle.company]) + sle.update(item_detail) + data.append(sle) if include_uom: conversion_factors.append(item_detail.conversion_factor) From dc34393b8a0bc1265ebf80439641931252bc9ddd Mon Sep 17 00:00:00 2001 From: Himanshu Date: Sun, 14 Apr 2019 00:54:24 +0530 Subject: [PATCH 19/20] fix: allow braces for custom field names --- erpnext/setup/doctype/naming_series/naming_series.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/setup/doctype/naming_series/naming_series.py b/erpnext/setup/doctype/naming_series/naming_series.py index 2167b12e32c..ffcfa2edb37 100644 --- a/erpnext/setup/doctype/naming_series/naming_series.py +++ b/erpnext/setup/doctype/naming_series/naming_series.py @@ -135,7 +135,7 @@ class NamingSeries(Document): def validate_series_name(self, n): import re - if not re.match("^[\w\- /.#]*$", n, re.UNICODE): + if not (re.match("^[\w\- /.#]*$", n, re.UNICODE) or re.match("\{(.*?)\}", n, re.UNICODE)): throw(_('Special Characters except "-", "#", "." and "/" not allowed in naming series')) def get_options(self, arg=None): From 548e93b2d3af4a085cdf81bc34ac400ee373b613 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Sun, 14 Apr 2019 19:39:11 +0530 Subject: [PATCH 20/20] fix: POS not working if user has access of multiple company --- .../page/point_of_sale/point_of_sale.js | 45 +++++++++++++++++-- 1 file changed, 41 insertions(+), 4 deletions(-) diff --git a/erpnext/selling/page/point_of_sale/point_of_sale.js b/erpnext/selling/page/point_of_sale/point_of_sale.js index 26cadae4ef9..3e6ee86df00 100644 --- a/erpnext/selling/page/point_of_sale/point_of_sale.js +++ b/erpnext/selling/page/point_of_sale/point_of_sale.js @@ -54,8 +54,16 @@ erpnext.pos.PointOfSale = class PointOfSale { this.prepare_menu(); this.set_online_status(); }, - () => this.setup_company(), () => this.make_new_invoice(), + () => { + if(!this.frm.doc.company) { + this.setup_company() + .then((company) => { + this.frm.doc.company = company; + this.get_pos_profile(); + }); + } + }, () => { frappe.dom.unfreeze(); }, @@ -63,6 +71,22 @@ erpnext.pos.PointOfSale = class PointOfSale { ]); } + get_pos_profile() { + return frappe.xcall("erpnext.stock.get_item_details.get_pos_profile", + {'company': this.frm.doc.company}) + .then((r) => { + if(r) { + this.frm.doc.pos_profile = r.name; + this.set_pos_profile_data() + .then(() => { + this.on_change_pos_profile(); + }); + } else { + this.raise_exception_for_pos_profile(); + } + }); + } + set_online_status() { this.connection_status = false; this.page.set_indicator(__("Offline"), "grey"); @@ -77,6 +101,11 @@ erpnext.pos.PointOfSale = class PointOfSale { }); } + raise_exception_for_pos_profile() { + setTimeout(() => frappe.set_route('List', 'POS Profile'), 2000); + frappe.throw(__("POS Profile is required to use Point-of-Sale")); + } + prepare_dom() { this.wrapper.append(`
@@ -447,7 +476,7 @@ erpnext.pos.PointOfSale = class PointOfSale { setup_company() { return new Promise(resolve => { - if(!frappe.sys_defaults.company) { + if(!this.frm.doc.company) { frappe.prompt({fieldname:"company", options: "Company", fieldtype:"Link", label: __("Select Company"), reqd: 1}, (data) => { this.company = data.company; @@ -487,6 +516,10 @@ erpnext.pos.PointOfSale = class PointOfSale { return new Promise(resolve => { if (this.frm) { this.frm = get_frm(this.frm); + if(this.company) { + this.frm.doc.company = this.company; + } + resolve(); } else { frappe.model.with_doctype(doctype, () => { @@ -503,6 +536,7 @@ erpnext.pos.PointOfSale = class PointOfSale { frm.refresh(name); frm.doc.items = []; frm.doc.is_pos = 1; + return frm; } } @@ -512,6 +546,10 @@ erpnext.pos.PointOfSale = class PointOfSale { this.frm.doc.company = this.company; } + if (!this.frm.doc.company) { + return; + } + return new Promise(resolve => { return this.frm.call({ doc: this.frm.doc, @@ -520,8 +558,7 @@ erpnext.pos.PointOfSale = class PointOfSale { if(!r.exc) { if (!this.frm.doc.pos_profile) { frappe.dom.unfreeze(); - setTimeout(() => frappe.set_route('List', 'POS Profile'), 2000); - frappe.throw(__("POS Profile is required to use Point-of-Sale")); + this.raise_exception_for_pos_profile(); } this.frm.script_manager.trigger("update_stock"); frappe.model.set_default_values(this.frm.doc);
Tax and Charges: {{doc.taxes_and_charges}}