[IMP] product_warranty module is migrated to API 8.0 and odoo 8.0

This commit is contained in:
Yanina Aular (Vauxoo)
2015-08-03 16:52:51 -04:30
committed by Maxime Chambreuil
parent 69a2a4b95b
commit 0480f83640
19 changed files with 692 additions and 273 deletions

View File

@@ -31,6 +31,7 @@ Contributors
* Maxime Chambreuil <maxime.chambreuil@savoirfairelinux.com> * Maxime Chambreuil <maxime.chambreuil@savoirfairelinux.com>
* Joël Grand-Guillaume <joel.grandguillaume@gmail.com> * Joël Grand-Guillaume <joel.grandguillaume@gmail.com>
* Ondřej Kuzník <ondrej.kuznik@credativ.co.uk> * Ondřej Kuzník <ondrej.kuznik@credativ.co.uk>
* Yanina Aular <yanina.aular@vauxoo.com>
Maintainer Maintainer
---------- ----------

View File

@@ -1,21 +1,23 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
############################################################################## #########################################################################
# # #
# Copyright (C) 2009-2011 Akretion, Emmanuel Samyn # #
# #########################################################################
# This program is free software: you can redistribute it and/or modify # #
# it under the terms of the GNU Affero General Public License as # Copyright (C) 2009-2011 Akretion, Emmanuel Samyn #
# published by the Free Software Foundation, either version 3 of the # #
# License, or (at your option) any later version. # 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 #
# This program is distributed in the hope that it will be useful, # the Free Software Foundation, either version 3 of the License, or #
# but WITHOUT ANY WARRANTY; without even the implied warranty of # (at your option) any later version. #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # #
# GNU Affero General Public License for more details. # This program is distributed in the hope that it will be useful, #
# # but WITHOUT ANY WARRANTY; without even the implied warranty of #
# You should have received a copy of the GNU Affero General Public License # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# along with this program. If not, see <http://www.gnu.org/licenses/>. # GNU General Public License for more details. #
# # #
############################################################################## # You should have received a copy of the GNU General Public License #
from . import product_warranty # along with this program. If not, see <http://www.gnu.org/licenses/>. #
from . import res_company #########################################################################
from . import models

View File

@@ -1,38 +1,44 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
############################################################################## #########################################################################
# # #
# Copyright (C) 2009-2011 Akretion, Emmanuel Samyn # #
# #########################################################################
# This program is free software: you can redistribute it and/or modify # #
# it under the terms of the GNU Affero General Public License as # Copyright (C) 2009-2011 Akretion, Emmanuel Samyn #
# published by the Free Software Foundation, either version 3 of the # #
# License, or (at your option) any later version. # 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 #
# This program is distributed in the hope that it will be useful, # the Free Software Foundation, either version 3 of the License, or #
# but WITHOUT ANY WARRANTY; without even the implied warranty of # (at your option) any later version. #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # #
# GNU Affero General Public License for more details. # This program is distributed in the hope that it will be useful, #
# # but WITHOUT ANY WARRANTY; without even the implied warranty of #
# You should have received a copy of the GNU Affero General Public License # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# along with this program. If not, see <http://www.gnu.org/licenses/>. # 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': 'Product warranty', 'name': 'Product warranty',
'version': '1.0', 'version': '1.0',
'category': 'Generic Modules/Product', 'category': 'Generic Modules/Product',
'author': "Akretion,Odoo Community Association (OCA)", 'author': "Akretion,Odoo Community Association (OCA),Vauxoo",
'website': 'http://akretion.com', 'website': 'http://akretion.com',
'license': 'AGPL-3', 'license': 'AGPL-3',
'depends': ['product'], 'depends': ['product'],
'data': [ 'data': [
'security/ir.model.access.csv', 'security/ir.model.access.csv',
'res_company_view.xml', 'views/res_company_view.xml',
'product_warranty_view.xml', 'views/product_warranty_view.xml',
],
'demo': [
'demo/product_warranty.xml',
'demo/res_company.xml',
], ],
'demo_xml': [],
'test': [], 'test': [],
'installable': True, 'installable': True,
'active': False,
'images': ['images/product_warranty.png'], 'images': ['images/product_warranty.png'],
} }

View File

