diff --git a/l10n_es_subcontractor_certificate/README.rst b/l10n_es_subcontractor_certificate/README.rst new file mode 100644 index 00000000000..7ea4b061641 --- /dev/null +++ b/l10n_es_subcontractor_certificate/README.rst @@ -0,0 +1,8 @@ +Certificado de subcontratista +============================= +Este módulo permite gestionar el certificado de subcontratista de los +proveedores, en su ficha la caducidad del certificado. + +En pedidos de compra y facturas, al seleccionar el proveedor, si este +tiene fecha de caducidad del certificado y es anterior a la fecha actual +devolverá un aviso indicando que tiene el certificado caducado. diff --git a/l10n_es_subcontractor_certificate/__init__.py b/l10n_es_subcontractor_certificate/__init__.py new file mode 100644 index 00000000000..35e4275b9c7 --- /dev/null +++ b/l10n_es_subcontractor_certificate/__init__.py @@ -0,0 +1,24 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (c) 2014 Domatix Technologies S.L. (http://www.domatix.com) +# info +# Angel Moya +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +############################################################################## + +from . import models diff --git a/l10n_es_subcontractor_certificate/__openerp__.py b/l10n_es_subcontractor_certificate/__openerp__.py new file mode 100644 index 00000000000..fd3e96e4005 --- /dev/null +++ b/l10n_es_subcontractor_certificate/__openerp__.py @@ -0,0 +1,35 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (c) 2014 Domatix Technologies S.L. (http://www.domatix.com) +# info +# Angel Moya +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +############################################################################## + +{ + "name": "Certificado de subcontratista", + "version": "1.0", + "author": "Domatix", + "website": "www.domatix.com", + "category": "Accounting", + "depends": ["purchase"], + "data": ["views/subcontractor_certificate_view.xml"], + "demo": [], + "auto_install": False, + "installable": True, +} diff --git a/l10n_es_subcontractor_certificate/i18n/es.po b/l10n_es_subcontractor_certificate/i18n/es.po new file mode 100644 index 00000000000..ffa2c103ef4 --- /dev/null +++ b/l10n_es_subcontractor_certificate/i18n/es.po @@ -0,0 +1,66 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * l10n_es_subcontractor_certificate +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 8.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-11-24 07:37+0000\n" +"PO-Revision-Date: 2014-11-24 08:38+0100\n" +"Last-Translator: Angel Moya - Domatix \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: \n" +"X-Generator: Poedit 1.5.4\n" + +#. module: l10n_es_subcontractor_certificate +#: field:res.partner,certificate_expiration:0 +msgid "Certificate Expiration" +msgstr "Caducidad de certificado" + +#. module: l10n_es_subcontractor_certificate +#: field:res.partner,certificate_required:0 +msgid "Certificate Required" +msgstr "Requiere certificado de subcontratista" + +#. module: l10n_es_subcontractor_certificate +#: model:ir.model,name:l10n_es_subcontractor_certificate.model_account_invoice +msgid "Invoice" +msgstr "Factura" + +#. module: l10n_es_subcontractor_certificate +#: model:ir.model,name:l10n_es_subcontractor_certificate.model_res_partner +msgid "Partner" +msgstr "Empresa" + +#. module: l10n_es_subcontractor_certificate +#: model:ir.model,name:l10n_es_subcontractor_certificate.model_purchase_order +msgid "Purchase Order" +msgstr "Pedido de compra" + +#. module: l10n_es_subcontractor_certificate +#: code:addons/l10n_es_subcontractor_certificate/models/subcontractor_certificate.py:28 +#, python-format +msgid "" +"The subcontractor certificate for this supplier has " +"expired" +msgstr "El certificado de subcontratista ha caducado." + +#. module: l10n_es_subcontractor_certificate +#: code:addons/l10n_es_subcontractor_certificate/models/subcontractor_certificate.py:34 +#, python-format +msgid "" +"The subcontractor certificate is required and expiration " +"date is not set" +msgstr "" +"No se ha indicado la fecha de caducidad del certificado de subcontratista." + +#. module: l10n_es_subcontractor_certificate +#: code:addons/l10n_es_subcontractor_certificate/models/subcontractor_certificate.py:27 +#: code:addons/l10n_es_subcontractor_certificate/models/subcontractor_certificate.py:33 +#, python-format +msgid "Warning!" +msgstr "¡Aviso!" diff --git a/l10n_es_subcontractor_certificate/i18n/l10n_es_subcontractor_certificate.pot b/l10n_es_subcontractor_certificate/i18n/l10n_es_subcontractor_certificate.pot new file mode 100644 index 00000000000..155b7c94815 --- /dev/null +++ b/l10n_es_subcontractor_certificate/i18n/l10n_es_subcontractor_certificate.pot @@ -0,0 +1,61 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * l10n_es_subcontractor_certificate +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 8.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-11-24 18:08+0000\n" +"PO-Revision-Date: 2014-11-24 18:08+0000\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: l10n_es_subcontractor_certificate +#: field:res.partner,certificate_expiration:0 +msgid "Certificate Expiration" +msgstr "" + +#. module: l10n_es_subcontractor_certificate +#: field:res.partner,certificate_required:0 +msgid "Certificate Required" +msgstr "" + +#. module: l10n_es_subcontractor_certificate +#: model:ir.model,name:l10n_es_subcontractor_certificate.model_account_invoice +msgid "Invoice" +msgstr "" + +#. module: l10n_es_subcontractor_certificate +#: model:ir.model,name:l10n_es_subcontractor_certificate.model_res_partner +msgid "Partner" +msgstr "" + +#. module: l10n_es_subcontractor_certificate +#: model:ir.model,name:l10n_es_subcontractor_certificate.model_purchase_order +msgid "Purchase Order" +msgstr "" + +#. module: l10n_es_subcontractor_certificate +#: code:addons/l10n_es_subcontractor_certificate/models/subcontractor_certificate.py:28 +#, python-format +msgid "The subcontractor certificate for this supplier has expired" +msgstr "" + +#. module: l10n_es_subcontractor_certificate +#: code:addons/l10n_es_subcontractor_certificate/models/subcontractor_certificate.py:34 +#, python-format +msgid "The subcontractor certificate is required and expiration date is not set" +msgstr "" + +#. module: l10n_es_subcontractor_certificate +#: code:addons/l10n_es_subcontractor_certificate/models/subcontractor_certificate.py:27 +#: code:addons/l10n_es_subcontractor_certificate/models/subcontractor_certificate.py:33 +#, python-format +msgid "Warning!" +msgstr "" + diff --git a/l10n_es_subcontractor_certificate/models/__init__.py b/l10n_es_subcontractor_certificate/models/__init__.py new file mode 100644 index 00000000000..4c76eaf00df --- /dev/null +++ b/l10n_es_subcontractor_certificate/models/__init__.py @@ -0,0 +1,24 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (c) 2014 Domatix Technologies S.L. (http://www.domatix.com) +# info +# Angel Moya +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +############################################################################## + +from . import subcontractor_certificate diff --git a/l10n_es_subcontractor_certificate/models/subcontractor_certificate.py b/l10n_es_subcontractor_certificate/models/subcontractor_certificate.py new file mode 100644 index 00000000000..90f0892da29 --- /dev/null +++ b/l10n_es_subcontractor_certificate/models/subcontractor_certificate.py @@ -0,0 +1,86 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (c) 2014 Domatix Technologies S.L. (http://www.domatix.com) +# info +# Angel Moya +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +############################################################################## + +from openerp import models, fields, api, _ + +EXPIRED_WARNING = { + 'title': _('Warning!'), + 'message': _('The subcontractor certificate for this supplier ' + 'has expired') + } + +REQUIRED_WARNING = { + 'title': _('Warning!'), + 'message': _('The subcontractor certificate is required and ' + 'expiration date is not set') + } + + +class ResPartner(models.Model): + _inherit = ['res.partner'] + + certificate_required = fields.Boolean(string='Certificate Required') + certificate_expiration = fields.Date(string='Certificate Expiration') + certificate_expired = fields.Boolean(string='Certificate Expirated', + compute='_certificate_expired') + + def _certificate_expired(self): + self.certificate_expired = self.certificate_expiration and \ + (self.certificate_expiration < fields.Date.today()) + + +class PurchaseOrder(models.Model): + _inherit = ['purchase.order'] + + @api.multi + def onchange_partner_id(self, partner_id): + res = super(PurchaseOrder, self).onchange_partner_id(partner_id) + if partner_id: + partner = self.env['res.partner'].browse(partner_id)[0] + if partner.certificate_required: + if not partner.certificate_expiration: + res['warning'] = REQUIRED_WARNING + elif partner.certificate_expired: + res['warning'] = EXPIRED_WARNING + return res + + +class AccountInvoice(models.Model): + _inherit = ['account.invoice'] + + @api.multi + def onchange_partner_id(self, type, partner_id, date_invoice=False, + payment_term=False, partner_bank_id=False, + company_id=False): + res = super(AccountInvoice, self).onchange_partner_id( + type, partner_id, date_invoice=False, + payment_term=False, partner_bank_id=False, + company_id=False) + if type == 'in_invoice' and partner_id: + partner = self.env['res.partner'].browse(partner_id) + if partner.certificate_required: + if not partner.certificate_expiration: + res['warning'] = REQUIRED_WARNING + elif partner.certificate_expired: + res['warning'] = EXPIRED_WARNING + return res diff --git a/l10n_es_subcontractor_certificate/views/subcontractor_certificate_view.xml b/l10n_es_subcontractor_certificate/views/subcontractor_certificate_view.xml new file mode 100644 index 00000000000..556659d41de --- /dev/null +++ b/l10n_es_subcontractor_certificate/views/subcontractor_certificate_view.xml @@ -0,0 +1,18 @@ + + + + + view.partner.account.code.form + res.partner + + + + + + + + + + + +