add journal to template
This commit is contained in:
parent
39070f31b0
commit
7f35b8a9ee
@ -22,6 +22,7 @@ class AccountMoveTemplate(models.Model):
|
||||
change_default=True,
|
||||
default=_company_get,
|
||||
)
|
||||
journal_id = fields.Many2one('account.journal', required=True)
|
||||
template_line_ids = fields.One2many(
|
||||
'account.move.template.line',
|
||||
inverse_name='template_id',
|
||||
@ -48,7 +49,9 @@ class AccountMoveTemplateLine(models.Model):
|
||||
company_id = fields.Many2one('res.company',
|
||||
related='template_id.company_id',
|
||||
readonly=True)
|
||||
journal_id = fields.Many2one('account.journal', required=True)
|
||||
journal_id = fields.Many2one('account.journal',
|
||||
related='template_id.journal_id',
|
||||
store=True, readonly=True)
|
||||
account_id = fields.Many2one(
|
||||
'account.account',
|
||||
required=True,
|
||||
|
@ -134,11 +134,11 @@ class TestAccountMoveTemplate(TransactionCase):
|
||||
template = self.env['account.move.template'].sudo(self.user).create({
|
||||
'name': 'Test Move Template',
|
||||
'company_id': self.company.id,
|
||||
'journal_id': self.account_journal_1.id,
|
||||
'template_line_ids': [
|
||||
(0, 0, {
|
||||
'name': 'L1',
|
||||
'sequence': 1,
|
||||
'journal_id': self.account_journal_1.id,
|
||||
'account_id': self.account_company_1.id,
|
||||
'partner_id': self.partner.id,
|
||||
'tax_line_id': self.tax.id,
|
||||
@ -148,7 +148,6 @@ class TestAccountMoveTemplate(TransactionCase):
|
||||
(0, 0, {
|
||||
'name': 'L2',
|
||||
'sequence': 2,
|
||||
'journal_id': self.account_journal_1.id,
|
||||
'account_id': self.account_company_1.id,
|
||||
'move_line_type': 'cr',
|
||||
'tax_ids': [(4, self.tax.id)],
|
||||
|
@ -80,6 +80,7 @@
|
||||
</div>
|
||||
<group>
|
||||
<field name="company_id" widget='selection' groups="base.group_multi_company"/>
|
||||
<field name="journal_id" widget='selection'/>
|
||||
</group>
|
||||
<field nolabel="1" name="template_line_ids" context="{'default_company_id' : company_id}"/>
|
||||
</sheet>
|
||||
|
Loading…
Reference in New Issue
Block a user