[IMP] intrastat_base: Several improvements:

* Use l10n_fr_* : use the method _company_default_get() intrastat_base : - the module is now PEP-8 compliant ! - add search view on countries - is_accessory_cost is now invisible when product != service - update POT file and FR translation - remove double import of logging lib
* Add context in on_change (to be able to use web_context_tunnel) XSD files are now pure XSD files, not python file with the content as string. Convert l10n_fr_intrastat_service to PEP-8 Start to convert l10n_fr_intrastat_product to PEP-8 (not finished yet) l10n_fr_intrastat_product : Update POT file and FR translation.
* l10n_fr_intrastat_service : update POT file and FR translation. l10n_fr_intrastat_product : continue PEP-8 compliance
This commit is contained in:
Alexis de Lattre
2014-04-14 16:32:08 +02:00
committed by Alexis de Lattre
parent 961fc07d3f
commit a6f5a904f2
9 changed files with 426 additions and 293 deletions

View File

@@ -27,7 +27,8 @@ 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):
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] = ''
@@ -39,21 +40,24 @@ class res_company(orm.Model):
return result
_columns = {
'intrastat_remind_user_ids': fields.many2many('res.users',
id1='company_id', id2='user_id',
'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.'),
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'),
}
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))
raise orm.except_orm(
_('Error :'),
_("Missing e-mail address on user '%s'.")
% (user.name))
return True
_constraints = [

View File

@@ -2,7 +2,7 @@
##############################################################################
#
# Report intrastat base module for OpenERP
# Copyright (C) 2011-2013 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>
#
# This program is free software: you can redistribute it and/or modify
@@ -26,7 +26,9 @@ from openerp.osv import orm, fields
class res_country(orm.Model):
_inherit = 'res.country'
_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."),
}
_defaults = {

View File

@@ -31,6 +31,21 @@
</field>
</record>
<!-- there is no native search view, so I can't inherit -->
<record id="intrastat_base_country_search" model="ir.ui.view">
<field name="name">intrastat.base.country.search</field>
<field name="model">res.country</field>
<field name="arch" type="xml">
<search string="Search Countries">
<field name="name" />
<field name="code" />
<filter name="intrastat" string="EU Country"
domain="[('intrastat', '=', True)]" />
</search>
</field>
</record>
</data>
</openerp>

View File

@@ -4,11 +4,11 @@
#
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 6.0.4\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2012-06-05 13:28+0000\n"
"PO-Revision-Date: 2012-06-05 13:28+0000\n"
"Last-Translator: <>\n"
"Project-Id-Version: OpenERP Server 7.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-04-14 14:18+0000\n"
"PO-Revision-Date: 2014-04-14 14:18+0000\n"
"Last-Translator: Alexis de Lattre <alexis.delattre@akretion.com>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@@ -16,122 +16,24 @@ msgstr ""
"Plural-Forms: \n"
#. module: intrastat_base
#: model:ir.ui.menu,name:intrastat_base.menu_intrastat_base_root
msgid "Intrastat reporting"
msgstr "DEB et DES"
#: help:product.template,is_accessory_cost:0
msgid "Activate this option for shipping costs, packaging costs and all services related to the sale of products. This option is used for Intrastat reports."
msgstr "Activez cette option pour les frais de port, les frais d'emballage et tous les services liés à la vente de produits physiques. Cette option est utilisée pour la DEB et la DES."
#. module: intrastat_base
#: sql_constraint:res.country:0
msgid "The code of the country must be unique !"
msgstr "Le code du pays doit être unique !"
#. module: intrastat_base
#: constraint:product.template:0
msgid "Error: The default UOM and the purchase UOM must be in the same category."
msgstr "Erreur: l'UdM par défaut et l'UdM d'achat doivent appartenir à la même catégorie."
#. module: intrastat_base
#: code:addons/intrastat_base/intrastat_common.py:64
#: code:addons/intrastat_base/intrastat_common.py:70
#: code:addons/intrastat_base/intrastat_common.py:85
#: code:addons/intrastat_base/intrastat_common.py:93
#: code:addons/intrastat_base/product.py:41
#, python-format
msgid "Error :"
msgstr "Erreur :"
#. module: intrastat_base
#: model:ir.model,name:intrastat_base.model_account_tax
msgid "account.tax"
msgstr "account.tax"
#. module: intrastat_base
#: field:account.tax,exclude_from_intrastat_if_present:0
msgid "Exclude invoice line from intrastat if this tax is present"
msgstr "Exclue la ligne de facture de la DEB/DES si cette taxe est présente"
#. module: intrastat_base
#: help:res.country,intrastat:0
msgid "Set as True for countries that must be selected in the intrastat reports, i.e. for all European Union countries other than your own country."
msgstr "Activer cette option pour les pays qui doivent être inclus dans la DEB et la DES, i.e. tous les pays de l'Union Européenne sauf votre propre pays."
#. module: intrastat_base
#: view:product.product:0
#: view:product.template:0
msgid "Intrastat properties"
msgstr "Paramètres pour la DEB et la DES"
#. module: intrastat_base
#: model:ir.module.module,description:intrastat_base.module_meta_information
msgid "This module contains the common functions for 2 other modules :\n"
"- l10n_fr_intrastat_service : the module for the \"Déclaration Européenne des Services\" (DES)\n"
"- l10n_fr_intrastat_product : the module for the \"Déclaration d'Echange de Biens\" (DEB)\n"
"This module is not usefull if it's not used together with one of those 2 modules.\n"
"\n"
"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.\n"
"\n"
"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.\n"
"\n"
"Please contact Alexis de Lattre from Akretion <alexis.delattre@akretion.com> for any help or question about this module.\n"
" "
msgstr "This module contains the common functions for 2 other modules :\n"
"- l10n_fr_intrastat_service : the module for the \"Déclaration Européenne des Services\" (DES)\n"
"- l10n_fr_intrastat_product : the module for the \"Déclaration d'Echange de Biens\" (DEB)\n"
"This module is not usefull if it's not used together with one of those 2 modules.\n"
"\n"
"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.\n"
"\n"
"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.\n"
"\n"
"Please contact Alexis de Lattre from Akretion <alexis.delattre@akretion.com> for any help or question about this module.\n"
" "
#. module: intrastat_base
#: sql_constraint:res.country:0
msgid "The name of the country must be unique !"
msgstr "Le nom du pays doit être unique !"
#. module: intrastat_base
#: constraint:product.template:0
msgid "Error msg is in raise"
msgstr "Error msg is in raise"
#. module: intrastat_base
#: help:account.tax,exclude_from_intrastat_if_present:0
msgid "If this tax is present on an invoice line, this invoice line will be skipped when generating Intrastat Product or Service lines from invoices."
msgstr "Si cette taxe est présente sur une ligne de facture, cette ligne de facture ne sera pas prise en compte lors de la génération de la DEB et de la DES depuis les factures."
#. module: intrastat_base
#: field:product.template,is_accessory_cost:0
msgid "Is accessory cost"
msgstr "Frais accessoires"
#. module: intrastat_base
#: field:res.country,intrastat:0
msgid "Intrastat country"
msgstr "Pays intrastat"
#. module: intrastat_base
#: help:product.template,exclude_from_intrastat:0
msgid "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."
msgstr "Si l'option est activée, le produit ou service ne sera pris en compte ni pour la DEB ni pour la DES. Cette option doit donc rester désactivée sauf si vous avez une très bonne raison."
#. module: intrastat_base
#: code:addons/intrastat_base/intrastat_common.py:64
#, python-format
msgid "The company currency must be 'EUR', but is currently '%s'."
msgstr "La monnaie de la société doit être 'EUR', mais est actuellement '%s'."
#. module: intrastat_base
#: code:addons/intrastat_base/intrastat_common.py:70
#, python-format
msgid "The VAT number is not set for the partner '%s'."
msgstr "Le numéro de TVA n'est pas renseigné pour le partenaire '%s'."
#: view:res.company:0
msgid "Common Intrastat Settings"
msgstr "Paramètres communs DEB et DES"
#. module: intrastat_base
#: model:ir.model,name:intrastat_base.model_report_intrastat_common
msgid "Common functions for intrastat reports for products and services"
msgstr "Common functions for intrastat reports for products and services"
msgstr "Fonctions communes pour la DEB et la DES"
#. module: intrastat_base
#: model:ir.model,name:intrastat_base.model_res_company
msgid "Companies"
msgstr "Sociétés"
#. module: intrastat_base
#: model:ir.model,name:intrastat_base.model_res_country
@@ -139,14 +41,26 @@ msgid "Country"
msgstr "Pays"
#. module: intrastat_base
#: model:ir.model,name:intrastat_base.model_product_template
msgid "Product Template"
msgstr "Modèle de produit"
#: view:res.country:0
#: field:res.country,intrastat:0
msgid "EU Country"
msgstr "Pays UE"
#. module: intrastat_base
#: model:ir.module.module,shortdesc:intrastat_base.module_meta_information
msgid "Base module for Intrastat reporting"
msgstr "Module de base pour les rapports intrastat"
#: code:addons/intrastat_base/company.py:58
#: code:addons/intrastat_base/intrastat_common.py:77
#: code:addons/intrastat_base/intrastat_common.py:82
#: code:addons/intrastat_base/intrastat_common.py:90
#: code:addons/intrastat_base/intrastat_common.py:110
#: code:addons/intrastat_base/product.py:51
#, python-format
msgid "Error :"
msgstr "Erreur :"
#. module: intrastat_base
#: constraint:product.template:0
msgid "Error msg is in raise"
msgstr "Error msg is in raise"
#. module: intrastat_base
#: field:product.template,exclude_from_intrastat:0
@@ -154,9 +68,76 @@ msgid "Exclude from Intrastat reports"
msgstr "Exclure de la DEB et de la DES"
#. module: intrastat_base
#: help:product.template,is_accessory_cost:0
msgid "Activate this option for shipping costs, packaging costs and all services related to the sale of products. This option is used for Intrastat reports."
msgstr "Activez cette option pour les frais de port, les frais d'emballage et tous les services liés à la vente de produits physiques. Cette option est utilisée pour la DEB et la DES."
#: field:account.tax,exclude_from_intrastat_if_present:0
msgid "Exclude invoice line from intrastat if this tax is present"
msgstr "Exclue la ligne de facture de la DEB/DES si cette taxe est présente"
#. module: intrastat_base
#: help:product.template,exclude_from_intrastat:0
msgid "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."
msgstr "Si l'option est activée, le produit ou service ne sera pris en compte ni pour la DEB ni pour la DES. Cette option doit donc rester désactivée sauf si vous avez une très bonne raison."
#. module: intrastat_base
#: help:account.tax,exclude_from_intrastat_if_present:0
msgid "If this tax is present on an invoice line, this invoice line will be skipped when generating Intrastat Product or Service lines from invoices."
msgstr "Si cette taxe est présente sur une ligne de facture, cette ligne de facture ne sera pas prise en compte lors de la génération de la DEB et de la DES depuis les factures."
#. module: intrastat_base
#: view:product.product:0
#: view:product.template:0
msgid "Intrastat Properties"
msgstr "Propriétés DEB/DES"
#. module: intrastat_base
#: view:res.company:0
msgid "Intrastat Settings"
msgstr "Configuration DEB/DES"
#. module: intrastat_base
#: model:ir.ui.menu,name:intrastat_base.menu_intrastat_base_root
msgid "Intrastat reporting"
msgstr "DEB et DES"
#. module: intrastat_base
#: field:product.template,is_accessory_cost:0
msgid "Is accessory cost"
msgstr "Frais accessoires"
#. module: intrastat_base
#: help:res.company,intrastat_remind_user_ids:0
msgid "List of OpenERP users who will receive a notification to remind them about the Intrastat declaration."
msgstr "Liste d'utilisateurs OpenERP qui recevront le rappel pour la DEB et/ou la DES."
#. module: intrastat_base
#: field:res.company,intrastat_email_list:0
msgid "List of emails of Users Receiving the Intrastat Reminder"
msgstr "Liste des emails d'utilisateurs qui recevront le rappel pour la DEB et/ou la DES"
#. module: intrastat_base
#: code:addons/intrastat_base/company.py:59
#, python-format
msgid "Missing e-mail address on user '%s'."
msgstr "Adresse e-mail manquante sur l'utilisateur '%s'."
#. module: intrastat_base
#: model:ir.model,name:intrastat_base.model_res_partner
msgid "Partner"
msgstr "Partenaire"
#. module: intrastat_base
#: model:ir.model,name:intrastat_base.model_product_template
msgid "Product Template"
msgstr "Modèle d'article"
#. module: intrastat_base
#: view:res.country:0
msgid "Search Countries"
msgstr "Recherche des pays"
#. module: intrastat_base
#: help:res.country,intrastat:0
msgid "Set to True for all European Union countries."
msgstr "A cocher pour tous les pays de l'Union Européenne."
#. module: intrastat_base
#: model:product.template,name:intrastat_base.shipping_costs_exclude_product_template
@@ -164,13 +145,47 @@ msgid "Shipping costs"
msgstr "Frais de port"
#. module: intrastat_base
#: code:addons/intrastat_base/intrastat_common.py:85
#: model:ir.model,name:intrastat_base.model_account_tax
msgid "Tax"
msgstr "Taxes"
#. module: intrastat_base
#: code:addons/intrastat_base/intrastat_common.py:91
#, python-format
msgid "The VAT number is not set for the partner '%s'."
msgstr "Le numéro de TVA n'est pas renseigné pour le partenaire '%s'."
#. module: intrastat_base
#: code:addons/intrastat_base/intrastat_common.py:83
#, python-format
msgid "The company currency must be 'EUR', but is currently '%s'."
msgstr "La monnaie de la société doit être 'EUR', mais est actuellement '%s'."
#. module: intrastat_base
#: code:addons/intrastat_base/intrastat_common.py:78
#, python-format
msgid "The country is not set on the company '%s'."
msgstr "Le pays n'est pas renseigné sur la société '%s'."
#. module: intrastat_base
#: code:addons/intrastat_base/intrastat_common.py:111
#, python-format
msgid "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."
msgstr "La validation du fichier XML avec le schéma XML officiel a échoué. Le fichier XML généré et le détail de l'erreur ont été écrits dans les logs du serveur. Voici le message d'erreur, qui peut vous donner une idée de la cause du problème : %s."
#. module: intrastat_base
#: model:ir.model,name:intrastat_base.model_res_partner_address
msgid "Partner Addresses"
msgstr "Carnet d'adresses"
#: code:addons/intrastat_base/product.py:56
#, python-format
msgid "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'"
msgstr "L'option 'Frais accessoires' ne doit être activée que sur les produits de type 'Service'. Vous avez activé cette option sur le produit '%s' qui est de type '%s'"
#. module: intrastat_base
#: field:res.company,intrastat_remind_user_ids:0
msgid "Users Receiving the Intrastat Reminder"
msgstr "Utilisateurs qui reçoivent le rappel DEB/DES"
#. module: intrastat_base
#: constraint:res.company:0
msgid "error msg in raise"
msgstr "error msg in raise"

View File

@@ -4,10 +4,10 @@
#
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 6.0.4\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2012-06-05 13:28+0000\n"
"PO-Revision-Date: 2012-06-05 13:28+0000\n"
"Project-Id-Version: OpenERP Server 7.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-04-14 14:18+0000\n"
"PO-Revision-Date: 2014-04-14 14:18+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@@ -16,106 +16,13 @@ msgstr ""
"Plural-Forms: \n"
#. module: intrastat_base
#: model:ir.ui.menu,name:intrastat_base.menu_intrastat_base_root
msgid "Intrastat reporting"
#: help:product.template,is_accessory_cost:0
msgid "Activate this option for shipping costs, packaging costs and all services related to the sale of products. This option is used for Intrastat reports."
msgstr ""
#. module: intrastat_base
#: sql_constraint:res.country:0
msgid "The code of the country must be unique !"
msgstr ""
#. module: intrastat_base
#: constraint:product.template:0
msgid "Error: The default UOM and the purchase UOM must be in the same category."
msgstr ""
#. module: intrastat_base
#: code:addons/intrastat_base/intrastat_common.py:64
#: code:addons/intrastat_base/intrastat_common.py:70
#: code:addons/intrastat_base/intrastat_common.py:85
#: code:addons/intrastat_base/intrastat_common.py:93
#: code:addons/intrastat_base/product.py:41
#, python-format
msgid "Error :"
msgstr ""
#. module: intrastat_base
#: model:ir.model,name:intrastat_base.model_account_tax
msgid "account.tax"
msgstr ""
#. module: intrastat_base
#: field:account.tax,exclude_from_intrastat_if_present:0
msgid "Exclude invoice line from intrastat if this tax is present"
msgstr ""
#. module: intrastat_base
#: help:res.country,intrastat:0
msgid "Set as True for countries that must be selected in the intrastat reports, i.e. for all European Union countries other than your own country."
msgstr ""
#. module: intrastat_base
#: view:product.product:0
#: view:product.template:0
msgid "Intrastat properties"
msgstr ""
#. module: intrastat_base
#: model:ir.module.module,description:intrastat_base.module_meta_information
msgid "This module contains the common functions for 2 other modules :\n"
"- l10n_fr_intrastat_service : the module for the \"Déclaration Européenne des Services\" (DES)\n"
"- l10n_fr_intrastat_product : the module for the \"Déclaration d'Echange de Biens\" (DEB)\n"
"This module is not usefull if it's not used together with one of those 2 modules.\n"
"\n"
"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.\n"
"\n"
"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.\n"
"\n"
"Please contact Alexis de Lattre from Akretion <alexis.delattre@akretion.com> for any help or question about this module.\n"
" "
msgstr ""
#. module: intrastat_base
#: sql_constraint:res.country:0
msgid "The name of the country must be unique !"
msgstr ""
#. module: intrastat_base
#: constraint:product.template:0
msgid "Error msg is in raise"
msgstr ""
#. module: intrastat_base
#: help:account.tax,exclude_from_intrastat_if_present:0
msgid "If this tax is present on an invoice line, this invoice line will be skipped when generating Intrastat Product or Service lines from invoices."
msgstr ""
#. module: intrastat_base
#: field:product.template,is_accessory_cost:0
msgid "Is accessory cost"
msgstr ""
#. module: intrastat_base
#: field:res.country,intrastat:0
msgid "Intrastat country"
msgstr ""
#. module: intrastat_base
#: help:product.template,exclude_from_intrastat:0
msgid "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."
msgstr ""
#. module: intrastat_base
#: code:addons/intrastat_base/intrastat_common.py:64
#, python-format
msgid "The company currency must be 'EUR', but is currently '%s'."
msgstr ""
#. module: intrastat_base
#: code:addons/intrastat_base/intrastat_common.py:70
#, python-format
msgid "The VAT number is not set for the partner '%s'."
#: view:res.company:0
msgid "Common Intrastat Settings"
msgstr ""
#. module: intrastat_base
@@ -123,19 +30,36 @@ msgstr ""
msgid "Common functions for intrastat reports for products and services"
msgstr ""
#. module: intrastat_base
#: model:ir.model,name:intrastat_base.model_res_company
msgid "Companies"
msgstr ""
#. module: intrastat_base
#: model:ir.model,name:intrastat_base.model_res_country
msgid "Country"
msgstr ""
#. module: intrastat_base
#: model:ir.model,name:intrastat_base.model_product_template
msgid "Product Template"
#: view:res.country:0
#: field:res.country,intrastat:0
msgid "EU Country"
msgstr ""
#. module: intrastat_base
#: model:ir.module.module,shortdesc:intrastat_base.module_meta_information
msgid "Base module for Intrastat reporting"
#: code:addons/intrastat_base/company.py:58
#: code:addons/intrastat_base/intrastat_common.py:77
#: code:addons/intrastat_base/intrastat_common.py:82
#: code:addons/intrastat_base/intrastat_common.py:90
#: code:addons/intrastat_base/intrastat_common.py:110
#: code:addons/intrastat_base/product.py:51
#, python-format
msgid "Error :"
msgstr ""
#. module: intrastat_base
#: constraint:product.template:0
msgid "Error msg is in raise"
msgstr ""
#. module: intrastat_base
@@ -144,8 +68,75 @@ msgid "Exclude from Intrastat reports"
msgstr ""
#. module: intrastat_base
#: help:product.template,is_accessory_cost:0
msgid "Activate this option for shipping costs, packaging costs and all services related to the sale of products. This option is used for Intrastat reports."
#: field:account.tax,exclude_from_intrastat_if_present:0
msgid "Exclude invoice line from intrastat if this tax is present"
msgstr ""
#. module: intrastat_base
#: help:product.template,exclude_from_intrastat:0
msgid "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."
msgstr ""
#. module: intrastat_base
#: help:account.tax,exclude_from_intrastat_if_present:0
msgid "If this tax is present on an invoice line, this invoice line will be skipped when generating Intrastat Product or Service lines from invoices."
msgstr ""
#. module: intrastat_base
#: view:product.product:0
#: view:product.template:0
msgid "Intrastat Properties"
msgstr ""
#. module: intrastat_base
#: view:res.company:0
msgid "Intrastat Settings"
msgstr ""
#. module: intrastat_base
#: model:ir.ui.menu,name:intrastat_base.menu_intrastat_base_root
msgid "Intrastat reporting"
msgstr ""
#. module: intrastat_base
#: field:product.template,is_accessory_cost:0
msgid "Is accessory cost"
msgstr ""
#. module: intrastat_base
#: help:res.company,intrastat_remind_user_ids:0
msgid "List of OpenERP users who will receive a notification to remind them about the Intrastat declaration."
msgstr ""
#. module: intrastat_base
#: field:res.company,intrastat_email_list:0
msgid "List of emails of Users Receiving the Intrastat Reminder"
msgstr ""
#. module: intrastat_base
#: code:addons/intrastat_base/company.py:59
#, python-format
msgid "Missing e-mail address on user '%s'."
msgstr ""
#. module: intrastat_base
#: model:ir.model,name:intrastat_base.model_res_partner
msgid "Partner"
msgstr ""
#. module: intrastat_base
#: model:ir.model,name:intrastat_base.model_product_template
msgid "Product Template"
msgstr ""
#. module: intrastat_base
#: view:res.country:0
msgid "Search Countries"
msgstr ""
#. module: intrastat_base
#: help:res.country,intrastat:0
msgid "Set to True for all European Union countries."
msgstr ""
#. module: intrastat_base
@@ -154,13 +145,47 @@ msgid "Shipping costs"
msgstr ""
#. module: intrastat_base
#: code:addons/intrastat_base/intrastat_common.py:85
#: model:ir.model,name:intrastat_base.model_account_tax
msgid "Tax"
msgstr ""
#. module: intrastat_base
#: code:addons/intrastat_base/intrastat_common.py:91
#, python-format
msgid "The VAT number is not set for the partner '%s'."
msgstr ""
#. module: intrastat_base
#: code:addons/intrastat_base/intrastat_common.py:83
#, python-format
msgid "The company currency must be 'EUR', but is currently '%s'."
msgstr ""
#. module: intrastat_base
#: code:addons/intrastat_base/intrastat_common.py:78
#, python-format
msgid "The country is not set on the company '%s'."
msgstr ""
#. module: intrastat_base
#: code:addons/intrastat_base/intrastat_common.py:111
#, python-format
msgid "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."
msgstr ""
#. module: intrastat_base
#: model:ir.model,name:intrastat_base.model_res_partner_address
msgid "Partner Addresses"
#: code:addons/intrastat_base/product.py:56
#, python-format
msgid "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'"
msgstr ""
#. module: intrastat_base
#: field:res.company,intrastat_remind_user_ids:0
msgid "Users Receiving the Intrastat Reminder"
msgstr ""
#. module: intrastat_base
#: constraint:res.company:0
msgid "error msg in raise"
msgstr ""

View File

@@ -2,7 +2,7 @@
##############################################################################
#
# Report intrastat base module for OpenERP
# Copyright (C) 2010-2013 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>
#
# This program is free software: you can redistribute it and/or modify
@@ -22,6 +22,7 @@
from openerp.osv import orm
from openerp.tools.translate import _
from openerp import tools
from datetime import datetime
from dateutil.relativedelta import relativedelta
import logging
@@ -31,7 +32,8 @@ logger = logging.getLogger(__name__)
class report_intrastat_common(orm.TransientModel):
_name = "report.intrastat.common"
_description = "Common functions for intrastat reports for products and services"
_description = "Common functions for intrastat reports for products "
"and services"
def _compute_numbers(self, cr, uid, ids, object, context=None):
result = {}
@@ -41,14 +43,19 @@ class report_intrastat_common(orm.TransientModel):
for line in intrastat.intrastat_line_ids:
total_amount += line.amount_company_currency
num_lines += 1
result[intrastat.id] = {'num_lines': num_lines, 'total_amount': total_amount}
result[intrastat.id] = {
'num_lines': num_lines,
'total_amount': total_amount,
}
return result
def _compute_dates(self, cr, uid, ids, object, context=None):
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')
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': end_date_str,
'year_month': start_date_datetime.strftime('%Y-%m'),
@@ -57,53 +64,89 @@ class report_intrastat_common(orm.TransientModel):
def _check_start_date(self, cr, uid, ids, object, context=None):
'''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):
datetime_to_check = datetime.strptime(date_to_check['start_date'], '%Y-%m-%d')
for date_to_check in object.read(
cr, uid, ids, ['start_date'], context=context):
datetime_to_check = datetime.strptime(
date_to_check['start_date'], '%Y-%m-%d')
if datetime_to_check.day != 1:
return False
return True
def _check_generate_lines(self, cr, uid, intrastat, context=None):
if not intrastat.company_id.country_id:
raise orm.except_orm(_('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':
raise orm.except_orm(_('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
def _check_generate_xml(self, cr, uid, intrastat, context=None):
if not intrastat.company_id.partner_id.vat:
raise orm.except_orm(_('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
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_file, context=None):
'''Validate the XML file against the XSD'''
from lxml import etree
official_des_xml_schema = etree.XMLSchema(etree.fromstring(xsd))
xsd_etree_obj = etree.parse(
tools.file_open(xsd_file))
official_schema = etree.XMLSchema(xsd_etree_obj)
try:
official_des_xml_schema.assertValid(xml_root)
except Exception, e: # if the validation of the XSD fails, we arrive here
import logging
official_schema.assertValid(xml_root)
except Exception, e:
# if the validation of the XSD fails, we arrive here
_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(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))
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
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'''
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'''
import base64
assert len(ids) == 1, "Only one ID accepted"
filename = datetime.strftime(start_date_datetime, '%Y-%m') + '_' + declaration_name + '.xml'
attach_obj = self.pool.get('ir.attachment')
filename = '%s_%s.xml' % (
datetime.strftime(start_date_datetime, '%Y-%m'),
declaration_name)
if not context:
context = {}
context.update({'default_res_id': ids[0], 'default_res_model': object._name})
attach_id = attach_obj.create(cr, uid, {'name': filename, 'datas': base64.encodestring(xml_string), 'datas_fname': filename}, context=context)
context.update({
'default_res_id': ids[0],
'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(self, cr, uid, attach_id, title='XML file', context=None):
'''Returns an action which opens the form view of the corresponding attachement'''
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'''
action = {
'name': title,
'view_type': 'form',
@@ -117,23 +160,30 @@ class report_intrastat_common(orm.TransientModel):
}
return action
def partner_on_change(self, cr, uid, ids, partner_id=False):
def partner_on_change(self, cr, uid, ids, partner_id=False, context=None):
result = {}
result['value'] = {}
if partner_id:
company = self.pool.get('res.partner').read(cr, uid, partner_id, ['vat'])
result['value'].update({'partner_vat': company['vat']})
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_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]))
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(cr, uid, template_id, intrastat_id, context=context)
logger.info('Intrastat Reminder email has been sent (XMLID: %s).' % template_xmlid)
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)
logger.warning(
'The list of users receiving the Intrastat Reminder is empty '
'on company %s' % company.name)
return True

