Skip to content

Commit

Permalink
Merge PR #3340 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by rvalyi
  • Loading branch information
OCA-git-bot committed Sep 6, 2024
2 parents 3e97121 + e397a8f commit 6715e9d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 16 deletions.
28 changes: 12 additions & 16 deletions l10n_br_account/models/account_move_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@ def create(self, vals_list):
values.get("uot_id"),
)
)
values["uom_id"] = values.get("product_uom_id")
values["document_id"] = fiscal_doc_id # pass through the _inherits system

self._inject_shadowed_fields(vals_list)
Expand Down Expand Up @@ -300,34 +299,31 @@ def changed(fname):
not changed("amount_currency") or line not in before
):
if not line.move_id.fiscal_operation_id:
amount_currency = (
line.move_id.direction_sign
* line.currency_id.round(line.price_subtotal)
unsigned_amount_currency = line.currency_id.round(
line.price_subtotal
)
else: # BRAZIL CASE:
if line.cfop_id and not line.cfop_id.finance_move:
amount_currency = 0
unsigned_amount_currency = 0
else:
if line.move_id.fiscal_operation_id.deductible_taxes:
amount_currency = (
unsigned_amount_currency = (
line.amount_total + line.amount_tax_withholding
)
else:
amount_total = (
line.amount_total + line.amount_tax_withholding
)
amount_currency = (
line.move_id.direction_sign
* line.currency_id.round(
amount_total
- (
line.amount_tax_included
- line.amount_tax_withholding
)
- line.amount_tax_not_included
- line.icms_relief_value
unsigned_amount_currency = line.currency_id.round(
amount_total
- (
line.amount_tax_included
- line.amount_tax_withholding
)
- line.amount_tax_not_included
- line.icms_relief_value
)
amount_currency = unsigned_amount_currency * line.move_id.direction_sign
if line.amount_currency != amount_currency or line not in before:
line.amount_currency = amount_currency
if line.currency_id == line.company_id.currency_id:
Expand Down
7 changes: 7 additions & 0 deletions l10n_br_account/models/fiscal_document_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ class FiscalDocumentLine(models.Model):
string="Invoice Lines",
)

uom_id = fields.Many2one(
comodel_name="uom.uom",
related="account_line_ids.product_uom_id",
store=True,
string="UOM",
)

# proxy fields to enable writing the related (shadowed) fields
# to the fiscal doc line from the aml through the _inherits system
# despite they have the same names.
Expand Down

0 comments on commit 6715e9d

Please sign in to comment.