diff --git a/account_invoice_update_wizard/models/account_move.py b/account_invoice_update_wizard/models/account_move.py index 47b5d8c..7811599 100644 --- a/account_invoice_update_wizard/models/account_move.py +++ b/account_invoice_update_wizard/models/account_move.py @@ -11,9 +11,8 @@ class AccountMove(models.Model): self.ensure_one() wizard = self.env['account.move.update'] res = wizard._prepare_default_get(self) - action = self.env.ref( - 'account_invoice_update_wizard.account_invoice_update_action' - ).read()[0] + action = self.env["ir.actions.actions"]._for_xml_id( + 'account_invoice_update_wizard.account_invoice_update_action') action['name'] = "Update Wizard" action['res_id'] = wizard.create(res).id return action diff --git a/account_invoice_update_wizard/wizard/account_move_update.py b/account_invoice_update_wizard/wizard/account_move_update.py index cae7176..c454f07 100644 --- a/account_invoice_update_wizard/wizard/account_move_update.py +++ b/account_invoice_update_wizard/wizard/account_move_update.py @@ -14,16 +14,13 @@ class AccountMoveUpdate(models.TransientModel): invoice_id = fields.Many2one( 'account.move', string='Invoice', required=True, readonly=True) - type = fields.Selection(related='invoice_id.move_type', readonly=True) - company_id = fields.Many2one( - related='invoice_id.company_id', readonly=True) - partner_id = fields.Many2one( - related='invoice_id.partner_id', readonly=True) + move_type = fields.Selection(related='invoice_id.move_type') + company_id = fields.Many2one(related='invoice_id.company_id') + partner_id = fields.Many2one(related='invoice_id.partner_id') user_id = fields.Many2one('res.users', string='Salesperson') invoice_payment_term_id = fields.Many2one( 'account.payment.term', string='Payment Term') - ref = fields.Char(string='Invoice Reference') - name = fields.Char(string='Reference/Description') + ref = fields.Char(string='Reference') # field label is customized in the view invoice_origin = fields.Char(string='Source Document') partner_bank_id = fields.Many2one( 'res.partner.bank', string='Bank Account') @@ -33,7 +30,7 @@ class AccountMoveUpdate(models.TransientModel): @api.model def _simple_fields2update(self): '''List boolean, date, datetime, char, text fields''' - return ['ref', 'name', 'invoice_origin'] + return ['ref', 'invoice_origin'] @api.model def _m2o_fields2update(self): @@ -55,15 +52,16 @@ class AccountMoveUpdate(models.TransientModel): 'quantity': line.quantity, 'price_subtotal': line.price_subtotal, 'analytic_account_id': line.analytic_account_id.id, + 'currency_id': line.currency_id.id, 'analytic_tag_ids': aa_tags, 'display_type': line.display_type, }]) return res - @api.onchange('type') - def type_on_change(self): + @api.onchange('move_type') + def move_type_on_change(self): res = {'domain': {}} - if self.type in ('out_invoice', 'out_refund'): + if self.move_type in ('out_invoice', 'out_refund'): res['domain']['partner_bank_id'] =\ "[('partner_id.ref_company_ids', 'in', [company_id])]" else: @@ -243,11 +241,11 @@ class AccountMoveLineUpdate(models.TransientModel): ('line_section', "Section"), ('line_note', "Note")], default=False, help="Technical field for UX purpose.") quantity = fields.Float( - string='Quantity', digits=dp.get_precision('Product Unit of Measure'), - readonly=True) - price_subtotal = fields.Float( - string='Amount', readonly=True, digits=dp.get_precision('Account')) + string='Quantity', digits='Product Unit of Measure', readonly=True) + price_subtotal = fields.Monetary( + string='Amount', readonly=True) analytic_account_id = fields.Many2one( 'account.analytic.account', string='Analytic Account') analytic_tag_ids = fields.Many2many( 'account.analytic.tag', string='Analytic Tags') + currency_id = fields.Many2one('res.currency', readonly=True) diff --git a/account_invoice_update_wizard/wizard/account_move_update_view.xml b/account_invoice_update_wizard/wizard/account_move_update_view.xml index 31ca6e9..c817089 100644 --- a/account_invoice_update_wizard/wizard/account_move_update_view.xml +++ b/account_invoice_update_wizard/wizard/account_move_update_view.xml @@ -12,26 +12,27 @@