View File

@@ -27,8 +27,17 @@ from openerp.tools.translate import _
class product_template(orm.Model):
_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.'),
'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 = {
@@ -38,7 +47,13 @@ class product_template(orm.Model):
def _check_accessory_cost(self, cr, uid, ids):
for product in self.browse(cr, uid, ids):
if product.is_accessory_cost and product.type != 'service':
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)))
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
_constraints = [

View File

@@ -18,7 +18,8 @@
<group name="properties" position="after">
<group string="Intrastat Properties" name="intrastat">
<field name="exclude_from_intrastat" />
<field name="is_accessory_cost" />
<field name="is_accessory_cost"
attrs="{'invisible': [('type', '!=', 'service')]}"/>
</group>
</group>
</field>
@@ -33,7 +34,8 @@
<field name="supplier_taxes_id" position="after">
<group string="Intrastat Properties" name="intrastat">
<field name="exclude_from_intrastat" />
<field name="is_accessory_cost" />
<field name="is_accessory_cost"
attrs="{'invisible': [('type', '!=', 'service')]}"/>
</group>
</field>
</field>

View File

@@ -2,7 +2,7 @@
##############################################################################
#
# Report intrastat base module for OpenERP
# Copyright (C) 2011-2013 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>
#
# This program is free software: you can redistribute it and/or modify
@@ -25,6 +25,11 @@ from openerp.osv import orm, fields
class account_tax(orm.Model):
_inherit = "account.tax"
_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."),
}