Files
enterprise-addons/l10n_pe_edi/wizards/account_cancel_wizard.py
T

21 lines
722 B
Python

# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import fields, models
class L10n_Pe_EdiCancel(models.TransientModel):
_name = 'l10n_pe_edi.cancel'
_description = "Wizard to allow the cancellation of Peruvian documents"
l10n_pe_edi_cancel_reason = fields.Char(
string="Cancel Reason",
required=True,
help="Reason to cancel this invoice.")
def button_cancel(self):
self.ensure_one()
moves = self.env['account.move'].browse(self.env.context.get('active_ids'))
moves.l10n_pe_edi_cancel_reason = self.l10n_pe_edi_cancel_reason.strip()
moves.button_cancel_posted_moves()
return True