Skip to content

Commit 5d5bdd9

Browse files
[FIX] l10n_uy_ux: update fields button on vendor bills
closes #316 Task: 43467. X-original-commit: 26fc77f Signed-off-by: Katherine Zaoral <kz@adhoc.com.ar> Signed-off-by: pablohmontenegro <pam@adhoc.com.ar>
1 parent 801f43b commit 5d5bdd9

3 files changed

Lines changed: 7 additions & 5 deletions

File tree

l10n_uy_ux/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"category": "Localization",
99
"countries": ["uy"],
1010
"license": "LGPL-3",
11-
"version": "18.0.1.5.0",
11+
"version": "18.0.1.6.0",
1212
"depends": [
1313
"l10n_uy_edi",
1414
"certificate",

l10n_uy_ux/models/account_move.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import logging
33

44
from lxml import etree
5-
from odoo import api, fields, models
5+
from odoo import _, api, fields, models
66
from odoo.exceptions import UserError, ValidationError
77
from odoo.tools import safe_eval
88

@@ -360,8 +360,10 @@ def _is_manual_document_number(self):
360360
def action_l10n_uy_update_fields(self):
361361
"""Sync with Uruware and complete vendor bill information."""
362362
self.ensure_one()
363-
self.clear_l10n_uy_invoice_fields()
364-
# también puede ser base64.b64decode(self.l10n_uy_edi_document_id.attachment_file)
363+
if self.l10n_uy_edi_xml_attachment_id:
364+
self.clear_l10n_uy_invoice_fields()
365+
else:
366+
raise UserError(_("It is not possible to update the move because there is no xml file."))
365367
xml = base64.b64decode(self.l10n_uy_edi_xml_attachment_id.datas)
366368
self._l10n_uy_edi_complete_cfe_from_xml(self, etree.fromstring(xml))
367369

l10n_uy_ux/views/account_move_views.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<field name="arch" type="xml">
99

1010
<header position="inside">
11-
<button name="action_l10n_uy_update_fields" type="object" string="(UY)Update Invoice With XML data" invisible="invoice_filter_type_domain != 'purchase' and l10n_uy_edi_journal_type != 'electronic' and not l10n_uy_edi_cfe_uuid" help="Read the XML and fill the fields of the invoice/bill with the xml values" confirm="Are you sure? this action will update the invoice information."/>
11+
<button name="action_l10n_uy_update_fields" type="object" string="(UY)Update Invoice With XML data" invisible="invoice_filter_type_domain != 'purchase' or not l10n_uy_edi_document_id" help="Read the XML and fill the fields of the invoice/bill with the xml values" confirm="Are you sure? this action will update the invoice information."/>
1212
</header>
1313

1414
<field name="l10n_uy_edi_addenda_ids" position="attributes">

0 commit comments

Comments
 (0)