[IMP] l10n_xx: hide country specific fields from company/settings view
There are few fields added on settings and on company form view by various l10n modules which are meant for particular country's user and are of no use to others. Such fields should be hidden from unrelated users. With this commit, it will be the case. closes odoo/odoo#35755 Task: 2049977 Closes: #35755 Related: odoo/enterprise#5158 Related: odoo/enterprise#5158 Signed-off-by: Josse Colpaert <jco@openerp.com>
This commit is contained in:
@@ -6,7 +6,6 @@ class ResCompany(models.Model):
|
||||
|
||||
_inherit = "res.company"
|
||||
|
||||
l10n_ar_country_code = fields.Char(related='country_id.code', string='Country Code')
|
||||
l10n_ar_gross_income_number = fields.Char(
|
||||
related='partner_id.l10n_ar_gross_income_number', string='Gross Income Number', readonly=False,
|
||||
help="This field is required in order to print the invoice report properly")
|
||||
|
||||
@@ -5,17 +5,14 @@
|
||||
<field name="inherit_id" ref="base.view_company_form"/>
|
||||
<field name="model">res.company</field>
|
||||
<field name="arch" type="xml">
|
||||
<form>
|
||||
<field name="l10n_ar_country_code" invisible="1"/>
|
||||
</form>
|
||||
<field name="vat" position="after">
|
||||
<field name="l10n_ar_afip_responsibility_type_id" options="{'no_open': True, 'no_create': True}" attrs="{'invisible': [('l10n_ar_country_code', '!=', 'AR')]}"/>
|
||||
<label for="l10n_ar_gross_income_number" string="Gross Income" attrs="{'invisible': [('l10n_ar_country_code', '!=', 'AR')]}"/>
|
||||
<div attrs="{'invisible': [('l10n_ar_country_code', '!=', 'AR')]}" name="gross_income">
|
||||
<field name="l10n_ar_afip_responsibility_type_id" options="{'no_open': True, 'no_create': True}" attrs="{'invisible': [('country_code', '!=', 'AR')]}"/>
|
||||
<label for="l10n_ar_gross_income_number" string="Gross Income" attrs="{'invisible': [('country_code', '!=', 'AR')]}"/>
|
||||
<div attrs="{'invisible': [('country_code', '!=', 'AR')]}" name="gross_income">
|
||||
<field name="l10n_ar_gross_income_type" class="oe_inline"/>
|
||||
<field name="l10n_ar_gross_income_number" placeholder="Number..." class="oe_inline" attrs="{'invisible': [('l10n_ar_gross_income_type', 'in', [False, 'exempt'])], 'required': [('l10n_ar_gross_income_type', 'not in', [False, 'exempt'])]}"/>
|
||||
</div>
|
||||
<field name="l10n_ar_afip_start_date" attrs="{'invisible': [('l10n_ar_country_code', '!=', 'AR')]}"/>
|
||||
<field name="l10n_ar_afip_start_date" attrs="{'invisible': [('country_code', '!=', 'AR')]}"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<field name="inherit_id" ref="account.res_config_settings_view_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//div[@id='invoicing_settings']" position="inside">
|
||||
<div class="col-12 col-lg-6 o_setting_box" id="l10n_ch-isr_print_bank">
|
||||
<div class="col-12 col-lg-6 o_setting_box" id="l10n_ch-isr_print_bank" attrs="{'invisible': [('country_code', '!=', 'CH')]}">
|
||||
<div class="o_setting_left_pane">
|
||||
<field name="l10n_ch_print_qrcode"/>
|
||||
</div>
|
||||
@@ -38,7 +38,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-lg-6 o_setting_box" id="l10n_ch-isr_print_scanline_offset">
|
||||
<div class="col-12 col-lg-6 o_setting_box" id="l10n_ch-isr_print_scanline_offset" attrs="{'invisible': [('country_code', '!=', 'CH')]}">
|
||||
<div class="o_setting_left_pane"/>
|
||||
<div class="o_setting_right_pane">
|
||||
<span class="o_form_label">ISR scan line offset</span>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<div id="l10n_cl_title" attrs="{'invisible': True}">
|
||||
<h2>Chilean Localization</h2>
|
||||
</div>
|
||||
<div id="l10n_cl_section" class="row mt16 o_settings_container">
|
||||
<div id="l10n_cl_section" class="row mt16 o_settings_container" attrs="{'invisible': [('country_code', '!=', 'CL')]}">
|
||||
<!-- inside empty to add configuration of tags -->
|
||||
</div>
|
||||
</xpath>
|
||||
|
||||
@@ -2,3 +2,4 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import eu_service_tax_rate
|
||||
from . import res_config_settings
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class ResConfigSettings(models.TransientModel):
|
||||
_inherit = 'res.config.settings'
|
||||
|
||||
l10n_eu_services_eu_country = fields.Boolean('Is European country?', compute='_compute_l10n_eu_services_european_country')
|
||||
|
||||
@api.depends('company_id')
|
||||
def _compute_l10n_eu_services_european_country(self):
|
||||
self.l10n_eu_services_eu_country = self.company_id.country_id in self.env.ref('base.europe').country_ids
|
||||
@@ -7,8 +7,9 @@
|
||||
<field name="inherit_id" ref="account.res_config_settings_view_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<div name="l10n_eu_service_right_pane" position="inside">
|
||||
<field name="l10n_eu_services_eu_country" invisible="1"/>
|
||||
<div class="content-group" attrs="{'invisible': [('module_l10n_eu_service', '=', False)]}">
|
||||
<div class="mt8">
|
||||
<div class="mt8" attrs="{'invisible': [('l10n_eu_services_eu_country', '=', False)]}">
|
||||
<button name="%(l10n_eu_service.action_eu_service)d" icon="fa-arrow-right" type="action" string="Add new countries" class="btn-link"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
<field name="arch" type="xml">
|
||||
<data>
|
||||
<xpath expr="//field[@name='company_registry']" position="after">
|
||||
<field name="siret"/>
|
||||
<field name="ape"/>
|
||||
<field name="siret" attrs="{'invisible': [('country_code', '!=', 'FR')]}"/>
|
||||
<field name="ape" attrs="{'invisible': [('country_code', '!=', 'FR')]}"/>
|
||||
</xpath>
|
||||
</data>
|
||||
</field>
|
||||
|
||||
@@ -7,9 +7,4 @@ from odoo import api, fields, models
|
||||
class ResConfigSettings(models.TransientModel):
|
||||
_inherit = 'res.config.settings'
|
||||
|
||||
show_module_l10n_in = fields.Boolean(compute='_compute_show_module_l10n_in')
|
||||
group_l10n_in_reseller = fields.Boolean(implied_group='l10n_in.group_l10n_in_reseller', string="Manage Reseller(E-Commerce)")
|
||||
|
||||
@api.depends('company_id')
|
||||
def _compute_show_module_l10n_in(self):
|
||||
self.show_module_l10n_in = self.company_id.country_id.code == 'IN'
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<field name="inherit_id" ref="base.view_company_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='vat']" position="attributes">
|
||||
<attribute name="string">GSTIN</attribute>
|
||||
<attribute name="string" attrs="{'invisible': [('country_code', '!=', 'IN')]}">GSTIN</attribute>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -6,11 +6,10 @@
|
||||
<field name="inherit_id" ref="account.res_config_settings_view_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<div id="invoicing_settings" position="inside">
|
||||
<field name="show_module_l10n_in" invisible="1"/>
|
||||
<div class="col-xs-12 col-md-6 o_setting_box"
|
||||
name="ecommerce_reseller_setting"
|
||||
title="Manage Reseller(E-Commerce)"
|
||||
attrs="{'invisible': [('show_module_l10n_in', '=', False)]}">
|
||||
attrs="{'invisible': [('country_code', '!=', 'IN')]}">
|
||||
<div class="o_setting_left_pane">
|
||||
<field name="group_l10n_in_reseller"/>
|
||||
</div>
|
||||
|
||||
@@ -57,16 +57,16 @@
|
||||
<field name="arch" type="xml">
|
||||
<data>
|
||||
<xpath expr="//div[hasclass('o_address_format')]" position="after">
|
||||
<field name="l10n_it_mail_pec_server_id"/>
|
||||
<field name="l10n_it_address_send_fatturapa"/>
|
||||
<field name="l10n_it_address_recipient_fatturapa"/>
|
||||
<field name="l10n_it_mail_pec_server_id" attrs="{'invisible': [('country_code', '!=', 'IT')]}"/>
|
||||
<field name="l10n_it_address_send_fatturapa" attrs="{'invisible': [('country_code', '!=', 'IT')]}"/>
|
||||
<field name="l10n_it_address_recipient_fatturapa" attrs="{'invisible': [('country_code', '!=', 'IT')]}"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='vat']" position="after">
|
||||
<field name="l10n_it_codice_fiscale"/>
|
||||
<field name="l10n_it_tax_system"/>
|
||||
<field name="l10n_it_codice_fiscale" attrs="{'invisible': [('country_code', '!=', 'IT')]}"/>
|
||||
<field name="l10n_it_tax_system" attrs="{'invisible': [('country_code', '!=', 'IT')]}"/>
|
||||
</xpath>
|
||||
<xpath expr="//page" position="after">
|
||||
<page string="Electronic Invoicing" name="electronic_invoicing">
|
||||
<page string="Electronic Invoicing" name="electronic_invoicing" attrs="{'invisible': [('country_code', '!=', 'IT')]}">
|
||||
<group>
|
||||
<separator string="Economic and Administrative Index" colspan="4"/>
|
||||
<div colspan="4">
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<field name="inherit_id" ref="account.res_config_settings_view_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr=".//div[@id='invoicing_settings']" position="inside">
|
||||
<div class="col-12 col-lg-6 o_setting_box" id="electronic_invoices_mx">
|
||||
<div class="col-12 col-lg-6 o_setting_box" id="electronic_invoices_mx" attrs="{'invisible': [('country_code', '!=', 'MX')]}">
|
||||
<div class="o_setting_left_pane">
|
||||
<field name="module_l10n_mx_edi" class="oe_inline" widget="upgrade_boolean"/>
|
||||
</div>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<field name="inherit_id" ref="base.view_company_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='email']" position="after">
|
||||
<field name="l10n_sg_unique_entity_number"/>
|
||||
<field name="l10n_sg_unique_entity_number" attrs="{'invisible': [('country_code', '!=', 'SG')]}"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='vat']" position="attributes">
|
||||
<attribute name="string" >GST No.</attribute>
|
||||
|
||||
Reference in New Issue
Block a user