[MIG] intrastat_base: Migration to 7.0

Should now be compatible with both OCB and RS-OCB Add field import_obligation_level on res.company Add group group_detailed_intrastat_product, so that companies that only use obligation = simplified don't see all the additionnal fields. Remove transaction code corresponding to repairs in intrastat types Better on_change on intrastat types (code is mutualised with field.function) Update syntax : demo_xml/update_xml/init_xml -> data/demo

Welcome to Croatia in the European Union !

Add an e-mail reminder for l10n_fr_intrastat_product and l10n_fr_intrastat_service (hope that Akretion France won't forget it's own declarations now !!!) On report.intrastat.product and report.intrastat.service : add copy() fonctions, tracking of important fields, a year_month function field and enhance views. Remove date_done field (the tracking in the chatter does the job). Remove class instanciation in the code.

Better form view of product category, courtesy of David Beal.

Raise an explicit exception (take into account Stefan remark on the merge proposal)

Fix to make the module truly usable when user is not part of the group "Detailed intrastat product". Remove dead code and fields that was used when we had to put DEB lines for repair operations (a thing of the past !). Update coding style. Reduce the number of flake8 warnings.

On OpenERP 7, when you have the document module installed and you download the attachement via the drop down list on the form view, the name of the file will be the name of the attachement and not datas_fname ; so we need to have name = datas_fname.
This commit is contained in:
Alexis de Lattre
2013-04-24 10:55:14 +02:00
committed by Alexis de Lattre
parent b5f1d9ac8f
commit 769956e322
15 changed files with 186 additions and 102 deletions

View File

@@ -2,7 +2,7 @@
############################################################################## ##############################################################################
# #
# Report intrastat base module for OpenERP # Report intrastat base module for OpenERP
# Copyright (C) 2011 Akretion (http://www.akretion.com). All Rights Reserved # Copyright (C) 2011-2013 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com> # @author Alexis de Lattre <alexis.delattre@akretion.com>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
@@ -20,9 +20,9 @@
# #
############################################################################## ##############################################################################
import country from . import country
import product from . import product
import tax from . import tax
import partner_address from . import partner
import intrastat_common from . import company
from . import intrastat_common

View File

@@ -2,7 +2,7 @@
############################################################################## ##############################################################################
# #
# Report intrastat base module for OpenERP # Report intrastat base module for OpenERP
# Copyright (C) 2011 Akretion (http://www.akretion.com). All Rights Reserved # Copyright (C) 2011-2013 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com> # @author Alexis de Lattre <alexis.delattre@akretion.com>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
@@ -22,14 +22,15 @@
{ {
'name': 'Base module for Intrastat reporting', 'name': 'Intrastat Reporting Base',
'version': '1.1', 'version': '1.1',
'category': 'Localisation/Report Intrastat', 'category': 'Localisation/Report Intrastat',
'license': 'AGPL-3', 'license': 'AGPL-3',
'summary': 'Base module for Intrastat reporting',
'description': """This module contains the common functions for 2 other modules : 'description': """This module contains the common functions for 2 other modules :
- l10n_fr_intrastat_service : the module for the "Déclaration Européenne des Services" (DES) - l10n_fr_intrastat_service : the module for the "Déclaration Européenne des Services" (DES)
- l10n_fr_intrastat_product : the module for the "Déclaration d'Echange de Biens" (DEB) - l10n_fr_intrastat_product : the module for the "Déclaration d'Echange de Biens" (DEB)
This module is not usefull if it's not used together with one of those 2 modules. This module is not usefull if it's not used together with one of those 2 modules or other country-specific intrastat modules.
This module doesn't have any France-specific stuff. So it can be used as a basis for other intrastat modules for other EU countries. This module doesn't have any France-specific stuff. So it can be used as a basis for other intrastat modules for other EU countries.
@@ -40,15 +41,15 @@ Please contact Alexis de Lattre from Akretion <alexis.delattre@akretion.com> for
'author': 'Akretion', 'author': 'Akretion',
'website': 'http://www.akretion.com', 'website': 'http://www.akretion.com',
'depends': ['base_vat'], 'depends': ['base_vat'],
'init_xml': ['country_data.xml'], 'data': [
'update_xml': [ 'country_data.xml',
'security/ir.model.access.csv',
'product_view.xml', 'product_view.xml',
'country_view.xml', 'country_view.xml',
'tax_view.xml', 'tax_view.xml',
'company_view.xml',
'intrastat_menu.xml', 'intrastat_menu.xml',
], ],
'demo_xml': ['intrastat_demo.xml'], 'demo': ['intrastat_demo.xml'],
'installable': True, 'installable': True,
'active': False, 'active': False,
} }

