diff --git a/l10n_fr_intrastat_base/__init__.py b/intrastat_base/__init__.py similarity index 95% rename from l10n_fr_intrastat_base/__init__.py rename to intrastat_base/__init__.py index 4fbf7213..c5935680 100644 --- a/l10n_fr_intrastat_base/__init__.py +++ b/intrastat_base/__init__.py @@ -20,11 +20,8 @@ # ############################################################################## -import intrastat_type import country import product -import account_invoice import partner_address -import company import intrastat_common diff --git a/l10n_fr_intrastat_base/__terp__.py b/intrastat_base/__terp__.py similarity index 87% rename from l10n_fr_intrastat_base/__terp__.py rename to intrastat_base/__terp__.py index 4d0e4b1f..6ad92af0 100644 --- a/l10n_fr_intrastat_base/__terp__.py +++ b/intrastat_base/__terp__.py @@ -22,7 +22,7 @@ { - 'name': 'Base module for Intrastat reporting (DEB & DES) for France', + 'name': 'Base module for Intrastat reporting', 'version': '1.1', 'category': 'Localisation/Report Intrastat', 'license': 'AGPL-3', @@ -31,6 +31,8 @@ - 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 doesn't have any France-specific stuff. So it can be used as a basis for other intrastat modules for other EU countries. + 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. Please contact Alexis de Lattre from Akretion for any help or question about this module. @@ -38,17 +40,14 @@ Please contact Alexis de Lattre from Akretion for 'author': 'Akretion', 'website': 'http://www.akretion.com', 'depends': ['account'], - 'init_xml': ['country_data.xml', 'intrastat_type_data.xml'], + 'init_xml': ['country_data.xml'], 'update_xml': [ 'security/ir.model.access.csv', 'product_view.xml', 'country_view.xml', - 'intrastat_type_view.xml', - 'company_view.xml', - 'account_invoice_view.xml', - 'account_invoice_workflow.xml', + 'intrastat_menu.xml', ], - 'demo_xml': [], + 'demo_xml': ['product_demo.xml'], 'installable': True, 'active': False, } diff --git a/l10n_fr_intrastat_base/country.py b/intrastat_base/country.py similarity index 100% rename from l10n_fr_intrastat_base/country.py rename to intrastat_base/country.py diff --git a/l10n_fr_intrastat_base/country_data.xml b/intrastat_base/country_data.xml similarity index 100% rename from l10n_fr_intrastat_base/country_data.xml rename to intrastat_base/country_data.xml diff --git a/l10n_fr_intrastat_base/country_view.xml b/intrastat_base/country_view.xml similarity index 75% rename from l10n_fr_intrastat_base/country_view.xml rename to intrastat_base/country_view.xml index 3e7d4321..faa85d90 100644 --- a/l10n_fr_intrastat_base/country_view.xml +++ b/intrastat_base/country_view.xml @@ -9,8 +9,8 @@ - - fr.intrastat.base.country.tree + + intrastat.base.country.tree res.country @@ -20,8 +20,8 @@ - - fr.intrastat.base.country.form + + intrastat.base.country.form res.country diff --git a/l10n_fr_intrastat_base/intrastat_common.py b/intrastat_base/intrastat_common.py similarity index 94% rename from l10n_fr_intrastat_base/intrastat_common.py rename to intrastat_base/intrastat_common.py index ff7b4b1d..d7e6ec89 100644 --- a/l10n_fr_intrastat_base/intrastat_common.py +++ b/intrastat_base/intrastat_common.py @@ -30,7 +30,6 @@ class report_intrastat_common(osv.osv_memory): _description = "Common functions for intrastat reports for products and services" def _compute_numbers(self, cr, uid, ids, object, context=None): - print "COMMON START compute numbers ids=", ids result = {} for intrastat in object.browse(cr, uid, ids, context=context): total_amount = 0.0 @@ -39,18 +38,15 @@ class report_intrastat_common(osv.osv_memory): total_amount += line.amount_company_currency num_lines += 1 result[intrastat.id] = {'num_lines': num_lines, 'total_amount': total_amount} - print "COMMON _compute_numbers res = ", result return result def _compute_end_date(self, cr, uid, ids, object, context=None): - print "COMMON _compute_end_date START ids=", ids result = {} for intrastat in object.browse(cr, uid, ids, context=context): 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') result[intrastat.id] = end_date_str - print "COMMON _compute_end_date res=", result return result @@ -64,7 +60,6 @@ class report_intrastat_common(osv.osv_memory): def _check_generate_lines(self, cr, uid, ids, intrastat, context=None): - print "START _check_generate_lines ids=", ids if len(ids) != 1: raise osv.except_osv(_('Error :'), 'Hara kiri in generate_lines') if not intrastat.company_id.currency_id.code: @@ -75,7 +70,6 @@ class report_intrastat_common(osv.osv_memory): def _check_generate_xml(self, cr, uid, ids, intrastat, context=None): - print "START _check_generate_xml ids=", ids if len(ids) != 1: raise osv.except_osv(_('Error :'), 'Hara kiri in generate_xml') if not intrastat.company_id.partner_id.vat: @@ -108,7 +102,6 @@ class report_intrastat_common(osv.osv_memory): attach_obj = self.pool.get('ir.attachment') if not context: context = {} - print "object name = ", 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) return None diff --git a/intrastat_base/intrastat_menu.xml b/intrastat_base/intrastat_menu.xml new file mode 100644 index 00000000..42888ca9 --- /dev/null +++ b/intrastat_base/intrastat_menu.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + diff --git a/l10n_fr_intrastat_base/partner_address.py b/intrastat_base/partner_address.py similarity index 100% rename from l10n_fr_intrastat_base/partner_address.py rename to intrastat_base/partner_address.py diff --git a/l10n_fr_intrastat_base/product.py b/intrastat_base/product.py similarity index 100% rename from l10n_fr_intrastat_base/product.py rename to intrastat_base/product.py diff --git a/intrastat_base/product_demo.xml b/intrastat_base/product_demo.xml new file mode 100644 index 00000000..f29f16dd --- /dev/null +++ b/intrastat_base/product_demo.xml @@ -0,0 +1,22 @@ + + + + + + + + + Shipping costs + SHIP + service + + 30 + False + + + + diff --git a/l10n_fr_intrastat_base/product_view.xml b/intrastat_base/product_view.xml similarity index 66% rename from l10n_fr_intrastat_base/product_view.xml rename to intrastat_base/product_view.xml index 30d253c6..71737655 100644 --- a/l10n_fr_intrastat_base/product_view.xml +++ b/intrastat_base/product_view.xml @@ -10,30 +10,34 @@ - - fr.intrastat.base.product.normal.form + + intrastat.base.product.normal.form product.product - + + + - - fr.intrastat.base.product.template.form + + intrastat.base.product.template.form product.template - + + + diff --git a/l10n_fr_intrastat_base/security/ir.model.access.csv b/intrastat_base/security/ir.model.access.csv similarity index 64% rename from l10n_fr_intrastat_base/security/ir.model.access.csv rename to intrastat_base/security/ir.model.access.csv index fe43ec70..d7a2bf1c 100644 --- a/l10n_fr_intrastat_base/security/ir.model.access.csv +++ b/intrastat_base/security/ir.model.access.csv @@ -1,3 +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 "access_report_intrastat_common","Read access on report.intrastat.common","model_report_intrastat_common","base.group_user",1,0,0,0 diff --git a/l10n_fr_intrastat_base/account_invoice.py b/l10n_fr_intrastat_base/account_invoice.py deleted file mode 100644 index 56196eb4..00000000 --- a/l10n_fr_intrastat_base/account_invoice.py +++ /dev/null @@ -1,47 +0,0 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# -# Report intrastat base module for OpenERP -# 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 . -# -############################################################################## - -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() - diff --git a/l10n_fr_intrastat_base/account_invoice_view.xml b/l10n_fr_intrastat_base/account_invoice_view.xml deleted file mode 100644 index 79b2b78c..00000000 --- a/l10n_fr_intrastat_base/account_invoice_view.xml +++ /dev/null @@ -1,173 +0,0 @@ - - - - - report.intrastat.invoice.supplier - account.invoice - - - - - - - - - - - report.intrastat.invoice - account.invoice - - - - - - - - - - - report.intrastat.invoice.supplier.buttons - account.invoice - - - - - - - - report.intrastat.invoice.supplier.buttons - account.invoice - - - - - - - - report.intrastat.invoice.buttons - account.invoice - - - - - - - - report.intrastat.invoice.buttons - account.invoice - - - - - - - - Customer Intrastat Invoices - account.invoice - form - tree,form,calendar,graph - [('state','in',['legal_intrastat']),('type','=','out_invoice')] - {'type':'out_invoice'} - - - - tree - - - - - form - - - - - - - - - Supplier Intrastat Invoices - account.invoice - form - tree,form,calendar,graph - [('state','in',['legal_intrastat']),('type','=','in_invoice')] - {'type':'out_invoice'} - - - - tree - - - - - form - - - - - - - - - Customer Intrastat Refunds - account.invoice - form - tree,form,calendar,graph - [('state','in',['legal_intrastat']),('type','=','out_refund')] - {'type':'out_refund'} - - - - tree - - - - - form - - - - - - - - Supplier Intrastat Refunds - account.invoice - form - tree,form,calendar,graph - [('state','in',['legal_intrastat']),('type','=','in_refund')] - {'type':'in_refund'} - - - - tree - - - - - form - - - - - - - - \ No newline at end of file diff --git a/l10n_fr_intrastat_base/account_invoice_workflow.xml b/l10n_fr_intrastat_base/account_invoice_workflow.xml deleted file mode 100644 index 8814135a..00000000 --- a/l10n_fr_intrastat_base/account_invoice_workflow.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - legal_intrastat - write({'state':'legal_intrastat'}) - function - - - - - - invoice_legal_intrastat - - - - - - invoice_cancel - - - diff --git a/l10n_fr_intrastat_base/company.py b/l10n_fr_intrastat_base/company.py deleted file mode 100644 index 22dccc6a..00000000 --- a/l10n_fr_intrastat_base/company.py +++ /dev/null @@ -1,32 +0,0 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# -# Report intrastat base module for OpenERP -# 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 . -# -############################################################################## - -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() - diff --git a/l10n_fr_intrastat_base/company_view.xml b/l10n_fr_intrastat_base/company_view.xml deleted file mode 100644 index 1fa71c65..00000000 --- a/l10n_fr_intrastat_base/company_view.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - fr.intrastat.base.company.form - res.company - - - - - - - - - - - - - diff --git a/l10n_fr_intrastat_base/intrastat_type.py b/l10n_fr_intrastat_base/intrastat_type.py deleted file mode 100644 index 4d00e9ac..00000000 --- a/l10n_fr_intrastat_base/intrastat_type.py +++ /dev/null @@ -1,65 +0,0 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# -# Report intrastat base module for OpenERP -# 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 . -# -############################################################################## - -from osv import osv, fields - - -class report_intrastat_type(osv.osv): - _name = "report.intrastat.type" - _description = "Intrastat type" - _order = "type, intrastat_only" - _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() - diff --git a/l10n_fr_intrastat_base/intrastat_type_data.xml b/l10n_fr_intrastat_base/intrastat_type_data.xml deleted file mode 100644 index a65ce931..00000000 --- a/l10n_fr_intrastat_base/intrastat_type_data.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - Regular export - - export - - - - Regular import - - import - - - - Exclude from intrastat (special) - - other - - - - diff --git a/l10n_fr_intrastat_base/intrastat_type_view.xml b/l10n_fr_intrastat_base/intrastat_type_view.xml deleted file mode 100644 index f3cc92a5..00000000 --- a/l10n_fr_intrastat_base/intrastat_type_view.xml +++ /dev/null @@ -1,98 +0,0 @@ - - - - - - - - - - fr.intrastat.base.report.intrastat.type.tree - report.intrastat.type - tree - - - - - - - - - - - - fr.intrastat.base.report.intrastat.type.form - report.intrastat.type - form - -
- - - - - - -
- - - - fr.intrastat.base.report.intrastat.type.config.tree - report.intrastat.type - tree - - - - - - - - - - - - - fr.intrastat.base.report.intrastat.type.config.form - report.intrastat.type - form - -
- - - - - - - -
- - - - - Intrastat types - report.intrastat.type - form - - - - - tree - - - - - - - form - - - - - - - - -
-