Merge pull request #16 from Noviat/80-region_attrs_invisible

region attrs invisible
This commit is contained in:
Alexis de Lattre
2017-08-29 22:59:57 +02:00
committed by GitHub
7 changed files with 33 additions and 95 deletions

View File

@@ -1,30 +1,11 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Intrastat Product module for Odoo
# Copyright (C) 2011-2015 Akretion (http://www.akretion.com)
# Copyright (C) 2009-2015 Noviat (http://www.noviat.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
# @author Luc de Meyer <info@noviat.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
# Copyright 2011-2017 Akretion (http://www.akretion.com)
# Copyright 2009-2017 Noviat
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
'name': 'Intrastat Product',
'version': '8.0.1.4.1',
'version': '8.0.1.5.0',
'category': 'Intrastat',
'license': 'AGPL-3',
'summary': 'Base module for Intrastat Product',
@@ -35,7 +16,7 @@
'stock_picking_invoice_link',
'sale_stock',
'purchase',
],
],
'conflicts': ['report_intrastat'],
'data': [
'views/hs_code.xml',

View File

@@ -1,28 +1,9 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Intrastat Product module for Odoo
# Copyright (C) 2011-2016 Akretion (http://www.akretion.com)
# Copyright (C) 2009-2016 Noviat (http://www.noviat.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
# @author Luc de Meyer <info@noviat.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
# Copyright 2011-2017 Akretion (http://www.akretion.com)
# Copyright 2009-2017 Noviat
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp import models, fields, api
from openerp import api, fields, models
class AccountInvoice(models.Model):
@@ -43,6 +24,8 @@ class AccountInvoice(models.Model):
src_dest_country_id = fields.Many2one(
'res.country', string='Origin/Destination Country',
ondelete='restrict')
company_country_code = fields.Char(
related='company_id.country_id.code', readonly=True)
src_dest_region_id = fields.Many2one(
'intrastat.region', string='Origin/Destination Region',
default=lambda self: self._default_src_dest_region_id(),

View File

@@ -1,28 +1,9 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Intrastat Product module for Odoo
# Copyright (C) 2011-2015 Akretion (http://www.akretion.com)
# Copyright (C) 2009-2015 Noviat (http://www.noviat.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
# @author Luc de Meyer <info@noviat.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
# Copyright 2011-2017 Akretion (http://www.akretion.com)
# Copyright 2009-2017 Noviat
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp import models, fields, api
from openerp import api, fields, models
class ResCompany(models.Model):
@@ -46,6 +27,8 @@ class ResCompany(models.Model):
intrastat = fields.Char(
string='Intrastat Declaration', store=True, readonly=True,
compute='_compute_intrastat')
country_code = fields.Char(
related='country_id.code', readonly=True)
intrastat_region_id = fields.Many2one(
'intrastat.region',
string='Default Intrastat Region')

View File

@@ -1,26 +1,8 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Odoo, Open Source Management Solution
#
# Copyright (c) 2009-2015 Noviat nv/sa (www.noviat.com).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
# Copyright 2009-2017 Noviat
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp import models, fields, api
from openerp import api, fields, models
class StockWarehouse(models.Model):
@@ -29,6 +11,8 @@ class StockWarehouse(models.Model):
region_id = fields.Many2one(
'intrastat.region',
string='Intrastat region')
country_code = fields.Char(
related='company_id.country_id.code', readonly=True)
class StockLocation(models.Model):

View File

@@ -18,7 +18,9 @@
attrs="{'invisible': [('intrastat', '!=', 'extended')]}"
widget="selection"/>
<field name="src_dest_country_id" string="Destination Country"/>
<field name="src_dest_region_id" string="Origin Region" invisible="1"/>
<field name="company_country_code" invisible="1"/>
<field name="src_dest_region_id" string="Origin/Destination Region"
attrs="{'invisible': [('company_country_code', 'not in', ['BE'])]}"/>
</xpath>
<xpath expr="//field[@name='invoice_line']//field[@name='account_id']" position="after">
<field name="hs_code_id"/>
@@ -42,7 +44,9 @@
attrs="{'invisible': [('intrastat', '!=', 'extended')]}"
widget="selection"/>
<field name="src_dest_country_id" string="Origin/Destination Country"/>
<field name="src_dest_region_id" string="Origin/Destination Region" invisible="1"/>
<field name="company_country_code" invisible="1"/>
<field name="src_dest_region_id" string="Origin/Destination Region"
attrs="{'invisible': [('company_country_code', 'not in', ['BE'])]}"/>
</xpath>
<xpath expr="//field[@name='invoice_line']//field[@name='account_id']" position="after">
<field name="hs_code_id"/>

View File

@@ -15,7 +15,9 @@
<field name="intrastat_transaction_out_refund"/>
<field name="intrastat_transaction_in_invoice"/>
<field name="intrastat_transaction_in_refund"/>
<field name="intrastat_region_id" domain="[('country_id','=', country_id)]" invisible="1"/>
<field name="country_code" invisible="1"/>
<field name="intrastat_region_id" domain="[('country_id','=', country_id)]"
attrs="{'invisible': [('country_code', 'not in', ['BE'])]}"/>
<field name="intrastat_transport_id"
attrs="{'required': [('intrastat', '=', 'extended')], 'invisible': [('intrastat', '!=', 'extended')]}"/>
<field name="intrastat_incoterm_id" invisible="1"/>

View File

@@ -8,7 +8,8 @@
<field name="inherit_id" ref="stock.view_warehouse"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='partner_id']" position="after">
<field name="region_id"/>
<field name="country_code" invisible="1"/>
<field name="region_id" attrs="{'invisible': [('country_code', 'not in', ['BE'])]}"/>
</xpath>
</field>
</record>