2
0

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
This commit is contained in:
Alexis de Lattre 2019-04-30 11:35:06 +02:00 committed by Abraham Anes
parent 1d5b817a1e
commit c61a22bc5e
3 changed files with 5 additions and 4 deletions

View File

@ -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',

View File

@ -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*.

View File

@ -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')