[FIX] base: paperformat_id is required on settings

Not setting a value for paperformat_id on 'Company Document Layout'
will also make paperformat_id False on the company but it is required
in the settings.

Without this commit, you can get in the weird situation of being able
to set a value on the document layout but having an error in the
general settings as a required field is missing.

Apply the same logic as in the other views

closes odoo/odoo#45527

X-original-commit: e518063e48936a3f8f9f921950cdae209e67ab47
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
This commit is contained in:
Swapnesh Shah
2020-02-17 15:07:15 +00:00
committed by Martin Trigaux
parent 0494e6763f
commit f69fa0af63
2 changed files with 6 additions and 1 deletions
@@ -118,6 +118,7 @@ class TestBaseDocumentLayout(TestBaseDocumentLayoutHelpers):
'secondary_color': False,
'logo': False,
'external_report_layout_id': self.env.ref('base.layout_template1').id,
'paperformat_id': self.env.ref('base.paperformat_us').id,
})
default_colors = self.default_colors
with Form(self.env['base.document.layout']) as doc_layout:
@@ -138,6 +139,7 @@ class TestBaseDocumentLayout(TestBaseDocumentLayoutHelpers):
'primary_color': '#ff0080',
'secondary_color': '#00ff00',
'logo': self.company_imgs['overwatch']['img'],
'paperformat_id': self.env.ref('base.paperformat_us').id,
})
with Form(self.env['base.document.layout']) as doc_layout:
@@ -151,6 +153,7 @@ class TestBaseDocumentLayout(TestBaseDocumentLayoutHelpers):
'primary_color': '#ff0080',
'secondary_color': '#00ff00',
'logo': False,
'paperformat_id': self.env.ref('base.paperformat_us').id,
})
with Form(self.env['base.document.layout']) as doc_layout:
@@ -166,6 +169,7 @@ class TestBaseDocumentLayout(TestBaseDocumentLayoutHelpers):
'primary_color': '#ff0080',
'secondary_color': '#00ff00',
'logo': self.company_imgs['overwatch']['img'],
'paperformat_id': self.env.ref('base.paperformat_us').id,
})
with Form(self.env['base.document.layout']) as doc_layout:
@@ -181,6 +185,7 @@ class TestBaseDocumentLayout(TestBaseDocumentLayoutHelpers):
'primary_color': '#ff0080',
'secondary_color': '#00ff00',
'logo': self.company_imgs['overwatch']['img'],
'paperformat_id': self.env.ref('base.paperformat_us').id,
})
with Form(self.env['base.document.layout']) as doc_layout:
@@ -26,7 +26,7 @@
<field name="font" widget="font" class="mb-4" />
<field name="report_header" widget="char" placeholder="e.g. Global Business Solutions" />
<field name="report_footer" string="Footer" placeholder="e.g. Opening hours, bank accounts (one per line)" />
<field name="paperformat_id" />
<field name="paperformat_id" required="1" />
</group>
<div class="o_document_layout_preview">
<field name="preview_logo" widget="image" readonly="1" nolabel="1" class="o_document_layout_preview_logo" />