diff --git a/models/res_company.py b/models/res_company.py index e0c6555d081719e470553086b108bc176df42b7d..6bb0f9d0d886e18fe8933515d8dfb621aeb34fe3 100644 --- a/models/res_company.py +++ b/models/res_company.py @@ -10,3 +10,8 @@ class ResCompanyInvoice(models.Model): cgv = fields.Html('CGV') oec = fields.Char('OEC') forme_juridique = fields.Char('Forme Juridique') + has_facility = fields.Boolean('Etablissement secondaire ?', default=False) + facility_street = fields.Char('Rue') + facility_street2 = fields.Char('Rue 2') + facility_zip = fields.Char('Code Postal') + facility_city = fields.Char('Ville') diff --git a/views/report_templates.xml b/views/report_templates.xml index ddee16876dd9ad99885a8709bce42dc718fa853d..b758f5707131d9a43dcc6b6ceb7ca57f8f46d540 100644 --- a/views/report_templates.xml +++ b/views/report_templates.xml @@ -11,10 +11,20 @@ </div> <div class="col-6 text-right mb4"> <h4 class="mt0" t-field="company.report_header"/> - <div name="company_address" class="mb4"> - <span class="company_address" t-field="company.partner_id" - t-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": true}'/> - </div> + <t t-if="company.has_facility"> + <div name="facility_address" class="mb4"> + <span t-field="company.partner_id.name"/><br/> + <span t-field="company.facility_street"/><br/> + <t t-if="company.facility_street2"><span t-field="company.facility_street2"/><br/></t> + <span t-field="company.facility_zip"/> <span t-field="company.facility_city"/> + </div> + </t> + <t t-else=""> + <div name="company_address" class="mb4"> + <span class="company_address" t-field="company.partner_id" + t-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": true}'/> + </div> + </t> </div> </div> </div> diff --git a/views/res_company_views.xml b/views/res_company_views.xml index 6c88c88e7a47c13462fbb3bc42ee15e896697fb8..c8acf2c90a20749631a1735a46425200d2b10d1c 100644 --- a/views/res_company_views.xml +++ b/views/res_company_views.xml @@ -7,6 +7,13 @@ <field name="model">res.company</field> <field name="inherit_id" ref="base.view_company_form"/> <field name="arch" type="xml"> + <xpath expr="//notebook/page/group/group" position="inside"> + <field name="has_facility" widget="boolean_toggle"/> + <field name="facility_street" attrs="{'invisible': [('has_facility', '!=', True)]}"/> + <field name="facility_street2" attrs="{'invisible': [('has_facility', '!=', True)]}"/> + <field name="facility_zip" attrs="{'invisible': [('has_facility', '!=', True)]}"/> + <field name="facility_city" attrs="{'invisible': [('has_facility', '!=', True)]}"/> + </xpath> <xpath expr="//field[@name='website']" position="after"> <field name="forme_juridique"/> <field name="cgv"/>