From 9c3535307fcc51222637049b50db682d4b0b2a24 Mon Sep 17 00:00:00 2001 From: Neil Trini Lasrado Date: Tue, 19 Aug 2014 10:41:34 +0530 Subject: [PATCH 1/5] [fix] frappe/erpnext#1510 --- .../accounts/doctype/purchase_invoice/purchase_invoice.json | 4 ++-- erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json index 9d85cdb96b4..d3e99d5e071 100755 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json @@ -117,7 +117,7 @@ "search_index": 1 }, { - "description": "If not applicable please enter: NA", + "description": "", "fieldname": "bill_no", "fieldtype": "Data", "in_filter": 1, @@ -758,7 +758,7 @@ "icon": "icon-file-text", "idx": 1, "is_submittable": 1, - "modified": "2014-08-12 05:25:16.261614", + "modified": "2014-08-19 10:36:33.177267", "modified_by": "Administrator", "module": "Accounts", "name": "Purchase Invoice", diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py index 68a21d9117c..2c762f3a235 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -89,8 +89,7 @@ class PurchaseInvoice(BuyingController): throw(_("Conversion rate cannot be 0 or 1")) def validate_bill_no(self): - if self.bill_no and self.bill_no.lower().strip() \ - not in ['na', 'not applicable', 'none']: + if self.bill_no: b_no = frappe.db.sql("""select bill_no, name, ifnull(is_opening,'') from `tabPurchase Invoice` where bill_no = %s and credit_to = %s and docstatus = 1 and name != %s""", (self.bill_no, self.credit_to, self.name)) From 2026148dbe6d5e8e2c9701b7db0d1041be662307 Mon Sep 17 00:00:00 2001 From: Neil Trini Lasrado Date: Tue, 19 Aug 2014 12:22:45 +0530 Subject: [PATCH 2/5] [fix issue No #1510] --- erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py index 2c762f3a235..fdd669bc7c2 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -88,7 +88,7 @@ class PurchaseInvoice(BuyingController): if (self.currency == default_currency and flt(self.conversion_rate) != 1.00) or not self.conversion_rate or (self.currency != default_currency and flt(self.conversion_rate) == 1.00): throw(_("Conversion rate cannot be 0 or 1")) - def validate_bill_no(self): +''' def validate_bill_no(self): if self.bill_no: b_no = frappe.db.sql("""select bill_no, name, ifnull(is_opening,'') from `tabPurchase Invoice` where bill_no = %s and credit_to = %s and docstatus = 1 and name != %s""", @@ -103,7 +103,7 @@ class PurchaseInvoice(BuyingController): if not self.remarks: self.remarks = "No Remarks" - +''' def validate_credit_acc(self): if frappe.db.get_value("Account", self.credit_to, "report_type") != "Balance Sheet": frappe.throw(_("Account must be a balance sheet account")) From 67e14a48b83740776ca22473543eb49db7da6125 Mon Sep 17 00:00:00 2001 From: Neil Trini Lasrado Date: Tue, 19 Aug 2014 12:35:14 +0530 Subject: [PATCH 3/5] [fix issue No #1510] --- .../purchase_invoice/purchase_invoice.json | 4 ++-- .../purchase_invoice/purchase_invoice.py | 17 ----------------- 2 files changed, 2 insertions(+), 19 deletions(-) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json index d3e99d5e071..fb991ceba79 100755 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json @@ -127,7 +127,7 @@ "permlevel": 0, "print_hide": 1, "read_only": 0, - "reqd": 1, + "reqd": 0, "search_index": 1 }, { @@ -758,7 +758,7 @@ "icon": "icon-file-text", "idx": 1, "is_submittable": 1, - "modified": "2014-08-19 10:36:33.177267", + "modified": "2014-08-19 12:01:12.133942", "modified_by": "Administrator", "module": "Accounts", "name": "Purchase Invoice", diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py index fdd669bc7c2..6f4dad09efb 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -47,7 +47,6 @@ class PurchaseInvoice(BuyingController): self.pr_required() self.check_active_purchase_items() self.check_conversion_rate() - self.validate_bill_no() self.validate_credit_acc() self.clear_unallocated_advances("Purchase Invoice Advance", "advance_allocation_details") self.check_for_acc_head_of_supplier() @@ -88,22 +87,6 @@ class PurchaseInvoice(BuyingController): if (self.currency == default_currency and flt(self.conversion_rate) != 1.00) or not self.conversion_rate or (self.currency != default_currency and flt(self.conversion_rate) == 1.00): throw(_("Conversion rate cannot be 0 or 1")) -''' def validate_bill_no(self): - if self.bill_no: - b_no = frappe.db.sql("""select bill_no, name, ifnull(is_opening,'') from `tabPurchase Invoice` - where bill_no = %s and credit_to = %s and docstatus = 1 and name != %s""", - (self.bill_no, self.credit_to, self.name)) - if b_no and cstr(b_no[0][2]) == cstr(self.is_opening): - throw(_("Bill No {0} already booked in Purchase Invoice {1}").format(cstr(b_no[0][0]), - cstr(b_no[0][1]))) - - if not self.remarks and self.bill_date: - self.remarks = (self.remarks or '') + "\n" \ - + _("Against Bill {0} dated {1}").format(self.bill_no, formatdate(self.bill_date)) - - if not self.remarks: - self.remarks = "No Remarks" -''' def validate_credit_acc(self): if frappe.db.get_value("Account", self.credit_to, "report_type") != "Balance Sheet": frappe.throw(_("Account must be a balance sheet account")) From 95b395505faa1be36ca73e70e7dfa77a4a62cd5d Mon Sep 17 00:00:00 2001 From: Neil Trini Lasrado Date: Tue, 19 Aug 2014 13:12:33 +0530 Subject: [PATCH 4/5] [new fix issue No #1510] --- .../accounts/doctype/purchase_invoice/purchase_invoice.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py index 6f4dad09efb..239b0125b4a 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -60,6 +60,14 @@ class PurchaseInvoice(BuyingController): self.update_valuation_rate("entries") self.validate_multiple_billing("Purchase Receipt", "pr_detail", "amount", "purchase_receipt_details") + self.create_remarks() + + def create_remarks(self): + if not self.remarks: + if self.bill_no and self.bill_date: + self.remarks = _("Against Bill {0} dated {1}").format(self.bill_no, formatdate(self.bill_date)) + else: + self.remarks = _("No Remarks") def set_missing_values(self, for_validate=False): if not self.credit_to: From 84e5a4a2c2228bbe2718df61a5f002f5995b9a38 Mon Sep 17 00:00:00 2001 From: Neil Trini Lasrado Date: Wed, 20 Aug 2014 13:44:56 +0530 Subject: [PATCH 5/5] [fix-remarks-changed-issue#110] --- erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py index 239b0125b4a..79f433c4701 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -65,7 +65,7 @@ class PurchaseInvoice(BuyingController): def create_remarks(self): if not self.remarks: if self.bill_no and self.bill_date: - self.remarks = _("Against Bill {0} dated {1}").format(self.bill_no, formatdate(self.bill_date)) + self.remarks = _("Against Supplier Invoice {0} dated {1}").format(self.bill_no, formatdate(self.bill_date)) else: self.remarks = _("No Remarks")