mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-02 19:59:12 +00:00
fix: incorrect Gross Margin on project (#44461)
This commit is contained in:
@@ -1713,6 +1713,9 @@ class SalesInvoice(SellingController):
|
|||||||
|
|
||||||
def update_project(self):
|
def update_project(self):
|
||||||
unique_projects = list(set([d.project for d in self.get("items") if d.project]))
|
unique_projects = list(set([d.project for d in self.get("items") if d.project]))
|
||||||
|
if self.project and self.project not in unique_projects:
|
||||||
|
unique_projects.append(self.project)
|
||||||
|
|
||||||
for p in unique_projects:
|
for p in unique_projects:
|
||||||
project = frappe.get_doc("Project", p)
|
project = frappe.get_doc("Project", p)
|
||||||
project.update_billed_amount()
|
project.update_billed_amount()
|
||||||
|
|||||||
@@ -4276,6 +4276,20 @@ class TestSalesInvoice(IntegrationTestCase):
|
|||||||
|
|
||||||
self.assertTrue(all([x == "Credit Note" for x in gl_entries]))
|
self.assertTrue(all([x == "Credit Note" for x in gl_entries]))
|
||||||
|
|
||||||
|
def test_total_billed_amount(self):
|
||||||
|
si = create_sales_invoice(do_not_submit=True)
|
||||||
|
|
||||||
|
project = frappe.new_doc("Project")
|
||||||
|
project.project_name = "Test Total Billed Amount"
|
||||||
|
project.save()
|
||||||
|
|
||||||
|
si.project = project.name
|
||||||
|
si.save()
|
||||||
|
si.submit()
|
||||||
|
|
||||||
|
doc = frappe.get_doc("Project", project.name)
|
||||||
|
self.assertEqual(doc.total_billed_amount, si.grand_total)
|
||||||
|
|
||||||
|
|
||||||
def set_advance_flag(company, flag, default_account):
|
def set_advance_flag(company, flag, default_account):
|
||||||
frappe.db.set_value(
|
frappe.db.set_value(
|
||||||
|
|||||||
Reference in New Issue
Block a user