Skip to content

Commit

Permalink
Merge pull request #38782 from frappe/mergify/bp/version-14-hotfix/pr…
Browse files Browse the repository at this point in the history
…-38691

fix: Init internal child table values (#38691)
  • Loading branch information
deepeshgarg007 authored Dec 15, 2023
2 parents e05b23c + d593f81 commit 34549b6
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions erpnext/controllers/accounts_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ def validate(self):
self.disable_pricing_rule_on_internal_transfer()
self.disable_tax_included_prices_for_internal_transfer()
self.set_incoming_rate()
self.init_internal_values()

if self.meta.get_field("currency"):
self.calculate_taxes_and_totals()
Expand Down Expand Up @@ -224,6 +225,16 @@ def validate(self):

self.set_total_in_words()

def init_internal_values(self):
# init all the internal values as 0 on sa
if self.docstatus.is_draft():
# TODO: Add all such pending values here
fields = ["billed_amt", "delivered_qty"]
for item in self.get("items"):
for field in fields:
if hasattr(item, field):
item.set(field, 0)

def before_cancel(self):
validate_einvoice_fields(self)

Expand Down

0 comments on commit 34549b6

Please sign in to comment.