[MIG] intrastat_base: Migration to 8.0

* Add intrastat_type_data and update demo data accordingly Remove version="7.0" from form views Add ondelete='restrict' on M2O pointing to intrastat.type Add graph views on intrastat.product and intrastat.service... because Odoo v8 graph views are so cool ! :)
* When the obligation level for import is none, the type of the DEB is automatically set to export. [FIX] country -> country_id type='string' -> type='char' (v8 only accepts char) Change "error msg in raise", because v8 displays this to the user Remove statistical_pricelist_id from demo data Harmonize labels of button between DEB and DES
* Add module intrastat_product. Rename report.intrastat.product to l10n.fr.report.intrastat.product (same for service and for lines) + migration scripts
* intrastat_base + l10n_fr_intrastat_service : port to new API
This commit is contained in:
Alexis de Lattre
2014-06-23 12:12:40 +02:00
committed by Alexis de Lattre
parent 41bab17d0c
commit a8510ae4d8
15 changed files with 177 additions and 248 deletions

View File

@@ -1,8 +1,8 @@
# -*- encoding: utf-8 -*- # -*- encoding: utf-8 -*-
############################################################################## ##############################################################################
# #
# Report intrastat base module for OpenERP # Report intrastat base module for Odoo
# Copyright (C) 2011-2013 Akretion (http://www.akretion.com) # Copyright (C) 2011-2014 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

View File

@@ -1,8 +1,8 @@
# -*- encoding: utf-8 -*- # -*- encoding: utf-8 -*-
############################################################################## ##############################################################################
# #
# Report intrastat base module for OpenERP # Report intrastat base module for Odoo
# Copyright (C) 2011-2013 Akretion (http://www.akretion.com) # Copyright (C) 2011-2014 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
@@ -52,5 +52,4 @@ Please contact Alexis de Lattre from Akretion <alexis.delattre@akretion.com> for
], ],
'demo': ['intrastat_demo.xml'], 'demo': ['intrastat_demo.xml'],
'installable': True, 'installable': True,
'active': False,
} }

View File