62
intrastat_base/company.py Normal file
View File

@@ -0,0 +1,62 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Intrastat base module for OpenERP
# Copyright (C) 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
from openerp.tools.translate import _
class res_company(orm.Model):
_inherit = "res.company"
def _compute_intrastat_email_list(self, cr, uid, ids, name, arg, context=None):
result = {}
for company in self.browse(cr, uid, ids, context=context):
result[company.id] = ''
for user in company.intrastat_remind_user_ids:
if result[company.id]:
result[company.id] += ',%s' % (user.email)
else:
result[company.id] = user.email
return result
_columns = {
'intrastat_remind_user_ids': fields.many2many('res.users',
id1='company_id', id2='user_id',
string="Users Receiving the Intrastat Reminder",
help="List of OpenERP users who will receive a notification to remind them about the Intrastat declaration."),
'intrastat_email_list': fields.function(_compute_intrastat_email_list,
type='char', size=1000,
string='List of emails of Users Receiving the Intrastat Reminder',
help='Comma-separated list of email addresses of Users Receiving the Intrastat Reminder. For use in the email template.'),
}
def _check_intrastat_remind_users(self, cr, uid, ids):
for company in self.browse(cr, uid, ids):
for user in company.intrastat_remind_user_ids:
if not user.email:
raise orm.except_orm(_('Error :'), _("Missing e-mail address on user '%s'.") % (user.name))
return True
_constraints = [
(_check_intrastat_remind_users, "error msg in raise",
['intrastat_remind_user_ids']),
]

View File

