Skip to content

Commit

Permalink
* l10n_it_fatturapa_in_rc, fix set rc flag
Browse files Browse the repository at this point in the history
  • Loading branch information
GSLabIt committed Sep 8, 2022
1 parent 9f4f691 commit 09da4f6
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
14 changes: 10 additions & 4 deletions l10n_it_fatturapa_in_rc/models/account_invoice.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
from odoo import _, models
from odoo import _, api, models
from odoo.tools import float_compare


class InvoiceLine(models.Model):
_inherit = "account.move.line"

def _set_rc_flag(self, invoice):
self.ensure_one()
@api.depends(
"move_id",
"move_id.move_type",
"move_id.fiscal_position_id",
"move_id.fiscal_position_id.rc_type_id",
"tax_ids",
)
def _compute_rc_flag(self):
if "fatturapa.attachment.in" in self.env.context.get("active_model", []):
# this means we are importing an e-invoice,
# so RC flag is already set, where needed
return
return super(InvoiceLine, self)._set_rc_flag(invoice)
super()._compute_rc_flag()


class Invoice(models.Model):
Expand Down
4 changes: 4 additions & 0 deletions l10n_it_fatturapa_in_rc/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
* Sergio Corato <info@efatto.it>
* Lorenzo Battistini <https://github.com/eLBati>
* Marco Colombo <https://github.com/TheMule71>

* `Ooops <https://www.ooops404.com>`_:

* Giovanni Serra <giovanni@gslab.it>
8 changes: 7 additions & 1 deletion l10n_it_reverse_charge/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@
class AccountMoveLine(models.Model):
_inherit = "account.move.line"

@api.depends("move_id", "move_id.fiscal_position_id", "tax_ids")
@api.depends(
"move_id",
"move_id.move_type",
"move_id.fiscal_position_id",
"move_id.fiscal_position_id.rc_type_id",
"tax_ids",
)
def _compute_rc_flag(self):
for line in self.filtered(lambda r: not r.exclude_from_invoice_tab):
if line.move_id.is_purchase_document():
Expand Down

0 comments on commit 09da4f6

Please sign in to comment.