-
-
Notifications
You must be signed in to change notification settings - Fork 507
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #83 from AngelMoya-Domatix/subcontractor_certificate
IMP certificado de subcontratista
- Loading branch information
Showing
8 changed files
with
322 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# -*- encoding: utf-8 -*- | ||
############################################################################## | ||
# | ||
# OpenERP, Open Source Management Solution | ||
# Copyright (c) 2014 Domatix Technologies S.L. (http://www.domatix.com) | ||
# info <info@domatix.com> | ||
# Angel Moya <angel.moya@domatix.com> | ||
# | ||
# 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 <http://www.gnu.org/licenses/>. | ||
# | ||
############################################################################## | ||
|
||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# -*- encoding: utf-8 -*- | ||
############################################################################## | ||
# | ||
# OpenERP, Open Source Management Solution | ||
# Copyright (c) 2014 Domatix Technologies S.L. (http://www.domatix.com) | ||
# info <info@domatix.com> | ||
# Angel Moya <angel.moya@domatix.com> | ||
# | ||
# 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 <http://www.gnu.org/licenses/>. | ||
# | ||
############################################################################## | ||
|
||
{ | ||
"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, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <angel.moya@domatix.com>\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!" |
61 changes: 61 additions & 0 deletions
61
l10n_es_subcontractor_certificate/i18n/l10n_es_subcontractor_certificate.pot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 "" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# -*- encoding: utf-8 -*- | ||
############################################################################## | ||
# | ||
# OpenERP, Open Source Management Solution | ||
# Copyright (c) 2014 Domatix Technologies S.L. (http://www.domatix.com) | ||
# info <info@domatix.com> | ||
# Angel Moya <angel.moya@domatix.com> | ||
# | ||
# 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 <http://www.gnu.org/licenses/>. | ||
# | ||
############################################################################## | ||
|
||
from . import subcontractor_certificate |
86 changes: 86 additions & 0 deletions
86
l10n_es_subcontractor_certificate/models/subcontractor_certificate.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
# -*- encoding: utf-8 -*- | ||
############################################################################## | ||
# | ||
# OpenERP, Open Source Management Solution | ||
# Copyright (c) 2014 Domatix Technologies S.L. (http://www.domatix.com) | ||
# info <info@domatix.com> | ||
# Angel Moya <angel.moya@domatix.com> | ||
# | ||
# 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 <http://www.gnu.org/licenses/>. | ||
# | ||
############################################################################## | ||
|
||
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 |
18 changes: 18 additions & 0 deletions
18
l10n_es_subcontractor_certificate/views/subcontractor_certificate_view.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<openerp> | ||
<data> | ||
<record model="ir.ui.view" id="view_partner_account_code_form"> | ||
<field name="name">view.partner.account.code.form</field> | ||
<field name="model">res.partner</field> | ||
<field name="inherit_id" ref="base.view_partner_form"/> | ||
<field name="arch" type="xml"> | ||
<xpath expr="//page[@name='sales_purchases']/group" position="inside"> | ||
<group attrs="{'invisible': [('supplier','=', False)]}"> | ||
<field name="certificate_required"/> | ||
<field name="certificate_expiration" attrs="{'invisible': [('certificate_required','=', False)]}"/> | ||
</group> | ||
</xpath> | ||
</field> | ||
</record> | ||
</data> | ||
</openerp> |