@@ -0,0 +1,64 @@
<?xml version="1.0"?>
<openerp>
<data noupdate="1">
<record id="return_instruction_1" model="return.instruction">
<field name="name">Default Instruction</field>
<field name="instructions">To return a product purchased through our platform vendor Marketplace access our online Returns Center and click Return products to begin the application process for the return.
Select the product you want to return and the reason for the return. You will need you to provide detailed information to enable the seller to handle your request. Once the seller has reviewed your application, it will respond by e-mail within 3 working days.</field>
<field name="is_default">1</field>
</record>
<record id="return_instruction_2" model="return.instruction">
<field name="name">Provisional Instruction</field>
<field name="instructions">Under the provisions of these Conditions of Sale, you may return the products received once you have contacted our customer service department adidas Mexico and the request is authorized. If you choose to return your order, we will refund: the full purchase price, as long as we have previously returned the products you order in perfect condition: (i) new product unused, (ii) with packaging, original box and tags (iii) be in the period of 30 calendar days after receiving the product. If you do not return the products to fulfill the above conditions, we are entitled to charge the products or the costs of recovery.</field>
</record>
<!-- Warranty Information of PC Assemble SC234 Product in Supplier Info -->
<record id="product.product_product_3_product_template" model="product.template">
<field name="warranty">5</field>
</record>
<record id="product_supplierinfo_warranty_31" model="product.supplierinfo">
<field name="return_instructions" ref="return_instruction_2"/>
<field name="warranty_return_partner">other</field>
<field name="warranty_return_other_address"
ref="base.res_partner_address_7"/>
<field name="warranty_duration">8</field>
<field name="product_tmpl_id" ref="product.product_product_3_product_template"/>
<field name="name" ref="base.res_partner_4"/>
<field name="delay">5</field>
<field name="min_qty">1</field>
</record>
<record id="product_supplierinfo_warranty_32" model="product.supplierinfo">
<field name="return_instructions" ref="return_instruction_1"/>
<field name="warranty_return_partner">supplier</field>
<field name="warranty_duration">12</field>
<field name="product_tmpl_id" ref="product.product_product_3_product_template"/>
<field name="name" ref="base.res_partner_5"/>
<field name="delay">5</field>
<field name="min_qty">1</field>
</record>
<!-- Warranty Information of iMac Product in Supplier Info -->
<record id="product.product_product_8_product_template" model="product.template">
<field name="warranty">5</field>
</record>
<record id="product.product_supplierinfo_5" model="product.supplierinfo">
<field name="return_instructions" ref="return_instruction_1"/>
<field name="warranty_return_partner">supplier</field>
<field name="warranty_duration">10</field>
</record>
<record id="product.product_supplierinfo_6" model="product.supplierinfo">
<field name="return_instructions" ref="return_instruction_2"/>
<field name="warranty_return_partner">supplier</field>
<field name="warranty_duration">6</field>
</record>
</data>
</openerp>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0"?>
<openerp>
<data noupdate="1">
<record id="base.main_company" model="res.company">
<field name="crm_return_address_id" ref="base.res_partner_main1"/>
</record>
</data>
</openerp>

View File

