Browse Source

Initial commit of the entirely new code for report_intrastat for France.

pull/79/head^2
Alexis de Lattre 13 years ago
commit
81aa1d46b4
  1. 29
      l10n_fr_intrastat_base/__init__.py
  2. 52
      l10n_fr_intrastat_base/__terp__.py
  3. 47
      l10n_fr_intrastat_base/account_invoice.py
  4. 173
      l10n_fr_intrastat_base/account_invoice_view.xml
  5. 24
      l10n_fr_intrastat_base/account_invoice_workflow.xml
  6. 32
      l10n_fr_intrastat_base/company.py
  7. 20
      l10n_fr_intrastat_base/company_view.xml
  8. 33
      l10n_fr_intrastat_base/country.py
  9. 84
      l10n_fr_intrastat_base/country_data.xml
  10. 30
      l10n_fr_intrastat_base/country_view.xml
  11. 24
      l10n_fr_intrastat_base/intrastat_demo.xml
  12. 35
      l10n_fr_intrastat_base/partner_address.py
  13. 35
      l10n_fr_intrastat_base/product.py
  14. 36
      l10n_fr_intrastat_base/product_view.xml
  15. 65
      l10n_fr_intrastat_base/report_intrastat.py
  16. 92
      l10n_fr_intrastat_base/report_intrastat_view.xml
  17. 2
      l10n_fr_intrastat_base/security/ir.model.access.csv

29
l10n_fr_intrastat_base/__init__.py

