Skip to content

Commit

Permalink
fix: Init internal child table values
Browse files Browse the repository at this point in the history
(cherry picked from commit 2588970)
  • Loading branch information
deepeshgarg007 authored and mergify[bot] committed Dec 15, 2023
1 parent 7fc8150 commit 7802f6c
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 @@ -166,6 +166,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 @@ -225,6 +226,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 7802f6c

Please sign in to comment.