feat(cancelación de cfdi's de complementos de pago): agregar boton

parent 3a15406e
Pipeline #22812 failed with stage
in 54 seconds
......@@ -145,7 +145,9 @@ class AccountPayment(models.Model):
def replace_cfdi(self):
"""Cancel voucher cfdi by replacing with 1 MXN voucher"""
for record in self:
self._cancel_cfdi()
record.cancel_cfdi()
record.action_draft()
record.action_cancel()
def currency_rate(self):
"""Compute currency rate used for current voucher to display on XML
......
......@@ -24,6 +24,11 @@
<field name="model">account.payment</field>
<field name="inherit_id" ref="account.view_account_payment_form"/>
<field name="arch" type="xml">
<button name="action_draft" position="attributes">
<attribute name="attrs">
{'invisible': ['&amp;',('state', 'in', ('posted', 'cancel')),('cfdi_state', 'in', ('done', 'cancel'))]}
</attribute>
</button>
<button name="action_post" position="after">
<button name="sign_payment" type="object" string="Sign"
class="oe_highlight"
......@@ -33,8 +38,9 @@
('cfdi_state', '!=', False)
]}" />
<!--<button name="substitute_payment" type="object" string="Replace"
attrs="{'invisible': ['|', ('cfdi_state', 'not in', ['signed', 'done']), ('state', '=', 'cancel')]}"/>
<button name="replace_cfdi" type="object" string="Cancel"
attrs="{'invisible': ['|', ('cfdi_state', 'not in', ['signed',
'done']), ('state', '=', 'cancel')]}"/>-->
<button name="replace_cfdi" type="object" class="btn-primary" string="Cancel"
confirm="Are you sure to cancel this payment?"
attrs="{'invisible': ['|', ('cfdi_state', 'not in', ['signed',
'done']), ('state', '=', 'cancel')]}"/>-->
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment