Debian Codegraph @

addons/l10n_my_edi/wizard/myinvois_document_status_update_wizard.py

raw
1 # Part of Odoo. See LICENSE file for full copyright and licensing details.
2 from odoo import fields, models
3 from odoo.exceptions import UserError
4
5
6 class MyInvoisStatusUpdateWizard(models.TransientModel):
7 _name = 'myinvois.document.status.update.wizard'
8 _description = 'Document Status Update Wizard'
9
10 document_id = fields.Many2one(
11 comodel_name='myinvois.document',
12 string='Document To Update',
13 required=True,
14 readonly=True,
15 )
16 reason = fields.Char(
17 help='Reason for updating the document.',
18 required=True,
19 )
20 new_status = fields.Char(
21 help='New status to set on the document.',
22 required=True,
23 readonly=True,
24 )
25
26 def button_request_update(self):
27 self.ensure_one()
28 if not self.reason.strip():
29 raise UserError(self.env._('You must provide a reason for updating the document.'))
30
31 self.document_id._myinvois_update_document(status=self.new_status, reason=self.reason)