Skip to content

Commit

Permalink
fix la eroare acces sa nu mai dubleze xml-urile
Browse files Browse the repository at this point in the history
  • Loading branch information
dhongu committed Sep 30, 2024
1 parent ed949e5 commit ba6397f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions l10n_ro_account_edi_ubl/models/account_edi_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ def _export_cius_ro(self, invoice):
if old_attachment:
edi_document.sudo().attachment_id = False
old_attachment.unlink()
domain = [
("res_model", "=", "account.move"),
("res_id", "=", invoice.id),
("name", "=", xml_name),
]
old_attachment = self.env["ir.attachment"].sudo().search(domain)
if old_attachment:
old_attachment.unlink()
res = self.env["ir.attachment"].create(
{
"name": xml_name,
Expand Down

0 comments on commit ba6397f

Please sign in to comment.