Skip to content

Commit

Permalink
[IMP]l10n_it_fatturapa_in: copy changing values only
Browse files Browse the repository at this point in the history
  • Loading branch information
PicchiSeba committed Jun 28, 2024
1 parent 6ef096e commit 3b311cd
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion l10n_it_fatturapa_in/wizard/wizard_import_fatturapa.py
Original file line number Diff line number Diff line change
Expand Up @@ -1183,6 +1183,21 @@ def _prepare_invoice_values(self, fatt, fatturapa_attachment, FatturaBody, partn
self.set_e_invoice_lines(FatturaBody, invoice_data)
return invoice_data

def _new_write_vals(self, invoice):
"""
Update changing values only
"""
to_return = invoice._convert_to_write(invoice._cache)
to_remove = set()
for k, val in to_return.items():
if (
k.endswith("_ids") and val[0][0] == 6 and val[0][2] == invoice[k].ids
) or invoice[k] == val:
to_remove.add(k)
for k in to_remove:
del to_return[k]
return to_return

def invoiceCreate(self, fatt, fatturapa_attachment, FatturaBody, partner_id):
partner_model = self.env["res.partner"]
partner = partner_model.browse(partner_id)
Expand Down Expand Up @@ -1227,7 +1242,8 @@ def invoiceCreate(self, fatt, fatturapa_attachment, FatturaBody, partner_id):

invoice._onchange_invoice_line_wt_ids()
invoice._recompute_dynamic_lines()
invoice.write(invoice._convert_to_write(invoice._cache))
write_vals = self._new_write_vals(invoice)
invoice.write(write_vals)

rel_docs_dict = {
# 2.1.2
Expand Down

0 comments on commit 3b311cd

Please sign in to comment.