@@ -159,3 +159,136 @@ msgstr "Instrucciones de devolución"
#: field:return.instruction,instructions:0 #: field:return.instruction,instructions:0
msgid "Instructions" msgid "Instructions"
msgstr "Instrucciones" msgstr "Instrucciones"
#. module: product_warranty
#: field:product.supplierinfo,active_supplier:0
msgid "Active supplier"
msgstr "Proveedor activo"
#. module: product_warranty
#: model:ir.model,name:product_warranty.model_res_company
msgid "Companies"
msgstr "Compañías"
#. module: product_warranty
#: field:return.instruction,create_uid:0
msgid "Created by"
msgstr "Creado por"
#. module: product_warranty
#: field:return.instruction,create_date:0
msgid "Created on"
msgstr "Creado en"
#. module: product_warranty
#: view:res.company:product_warranty.company_form
msgid "Crm product return address"
msgstr "Dirección de devolución del producto"
#. module: product_warranty
#: help:res.company,crm_return_address_id:0
msgid "Default address where the customers has to send back the returned product. If empty, the address is the company address"
msgstr "Dirección por defecto donde los clientes deben enviar de regresa los productos devueltos. Si está vacío, la dirección es la dirección de la compañía"
#. module: product_warranty
#: field:return.instruction,id:0
msgid "ID"
msgstr "ID"
#. module: product_warranty
#: help:return.instruction,is_default:0
msgid "If is default, will be use to set the default value in supplier infos. Be careful to have only one default"
msgstr "Si es por defecto, se usará para establecer el valor por defecto en la información del proveedor. Tenga cuidado de tener sólo un por defecto."
#. module: product_warranty
#: model:ir.model,name:product_warranty.model_product_supplierinfo
msgid "Information about a product supplier"
msgstr "Información sobre un proveedor de producto"
#. module: product_warranty
#: field:product.supplierinfo,return_instructions:0
#: view:return.instruction:product_warranty.product_return_instructions_form_view
#: field:return.instruction,instructions:0
msgid "Instructions"
msgstr "Instrucciones"
#. module: product_warranty
#: model:ir.model,name:product_warranty.model_return_instruction
#: help:product.supplierinfo,return_instructions:0
#: help:return.instruction,instructions:0
msgid "Instructions for product return"
msgstr "Instrucciones para la devolución del producto"
#. module: product_warranty
#: field:return.instruction,is_default:0
msgid "Is default"
msgstr "Por defecto"
#. module: product_warranty
#: help:product.supplierinfo,active_supplier:0
msgid "Is this supplier still active, only for information"
msgstr "Indica si el proveedor todavía está activo. Sólo para información."
#. module: product_warranty
#: field:return.instruction,write_uid:0
msgid "Last Updated by"
msgstr "Last Updated by"
#. module: product_warranty
#: field:return.instruction,write_date:0
msgid "Last Updated on"
msgstr "Last Updated on"
#. module: product_warranty
#: field:product.supplierinfo,warranty_duration:0
msgid "Period"
msgstr "Periodo"
#. module: product_warranty
#: model:ir.actions.act_window,name:product_warranty.product_return_instructions_action
#: model:ir.ui.menu,name:product_warranty.menu_product_return_instructions_action
msgid "Products Return Instructions"
msgstr "Intrucciones para devolución de productos"
#. module: product_warranty
#: field:product.supplierinfo,warranty_return_other_address:0
#: field:res.company,crm_return_address_id:0
msgid "Return address"
msgstr "Dirección de retorno"
#. module: product_warranty
#: view:return.instruction:product_warranty.product_return_instructions_form_view
#: view:return.instruction:product_warranty.product_return_instructions_tree_view
msgid "Return instructions"
msgstr "Instrucciones de devolución"
#. module: product_warranty
#: field:product.supplierinfo,warranty_return_partner:0
msgid "Return type"
msgstr "Tipo de devolución"
#. module: product_warranty
#: field:return.instruction,name:0
msgid "Title"
msgstr "Título"
#. module: product_warranty
#: help:product.supplierinfo,warranty_duration:0
msgid "Warranty in month for this product/supplier relation. Only for company/supplier relation (purchase order) ; the customer/company relation (sale order) always use the product main warranty field"
msgstr "Garantía en meses para la relación producto/proveedor. Sólo para la relación producto/compañía (orden de compra); la relación cliente/compañía (orden de venta) siempre usa el producto principal para el campo garantía"
#. module: product_warranty
#: view:product.supplierinfo:product_warranty.product_supplierinfo_warranty_form_view
msgid "Warranty informations"
msgstr "Información de garantía"
#. module: product_warranty
#: help:product.supplierinfo,warranty_return_other_address:0
msgid "Where the customer has to send back the product(s) if warranty return is set to 'other'."
msgstr "Donde el cliente debe enviar el producto si la garantía es 'otros'"
#. module: product_warranty
#: help:product.supplierinfo,warranty_return_partner:0
msgid "Who is in charge of the warranty return treatment toward the end customer. Company will use the current compagny delivery or default address and so on for supplier and brand manufacturer. Doesn't necessarly mean that the warranty to be applied is the one of the return partner (ie: can be returned to the company and be under the brand warranty"
msgstr "Quién se encarga del tratamiento de retorno de garantía hacia el cliente final. Compañía utilizará la entrega compagny actual o la dirección por defecto y así sucesivamente para el proveedor y el fabricante de la marca. No significa necessarly que la garantía que se aplica es el de la pareja de retorno (es decir: pueden ser devueltos a la empresa y estar bajo la garantía de la marca"

View File

@@ -0,0 +1,16 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * product_warranty
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-07-17 20:41+0000\n"
"PO-Revision-Date: 2015-07-17 20:41+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"

View File

@@ -0,0 +1,16 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * product_warranty
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-07-17 20:41+0000\n"
"PO-Revision-Date: 2015-07-17 20:41+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"

View File

@@ -0,0 +1,16 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * product_warranty
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-07-17 20:41+0000\n"
"PO-Revision-Date: 2015-07-17 20:41+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"

View File

@@ -1,13 +1,13 @@
# Translation of OpenERP Server. # Translation of Odoo Server.
# This file contains the translation of the following modules: # This file contains the translation of the following modules:
# * product_warranty # * product_warranty
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: OpenERP Server 7.0\n" "Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2013-11-21 15:06+0000\n" "POT-Creation-Date: 2015-07-18 02:03+0000\n"
"PO-Revision-Date: 2013-11-21 15:06+0000\n" "PO-Revision-Date: 2015-07-18 02:03+0000\n"
"Last-Translator: <>\n" "Last-Translator: <>\n"
"Language-Team: \n" "Language-Team: \n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
@@ -16,38 +16,57 @@ msgstr ""
"Plural-Forms: \n" "Plural-Forms: \n"
#. module: product_warranty #. module: product_warranty
#: model:ir.model.fields,field_description:product_warranty.field_product_supplierinfo_warranty_return_address #: field:product.supplierinfo,active_supplier:0
#: model:ir.model.fields,field_description:product_warranty.field_product_supplierinfo_warranty_return_other_address_id msgid "Active supplier"
#: field:product.supplierinfo,warranty_return_address:0
#: field:product.supplierinfo,warranty_return_other_address_id:0
msgid "Return address"
msgstr "" msgstr ""
#. module: product_warranty #. module: product_warranty
#: view:product.supplierinfo:0 #: model:ir.model,name:product_warranty.model_res_company
msgid "Warranty informations" msgid "Companies"
msgstr "" msgstr ""
#. module: product_warranty #. module: product_warranty
#: help:product.supplierinfo,warranty_return_partner:0 #: field:return.instruction,create_uid:0
msgid "Who is in charge of the warranty return treatment toward the end customer. Company will use the current company delivery or default address and so on for supplier and brand manufacturer. Doesn't necessarily mean that the warranty to be applied is the one of the return partner (i.e. can be returned to the company and be under the brand warranty" msgid "Created by"
msgstr "" msgstr ""
#. module: product_warranty #. module: product_warranty
#: help:product.supplierinfo,warranty_return_other_address_id:0 #: field:return.instruction,create_date:0
msgid "Where the customer has to send back the product(s) if warranty return is set to 'other'." msgid "Created on"
msgstr "" msgstr ""
#. module: product_warranty #. module: product_warranty
#: help:product.supplierinfo,warranty_duration:0 #: view:res.company:product_warranty.company_form
msgid "Warranty in month for this product/supplier relation. Only for company/supplier relation (purchase order) ; the customer/company relation (sale order) always use the product main warranty field"
msgstr ""
#. module: product_warranty
#: view:res.company:0
msgid "Crm product return address" msgid "Crm product return address"
msgstr "" msgstr ""
#. module: product_warranty
#: help:res.company,crm_return_address_id:0
msgid "Default address where the customers has to send back the returned product. If empty, the address is the company address"
msgstr ""
#. module: product_warranty
#: field:return.instruction,id:0
msgid "ID"
msgstr ""
#. module: product_warranty
#: help:return.instruction,is_default:0
msgid "If is default, will be use to set the default value in supplier infos. Be careful to have only one default"
msgstr ""
#. module: product_warranty
#: model:ir.model,name:product_warranty.model_product_supplierinfo
msgid "Information about a product supplier"
msgstr ""
#. module: product_warranty
#: field:product.supplierinfo,return_instructions:0
#: view:return.instruction:product_warranty.product_return_instructions_form_view
#: field:return.instruction,instructions:0
msgid "Instructions"
msgstr ""
#. module: product_warranty #. module: product_warranty
#: model:ir.model,name:product_warranty.model_return_instruction #: model:ir.model,name:product_warranty.model_return_instruction
#: help:product.supplierinfo,return_instructions:0 #: help:product.supplierinfo,return_instructions:0
@@ -56,76 +75,74 @@ msgid "Instructions for product return"
msgstr "" msgstr ""
#. module: product_warranty #. module: product_warranty
#: model:ir.model.fields,field_description:product_warranty.field_product_supplierinfo_warranty_duration
#: field:product.supplierinfo,warranty_duration:0
msgid "Period"
msgstr ""
#. module: product_warranty
#: model:ir.model.fields,field_description:product_warranty.field_return_instruction_name
#: field:return.instruction,name:0
msgid "Title"
msgstr ""
#. module: product_warranty
#: model:ir.model,name:product_warranty.model_res_company
msgid "Companies"
msgstr ""
#. module: product_warranty
#: model:ir.model.fields,field_description:product_warranty.field_product_supplierinfo_active_supplier
#: field:product.supplierinfo,active_supplier:0
msgid "Active supplier"
msgstr ""
#. module: product_warranty
#: model:ir.model.fields,field_description:product_warranty.field_return_instruction_is_default
#: field:return.instruction,is_default:0 #: field:return.instruction,is_default:0
msgid "Is default" msgid "Is default"
msgstr "" msgstr ""
#. module: product_warranty
#: help:product.supplierinfo,warranty_return_address:0
msgid "Where the goods should be returned (computed field based on other infos.)"
msgstr ""
#. module: product_warranty
#: help:return.instruction,is_default:0
msgid "If is default, will be use to set the default value in supplier infos. Be careful to have only one default"
msgstr ""
#. module: product_warranty
#: model:ir.actions.act_window,name:product_warranty.product_return_instructions_action
#: model:ir.ui.menu,name:product_warranty.menu_product_return_instructions_action
msgid "Products return instructions"
msgstr ""
#. module: product_warranty
#: model:ir.model,name:product_warranty.model_product_supplierinfo
msgid "Information about a product supplier"
msgstr ""
#. module: product_warranty #. module: product_warranty
#: help:product.supplierinfo,active_supplier:0 #: help:product.supplierinfo,active_supplier:0
msgid "Is this supplier still active, only for information" msgid "Is this supplier still active, only for information"
msgstr "" msgstr ""
#. module: product_warranty #. module: product_warranty
#: model:ir.model.fields,field_description:product_warranty.field_product_supplierinfo_warranty_return_partner #: field:return.instruction,write_uid:0
msgid "Last Updated by"
msgstr ""
#. module: product_warranty
#: field:return.instruction,write_date:0
msgid "Last Updated on"
msgstr ""
#. module: product_warranty
#: field:product.supplierinfo,warranty_duration:0
msgid "Period"
msgstr ""
#. module: product_warranty
#: model:ir.actions.act_window,name:product_warranty.product_return_instructions_action
#: model:ir.ui.menu,name:product_warranty.menu_product_return_instructions_action
msgid "Products Return Instructions"
msgstr ""
#. module: product_warranty
#: field:product.supplierinfo,warranty_return_other_address:0
#: field:res.company,crm_return_address_id:0
msgid "Return address"
msgstr ""
#. module: product_warranty
#: view:return.instruction:product_warranty.product_return_instructions_form_view
#: view:return.instruction:product_warranty.product_return_instructions_tree_view
msgid "Return instructions"
msgstr ""
#. module: product_warranty
#: field:product.supplierinfo,warranty_return_partner:0 #: field:product.supplierinfo,warranty_return_partner:0
msgid "Return type" msgid "Return type"
msgstr "" msgstr ""
#. module: product_warranty #. module: product_warranty
#: view:return.instruction:0 #: field:return.instruction,name:0
msgid "Return instructions" msgid "Title"
msgstr "" msgstr ""
#. module: product_warranty #. module: product_warranty
#: model:ir.model.fields,field_description:product_warranty.field_product_supplierinfo_return_instructions #: help:product.supplierinfo,warranty_duration:0
#: model:ir.model.fields,field_description:product_warranty.field_return_instruction_instructions msgid "Warranty in month for this product/supplier relation. Only for company/supplier relation (purchase order) ; the customer/company relation (sale order) always use the product main warranty field"
#: field:product.supplierinfo,return_instructions:0 msgstr ""
#: view:return.instruction:0
#: field:return.instruction,instructions:0 #. module: product_warranty
msgid "Instructions" #: view:product.supplierinfo:product_warranty.product_supplierinfo_warranty_form_view
msgid "Warranty informations"
msgstr ""
#. module: product_warranty
#: help:product.supplierinfo,warranty_return_other_address:0
msgid "Where the customer has to send back the product(s) if warranty return is set to 'other'."
msgstr ""
#. module: product_warranty
#: help:product.supplierinfo,warranty_return_partner:0
msgid "Who is in charge of the warranty return treatment toward the end customer. Company will use the current compagny delivery or default address and so on for supplier and brand manufacturer. Doesn't necessarly mean that the warranty to be applied is the one of the return partner (ie: can be returned to the company and be under the brand warranty"
msgstr "" msgstr ""

View File

@@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
#########################################################################
# #
# #
#########################################################################
# #
# Copyright (C) 2009-2011 Akretion, Emmanuel Samyn #
# #
# 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 return_instruction
from . import product_supplierinfo
from . import res_company

View File

@@ -0,0 +1,107 @@
# -*- coding: utf-8 -*-
# ########################################################################
# #
# #
# ########################################################################
# #
# Copyright 2015 Vauxoo
# Copyright (C) 2009-2011 Akretion, Emmanuel Samyn, Benoît Guillot #
# #
# 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 api, fields, models
class ProductSupplierInfo(models.Model):
_inherit = "product.supplierinfo"
@api.model
def get_warranty_return_partner(self):
result = [('company', 'Company'),
('supplier', 'Supplier'),
('other', 'Other'),
]
return result
@api.model
def _get_default_instructions(self):
""" Get selected lines to add to exchange """
instruction_ids = self.env['return.instruction']\
.search([('is_default', '=', True)], limit=1)
return instruction_ids
@api.one
@api.depends('warranty_return_partner')
def _compute_warranty_return_address(self):
""" Method to return the partner delivery address or if none,
the default address
dedicated_delivery_address stand for the case a new type of
address more particularly dedicated to return delivery would be
implemented.
"""
return_partner = self.warranty_return_partner
partner_id = self.company_id.partner_id.id
if return_partner:
if return_partner == 'supplier':
partner_id = self.name.id
elif return_partner == 'company':
if self.company_id.crm_return_address_id:
partner_id = self.company_id.\
crm_return_address_id.id
elif return_partner == 'other':
if self.warranty_return_other_address:
partner_id = self.\
warranty_return_other_address.id
self.warranty_return_address = partner_id
warranty_duration = fields.Float(
'Period',
help="Warranty in month for this product/supplier relation. Only "
"for company/supplier relation (purchase order) ; the "
"customer/company relation (sale order) always use the "
"product main warranty field")
warranty_return_partner = fields.Selection(
get_warranty_return_partner,
'Return type',
required=True,
default='company',
help="Who is in charge of the warranty return treatment toward the"
" end customer. Company will use the current compagny "
" delivery or default address and so on for supplier and "
"brand manufacturer. Doesn't necessarly mean that the "
"warranty to be applied is the one of the return partner "
"(ie: can be returned to the company and be under the "
"brand warranty")
return_instructions = fields.Many2one(
'return.instruction',
'Instructions',
default=_get_default_instructions,
help="Instructions for product return")
active_supplier = fields.Boolean(
help="Is this supplier still active, only for information")
warranty_return_address = fields.Many2one(
'res.partner',
compute='_compute_warranty_return_address',
string="Return address",
help="Where the goods should be returned "
"(computed field based on other infos.)")
warranty_return_other_address = fields.Many2one(
'res.partner',
string='Return address',
help="Where the customer has to send back the product(s) "
"if warranty return is set to 'other'.")