@ -0,0 +1,29 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (http://tiny.be). All Rights Reserved
# Copyright (C) 2010-2011 Akretion (http://www.akretion.com). All Rights Reserved
#
# 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/>.
#
##############################################################################
import report_intrastat
import country
import product
import account_invoice
import partner_address
import company

52
l10n_fr_intrastat_base/__terp__.py

@ -0,0 +1,52 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (http://tiny.be). All Rights Reserved
# Copyright (C) 2011 Akretion (http://www.akretion.com). All Rights Reserved
#
# 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/>.
#
##############################################################################
{
'name': 'Base module for Intrastat reporting (DEB + DES) for France',
'version': '1.1',
'category': 'Localisation/Report Intrastat',
'license': 'AGPL-3',
'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_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 the other 2 modules.
WARNING : this module conflicts with the module "report_intrastat" from the addons. If you have already installed the module "report_intrastat", you should uninstall it first before installing this module.
""",
'author': 'Akretion and OpenERP S.A.',
'website': 'http://www.akretion.com',
'depends': ['account'],
'init_xml': ['country_data.xml'],
'update_xml': [
'security/ir.model.access.csv',
'product_view.xml',
'country_view.xml',
'report_intrastat_view.xml',
'company_view.xml',
'account_invoice_view.xml',
'account_invoice_workflow.xml',
],
'demo_xml': ['intrastat_demo.xml'],
'installable': True,
'active': False,
}

47
l10n_fr_intrastat_base/account_invoice.py

@ -0,0 +1,47 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2009-2011 Akretion (http://www.akretion.com/) All Rights Reserved
#
# 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 osv import osv, fields
from tools.translate import _
class account_invoice(osv.osv):
_inherit = "account.invoice"
_columns = {
'intrastat_type_id': fields.many2one('report.intrastat.type', 'Intrastat Type',select=True,readonly=True, states={'draft':[('readonly',False)]}),
'state': fields.selection([
('draft','Draft'),
('legal_intrastat','Legal Intrastat'),
('proforma','Pro-forma'),
('proforma2','Pro-forma'),
('open','Open'),
('paid','Done'),
('cancel','Cancelled')
],'State', select=True, readonly=True),
'intrastat_only': fields.boolean('Intrastat Only'),
}
def intrastat_type_id_change(self, cr, uid, ids, intrastat_type_id):
if intrastat_type_id:
intrastat_only = self.pool.get('report.intrastat.type').browse(cr, uid, intrastat_type_id).intrastat_only
return {'value': {'intrastat_only': intrastat_only}}
account_invoice()

173
l10n_fr_intrastat_base/account_invoice_view.xml

@ -0,0 +1,173 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<record model="ir.ui.view" id="view_report_intrastat_invoice_supplier_form">
<field name="name">report.intrastat.invoice.supplier</field>
<field name="model">account.invoice</field>
<field name="inherit_id" ref="account.invoice_supplier_form" />
<field name="arch" type="xml">
<field name="check_total" position="after">
<field name="intrastat_type_id" on_change="intrastat_type_id_change(intrastat_type_id)" domain="[('company_id','=',company_id)]" required="1" />
<field name="intrastat_only" invisible="True" />
</field>
</field>
</record>
<record model="ir.ui.view" id="view_report_intrastat_invoice_form">
<field name="name">report.intrastat.invoice</field>
<field name="model">account.invoice</field>
<field name="inherit_id" ref="account.invoice_form" />
<field name="arch" type="xml">
<field name="payment_term" position="after">
<field name="intrastat_type_id" on_change="intrastat_type_id_change(intrastat_type_id)" domain="[('company_id','=',company_id)]" required="1" />
<field name="intrastat_only" invisible="True" />
</field>
</field>
</record>
<record model="ir.ui.view" id="view_report_intrastat_invoice_supplier_form_2">
<field name="name">report.intrastat.invoice.supplier.buttons</field>
<field name="model">account.invoice</field>
<field name="inherit_id" ref="account.invoice_supplier_form" />
<field name="arch" type="xml">
<button name="invoice_open" position="replace">
<group attrs="{'invisible':[('intrastat_only','=',True)]}">
<button name="invoice_open" states="draft,proforma2" string="Validate" icon="gtk-execute" />
</group>
<group attrs="{'invisible':[('intrastat_only','=',False)]}">
<button name="invoice_legal_intrastat" states="draft" string="Legal Intrastat" icon="gtk-execute" />
</group>
</button>
</field>
</record>
<record model="ir.ui.view" id="view_report_intrastat_invoice_supplier_form_3">
<field name="name">report.intrastat.invoice.supplier.buttons</field>
<field name="model">account.invoice</field>
<field name="inherit_id" ref="account.invoice_supplier_form" />
<field name="arch" type="xml">
<button name="invoice_cancel" position="replace">
<button name="invoice_cancel" states="draft,proforma2,sale,open,legal_intrastat" string="Cancel" icon="gtk-cancel" />
</button>
</field>
</record>
<record model="ir.ui.view" id="view_report_intrastat_invoice_form_2">
<field name="name">report.intrastat.invoice.buttons</field>
<field name="model">account.invoice</field>
<field name="inherit_id" ref="account.invoice_form" />
<field name="arch" type="xml">
<button name="invoice_open" position="replace">
<group attrs="{'invisible':[('intrastat_only','=',True)]}">
<button name="invoice_open" states="draft,proforma2" string="Create" icon="gtk-execute" />
</group>
<group attrs="{'invisible':[('intrastat_only','=',False)]}">
<button name="invoice_legal_intrastat" states="draft" string="Legal Intrastat" icon="gtk-execute" />
</group>
</button>
</field>
</record>
<record model="ir.ui.view" id="view_report_intrastat_invoice_form_3">
<field name="name">report.intrastat.invoice.buttons</field>
<field name="model">account.invoice</field>
<field name="inherit_id" ref="account.invoice_form" />
<field name="arch" type="xml">
<button name="invoice_cancel" position="replace">
<button name="invoice_cancel" states="draft,proforma2,sale,open,legal_intrastat" string="Cancel" icon="gtk-cancel" />
</button>
</field>
</record>
<record id="action_invoice_tree14" model="ir.actions.act_window">
<field name="name">Customer Intrastat Invoices</field>
<field name="res_model">account.invoice</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form,calendar,graph</field>
<field name="domain">[('state','in',['legal_intrastat']),('type','=','out_invoice')]</field>
<field name="context">{'type':'out_invoice'}</field>
</record>
<record id="action_invoice_tree14_view1" model="ir.actions.act_window.view">
<field eval="1" name="sequence" />
<field name="view_mode">tree</field>
<field name="act_window_id" ref="action_invoice_tree14" />
</record>
<record id="action_invoice_tree14_view2" model="ir.actions.act_window.view">
<field eval="2" name="sequence" />
<field name="view_mode">form</field>
<field name="view_id" ref="account.invoice_supplier_form" />
<field name="act_window_id" ref="action_invoice_tree14" />
</record>
<menuitem action="action_invoice_tree14" id="menu_action_invoice_tree14" parent="account.menu_action_invoice_tree1" />
<record id="action_invoice_tree15" model="ir.actions.act_window">
<field name="name">Supplier Intrastat Invoices</field>
<field name="res_model">account.invoice</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form,calendar,graph</field>
<field name="domain">[('state','in',['legal_intrastat']),('type','=','in_invoice')]</field>
<field name="context">{'type':'out_invoice'}</field>
</record>
<record id="action_invoice_tree15_view1" model="ir.actions.act_window.view">
<field eval="1" name="sequence" />
<field name="view_mode">tree</field>
<field name="act_window_id" ref="action_invoice_tree15" />
</record>
<record id="action_invoice_tree15_view2" model="ir.actions.act_window.view">
<field eval="2" name="sequence" />
<field name="view_mode">form</field>
<field name="view_id" ref="account.invoice_supplier_form" />
<field name="act_window_id" ref="action_invoice_tree15" />
</record>
<menuitem action="action_invoice_tree15" id="menu_action_invoice_tree15" parent="account.menu_action_invoice_tree2" />
<record id="action_invoice_tree16" model="ir.actions.act_window">
<field name="name">Customer Intrastat Refunds</field>
<field name="res_model">account.invoice</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form,calendar,graph</field>
<field name="domain">[('state','in',['legal_intrastat']),('type','=','out_refund')]</field>
<field name="context">{'type':'out_refund'}</field>
</record>
<record id="action_invoice_tree16_view1" model="ir.actions.act_window.view">
<field eval="1" name="sequence" />
<field name="view_mode">tree</field>
<field name="act_window_id" ref="action_invoice_tree16" />
</record>
<record id="action_invoice_tree16_view2" model="ir.actions.act_window.view">
<field eval="2" name="sequence" />
<field name="view_mode">form</field>
<field name="view_id" ref="account.invoice_supplier_form" />
<field name="act_window_id" ref="action_invoice_tree16" />
</record>
<menuitem action="action_invoice_tree16" id="menu_action_invoice_tree16" parent="account.menu_action_invoice_tree3" />
<record id="action_invoice_tree17" model="ir.actions.act_window">
<field name="name">Supplier Intrastat Refunds</field>
<field name="res_model">account.invoice</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form,calendar,graph</field>
<field name="domain">[('state','in',['legal_intrastat']),('type','=','in_refund')]</field>
<field name="context">{'type':'in_refund'}</field>
</record>
<record id="action_invoice_tree17_view1" model="ir.actions.act_window.view">
<field eval="1" name="sequence" />
<field name="view_mode">tree</field>
<field name="act_window_id" ref="action_invoice_tree17" />
</record>
<record id="action_invoice_tree17_view2" model="ir.actions.act_window.view">
<field eval="2" name="sequence" />
<field name="view_mode">form</field>
<field name="view_id" ref="account.invoice_supplier_form" />
<field name="act_window_id" ref="action_invoice_tree17" />
</record>
<menuitem action="action_invoice_tree17" id="menu_action_invoice_tree17" parent="account.menu_action_invoice_tree4" />
</data>
</openerp>

24
l10n_fr_intrastat_base/account_invoice_workflow.xml

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="act_legal_intrastat" model="workflow.activity">
<field name="wkf_id" ref="account.wkf" />
<field name="name">legal_intrastat</field>
<field name="action">write({'state':'legal_intrastat'})</field>
<field name="kind">function</field>
</record>
<record id="t1" model="workflow.transition">
<field name="act_from" ref="account.act_draft" />
<field name="act_to" ref="act_legal_intrastat" />
<field name="signal">invoice_legal_intrastat</field>
</record>
<record id="t2" model="workflow.transition">
<field name="act_from" ref="act_legal_intrastat" />
<field name="act_to" ref="account.act_cancel" />
<field name="signal">invoice_cancel</field>
</record>
</data>
</openerp>

32
l10n_fr_intrastat_base/company.py

@ -0,0 +1,32 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2009-2011 Akretion (http://www.akretion.com/) All Rights Reserved
#
# 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 osv import osv, fields
class res_company(osv.osv):
_name = "res.company"
_inherit = "res.company"
_columns = {
'intrastat_type_ids': fields.one2many('report.intrastat.type', 'company_id', 'Intrastat Type'),
}
res_company()

20
l10n_fr_intrastat_base/company_view.xml

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="fr_intrastat_base_company_form" model="ir.ui.view">
<field name="name">fr.intrastat.base.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="France intrastat settings">
<separator colspan="4" string="Intrastat Type" />
<field nolabel="1" colspan="4" name="intrastat_type_ids" />
</page>
</notebook>
</field>
</record>
</data>
</openerp>

33
l10n_fr_intrastat_base/country.py

@ -0,0 +1,33 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (http://tiny.be). All Rights Reserved
#
# 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 osv import osv, fields
class res_country(osv.osv):
_inherit = 'res.country'
_columns = {
'intrastat': fields.boolean('Intrastat member'),
}
_defaults = {
'intrastat': lambda *a: False,
}
res_country()

84
l10n_fr_intrastat_base/country_data.xml

@ -0,0 +1,84 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="1">
<record id="base.de" model="res.country">
<field eval="True" name="intrastat"/>
</record>
<record id="base.at" model="res.country">
<field eval="True" name="intrastat"/>
</record>
<record id="base.cy" model="res.country">
<field eval="True" name="intrastat"/>
</record>
<record id="base.dk" model="res.country">
<field eval="True" name="intrastat"/>
</record>
<record id="base.es" model="res.country">
<field eval="True" name="intrastat"/>
</record>
<record id="base.ee" model="res.country">
<field eval="True" name="intrastat"/>
</record>
<record id="base.fi" model="res.country">
<field eval="True" name="intrastat"/>
</record>
<record id="base.gr" model="res.country">
<field eval="True" name="intrastat"/>
</record>
<record id="base.hu" model="res.country">
<field eval="True" name="intrastat"/>
</record>
<record id="base.ie" model="res.country">
<field eval="True" name="intrastat"/>
</record>
<record id="base.it" model="res.country">
<field eval="True" name="intrastat"/>
</record>
<record id="base.lv" model="res.country">
<field eval="True" name="intrastat"/>
</record>
<record id="base.lt" model="res.country">
<field eval="True" name="intrastat"/>
</record>
<record id="base.lu" model="res.country">
<field eval="True" name="intrastat"/>
</record>
<record id="base.mt" model="res.country">
<field eval="True" name="intrastat"/>
</record>
<record id="base.nl" model="res.country">
<field eval="True" name="intrastat"/>
</record>
<record id="base.pl" model="res.country">
<field eval="True" name="intrastat"/>
</record>
<record id="base.pt" model="res.country">
<field eval="True" name="intrastat"/>
</record>
<record id="base.sk" model="res.country">
<field eval="True" name="intrastat"/>
</record>
<record id="base.cz" model="res.country">
<field eval="True" name="intrastat"/>
</record>
<record id="base.uk" model="res.country">
<field eval="True" name="intrastat"/>
</record>
<record id="base.si" model="res.country">
<field eval="True" name="intrastat"/>
</record>
<record id="base.se" model="res.country">
<field eval="True" name="intrastat"/>
</record>
<record id="base.ro" model="res.country">
<field eval="True" name="intrastat"/>
</record>
<record id="base.bg" model="res.country">
<field eval="True" name="intrastat"/>
</record>
<record id="base.be" model="res.country">
<field eval="True" name="intrastat"/>
</record>
</data>
</openerp>

30
l10n_fr_intrastat_base/country_view.xml

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- Add intrastat field on res_country -->
<record id="fr_intrastat_base_country_tree" model="ir.ui.view">
<field name="name">fr.intrastat.base.country.tree</field>
<field name="model">res.country</field>
<field name="inherit_id" ref="base.view_country_tree" />
<field name="arch" type="xml">
<field name="code" position="after">
<field name="intrastat" />
</field>
</field>
</record>
<record id="fr_intrastat_base_country_form" model="ir.ui.view">
<field name="name">fr.intrastat.base.country.form</field>
<field name="model">res.country</field>
<field name="inherit_id" ref="base.view_country_form" />
<field name="arch" type="xml">
<field name="code" position="after">
<field name="intrastat" select="1" />
</field>
</field>
</record>
</data>
</openerp>

24
l10n_fr_intrastat_base/intrastat_demo.xml

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="1">
<record id="regular_export" model="report.intrastat.type">
<field name="name">Regular export</field>
<field name="company_id" ref="base.main_company"/>
<field name="type">export</field>
</record>
<record id="regular_import" model="report.intrastat.type">
<field name="name">Regular import</field>
<field name="company_id" ref="base.main_company"/>
<field name="type">import</field>
</record>
<record id="other" model="report.intrastat.type">
<field name="name">Exclude from intrastat (special)</field>
<field name="company_id" ref="base.main_company"/>
<field name="type">other</field>
</record>
</data>
</openerp>

35
l10n_fr_intrastat_base/partner_address.py

@ -0,0 +1,35 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2010-2011 Akretion (http://www.akretion.com/) All Rights Reserved
#
# 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 osv import osv, fields
# We want to have the country field of partner_address always set
# because the selection of invoices for intrastat reports is based
# on the country of the invoice partner address !
class res_partner_address(osv.osv):
_name = 'res.partner.address'
_inherit = 'res.partner.address'
_columns = {
'country_id': fields.many2one('res.country', 'Country', required=True),
}
res_partner_address()

35
l10n_fr_intrastat_base/product.py

@ -0,0 +1,35 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2010-2011 Akretion (http://www.akretion.com/) All Rights Reserved
#
# 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 osv import osv, fields
class product_template(osv.osv):
_inherit = "product.template"
_columns = {
'exclude_from_intrastat': fields.boolean('Exclude from Intrastat reports', help="If true, the product or service will not taken into account for Intrastat Product or Service reports. So you should leave this field to false unless you have a good reason. Exemple of good reason : 'Shipping' is a service that should probably be excluded from the Intrastat Service report."),
}
_default = {
'exclude_from_intrastat': lambda *a: False,
}
product_template()

36
l10n_fr_intrastat_base/product_view.xml

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- Add field on product.product view -->
<record id="fr_intrastat_base_product_normal_form" model="ir.ui.view">
<field name="name">fr.intrastat.base.product.normal.form</field>
<field name="model">product.product</field>
<field name="inherit_id" ref="account.product_normal_form_view" />
<field name="arch" type="xml">
<data>
<field name="property_account_expense" position="after">
<separator string="Intrastat properties" colspan="4"/>
<field name="exclude_from_intrastat" select="2" />
</field>
</data>
</field>
</record>
<!-- Same on product.template view -->
<record id="fr_intrastat_base_product_template_form" model="ir.ui.view">
<field name="name">fr.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">
<data>
<field name="property_account_expense" position="after">
<separator string="Intrastat properties" colspan="4"/>
<field name="exclude_from_intrastat" select="2" />
</field>
</data>
</field>
</record>
</data>
</openerp>

65
l10n_fr_intrastat_base/report_intrastat.py

@ -0,0 +1,65 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2010-2011 Akretion (http://www.akretion.com/) All Rights Reserved
#
# 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 osv import osv, fields
from tools.translate import _
class report_intrastat_type(osv.osv):
_name = "report.intrastat.type"
_description = "Intrastat type"
_columns = {
'name': fields.char('Name',size=64,help="Name which appear when you select the Intrastat type on the invoice."),
'active' : fields.boolean('Active', help="The active field allows you to hide the Intrastat type without deleting it."),
'company_id': fields.many2one('res.company', 'Company'),
'type': fields.selection([('import', 'Import'),('export', 'Export'), ('other', 'Other')], 'Value', required=True, help="If 'Import' is selected, the corresponding invoices will be selected for the 'Intrastat Import' reports. Same for 'Export'. If 'Other' is selected, the corresponding invoices will NOT be selected in any Intrastat report ; so you should choose it for an invoice only in very particular cases."),
'intrastat_only': fields.boolean('Intrastat only', help="An invoice which has an Intrastat type which is 'Intrastat only' = true is not a real invoice i.e. once created it won't have an invoice number nor corresponding accounting entries. It follows a different path in the invoice workflow and it's state once created is called 'legal intrastat'. So the purpose of an 'intrastat only' invoice is to add entries to the Intrastat report without impacting anything else. This is used for example for a repair under warranty : nothing is invoiced to the customer, but it creates a movement of goods which should be part of the Intrastat report with a certain value.")
}
_defaults = {
'active': lambda *a: 1,
}
def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False):
if not args:
args=[]
if context is None:
context={}
ids = []
if context.get('type', False) == 'out_invoice':
args = args+['|',('type','=','export'), ('type','=','other')]
if context.get('type', False) == 'in_invoice':
args = args+['|',('type','=','import'), ('type','=','other')]
if context.get('type', False) == 'in_refund':
args = args+['|',('type','=','export'), ('type','=','other')]
if context.get('type', False) == 'out_refund':
args = args+['|',('type','=','import'), ('type','=','other')]
return super(report_intrastat_type,self).search(cr, user, args, offset, limit, order, context=context, count=count)
report_intrastat_type()

92
l10n_fr_intrastat_base/report_intrastat_view.xml

@ -0,0 +1,92 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- Intrastat Type - Tree view for Users > Companies-->
<record id="fr_intrastat_base_report_intrastat_type_tree" model="ir.ui.view">
<field name="name">fr.intrastat.base.report.intrastat.type.tree</field>
<field name="model">report.intrastat.type</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Intrastat Type">
<field name="name" />
<field name="type" />
<field name="intrastat_only" />
</tree>
</field>
</record>
<!-- Intrastat Type - Form view for Users > Companies-->
<record id="fr_intrastat_base_report_intrastat_type_form" model="ir.ui.view">
<field name="name">fr.intrastat.base.report.intrastat.type.form</field>
<field name="model">report.intrastat.type</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Intrastat Type">
<field name="name" select="1" />
<field name="active" select="2" />
<field name="type" select="1" />
<field name="intrastat_only" select="2" />
</form>
</field>
</record>
<!-- Intrastat type - Tree view for Configuration -->
<record id="fr_intrastat_base_report_intrastat_type_config_tree" model="ir.ui.view">
<field name="name">fr.intrastat.base.report.intrastat.type.config.tree</field>
<field name="model">report.intrastat.type</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Intrastat type">
<field name="company_id" />
<field name="name" />
<field name="type" />
<field name="intrastat_only" />
</tree>
</field>
</record>
<!-- Intrastat type - Form view for Configuration -->
<record id="fr_intrastat_base_report_intrastat_type_config_form" model="ir.ui.view">
<field name="name">fr.intrastat.base.report.intrastat.type.config.form</field>
<field name="model">report.intrastat.type</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Intrastat type">
<field name="company_id" select="1" />
<field name="name" select="1" />
<field name="active" select="2" />
<field name="type" select="1" />
<field name="intrastat_only" select="2" />
</form>
</field>
</record>
<!-- Intrastat type - Action for Configuration -->
<record id="act_fr_intrastat_base_report_intrastat_type_config" model="ir.actions.act_window">
<field name="name">Intrastat types</field>
<field name="res_model">report.intrastat.type</field>
<field name="view_type">form</field>
</record>
<record id="act_fr_intrastat_base_report_intrastat_type_config_tree" model="ir.actions.act_window.view">
<field eval="10" name="sequence" /> <!-- open tree view first -->
<field name="view_mode">tree</field>
<field name="view_id" ref="fr_intrastat_base_report_intrastat_type_config_tree" />
<field name="act_window_id" ref="act_fr_intrastat_base_report_intrastat_type_config" />
</record>
<record id="act_fr_intrastat_base_report_intrastat_type_config_form" model="ir.actions.act_window.view">
<field eval="20" name="sequence" />
<field name="view_mode">form</field>
<field name="view_id" ref="fr_intrastat_base_report_intrastat_type_config_form" />
<field name="act_window_id" ref="act_fr_intrastat_base_report_intrastat_type_config" />
</record>
<!-- Menu entry for Intrastat -->
<menuitem id="menu_fr_intrastat_base_root" name="Intrastat reporting" parent="account.menu_finance_legal_statement" />
</data>
</openerp>

2
l10n_fr_intrastat_base/security/ir.model.access.csv

@ -0,0 +1,2 @@
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
"access_report_intrastat_type","report.intrastat.type","model_report_intrastat_type","account.group_account_manager",1,1,1,1
Loading…
Cancel
Save