[MIG] intrastat_base: Migration to 11.0

This commit is contained in:
Kumar Aberer
2018-03-09 16:29:05 +01:00
committed by Alexis de Lattre
parent 35c04a5ded
commit e419e9e3a8
7 changed files with 43 additions and 33 deletions

View File

@@ -62,6 +62,7 @@ Contributors
* Alexis de Lattre, Akretion <alexis.delattre@akretion.com> * Alexis de Lattre, Akretion <alexis.delattre@akretion.com>
* Luc De Meyer, Noviat <info@noviat.com> * Luc De Meyer, Noviat <info@noviat.com>
* Kumar Aberer, brain-tec AG <kumar.aberer@braintec-group.com>
Maintainer Maintainer
---------- ----------

View File

@@ -1,16 +1,17 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# © 2011-2016 Akretion (http://www.akretion.com) # © 2011-2016 Akretion (http://www.akretion.com)
# © 2018 brain-tec AG (Kumar Aberer <kumar.aberer@braintec-group.com>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{ {
'name': 'Intrastat Reporting Base', 'name': 'Intrastat Reporting Base',
'version': '10.0.1.0.0', 'version': '11.0.1.0.0',
'category': 'Intrastat', 'category': 'Intrastat',
'license': 'AGPL-3', 'license': 'AGPL-3',
'summary': 'Base module for Intrastat reporting', 'summary': 'Base module for Intrastat reporting',
'author': 'Akretion,Odoo Community Association (OCA)', 'author': 'Akretion,Odoo Community Association (OCA), brain-tec AG',
'website': 'http://www.akretion.com', 'website': 'http://www.akretion.com',
'depends': ['base_vat'], 'depends': ['base_vat', 'account'],
'conflicts': ['report_intrastat'], 'conflicts': ['report_intrastat'],
'data': [ 'data': [
'data/country_data.xml', 'data/country_data.xml',
@@ -18,7 +19,7 @@
'views/res_partner.xml', 'views/res_partner.xml',
'views/res_country.xml', 'views/res_country.xml',
'views/account_tax.xml', 'views/account_tax.xml',
'views/account_config_settings.xml', 'views/res_config_settings.xml',
'views/intrastat.xml', 'views/intrastat.xml',
], ],
'demo': [ 'demo': [

View File

@@ -4,5 +4,5 @@ from . import res_country
from . import product_template from . import product_template
from . import account_tax from . import account_tax
from . import res_company from . import res_company
from . import account_config_settings from . import res_config_settings
from . import intrastat_common from . import intrastat_common

View File

@@ -57,14 +57,14 @@ class IntrastatCommon(models.AbstractModel):
def _check_xml_schema(self, xml_string, xsd_file): def _check_xml_schema(self, 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
from StringIO import StringIO from io import StringIO
xsd_etree_obj = etree.parse( xsd_etree_obj = etree.parse(
tools.file_open(xsd_file)) tools.file_open(xsd_file))
official_schema = etree.XMLSchema(xsd_etree_obj) official_schema = etree.XMLSchema(xsd_etree_obj)
try: try:
t = etree.parse(StringIO(xml_string)) t = etree.parse(StringIO(xml_string))
official_schema.assertValid(t) official_schema.assertValid(t)
except Exception, e: except Exception as 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(

View File

@@ -1,12 +1,13 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# © 2017 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>) # © 2017 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
# © 2018 brain-tec AG (Kumar Aberer <kumar.aberer@braintec-group.com>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import models, fields from odoo import models, fields
class AccountConfigSettings(models.TransientModel): class ResConfigSettings(models.TransientModel):
_inherit = 'account.config.settings' _inherit = 'res.config.settings'
intrastat_remind_user_ids = fields.Many2many( intrastat_remind_user_ids = fields.Many2many(
related='company_id.intrastat_remind_user_ids') related='company_id.intrastat_remind_user_ids')

View File

@@ -1,23 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
© 2013-2017 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
<odoo>
<record id="view_account_config_settings" model="ir.ui.view">
<field name="name">intrastat.account.config.settings.form</field>
<field name="model">account.config.settings</field>
<field name="inherit_id" ref="account.view_account_config_settings" />
<field name="arch" type="xml">
<xpath expr="//field[@name='overdue_msg']/.." position="after">
<group name="intrastat" string="Intrastat">
<field name="intrastat_remind_user_ids" widget="many2many_tags" />
</group>
</xpath>
</field>
</record>
</odoo>

View File

@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
© 2013-2017 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
© 2018 brain-tec AG (Kumar Aberer <kumar.aberer@braintec-group.com>)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
<odoo>
<record id="view_intrastat_res_config_settings" model="ir.ui.view">
<field name="name">intrastat.res.config.settings.form</field>
<field name="model">res.config.settings</field>
<field name="inherit_id" ref="account.res_config_settings_view_form"/>
<field name="arch" type="xml">
<xpath expr="//div[@id='recommended_apps']" position="after">
<h2>Intrastat</h2>
<div class="row mt16 o_settings_container" id="intrastat">
<div class="col-xs-12 col-md-6 o_setting_box">
<div class="o_setting_right_pane">
<label for="intrastat_remind_user_ids"/>
<field name="intrastat_remind_user_ids" widget="many2many_tags"/>
</div>
</div>
</div>
</xpath>
</field>
</record>
</odoo>