@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2013 Akretion (http://www.akretion.com/)
@author Alexis de Lattre <alexis.delattre@akretion.com>
The licence is in the file __openerp__.py
-->
<openerp>
<data>
<record id="intrastat_company_form" model="ir.ui.view">
<field name="name">intrastat.company.form</field>
<field name="model">res.company</field>
<field name="inherit_id" ref="base.view_company_form" />
<field name="arch" type="xml">
<notebook>
<page position="inside" string="Intrastat Settings">
<group name="intrastat-common" string="Common Intrastat Settings">
<field name="intrastat_remind_user_ids" widget="many2many_tags" />
</group>
</page>
</notebook>
</field>
</record>
</data>
</openerp>

View File

@@ -20,9 +20,10 @@
# #
############################################################################## ##############################################################################
from osv import osv, fields from openerp.osv import orm, fields
class res_country(osv.osv):
class res_country(orm.Model):
_inherit = 'res.country' _inherit = 'res.country'
_columns = { _columns = {
'intrastat': fields.boolean('EU country', help="Set to True for all European Union countries."), 'intrastat': fields.boolean('EU country', help="Set to True for all European Union countries."),
@@ -31,5 +32,3 @@ class res_country(osv.osv):
_defaults = { _defaults = {
'intrastat': False, 'intrastat': False,
} }
res_country()

View File

@@ -83,5 +83,8 @@
<record id="base.be" model="res.country"> <record id="base.be" model="res.country">
<field name="intrastat" eval="True"/> <field name="intrastat" eval="True"/>
</record> </record>
<record id="base.hr" model="res.country">
<field name="intrastat" eval="True"/>
</record>
</data> </data>
</openerp> </openerp>

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- <!--
Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>) Copyright (C) 2011-2013 Akretion (http://www.akretion.com)
The licence is in the file __openerp__.py The licence is in the file __openerp__.py
--> -->
@@ -26,7 +26,7 @@
<field name="inherit_id" ref="base.view_country_form" /> <field name="inherit_id" ref="base.view_country_form" />
<field name="arch" type="xml"> <field name="arch" type="xml">
<field name="code" position="after"> <field name="code" position="after">
<field name="intrastat" select="1" /> <field name="intrastat" />
</field> </field>
</field> </field>
</record> </record>

View File

@@ -2,7 +2,7 @@
############################################################################## ##############################################################################
# #
# Report intrastat base module for OpenERP # Report intrastat base module for OpenERP
# Copyright (C) 2010-2011 Akretion (http://www.akretion.com/). All rights reserved. # Copyright (C) 2010-2013 Akretion (http://www.akretion.com/). All rights reserved.
# @author Alexis de Lattre <alexis.delattre@akretion.com> # @author Alexis de Lattre <alexis.delattre@akretion.com>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
@@ -20,12 +20,16 @@
# #
############################################################################## ##############################################################################
from osv import osv, fields from openerp.osv import orm
from openerp.tools.translate import _
from datetime import datetime from datetime import datetime
from dateutil.relativedelta import relativedelta from dateutil.relativedelta import relativedelta
from tools.translate import _ import logging
class report_intrastat_common(osv.osv_memory): logger = logging.getLogger(__name__)
class report_intrastat_common(orm.TransientModel):
_name = "report.intrastat.common" _name = "report.intrastat.common"
_description = "Common functions for intrastat reports for products and services" _description = "Common functions for intrastat reports for products and services"
@@ -40,16 +44,17 @@ class report_intrastat_common(osv.osv_memory):
result[intrastat.id] = {'num_lines': num_lines, 'total_amount': total_amount} result[intrastat.id] = {'num_lines': num_lines, 'total_amount': total_amount}
return result return result
def _compute_dates(self, cr, uid, ids, object, context=None):
def _compute_end_date(self, cr, uid, ids, object, context=None):
result = {} result = {}
for intrastat in object.browse(cr, uid, ids, context=context): for intrastat in object.browse(cr, uid, ids, context=context):
start_date_datetime = datetime.strptime(intrastat.start_date, '%Y-%m-%d') start_date_datetime = datetime.strptime(intrastat.start_date, '%Y-%m-%d')
end_date_str = datetime.strftime(start_date_datetime + relativedelta(day=31), '%Y-%m-%d') end_date_str = datetime.strftime(start_date_datetime + relativedelta(day=31), '%Y-%m-%d')
result[intrastat.id] = end_date_str result[intrastat.id] = {
'end_date': end_date_str,
'year_month': start_date_datetime.strftime('%Y-%m'),
}
return result return result
def _check_start_date(self, cr, uid, ids, object, context=None): def _check_start_date(self, cr, uid, ids, object, context=None):
'''Check that the start date is the first day of the month''' '''Check that the start date is the first day of the month'''
for date_to_check in object.read(cr, uid, ids, ['start_date'], context=context): for date_to_check in object.read(cr, uid, ids, ['start_date'], context=context):
@@ -58,54 +63,47 @@ class report_intrastat_common(osv.osv_memory):
return False return False
return True return True
def _check_generate_lines(self, cr, uid, intrastat, context=None): def _check_generate_lines(self, cr, uid, intrastat, context=None):
if not intrastat.company_id.country_id: if not intrastat.company_id.country_id:
raise osv.except_osv(_('Error :'), _("The country is not set on the company '%s'.") %intrastat.company_id.name) raise orm.except_orm(_('Error :'), _("The country is not set on the company '%s'.") % intrastat.company_id.name)
if not intrastat.currency_id.name == 'EUR': if not intrastat.currency_id.name == 'EUR':
raise osv.except_osv(_('Error :'), _("The company currency must be 'EUR', but is currently '%s'.") %intrastat.currency_id.name) raise orm.except_orm(_('Error :'), _("The company currency must be 'EUR', but is currently '%s'.") % intrastat.currency_id.name)
return True return True
def _check_generate_xml(self, cr, uid, intrastat, context=None): def _check_generate_xml(self, cr, uid, intrastat, context=None):
if not intrastat.company_id.partner_id.vat: if not intrastat.company_id.partner_id.vat:
raise osv.except_osv(_('Error :'), _("The VAT number is not set for the partner '%s'.") %intrastat.company_id.partner_id.name) raise orm.except_orm(_('Error :'), _("The VAT number is not set for the partner '%s'.") % intrastat.company_id.partner_id.name)
return True return True
def _check_xml_schema(self, cr, uid, xml_root, xml_string, xsd, context=None): def _check_xml_schema(self, cr, uid, xml_root, xml_string, xsd, context=None):
'''Validate the XML file against the XSD''' '''Validate the XML file against the XSD'''
from lxml import etree from lxml import etree
official_des_xml_schema = etree.XMLSchema(etree.fromstring(xsd)) official_des_xml_schema = etree.XMLSchema(etree.fromstring(xsd))
try: official_des_xml_schema.assertValid(xml_root) try:
official_des_xml_schema.assertValid(xml_root)
except Exception, e: # if the validation of the XSD fails, we arrive here except Exception, e: # if the validation of the XSD fails, we arrive here
import logging import logging
_logger = logging.getLogger(__name__) _logger = logging.getLogger(__name__)
_logger.warning("The XML file is invalid against the XML Schema Definition") _logger.warning("The XML file is invalid against the XML Schema Definition")
_logger.warning(xml_string) _logger.warning(xml_string)
_logger.warning(e) _logger.warning(e)
raise osv.except_osv(_('Error :'), _('The generated XML file is not valid against the official XML Schema Definition. The generated XML file and the full error have been written in the server logs. Here is the error, which may give you an idea on the cause of the problem : %s.') % str(e)) raise orm.except_orm(_('Error :'), _('The generated XML file is not valid against the official XML Schema Definition. The generated XML file and the full error have been written in the server logs. Here is the error, which may give you an idea on the cause of the problem : %s.') % str(e))
return True return True
def _attach_xml_file(self, cr, uid, ids, object, xml_string, start_date_datetime, declaration_name, context=None): def _attach_xml_file(self, cr, uid, ids, object, xml_string, start_date_datetime, declaration_name, context=None):
'''Attach the XML file to the report_intrastat_product/service object''' '''Attach the XML file to the report_intrastat_product/service object'''
import base64 import base64
if len(ids) != 1: assert len(ids) == 1, "Only one ID accepted"
raise osv.except_osv(_('Error :'), 'Hara kiri in attach_xml_file')
filename = datetime.strftime(start_date_datetime, '%Y-%m') + '_' + declaration_name + '.xml' filename = datetime.strftime(start_date_datetime, '%Y-%m') + '_' + declaration_name + '.xml'
attach_name = declaration_name.upper() + ' ' + datetime.strftime(start_date_datetime, '%Y-%m')
attach_obj = self.pool.get('ir.attachment') attach_obj = self.pool.get('ir.attachment')
if not context: if not context:
context = {} context = {}
context.update({'default_res_id' : ids[0], 'default_res_model': object._name}) context.update({'default_res_id': ids[0], 'default_res_model': object._name})
attach_id = attach_obj.create(cr, uid, {'name': attach_name, 'datas': base64.encodestring(xml_string), 'datas_fname': filename}, context=context) attach_id = attach_obj.create(cr, uid, {'name': filename, 'datas': base64.encodestring(xml_string), 'datas_fname': filename}, context=context)
return attach_id return attach_id
def _open_attach_view(self, cr, uid, attach_id, title='XML file', context=None): def _open_attach_view(self, cr, uid, attach_id, title='XML file', context=None):
'''Returns an action which opens the form view of the corresponding attachement''' '''Returns an action which opens the form view of the corresponding attachement'''
# Only works in v6 -> not used in v5
action = { action = {
'name': title, 'name': title,
'view_type': 'form', 'view_type': 'form',
@@ -115,11 +113,10 @@ class report_intrastat_common(osv.osv_memory):
'type': 'ir.actions.act_window', 'type': 'ir.actions.act_window',
'nodestroy': True, 'nodestroy': True,
'target': 'current', 'target': 'current',
'res_id': [attach_id], 'res_id': attach_id,
} }
return action return action
def partner_on_change(self, cr, uid, ids, partner_id=False): def partner_on_change(self, cr, uid, ids, partner_id=False):
result = {} result = {}
result['value'] = {} result['value'] = {}
@@ -128,5 +125,15 @@ class report_intrastat_common(osv.osv_memory):
result['value'].update({'partner_vat': company['vat']}) result['value'].update({'partner_vat': company['vat']})
return result return result
report_intrastat_common() def send_reminder_email(self, cr, uid, company, module_name, template_xmlid, intrastat_id, context=None):
template_data = self.pool['ir.model.data'].get_object_reference(cr, uid, module_name, template_xmlid)
if template_data and template_data[0] == 'email.template':
template_id = template_data[1]
else:
raise orm.except_orm(_('Error :'), _("Wrong model for XMLID '%s.%s': model is '%s' and it should be 'email.template'.") % (module_name, template_xmlid, template_data[0]))
if company.intrastat_remind_user_ids:
self.pool['email.template'].send_mail(cr, uid, template_id, intrastat_id, context=context)
logger.info('Intrastat Reminder email has been sent (XMLID: %s).' % template_xmlid)
else:
logger.warning('The list of users receiving the Intrastat Reminder is empty on company %s' % company.name)
return True

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- <!--
Copyright (C) 2011 Akretion (http://www.akretion.com/) Copyright (C) 2011-2013 Akretion (http://www.akretion.com/)
@author Alexis de Lattre <alexis.delattre@akretion.com> @author Alexis de Lattre <alexis.delattre@akretion.com>
The licence is in the file __openerp__.py The licence is in the file __openerp__.py
--> -->
@@ -13,7 +13,7 @@
<field name="vat">FR58441019213</field> <field name="vat">FR58441019213</field>
</record> </record>
<record id="base.res_partner_6" model="res.partner"> <!-- Elec Import --> <record id="base.res_partner_8" model="res.partner"> <!-- MediaPole -->
<field name="vat">BE0828696437</field> <field name="vat">BE0828696437</field>
<field name="supplier">True</field> <field name="supplier">True</field>
</record> </record>
@@ -23,7 +23,7 @@
<field name="supplier">True</field> <field name="supplier">True</field>
</record> </record>
<record id="base.res_partner_agrolait" model="res.partner"> <record id="base.res_partner_2" model="res.partner"> <!-- Agrolait -->
<field name="vat">BE0884025633</field> <field name="vat">BE0884025633</field>
<field name="supplier">True</field> <field name="supplier">True</field>
</record> </record>
@@ -48,7 +48,7 @@
<field name="name">Shipping costs</field> <field name="name">Shipping costs</field>
<field name="code">SHIP</field> <field name="code">SHIP</field>
<field name="type">service</field> <field name="type">service</field>
<field name="categ_id" ref="product.product_category_services"/> <field name="categ_id" ref="product.product_category_all"/>
<field name="list_price">30</field> <field name="list_price">30</field>
<field name="is_accessory_cost">True</field> <field name="is_accessory_cost">True</field>
</record> </record>

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- <!--
Copyright (C) 2011 Akretion (http://www.akretion.com/) Copyright (C) 2011-2013 Akretion (http://www.akretion.com/)
The licence is in the file __openerp__.py The licence is in the file __openerp__.py
--> -->

View File

@@ -2,7 +2,7 @@
############################################################################## ##############################################################################
# #
# Report intrastat base module for OpenERP # Report intrastat base module for OpenERP
# Copyright (C) 2010-2011 Akretion (http://www.akretion.com/) All Rights Reserved # Copyright (C) 2010-2013 Akretion (http://www.akretion.com/)
# @author Alexis de Lattre <alexis.delattre@akretion.com> # @author Alexis de Lattre <alexis.delattre@akretion.com>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
@@ -20,16 +20,14 @@
# #
############################################################################## ##############################################################################
from osv import osv, fields from openerp.osv import orm, fields
# We want to have the country field on res_partner_address always set
# We want to have the country field on res_partner always set
# because the selection of invoices for intrastat reports is based # because the selection of invoices for intrastat reports is based
# on the country of the invoice partner address ! # on the country of the invoice partner !
class res_partner_address(osv.osv): class res_partner(orm.Model):
_inherit = 'res.partner.address' _inherit = 'res.partner'
_columns = { _columns = {
'country_id': fields.many2one('res.country', 'Country', required=True), 'country_id': fields.many2one('res.country', 'Country', required=True),
} }
res_partner_address()

View File

@@ -2,7 +2,7 @@
############################################################################## ##############################################################################
# #
# Report intrastat base module for OpenERP # Report intrastat base module for OpenERP
# Copyright (C) 2010-2012 Akretion (http://www.akretion.com/) All Rights Reserved # Copyright (C) 2010-2013 Akretion (http://www.akretion.com/)
# @author Alexis de Lattre <alexis.delattre@akretion.com> # @author Alexis de Lattre <alexis.delattre@akretion.com>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
@@ -20,30 +20,28 @@
# #
############################################################################## ##############################################################################
from osv import osv, fields from openerp.osv import orm, fields
from tools.translate import _ from openerp.tools.translate import _
class product_template(osv.osv):
class product_template(orm.Model):
_inherit = "product.template" _inherit = "product.template"
_columns = { _columns = {
'exclude_from_intrastat': fields.boolean('Exclude from Intrastat reports', help="If set to True, the product or service will not be taken into account for Intrastat Product or Service reports. So you should leave this field to False unless you have a very good reason."), 'exclude_from_intrastat': fields.boolean('Exclude from Intrastat reports', help="If set to True, the product or service will not be taken into account for Intrastat Product or Service reports. So you should leave this field to False unless you have a very good reason."),
'is_accessory_cost' : fields.boolean('Is accessory cost', help='Activate this option for shipping costs, packaging costs and all services related to the sale of products. This option is used for Intrastat reports.'), 'is_accessory_cost': fields.boolean('Is accessory cost', help='Activate this option for shipping costs, packaging costs and all services related to the sale of products. This option is used for Intrastat reports.'),
} }
_defaults = { _defaults = {
'exclude_from_intrastat': False, 'exclude_from_intrastat': False,
} }
def _check_accessory_cost(self, cr, uid, ids): def _check_accessory_cost(self, cr, uid, ids):
for product in self.browse(cr, uid, ids): for product in self.browse(cr, uid, ids):
if product.is_accessory_cost and product.type != 'service': if product.is_accessory_cost and product.type != 'service':
raise osv.except_osv(_('Error :'), _("The option 'Is accessory cost?' should only be activated on 'Service' products. You have activated this option for the product '%s' which is of type '%s'" % (product.name, product.type))) raise orm.except_orm(_('Error :'), _("The option 'Is accessory cost?' should only be activated on 'Service' products. You have activated this option for the product '%s' which is of type '%s'" % (product.name, product.type)))
return True return True
_constraints = [ _constraints = [
(_check_accessory_cost, "Error msg is in raise", ['is_accessory_cost', 'type']) (_check_accessory_cost, "Error msg is in raise",
['is_accessory_cost', 'type'])
] ]
product_template()

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- <!--
Copyright (C) 2010-2011 Akretion (http://www.akretion.com/) Copyright (C) 2010-2013 Akretion (http://www.akretion.com/)
@author Alexis de Lattre <alexis.delattre@akretion.com> @author Alexis de Lattre <alexis.delattre@akretion.com>
The licence is in the file __openerp__.py The licence is in the file __openerp__.py
--> -->
@@ -15,17 +15,12 @@
<field name="model">product.product</field> <field name="model">product.product</field>
<field name="inherit_id" ref="account.product_normal_form_view" /> <field name="inherit_id" ref="account.product_normal_form_view" />
<field name="arch" type="xml"> <field name="arch" type="xml">
<data> <group name="properties" position="after">
<field name="property_account_expense" position="after"> <group string="Intrastat Properties" name="intrastat">
<separator string="Intrastat properties" colspan="4"/> <field name="exclude_from_intrastat" />
<group colspan="4">
<field name="exclude_from_intrastat" />
</group>
</field>
<field name="purchase_ok" position="after">
<field name="is_accessory_cost" /> <field name="is_accessory_cost" />
</field> </group>
</data> </group>
</field> </field>
</record> </record>
@@ -35,17 +30,12 @@
<field name="model">product.template</field> <field name="model">product.template</field>
<field name="inherit_id" ref="account.product_template_form_view"/> <field name="inherit_id" ref="account.product_template_form_view"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<data> <field name="supplier_taxes_id" position="after">
<field name="property_account_expense" position="after"> <group string="Intrastat Properties" name="intrastat">
<separator string="Intrastat properties" colspan="4"/> <field name="exclude_from_intrastat" />
<group colspan="4">
<field name="exclude_from_intrastat" />
</group>
</field>
<field name="purchase_ok" position="after">
<field name="is_accessory_cost" /> <field name="is_accessory_cost" />
</field> </group>
</data> </field>
</field> </field>
</record> </record>

View File

@@ -2,7 +2,7 @@
############################################################################## ##############################################################################
# #
# Report intrastat base module for OpenERP # Report intrastat base module for OpenERP
# Copyright (C) 2011 Akretion (http://www.akretion.com). All Rights Reserved # Copyright (C) 2011-2013 Akretion (http://www.akretion.com). All Rights Reserved
# @author Alexis de Lattre <alexis.delattre@akretion.com> # @author Alexis de Lattre <alexis.delattre@akretion.com>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
@@ -20,14 +20,11 @@
# #
############################################################################## ##############################################################################
from osv import osv, fields from openerp.osv import orm, fields
class account_tax(osv.osv): class account_tax(orm.Model):
_inherit = "account.tax" _inherit = "account.tax"
_columns = { _columns = {
'exclude_from_intrastat_if_present': fields.boolean('Exclude invoice line from intrastat if this tax is present', help="If this tax is present on an invoice line, this invoice line will be skipped when generating Intrastat Product or Service lines from invoices."), 'exclude_from_intrastat_if_present': fields.boolean('Exclude invoice line from intrastat if this tax is present', help="If this tax is present on an invoice line, this invoice line will be skipped when generating Intrastat Product or Service lines from invoices."),
} }
account_tax()

View File

@@ -17,8 +17,8 @@
<field name="inherit_id" ref="account.view_tax_form"/> <field name="inherit_id" ref="account.view_tax_form"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<data> <data>
<field name="type_tax_use" position="after"> <field name="active" position="after">
<field name="exclude_from_intrastat_if_present" /> <field name="exclude_from_intrastat_if_present" />
</field> </field>
</data> </data>
</field> </field>