Skip to content

Commit

Permalink
intrastat declaration - restore _compute_numbers that was dropped by PR
Browse files Browse the repository at this point in the history
#149 (removal of intrastat.common
  • Loading branch information
luc-demeyer authored and sergio-teruel committed Nov 7, 2023
1 parent cb9fbe9 commit d92bed7
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions intrastat_product/models/intrastat_product_declaration.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,17 @@ def _compute_check_validity(self):
for this in self:
this.valid = True

@api.depends("declaration_line_ids.amount_company_currency")
def _compute_numbers(self):
for this in self:
total_amount = 0 # it is an integer
num_lines = 0
for line in this.declaration_line_ids:
total_amount += line.amount_company_currency
num_lines += 1
this.num_decl_lines = num_lines
this.total_amount = total_amount

@api.constrains("year")
def _check_year(self):
for this in self:
Expand Down

0 comments on commit d92bed7

Please sign in to comment.