@@ -1,8 +1,8 @@
# -*- encoding: utf-8 -*- # -*- encoding: utf-8 -*-
############################################################################## ##############################################################################
# #
# Intrastat base module for OpenERP # Intrastat base module for Odoo
# Copyright (C) 2013 Akretion (http://www.akretion.com) # Copyright (C) 2013-2014 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,47 +20,37 @@
# #
############################################################################## ##############################################################################
from openerp.osv import orm, fields from openerp import models, fields, api, _
from openerp.tools.translate import _ from openerp.exceptions import ValidationError
class res_company(orm.Model): class ResCompany(models.Model):
_inherit = "res.company" _inherit = "res.company"
def _compute_intrastat_email_list( @api.one
self, cr, uid, ids, name, arg, context=None): @api.depends(
result = {} 'intrastat_remind_user_ids', 'intrastat_remind_user_ids.email')
for company in self.browse(cr, uid, ids, context=context): def _compute_intrastat_email_list(self):
result[company.id] = '' emails = []
for user in company.intrastat_remind_user_ids: for user in self.intrastat_remind_user_ids:
if result[company.id]: if user.email:
result[company.id] += ',%s' % (user.email) emails.append(user.email)
else: self.intrastat_email_list = ','.join(emails)
result[company.id] = user.email
return result
_columns = { intrastat_remind_user_ids = fields.Many2many(
'intrastat_remind_user_ids': fields.many2many( 'res.users', column1='company_id', column2='user_id',
'res.users', id1='company_id', id2='user_id', string="Users Receiving the Intrastat Reminder",
string="Users Receiving the Intrastat Reminder", help="List of OpenERP users who will receive a notification to "
help="List of OpenERP users who will receive a notification to " "remind them about the Intrastat declaration.")
"remind them about the Intrastat declaration."), intrastat_email_list = fields.Char(
'intrastat_email_list': fields.function( compute='_compute_intrastat_email_list',
_compute_intrastat_email_list, type='char', size=1000, string='List of emails of Users Receiving the Intrastat Reminder')
string='List of emails of Users Receiving the Intrastat Reminder'),
}
def _check_intrastat_remind_users(self, cr, uid, ids): @api.one
for company in self.browse(cr, uid, ids): @api.constrains('intrastat_remind_user_ids')
for user in company.intrastat_remind_user_ids: def _check_intrastat_remind_users(self):
if not user.email: for user in self.intrastat_remind_user_ids:
raise orm.except_orm( if not user.email:
_('Error :'), raise ValidationError(
_("Missing e-mail address on user '%s'.") _("Missing e-mail address on user '%s'.")
% (user.name)) % (user.name))
return True
_constraints = [
(_check_intrastat_remind_users, "error msg in raise",
['intrastat_remind_user_ids']),
]

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- <!--
Copyright (C) 2013 Akretion (http://www.akretion.com/) Copyright (C) 2013-2014 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
--> -->
@@ -9,7 +9,7 @@
<openerp> <openerp>
<data> <data>
<record id="intrastat_company_form" model="ir.ui.view"> <record id="view_company_form" model="ir.ui.view">
<field name="name">intrastat.company.form</field> <field name="name">intrastat.company.form</field>
<field name="model">res.company</field> <field name="model">res.company</field>
<field name="inherit_id" ref="base.view_company_form" /> <field name="inherit_id" ref="base.view_company_form" />

View File

@@ -1,8 +1,8 @@
# -*- encoding: utf-8 -*- # -*- encoding: utf-8 -*-
############################################################################## ##############################################################################
# #
# Report intrastat base module for OpenERP # Report intrastat base module for Odoo
# Copyright (C) 2011-2013 Akretion (http://www.akretion.com). # Copyright (C) 2011-2014 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,17 +20,12 @@
# #
############################################################################## ##############################################################################
from openerp.osv import orm, fields from openerp import models, fields
class res_country(orm.Model): class ResCountry(models.Model):
_inherit = 'res.country' _inherit = 'res.country'
_columns = {
'intrastat': fields.boolean(
'EU Country',
help="Set to True for all European Union countries."),
}
_defaults = { intrastat = fields.Boolean(
'intrastat': False, string='EU Country',
} help="Set to True for all European Union countries.")

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- <!--
Copyright (C) 2011-2013 Akretion (http://www.akretion.com) Copyright (C) 2011-2014 Akretion (http://www.akretion.com)
The licence is in the file __openerp__.py The licence is in the file __openerp__.py
--> -->
@@ -9,7 +9,7 @@
<data> <data>
<!-- Add intrastat field on res_country --> <!-- Add intrastat field on res_country -->
<record id="intrastat_base_country_tree" model="ir.ui.view"> <record id="view_country_tree" model="ir.ui.view">
<field name="name">intrastat.base.country.tree</field> <field name="name">intrastat.base.country.tree</field>
<field name="model">res.country</field> <field name="model">res.country</field>
<field name="inherit_id" ref="base.view_country_tree" /> <field name="inherit_id" ref="base.view_country_tree" />
@@ -20,7 +20,7 @@
</field> </field>
</record> </record>
<record id="intrastat_base_country_form" model="ir.ui.view"> <record id="view_country_form" model="ir.ui.view">
<field name="name">intrastat.base.country.form</field> <field name="name">intrastat.base.country.form</field>
<field name="model">res.country</field> <field name="model">res.country</field>
<field name="inherit_id" ref="base.view_country_form" /> <field name="inherit_id" ref="base.view_country_form" />
@@ -32,7 +32,7 @@
</record> </record>
<!-- there is no native search view, so I can't inherit --> <!-- there is no native search view, so I can't inherit -->
<record id="intrastat_base_country_search" model="ir.ui.view"> <record id="view_country_search" model="ir.ui.view">
<field name="name">intrastat.base.country.search</field> <field name="name">intrastat.base.country.search</field>
<field name="model">res.country</field> <field name="model">res.country</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
@@ -46,6 +46,5 @@
</record> </record>
</data> </data>
</openerp> </openerp>

View File

@@ -95,7 +95,7 @@ msgstr "Configuration DEB/DES"
#. module: intrastat_base #. module: intrastat_base
#: model:ir.ui.menu,name:intrastat_base.menu_intrastat_base_root #: model:ir.ui.menu,name:intrastat_base.menu_intrastat_base_root
msgid "Intrastat reporting" msgid "Intrastat Reporting"
msgstr "DEB et DES" msgstr "DEB et DES"
#. module: intrastat_base #. module: intrastat_base

View File

@@ -95,7 +95,7 @@ msgstr ""
#. module: intrastat_base #. module: intrastat_base
#: model:ir.ui.menu,name:intrastat_base.menu_intrastat_base_root #: model:ir.ui.menu,name:intrastat_base.menu_intrastat_base_root
msgid "Intrastat reporting" msgid "Intrastat Reporting"
msgstr "" msgstr ""
#. module: intrastat_base #. module: intrastat_base

View File

@@ -1,8 +1,8 @@
# -*- encoding: utf-8 -*- # -*- encoding: utf-8 -*-
############################################################################## ##############################################################################
# #
# Report intrastat base module for OpenERP # Report intrastat base module for Odoo
# Copyright (C) 2010-2013 Akretion (http://www.akretion.com/). # Copyright (C) 2010-2014 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 @@
# #
############################################################################## ##############################################################################
from openerp.osv import orm from openerp import models, api, tools, _
from openerp.tools.translate import _ from openerp.tools import DEFAULT_SERVER_DATE_FORMAT
from openerp import tools from openerp.exceptions import Warning, ValidationError
from datetime import datetime from datetime import datetime
from dateutil.relativedelta import relativedelta from dateutil.relativedelta import relativedelta
import logging import logging
@@ -30,71 +30,64 @@ import logging
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
class report_intrastat_common(orm.TransientModel): class ReportIntrastatCommon(models.AbstractModel):
_name = "report.intrastat.common" _name = "report.intrastat.common"
_description = "Common functions for intrastat reports for products " _description = "Common functions for intrastat reports for products "
"and services" "and services"
def _compute_numbers(self, cr, uid, ids, object, context=None): @api.one
result = {} @api.depends(
for intrastat in object.browse(cr, uid, ids, context=context): 'intrastat_line_ids', 'intrastat_line_ids.amount_company_currency')
total_amount = 0.0 def _compute_numbers(self):
num_lines = 0 total_amount = 0.0
for line in intrastat.intrastat_line_ids: num_lines = 0
total_amount += line.amount_company_currency for line in self.intrastat_line_ids:
num_lines += 1 total_amount += line.amount_company_currency
result[intrastat.id] = { num_lines += 1
'num_lines': num_lines, self.num_lines = num_lines
'total_amount': total_amount, self.total_amount = total_amount
}
return result
def _compute_dates(self, cr, uid, ids, object, context=None): @api.one
result = {} @api.depends('start_date')
for intrastat in object.browse(cr, uid, ids, context=context): def _compute_dates(self):
start_date_datetime = datetime.strptime( start_date_dt = datetime.strptime(
intrastat.start_date, '%Y-%m-%d') self.start_date, DEFAULT_SERVER_DATE_FORMAT)
end_date_str = datetime.strftime( self.end_date = datetime.strftime(
start_date_datetime + relativedelta(day=31), '%Y-%m-%d') start_date_dt + relativedelta(day=31), DEFAULT_SERVER_DATE_FORMAT)
result[intrastat.id] = { self.year_month = start_date_dt.strftime('%Y-%m')
'end_date': end_date_str,
'year_month': start_date_datetime.strftime('%Y-%m'),
}
return result
def _check_start_date(self, cr, uid, ids, object, context=None): @api.one
@api.constrains('start_date')
def _check_start_date(self):
'''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( datetime_to_check = datetime.strptime(
cr, uid, ids, ['start_date'], context=context): self.start_date, DEFAULT_SERVER_DATE_FORMAT)
datetime_to_check = datetime.strptime( if datetime_to_check.day != 1:
date_to_check['start_date'], '%Y-%m-%d') return ValidationError(
if datetime_to_check.day != 1: _('The start date must be the first day of the month'))
return False
return True
def _check_generate_lines(self, cr, uid, intrastat, context=None): @api.one
if not intrastat.company_id.country_id: def _check_generate_lines(self):
raise orm.except_orm( if not self.company_id.country_id:
_('Error :'), raise Warning(
_("The country is not set on the company '%s'.") _("The country is not set on the company '%s'.")
% intrastat.company_id.name) % self.company_id.name)
if not intrastat.currency_id.name == 'EUR': if self.currency_id.name != 'EUR':
raise orm.except_orm( raise Warning(
_('Error :'),
_("The company currency must be 'EUR', but is currently '%s'.") _("The company currency must be 'EUR', but is currently '%s'.")
% intrastat.currency_id.name) % self.currency_id.name)
return True return True
def _check_generate_xml(self, cr, uid, intrastat, context=None): @api.one
if not intrastat.company_id.partner_id.vat: def _check_generate_xml(self):
raise orm.except_orm( if not self.company_id.partner_id.vat:
_('Error :'), raise Warning(
_("The VAT number is not set for the partner '%s'.") _("The VAT number is not set for the partner '%s'.")
% intrastat.company_id.partner_id.name) % self.company_id.partner_id.name)
return True return True
def _check_xml_schema( @api.model
self, cr, uid, xml_root, xml_string, xsd_file, context=None): def _check_xml_schema(self, xml_root, xml_string, xsd_file):
'''Validate the XML file against the XSD''' '''Validate the XML file against the XSD'''
from lxml import etree from lxml import etree
xsd_etree_obj = etree.parse( xsd_etree_obj = etree.parse(
@@ -104,13 +97,12 @@ class report_intrastat_common(orm.TransientModel):
official_schema.assertValid(xml_root) official_schema.assertValid(xml_root)
except Exception, e: except Exception, e:
# if the validation of the XSD fails, we arrive here # if the validation of the XSD fails, we arrive here
_logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
_logger.warning( logger.warning(
"The XML file is invalid against the XML Schema Definition") "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 orm.except_orm( raise Warning(
_('Error :'),
_("The generated XML file is not valid against the official " _("The generated XML file is not valid against the official "
"XML Schema Definition. The generated XML file and the " "XML Schema Definition. The generated XML file and the "
"full error have been written in the server logs. " "full error have been written in the server logs. "
@@ -119,39 +111,29 @@ class report_intrastat_common(orm.TransientModel):
% str(e)) % str(e))
return True return True
def _attach_xml_file( @api.multi
self, cr, uid, ids, object, xml_string, start_date_datetime, def _attach_xml_file(self, xml_string, declaration_name):
declaration_name, context=None):
'''Attach the XML file to the report_intrastat_product/service ''' '''Attach the XML file to the report_intrastat_product/service '''
'''object''' '''object'''
self.ensure_one()
import base64 import base64
assert len(ids) == 1, "Only one ID accepted" filename = '%s_%s.xml' % (self.year_month, declaration_name)
filename = '%s_%s.xml' % ( attach = self.with_context(
datetime.strftime(start_date_datetime, '%Y-%m'), default_res_id=self.id,
declaration_name) default_res_model=self._name).env['ir.attachment'].create({
if not context: 'name': filename,
context = {} 'datas': base64.encodestring(xml_string),
context.update({ 'datas_fname': filename})
'default_res_id': ids[0], return attach.id
'default_res_model': object._name
})
attach_id = self.pool['ir.attachment'].create(
cr, uid, {
'name': filename,
'datas': base64.encodestring(xml_string),
'datas_fname': filename},
context=context)
return attach_id
def _open_attach_view( @api.model
self, cr, uid, attach_id, title='XML file', context=None): def _open_attach_view(self, attach_id, title='XML file'):
'''Returns an action which opens the form view of the ''' '''Returns an action which opens the form view of the '''
'''corresponding attachement''' '''corresponding attachement'''
action = { action = {
'name': title, 'name': title,
'view_type': 'form', 'view_type': 'form',
'view_mode': 'form,tree', 'view_mode': 'form',
'view_id': False,
'res_model': 'ir.attachment', 'res_model': 'ir.attachment',
'type': 'ir.actions.act_window', 'type': 'ir.actions.act_window',
'nodestroy': True, 'nodestroy': True,
@@ -160,30 +142,27 @@ class report_intrastat_common(orm.TransientModel):
} }
return action return action
def partner_on_change(self, cr, uid, ids, partner_id=False, context=None): @api.one
result = {} def send_reminder_email(self, mail_template_xmlid):
result['value'] = {} mail_template = self.env.ref(mail_template_xmlid)
if partner_id: if self.company_id.intrastat_remind_user_ids:
company = self.pool['res.partner'].read(
cr, uid, partner_id, ['vat'], context=context)
result['value']['partner_vat'] = company['vat']
return result
def send_reminder_email(
self, cr, uid, company, module_name, template_xmlid,
intrastat_id, context=None):
template_model, template_id =\
self.pool['ir.model.data'].get_object_reference(
cr, uid, module_name, template_xmlid)
assert template_model == 'email.template', 'Wrong model'
if company.intrastat_remind_user_ids:
self.pool['email.template'].send_mail( self.pool['email.template'].send_mail(
cr, uid, template_id, intrastat_id, context=context) self._cr, self._uid, mail_template.id, self.id,
context=self._context)
logger.info( logger.info(
'Intrastat Reminder email has been sent (XMLID: %s).' 'Intrastat Reminder email has been sent (XMLID: %s).'
% template_xmlid) % mail_template_xmlid)
else: else:
logger.warning( logger.warning(
'The list of users receiving the Intrastat Reminder is empty ' 'The list of users receiving the Intrastat Reminder is empty '
'on company %s' % company.name) 'on company %s' % self.company_id.name)
return True return True
@api.multi
def unlink(self):
for intrastat in self:
if intrastat.state == 'done':
raise Warning(
_('Cannot delete the declaration %s '
'because it is in Done state') % self.year_month)
return super(ReportIntrastatCommon, self).unlink()

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- <!--
Copyright (C) 2011-2013 Akretion (http://www.akretion.com/) Copyright (C) 2011-2014 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
--> -->

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- <!--
Copyright (C) 2011-2013 Akretion (http://www.akretion.com/) Copyright (C) 2011-2014 Akretion (http://www.akretion.com/)
The licence is in the file __openerp__.py The licence is in the file __openerp__.py
--> -->
@@ -9,7 +9,7 @@
<data> <data>
<!-- Menu entry for Intrastat --> <!-- Menu entry for Intrastat -->
<menuitem id="menu_intrastat_base_root" name="Intrastat reporting" parent="account.menu_finance_legal_statement" /> <menuitem id="menu_intrastat_base_root" name="Intrastat Reporting" parent="account.menu_finance_legal_statement" />
</data> </data>

View File

@@ -2,7 +2,7 @@
############################################################################## ##############################################################################
# #
# Report intrastat base module for OpenERP # Report intrastat base module for OpenERP
# Copyright (C) 2010-2013 Akretion (http://www.akretion.com/) # Copyright (C) 2010-2014 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,43 +20,32 @@
# #
############################################################################## ##############################################################################
from openerp.osv import orm, fields from openerp import models, fields, api, _
from openerp.tools.translate import _ from openerp.exceptions import ValidationError
class product_template(orm.Model): class ProductTemplate(models.Model):
_inherit = "product.template" _inherit = "product.template"
_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."),
'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 = { exclude_from_intrastat = fields.Boolean(
'exclude_from_intrastat': False, string='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(
string='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.")
def _check_accessory_cost(self, cr, uid, ids): @api.one
for product in self.browse(cr, uid, ids): @api.constrains('type', 'is_accessory_cost')
if product.is_accessory_cost and product.type != 'service': def _check_accessory_cost(self):
raise orm.except_orm( if self.is_accessory_cost and self.type != 'service':
_('Error :'), raise ValidationError(
_("The option 'Is accessory cost?' should only be " _("The option 'Is accessory cost?' should only be "
"activated on 'Service' products. You have activated " "activated on 'Service' products. You have activated "
"this option for the product '%s' which is of type " "this option for the product '%s' which is of type "
"'%s'" "'%s'"
% (product.name, product.type))) % (self.name, self.type)))
return True
_constraints = [
(_check_accessory_cost, "Error msg is in raise",
['is_accessory_cost', 'type'])
]

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- <!--
Copyright (C) 2010-2013 Akretion (http://www.akretion.com/) Copyright (C) 2010-2014 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
--> -->
@@ -9,11 +9,10 @@
<openerp> <openerp>
<data> <data>
<!-- Add field on product.product view --> <record id="product_template_form_view" model="ir.ui.view">
<record id="intrastat_base_product_normal_form" model="ir.ui.view"> <field name="name">intrastat.base.product.template.form</field>
<field name="name">intrastat.base.product.normal.form</field> <field name="model">product.template</field>
<field name="model">product.product</field> <field name="inherit_id" ref="account.product_template_form_view"/>
<field name="inherit_id" ref="account.product_normal_form_view" />
<field name="arch" type="xml"> <field name="arch" type="xml">
<group name="properties" position="after"> <group name="properties" position="after">
<group string="Intrastat Properties" name="intrastat"> <group string="Intrastat Properties" name="intrastat">
@@ -25,21 +24,5 @@
</field> </field>
</record> </record>
<!-- Same on product.template view -->
<record id="intrastat_base_product_template_form" model="ir.ui.view">
<field name="name">intrastat.base.product.template.form</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="account.product_template_form_view"/>
<field name="arch" type="xml">
<field name="supplier_taxes_id" position="after">
<group string="Intrastat Properties" name="intrastat">
<field name="exclude_from_intrastat" />
<field name="is_accessory_cost"
attrs="{'invisible': [('type', '!=', 'service')]}"/>
</group>
</field>
</field>
</record>
</data> </data>
</openerp> </openerp>

View File

@@ -1,8 +1,8 @@
# -*- encoding: utf-8 -*- # -*- encoding: utf-8 -*-
############################################################################## ##############################################################################
# #
# Report intrastat base module for OpenERP # Report intrastat base module for Odoo
# Copyright (C) 2011-2013 Akretion (http://www.akretion.com). # Copyright (C) 2011-2014 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 openerp.osv import orm, fields from openerp import models, fields
class account_tax(orm.Model): class AccountTax(models.Model):
_inherit = "account.tax" _inherit = "account.tax"
_columns = { exclude_from_intrastat_if_present = fields.Boolean(
'exclude_from_intrastat_if_present': fields.boolean( string='Exclude invoice line from intrastat if this tax is present',
'Exclude invoice line from intrastat if this tax is present', help="If this tax is present on an invoice line, this invoice "
help="If this tax is present on an invoice line, this invoice " "line will be skipped when generating Intrastat Product or "
"line will be skipped when generating Intrastat Product or " "Service lines from invoices.")
"Service lines from invoices."),
}

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-2014 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
--> -->
@@ -10,17 +10,14 @@
<data> <data>
<!-- Add 'exclude_from_intrastat_if_present' on tax form view --> <!-- Add 'exclude_from_intrastat_if_present' on tax form view -->
<record id="intrastat_base_tax" model="ir.ui.view"> <record id="view_tax_form" model="ir.ui.view">
<field name="name">intrastat.base.tax</field> <field name="name">intrastat.base.tax</field>
<field name="model">account.tax</field> <field name="model">account.tax</field>
<field name="type">form</field>
<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>
<field name="active" position="after"> <field name="active" position="after">
<field name="exclude_from_intrastat_if_present" /> <field name="exclude_from_intrastat_if_present" />
</field> </field>
</data>
</field> </field>
</record> </record>