View File

@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
############################################################################## ##############################################################################
# #
# Copyright 2015 Vauxoo
# Copyright 2013 Camptocamp # Copyright 2013 Camptocamp
# Copyright 2009-2013 Akretion, # Copyright 2009-2013 Akretion,
# Author: Emmanuel Samyn, Raphaël Valyi, Sébastien Beau, # Author: Emmanuel Samyn, Raphaël Valyi, Sébastien Beau,
@@ -21,18 +22,16 @@
# #
############################################################################## ##############################################################################
from openerp.osv import fields, orm from openerp import fields, models
class res_company(orm.Model): class ResCompany(models.Model):
_inherit = "res.company" _inherit = "res.company"
_columns = { crm_return_address_id = fields.Many2one(
'crm_return_address_id': fields.many2one( 'res.partner',
'res.partner', string='Return address',
'Return address', help="Default address where the customers has to send back the "
help="Default address where the customers has to send back the " "returned product. If empty, the address is the "
"returned product. If empty, the address is the " "company address")
"company address"),
}

View File

@@ -0,0 +1,40 @@
# -*- coding: utf-8 -*-
# ########################################################################
# #
# #
# ########################################################################
# #
# Copyright 2015 Vauxoo
# Copyright (C) 2009-2011 Akretion, Emmanuel Samyn, Benoît Guillot #
# #
# 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 fields, models
class ReturnInstruction(models.Model):
_name = "return.instruction"
_description = "Instructions for product return"
name = fields.Char('Title', required=True)
instructions = fields.Text(
'Instructions',
help="Instructions for product return")
is_default = fields.Boolean('Is default',
help="If is default, will be use "
"to set the default value in "
"supplier infos. Be careful to "
"have only one default")

