mirror of
https://github.com/OCA/intrastat-extrastat.git
synced 2025-02-16 17:13:41 +02:00
[FIX] intrastat_base: Several things
* switch required=True for country_id from model to views in res.partner * xpath in partner view as Niels Huylebroeck suggest * simplify first xpath too in partner view * xpath in a more generic way
This commit is contained in:
committed by
Alexis de Lattre
parent
769956e322
commit
84b4be792b
@@ -23,6 +23,5 @@
|
||||
from . import country
|
||||
from . import product
|
||||
from . import tax
|
||||
from . import partner
|
||||
from . import company
|
||||
from . import intrastat_common
|
||||
|
||||
@@ -44,6 +44,7 @@ Please contact Alexis de Lattre from Akretion <alexis.delattre@akretion.com> for
|
||||
'data': [
|
||||
'country_data.xml',
|
||||
'product_view.xml',
|
||||
'partner_view.xml',
|
||||
'country_view.xml',
|
||||
'tax_view.xml',
|
||||
'company_view.xml',
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Report intrastat base module for OpenERP
|
||||
# Copyright (C) 2010-2013 Akretion (http://www.akretion.com/)
|
||||
# @author Alexis de Lattre <alexis.delattre@akretion.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/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from openerp.osv import orm, fields
|
||||
|
||||
|
||||
# We want to have the country field on res_partner always set
|
||||
# because the selection of invoices for intrastat reports is based
|
||||
# on the country of the invoice partner !
|
||||
class res_partner(orm.Model):
|
||||
_inherit = 'res.partner'
|
||||
_columns = {
|
||||
'country_id': fields.many2one('res.country', 'Country', required=True),
|
||||
}
|
||||
31
intrastat_base/partner_view.xml
Normal file
31
intrastat_base/partner_view.xml
Normal file
@@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
Copyright (C) 2010-2014 Akretion (http://www.akretion.com/)
|
||||
@author David BEAL <david.beal@akretion.com>
|
||||
The licence is in the file __openerp__.py
|
||||
-->
|
||||
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<!-- Add required field country_id on view_partner_form -->
|
||||
<record id="view_partner_form" model="ir.ui.view">
|
||||
<field name="model">res.partner</field>
|
||||
<field name="inherit_id" ref="base.view_partner_form" />
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='country_id']"
|
||||
position="attributes">
|
||||
<attribute name="attrs">{'readonly': [('use_parent_address','=',True)], 'required': True}</attribute>
|
||||
</xpath>
|
||||
|
||||
<xpath expr="//field[@name='child_ids']/form//field[@name='country_id']"
|
||||
position="attributes">
|
||||
<attribute name="attrs">{'required': True}</attribute>
|
||||
</xpath>
|
||||
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
Reference in New Issue
Block a user