Merge branch 'develop'

This commit is contained in:
Nabin Hait
2017-04-04 11:46:47 +05:30
5 changed files with 16 additions and 10 deletions

View File

@@ -2,7 +2,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe import frappe
__version__ = '8.0.6' __version__ = '8.0.7'
def get_default_company(user=None): def get_default_company(user=None):
'''Get default company for user''' '''Get default company for user'''

View File

@@ -404,11 +404,14 @@ class calculate_taxes_and_totals(object):
self.doc.total_advance = flt(total_allocated_amount, self.doc.precision("total_advance")) self.doc.total_advance = flt(total_allocated_amount, self.doc.precision("total_advance"))
if self.doc.party_account_currency == self.doc.currency: if self.doc.party_account_currency == self.doc.currency:
invoice_total = self.doc.grand_total invoice_total = flt(self.doc.grand_total - flt(self.doc.write_off_amount),
else:
invoice_total = flt(self.doc.grand_total * self.doc.conversion_rate,
self.doc.precision("grand_total")) 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: if invoice_total > 0 and self.doc.total_advance > invoice_total:
frappe.throw(_("Advance amount cannot be greater than {0} {1}") frappe.throw(_("Advance amount cannot be greater than {0} {1}")
.format(self.doc.party_account_currency, invoice_total)) .format(self.doc.party_account_currency, invoice_total))

View File

@@ -64,8 +64,11 @@ def complete_setup(domain='Manufacturing'):
}) })
company = erpnext.get_default_company() 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(): def setup_demo_page():
# home page should always be "start" # home page should always be "start"

View File

@@ -1,3 +1,3 @@
frappe.listview_settings['Customer'] = { frappe.listview_settings['Customer'] = {
add_fields: ["customer_name", "territory", "customer_group", "customer_type"], add_fields: ["customer_name", "territory", "customer_group", "customer_type", "image"],
}; };

View File

@@ -79,7 +79,7 @@ class Company(Document):
if not frappe.local.flags.ignore_chart_of_accounts: if not frappe.local.flags.ignore_chart_of_accounts:
self.set_default_accounts() self.set_default_accounts()
if self.default_cash_account: if self.default_cash_account:
self.mode_of_payment() self.set_mode_of_payment_account()
if self.default_currency: if self.default_currency:
frappe.db.set_value("Currency", self.default_currency, "enabled", 1) frappe.db.set_value("Currency", self.default_currency, "enabled", 1)
@@ -166,7 +166,7 @@ class Company(Document):
if account: if account:
self.db_set(fieldname, 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') 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}): 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) mode_of_payment = frappe.get_doc('Mode of Payment', cash)