From 2e47654f436be8b07ff435600d36579e03b897e2 Mon Sep 17 00:00:00 2001 From: Saurabh Date: Mon, 3 Apr 2017 17:25:55 +0530 Subject: [PATCH 1/7] [fix] demo script for setup data --- erpnext/demo/setup/setup_data.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/erpnext/demo/setup/setup_data.py b/erpnext/demo/setup/setup_data.py index c1a8bed64bda..3675f0f4ead1 100644 --- a/erpnext/demo/setup/setup_data.py +++ b/erpnext/demo/setup/setup_data.py @@ -64,8 +64,11 @@ def complete_setup(domain='Manufacturing'): }) company = erpnext.get_default_company() - company.db_set('default_payroll_payable_account', - frappe.db.get_value('Account', dict(account_name='Payroll Payable'))) + + if company: + company_doc = frappe.get_doc("Company", company) + company_doc.db_set('default_payroll_payable_account', + frappe.db.get_value('Account', dict(account_name='Payroll Payable'))) def setup_demo_page(): # home page should always be "start" From 2d132e32aa31fd848e8f60dcd7032483757492d0 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 3 Apr 2017 17:25:38 +0530 Subject: [PATCH 2/7] Function name changed in company --- erpnext/setup/doctype/company/company.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/setup/doctype/company/company.py b/erpnext/setup/doctype/company/company.py index 26298bcc577a..c09255d506d7 100644 --- a/erpnext/setup/doctype/company/company.py +++ b/erpnext/setup/doctype/company/company.py @@ -79,7 +79,7 @@ def on_update(self): if not frappe.local.flags.ignore_chart_of_accounts: self.set_default_accounts() if self.default_cash_account: - self.mode_of_payment() + self.set_mode_of_payment_account() if self.default_currency: frappe.db.set_value("Currency", self.default_currency, "enabled", 1) @@ -166,7 +166,7 @@ def _set_default_account(self, fieldname, account_type): if account: self.db_set(fieldname, account) - def mode_of_payment(self): + def set_mode_of_payment_account(self): cash = frappe.db.get_value('Mode of Payment', {'type': 'Cash'}, 'name') if cash and not frappe.db.get_value('Mode of Payment Account', {'company': self.name}): mode_of_payment = frappe.get_doc('Mode of Payment', cash) From 8d8cba7faa9520be58bb3a81ffb89e627c583f68 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 3 Apr 2017 17:26:22 +0530 Subject: [PATCH 3/7] Validate total advance against grand total considering write off amount --- erpnext/controllers/taxes_and_totals.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/erpnext/controllers/taxes_and_totals.py b/erpnext/controllers/taxes_and_totals.py index bec57f4efbdb..40748df63086 100644 --- a/erpnext/controllers/taxes_and_totals.py +++ b/erpnext/controllers/taxes_and_totals.py @@ -404,11 +404,14 @@ def calculate_total_advance(self): self.doc.total_advance = flt(total_allocated_amount, self.doc.precision("total_advance")) if self.doc.party_account_currency == self.doc.currency: - invoice_total = self.doc.grand_total - else: - invoice_total = flt(self.doc.grand_total * self.doc.conversion_rate, + invoice_total = flt(self.doc.grand_total - self.write_off_amount, self.doc.precision("grand_total")) - + else: + base_write_off_amount = flt(self.doc.write_off_amount * self.doc.conversion_rate, + self.doc.precision("base_write_off_amount")) + invoice_total = flt(self.doc.grand_total * self.doc.conversion_rate, + self.doc.precision("grand_total")) - base_write_off_amount + if invoice_total > 0 and self.doc.total_advance > invoice_total: frappe.throw(_("Advance amount cannot be greater than {0} {1}") .format(self.doc.party_account_currency, invoice_total)) From 9300013accfa7d2c8dbef1ee33e938fef2d03507 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 3 Apr 2017 17:26:22 +0530 Subject: [PATCH 4/7] Validate total advance against grand total considering write off amount --- erpnext/controllers/taxes_and_totals.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/controllers/taxes_and_totals.py b/erpnext/controllers/taxes_and_totals.py index 40748df63086..45ed3385f5d4 100644 --- a/erpnext/controllers/taxes_and_totals.py +++ b/erpnext/controllers/taxes_and_totals.py @@ -404,7 +404,7 @@ def calculate_total_advance(self): self.doc.total_advance = flt(total_allocated_amount, self.doc.precision("total_advance")) if self.doc.party_account_currency == self.doc.currency: - invoice_total = flt(self.doc.grand_total - self.write_off_amount, + invoice_total = flt(self.doc.grand_total - self.doc.write_off_amount, self.doc.precision("grand_total")) else: base_write_off_amount = flt(self.doc.write_off_amount * self.doc.conversion_rate, From 6f038bc1f376e6362c994e5e20e09ae60b770d72 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 3 Apr 2017 17:56:05 +0530 Subject: [PATCH 5/7] Validate total advance against grand total considering write off amount --- erpnext/controllers/taxes_and_totals.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/controllers/taxes_and_totals.py b/erpnext/controllers/taxes_and_totals.py index 45ed3385f5d4..0355c269d0bb 100644 --- a/erpnext/controllers/taxes_and_totals.py +++ b/erpnext/controllers/taxes_and_totals.py @@ -404,10 +404,10 @@ def calculate_total_advance(self): self.doc.total_advance = flt(total_allocated_amount, self.doc.precision("total_advance")) if self.doc.party_account_currency == self.doc.currency: - invoice_total = flt(self.doc.grand_total - self.doc.write_off_amount, + invoice_total = flt(self.doc.grand_total - flt(self.doc.write_off_amount), self.doc.precision("grand_total")) else: - base_write_off_amount = flt(self.doc.write_off_amount * self.doc.conversion_rate, + base_write_off_amount = flt(flt(self.doc.write_off_amount) * self.doc.conversion_rate, self.doc.precision("base_write_off_amount")) invoice_total = flt(self.doc.grand_total * self.doc.conversion_rate, self.doc.precision("grand_total")) - base_write_off_amount From 0d114b4c31b116f4f0a5c521e78a1302495883b1 Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Mon, 3 Apr 2017 21:20:53 +0530 Subject: [PATCH 6/7] Add `image` field to fetch in Customer List --- erpnext/selling/doctype/customer/customer_list.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/selling/doctype/customer/customer_list.js b/erpnext/selling/doctype/customer/customer_list.js index 09c3e93c1ce7..38fc9ad1f13b 100644 --- a/erpnext/selling/doctype/customer/customer_list.js +++ b/erpnext/selling/doctype/customer/customer_list.js @@ -1,3 +1,3 @@ frappe.listview_settings['Customer'] = { - add_fields: ["customer_name", "territory", "customer_group", "customer_type"], + add_fields: ["customer_name", "territory", "customer_group", "customer_type", "image"], }; From 93a990f00650fa988e8ab154dbb965968e37de24 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 4 Apr 2017 12:16:47 +0600 Subject: [PATCH 7/7] bumped to version 8.0.7 --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 5b6f359981ee..881087a31181 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals import frappe -__version__ = '8.0.6' +__version__ = '8.0.7' def get_default_company(user=None): '''Get default company for user'''