| 1 |
# Part of Odoo. See LICENSE file for full copyright and licensing details. |
| 2 |
from odoo import fields, models |
| 3 |
|
| 4 |
from odoo.addons.l10n_in.models.account_invoice import EDI_CANCEL_REASON |
| 5 |
|
| 6 |
|
| 7 |
class L10n_In_EdiCancel(models.TransientModel): |
| 8 |
_name = 'l10n_in_edi.cancel' |
| 9 |
|
| 10 |
_description = "Cancel E-Invoice" |
| 11 |
|
| 12 |
move_id = fields.Many2one('account.move', string="Invoice", required=True) |
| 13 |
cancel_reason = fields.Selection( |
| 14 |
selection=list(EDI_CANCEL_REASON.items()), |
| 15 |
string="Cancel Reason", |
| 16 |
required=True |
| 17 |
) |
| 18 |
cancel_remarks = fields.Char("Cancel Remarks", required=True) |
| 19 |
|
| 20 |
def cancel_l10n_in_edi_move(self): |
| 21 |
self.move_id.write({ |
| 22 |
'l10n_in_edi_cancel_reason': self.cancel_reason, |
| 23 |
'l10n_in_edi_cancel_remarks': self.cancel_remarks, |
| 24 |
}) |
| 25 |
self.move_id._l10n_in_edi_cancel_invoice() |