View File

@@ -1,128 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2009-2011 Akretion, Emmanuel Samyn, Benoît Guillot
#
# 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 openerp.osv import orm, fields
class return_instruction(orm.Model):
_name = "return.instruction"
_description = "Instructions for product return"
_columns = {
'name': fields.char('Title', required=True),
'instructions': fields.text(
'Instructions',
help="Instructions for product return"),
'is_default': fields.boolean(
'Is default',
help="If is default, will be use to set the default value in "
"supplier infos. Be careful to have only one default"),
}
class product_supplierinfo(orm.Model):
_inherit = "product.supplierinfo"
def get_warranty_return_partner(self, cr, uid, context=None):
result = [('company', 'Company'),
('supplier', 'Supplier'),
('other', 'Other'),
]
return result
def _get_default_instructions(self, cr, uid, context=None):
""" Get selected lines to add to exchange """
instr_obj = self.pool.get('return.instruction')
instruction_ids = instr_obj.search(cr, uid,
[('is_default', '=', True)],
context=context)
if instruction_ids:
return instruction_ids[0]
return False
def _get_warranty_return_address(self, cr, uid, ids, field_names, arg,
context=None):
""" Method to return the partner delivery address or if none, the
default address
dedicated_delivery_address stand for the case a new type of
address more particularly dedicated to return delivery would be
implemented.
"""
result = {}
for supplier_info in self.browse(cr, uid, ids, context=context):
result[supplier_info.id] = False
return_partner = supplier_info.warranty_return_partner
partner_id = supplier_info.company_id.partner_id.id
if return_partner:
if return_partner == 'supplier':
partner_id = supplier_info.name.id
elif return_partner == 'company':
if supplier_info.company_id.crm_return_address_id:
partner_id = supplier_info.company_id.\
crm_return_address_id.id
elif return_partner == 'other':
if supplier_info.warranty_return_other_address_id:
partner_id = supplier_info.\
warranty_return_other_address_id.id
result[supplier_info.id] = partner_id
return result
_columns = {
"warranty_duration": fields.float(
'Period',
help="Warranty in month for this product/supplier relation. "
"Only for company/supplier relation (purchase order) ; "
"the customer/company relation (sale order) always use "
"the product main warranty field"),
"warranty_return_partner": fields.selection(
get_warranty_return_partner,
'Return type',
required=True,
help="Who is in charge of the warranty return treatment toward "
"the end customer. Company will use the current company "
"delivery or default address and so on for supplier and "
"brand manufacturer. Doesn't necessarily mean that "
"the warranty to be applied is the one of the return partner "
"(i.e. can be returned to the company and be under the brand "
"warranty"),
'return_instructions': fields.many2one(
'return.instruction',
'Instructions',
help="Instructions for product return"),
'active_supplier': fields.boolean(
'Active supplier',
help="Is this supplier still active, only for information"),
'warranty_return_address': fields.function(
_get_warranty_return_address,
type='many2one', relation='res.partner', string="Return address",
help="Where the goods should be returned "
"(computed field based on other infos.)"),
"warranty_return_other_address_id": fields.many2one(
'res.partner',
'Return address',
help="Where the customer has to send back the product(s) "
"if warranty return is set to 'other'."),
}
_defaults = {
'warranty_return_partner': 'company',
'return_instructions': _get_default_instructions,
}

View File

@@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Yanina Aular
# Copyright 2015 Vauxoo
#
# 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 . import test_product_warranty

View File

