fix: Patch fixes

This commit is contained in:
Deepesh Garg 2022-02-13 19:24:10 +05:30
parent 86ef932979
commit 615dd9decd
2 changed files with 5 additions and 9 deletions

View File

@ -6,8 +6,8 @@ from erpnext.setup.utils import get_exchange_rate
def execute():
frappe.reload_doc('crm', 'doctype', 'opportunity')
frappe.reload_doc('crm', 'doctype', 'opportunity_item')
frappe.reload_doc('crm', 'doctype', 'opportunity', force=True)
frappe.reload_doc('crm', 'doctype', 'opportunity_item', force=True)
opportunities = frappe.db.get_list('Opportunity', filters={
'opportunity_amount': ['>', 0]
@ -20,15 +20,11 @@ def execute():
if opportunity.currency != company_currency:
conversion_rate = get_exchange_rate(opportunity.currency, company_currency)
base_opportunity_amount = flt(conversion_rate) * flt(opportunity.opportunity_amount)
grand_total = flt(opportunity.opportunity_amount)
base_grand_total = flt(conversion_rate) * flt(opportunity.opportunity_amount)
else:
conversion_rate = 1
base_opportunity_amount = grand_total = base_grand_total = flt(opportunity.opportunity_amount)
base_opportunity_amount = flt(opportunity.opportunity_amount)
frappe.db.set_value('Opportunity', opportunity.name, {
'conversion_rate': conversion_rate,
'base_opportunity_amount': base_opportunity_amount,
'grand_total': grand_total,
'base_grand_total': base_grand_total
'base_opportunity_amount': base_opportunity_amount
}, update_modified=False)

View File

@ -102,7 +102,7 @@ def make_custom_fields():
]
}
create_custom_fields(custom_fields, update=True)
create_custom_fields(custom_fields, ignore_validate=True, update=True)
def update_regional_tax_settings(country, company):
create_ksa_vat_setting(company)