Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
nabinhait committed Apr 4, 2017
2 parents 9bfa0ab + 93a990f commit 7eea52d
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 10 deletions.
2 changes: 1 addition & 1 deletion erpnext/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'''
Expand Down
11 changes: 7 additions & 4 deletions erpnext/controllers/taxes_and_totals.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 - flt(self.doc.write_off_amount),
self.doc.precision("grand_total"))

else:
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

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))
Expand Down
7 changes: 5 additions & 2 deletions erpnext/demo/setup/setup_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion erpnext/selling/doctype/customer/customer_list.js
Original file line number Diff line number Diff line change
@@ -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"],
};
4 changes: 2 additions & 2 deletions erpnext/setup/doctype/company/company.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 7eea52d

Please sign in to comment.