@@ -0,0 +1,80 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Yanina Aular
# Copyright 2015 Vauxoo
#
# 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 openerp.tests.common import TransactionCase
class TestProductWarranty(TransactionCase):
def setUp(self):
super(TestProductWarranty, self).setUp()
self.instruction_model = self.env['return.instruction']
self.supplierinfo = self.env['product.supplierinfo']
self.create_product_supplierinfo()
def create_product_supplierinfo(self):
"""
Create a record of product.supplier for next tests
"""
product_tmpl_id = self.env.ref('product.product_product_3')
partner_id = self.env.ref('base.res_partner_4')
supplierinfo_data = dict(name=partner_id.id,
product_name='Test SupplierInfo for'
' display Default Instruction',
min_qty=4,
delay=5,
warranty_return_partner='supplier',
product_tmpl_id=product_tmpl_id.id,)
self.supplierinfo_brw = \
self.supplierinfo.create(supplierinfo_data)
def test_default_instruction(self):
"""
Test for return.instruction record with
default field in True. If is assigned
correctly when one record of
product.supplierinfo is created
"""
return_instructions_id = self.env.ref('product_warranty.'
'return_instruction_1')
self.assertEquals(self.supplierinfo_brw.return_instructions.id,
return_instructions_id.id)
def test_warranty_return_address(self):
"""
Test warranty_return_address field is calculate correctly depends of
warranty_return_partner
"""
self.create_product_supplierinfo()
self.assertEquals(self.supplierinfo_brw.warranty_return_address.id,
self.supplierinfo_brw.name.id)
self.supplierinfo_brw.write({'warranty_return_partner': 'company'})
self.assertEquals(self.supplierinfo_brw.warranty_return_address.id,
self.supplierinfo_brw.company_id.
crm_return_address_id.id)

View File

@@ -53,7 +53,7 @@
</record> </record>
<record id="product_return_instructions_action" model="ir.actions.act_window"> <record id="product_return_instructions_action" model="ir.actions.act_window">
<field name="name">Products return instructions</field> <field name="name">Products Return Instructions</field>
<field name="res_model">return.instruction</field> <field name="res_model">return.instruction</field>
<field name="view_type">form</field> <field name="view_type">form</field>
<field name="view_mode">tree,form</field> <field name="view_mode">tree,form</field>
@@ -71,13 +71,13 @@
<field name="model">product.supplierinfo</field> <field name="model">product.supplierinfo</field>
<field name="inherit_id" ref="product.product_supplierinfo_tree_view" /> <field name="inherit_id" ref="product.product_supplierinfo_tree_view" />
<field name="arch" type="xml"> <field name="arch" type="xml">
<field position="after" name="delay"> <xpath expr="//field[@name='delay']" position="after">
<field name="warranty_duration"/> <field name="warranty_duration"/>
<field name="warranty_return_partner"/> <field name="warranty_return_partner"/>
<field name="warranty_return_address"/> <field name="warranty_return_address"/>
<field name="active_supplier"/> <field name="active_supplier"/>
<field name="return_instructions"/> <field name="return_instructions"/>
</field> </xpath>
</field> </field>
</record> </record>
@@ -97,13 +97,10 @@
<field name="warranty_return_partner"/> <field name="warranty_return_partner"/>
</group> </group>
<group> <group>
<div> <field name="warranty_return_other_address" attrs="{'invisible':[('warranty_return_partner', '!=', 'other')], 'required':[('warranty_return_partner', '=', 'other')]}" class="oe_inline"/>
<label for="warranty_return_other_address_id"/> <field name="warranty_return_address" attrs="{'invisible':[('warranty_return_partner', '=', 'other')]}" class="oe_inline" />
<field name="warranty_return_other_address_id" attrs="{'invisible':[('warranty_return_partner', '!=', 'other')], 'required':[('warranty_return_partner', '=', 'other')]}" class="oe_inline"/>
<field name="warranty_return_address" attrs="{'invisible':[('warranty_return_partner', '=', 'other')]}" class="oe_inline" />
</div>
</group>
</group> </group>
</group>
</group> </group>
</field> </field>
</field> </field>

View File

@@ -6,18 +6,14 @@
<record id="company_form" model="ir.ui.view"> <record id="company_form" model="ir.ui.view">
<field name="name">crm_claim_rma.company_form</field> <field name="name">crm_claim_rma.company_form</field>
<field name="model">res.company</field> <field name="model">res.company</field>
<field name="inherit_id" ref="base.view_company_form" /> <field name="inherit_id" ref="base.view_company_form"/>
<field eval="16" name="priority"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<data> <xpath expr="//field[@name='company_registry']" position="after">
<field name="company_registry" position="after"> <separator string="Crm product return address"/>
<separator string="Crm product return address" colspan="4"/> <field name="crm_return_address_id"/>
<field name="crm_return_address_id"/> </xpath>
</field>
</data>
</field> </field>
</record> </record>
</data> </data>
</openerp> </openerp>