Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[14.0][FIX] l10n_br_fiscal: Os valores do frete, seguro e 'outros' não estão sendo inseridos no valor total da fatura #3484

Open
wants to merge 1 commit into
base: 14.0
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 48 additions & 21 deletions l10n_br_fiscal/models/document_mixin_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,23 @@
for line in record._get_product_amount_lines():
line._onchange_fiscal_taxes()
record._fields["amount_total"].compute_value(record)
record.write(
{
name: value
for name, value in record._cache.items()
if record._fields[name].compute == "_amount_all"

# Case Sale, Purchase or POS
vals = {}
for name, value in record._cache.items():
if (
record._fields[name].compute == "_amount_all"
and not record._fields[name].inverse
}
)
):
vals[name] = value
if vals:
record.write(vals)
elif hasattr(record, "move_ids"):
# Case invoice (account.move has not compute named '_amount_all')
record = record.with_context(check_move_validity=False)
record.move_ids.invoice_line_ids._onchange_price_subtotal()
record.move_ids.invoice_line_ids._onchange_mark_recompute_taxes()
record.move_ids._onchange_invoice_line_ids()

Check warning on line 178 in l10n_br_fiscal/models/document_mixin_methods.py

View check run for this annotation

Codecov / codecov/patch

l10n_br_fiscal/models/document_mixin_methods.py#L175-L178

Added lines #L175 - L178 were not covered by tests

def _inverse_amount_insurance(self):
for record in self.filtered(lambda doc: doc._get_product_amount_lines()):
Expand Down Expand Up @@ -209,14 +218,23 @@
for line in record._get_product_amount_lines():
line._onchange_fiscal_taxes()
record._fields["amount_total"].compute_value(record)
record.write(
{
name: value
for name, value in record._cache.items()
if record._fields[name].compute == "_amount_all"

# Case Sale, Purchase or POS
vals = {}
for name, value in record._cache.items():
if (
record._fields[name].compute == "_amount_all"
and not record._fields[name].inverse
}
)
):
vals[name] = value
if vals:
record.write(vals)
elif hasattr(record, "move_ids"):
# Case invoice (account.move has not compute named '_amount_all')
record = record.with_context(check_move_validity=False)
record.move_ids.invoice_line_ids._onchange_price_subtotal()
record.move_ids.invoice_line_ids._onchange_mark_recompute_taxes()
record.move_ids._onchange_invoice_line_ids()

Check warning on line 237 in l10n_br_fiscal/models/document_mixin_methods.py

View check run for this annotation

Codecov / codecov/patch

l10n_br_fiscal/models/document_mixin_methods.py#L234-L237

Added lines #L234 - L237 were not covered by tests

def _inverse_amount_other(self):
for record in self.filtered(lambda doc: doc._get_product_amount_lines()):
Expand Down Expand Up @@ -259,11 +277,20 @@
for line in record._get_product_amount_lines():
line._onchange_fiscal_taxes()
record._fields["amount_total"].compute_value(record)
record.write(
{
name: value
for name, value in record._cache.items()
if record._fields[name].compute == "_amount_all"

# Case Sale, Purchase or POS
vals = {}
for name, value in record._cache.items():
if (
record._fields[name].compute == "_amount_all"
and not record._fields[name].inverse
}
)
):
vals[name] = value
if vals:
record.write(vals)
elif hasattr(record, "move_ids"):
# Case invoice (account.move has not compute named '_amount_all')
record = record.with_context(check_move_validity=False)
record.move_ids.invoice_line_ids._onchange_price_subtotal()
record.move_ids.invoice_line_ids._onchange_mark_recompute_taxes()
record.move_ids._onchange_invoice_line_ids()

Check warning on line 296 in l10n_br_fiscal/models/document_mixin_methods.py

View check run for this annotation

Codecov / codecov/patch

l10n_br_fiscal/models/document_mixin_methods.py#L293-L296

Added lines #L293 - L296 were not covered by tests
Loading