From c61a22bc5e5ac979c5b9498ec24cef110d43c938 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Tue, 30 Apr 2019 11:35:06 +0200 Subject: [PATCH] account_move_template: Fix handling of ref field of account.move Fix required or readonly status of some fields Fix menu entry name in README --- account_move_template/models/account_move_template.py | 2 +- account_move_template/readme/USAGE.rst | 2 +- account_move_template/wizard/account_move_template_run.py | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/account_move_template/models/account_move_template.py b/account_move_template/models/account_move_template.py index 6faaee54..2c39871f 100644 --- a/account_move_template/models/account_move_template.py +++ b/account_move_template/models/account_move_template.py @@ -89,7 +89,7 @@ class AccountMoveTemplateLine(models.Model): template_id = fields.Many2one( 'account.move.template', string='Move Template', ondelete='cascade') - name = fields.Char(string='Label') + name = fields.Char(string='Label', required=True) sequence = fields.Integer('Sequence', required=True) account_id = fields.Many2one( 'account.account', string='Account', diff --git a/account_move_template/readme/USAGE.rst b/account_move_template/readme/USAGE.rst index 8e4c574d..aba820b7 100644 --- a/account_move_template/readme/USAGE.rst +++ b/account_move_template/readme/USAGE.rst @@ -8,6 +8,6 @@ To create new templates: To use an existing template: -#. Go to *Invoicing / Accounting / Accounting Entries / Create Journal Entry from Template* +#. Go to *Invoicing / Accounting / Accounting Entries / Create Entry from Template* #. Select one of the available templates. #. Complete the entries according to the template and click on the button *Generate Journal Entry*. diff --git a/account_move_template/wizard/account_move_template_run.py b/account_move_template/wizard/account_move_template_run.py index c8ee0d99..6d2e0a7c 100644 --- a/account_move_template/wizard/account_move_template_run.py +++ b/account_move_template/wizard/account_move_template_run.py @@ -63,6 +63,7 @@ class AccountMoveTemplateRun(models.TransientModel): amtlro.create(vals) self.write({ 'journal_id': self.template_id.journal_id.id, + 'ref': self.template_id.ref, 'state': 'set_lines', }) if not self.line_ids: @@ -152,7 +153,7 @@ class AccountMoveTemplateLineRun(models.TransientModel): company_currency_id = fields.Many2one( related='wizard_id.company_id.currency_id', string='Company Currency') sequence = fields.Integer('Sequence', required=True) - name = fields.Char('Name') + name = fields.Char('Name', readonly=True) account_id = fields.Many2one( 'account.account', required=True, readonly=True) analytic_account_id = fields.Many2one( @@ -166,7 +167,7 @@ class AccountMoveTemplateLineRun(models.TransientModel): partner_id = fields.Many2one( 'res.partner', readonly=True, string='Partner') payment_term_id = fields.Many2one( - 'account.payment.term', string='Payment Terms') + 'account.payment.term', string='Payment Terms', readonly=True) move_line_type = fields.Selection( [('cr', 'Credit'), ('dr', 'Debit')], required=True, readonly=True, string='Direction')