Remove enqueuing update_total_sales method, sometimes it does not include current invoice (#12522)
This commit is contained in:
parent
230805b016
commit
91fd29a963
@ -142,7 +142,7 @@ class SalesInvoice(SellingController):
|
||||
|
||||
self.update_time_sheet(self.name)
|
||||
|
||||
self.update_current_month_sales()
|
||||
update_company_current_month_sales(self.company)
|
||||
self.update_project()
|
||||
|
||||
def validate_pos_paid_amount(self):
|
||||
@ -181,15 +181,8 @@ class SalesInvoice(SellingController):
|
||||
self.make_gl_entries_on_cancel()
|
||||
frappe.db.set(self, 'status', 'Cancelled')
|
||||
|
||||
self.update_current_month_sales()
|
||||
self.update_project()
|
||||
|
||||
def update_current_month_sales(self):
|
||||
if frappe.flags.in_test:
|
||||
update_company_current_month_sales(self.company)
|
||||
else:
|
||||
frappe.enqueue('erpnext.setup.doctype.company.company.update_company_current_month_sales',
|
||||
company=self.company)
|
||||
self.update_project()
|
||||
|
||||
def update_status_updater_args(self):
|
||||
if cint(self.update_stock):
|
||||
|
@ -358,7 +358,6 @@ def update_company_current_month_sales(company):
|
||||
monthly_total = results[0]['total'] if len(results) > 0 else 0
|
||||
|
||||
frappe.db.set_value("Company", company, "total_monthly_sales", monthly_total)
|
||||
frappe.db.commit()
|
||||
|
||||
def update_company_monthly_sales(company):
|
||||
'''Cache past year monthly sales of every company based on sales invoices'''
|
||||
@ -369,7 +368,6 @@ def update_company_monthly_sales(company):
|
||||
"posting_date", filter_str, "sum")
|
||||
|
||||
frappe.db.set_value("Company", company, "sales_monthly_history", json.dumps(month_to_value_dict))
|
||||
frappe.db.commit()
|
||||
|
||||
def cache_companies_monthly_sales_history():
|
||||
companies = [d['name'] for d in frappe.get_list("Company")]
|
||||
|
Loading…
x
Reference in New Issue
Block a user