Skip to content

Commit

Permalink
[IMP] l10n_do_accounting: don't allow to cancel fiscal document if no…
Browse files Browse the repository at this point in the history
…t posted before (#1081)
  • Loading branch information
jose-pcg authored Aug 14, 2023
1 parent eb74520 commit 51d6247
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion l10n_do_accounting/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"category": "Localization",
"license": "LGPL-3",
"website": "https://github.com/odoo-dominicana",
"version": "15.0.0.11.0",
"version": "15.0.0.11.1",
# any module necessary for this one to work correctly
"depends": ["l10n_latam_invoice_document", "l10n_do"],
# always loaded
Expand Down
6 changes: 6 additions & 0 deletions l10n_do_accounting/i18n/es_DO.po
Original file line number Diff line number Diff line change
Expand Up @@ -1247,3 +1247,9 @@ msgstr ""
#, python-format
msgid "special from Tax Paying"
msgstr "Exento"

#. module: l10n_do_accounting
#: code:addons/l10n_do_accounting/models/account_move.py:0
#, python-format
msgid "You cannot cancel a fiscal document that has not been posted before."
msgstr "No puede cancelar un documento fiscal que no haya sido posteado anteriormente."
3 changes: 3 additions & 0 deletions l10n_do_accounting/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,9 @@ def button_cancel(self):
):
raise AccessError(_("You are not allowed to cancel Fiscal Invoices"))

if fiscal_invoice and not fiscal_invoice.posted_before:
raise ValidationError(_("You cannot cancel a fiscal document that has not been posted before."))

if fiscal_invoice and not self.env.context.get("skip_cancel_wizard", False):
action = self.env.ref(
"l10n_do_accounting.action_account_move_cancel"
Expand Down
10 changes: 0 additions & 10 deletions l10n_do_accounting/views/account_move_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,6 @@
Notice. This company is in a transient state of contingency for Electronic Invoice issuing. NCF issuing has been enabled.
</div>
</xpath>
<xpath expr="//button[@name='button_cancel']" position="attributes">
<attribute name="attrs">{
'invisible': ['|', '|',
('id', '=', False),
'&amp;', ('state', '!=', 'draft'),
('country_code', '!=', 'DO'),
'&amp;', ('state', 'in', ('draft', 'cancel')),
('country_code', '=', 'DO')]
}</attribute>
</xpath>
<xpath expr="//button[@name='button_draft']" position="attributes">
<attribute name="attrs">{
'invisible': ['|', '|',
Expand Down

0 comments on commit 51d6247

Please sign in to comment.