diff --git a/product_warranty/__init__.py b/product_warranty/__init__.py index 85031822..7c715039 100644 --- a/product_warranty/__init__.py +++ b/product_warranty/__init__.py @@ -19,5 +19,5 @@ #You should have received a copy of the GNU General Public License # #along with this program. If not, see . # ######################################################################### - -import product_warranty +from . import product_warranty +from . import res_company \ No newline at end of file diff --git a/product_warranty/__openerp__.py b/product_warranty/__openerp__.py index b844f932..6ffdaca7 100644 --- a/product_warranty/__openerp__.py +++ b/product_warranty/__openerp__.py @@ -26,17 +26,25 @@ 'version': '1.0', 'category': 'Generic Modules/Product', 'description': """ -Akretion - Emmanuel Samyn -Extend the product warranty management with warranty details on product / supplier relation +Product Warranty +================ + +Extend the product warranty management with warranty details on product / supplier relation: + * supplier warranty duration -* return product to company, supplier, brand, other - """, - 'author': 'esamyn', - 'website': 'http://www.erp-236.com', +* Set default return address for company (if different from standard one) +* return product to company, supplier, other + + +Those informations are used in the RMA Claim (Product Return Management) module. + +""", + 'author': 'Akretion', + 'website': 'http://akretion.com', 'depends': ['product'], - 'init_xml': [], - 'update_xml': [ + 'data': [ 'security/ir.model.access.csv', + 'res_company_view.xml', 'product_warranty_view.xml', ], 'demo_xml': [], diff --git a/product_warranty/i18n/product_warranty.pot b/product_warranty/i18n/product_warranty.pot new file mode 100644 index 00000000..7c7fd45b --- /dev/null +++ b/product_warranty/i18n/product_warranty.pot @@ -0,0 +1,132 @@ +# Translation of OpenERP Server. +# This file contains the translation of the following modules: +# * product_warranty +# +msgid "" +msgstr "" +"Project-Id-Version: OpenERP Server 7.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2013-11-21 15:06+0000\n" +"PO-Revision-Date: 2013-11-21 15:06+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: product_warranty +#: model:ir.model.fields,field_description:product_warranty.field_product_supplierinfo_warranty_return_address +#: model:ir.model.fields,field_description:product_warranty.field_product_supplierinfo_warranty_return_other_address_id +#: field:product.supplierinfo,warranty_return_address:0 +#: field:product.supplierinfo,warranty_return_other_address_id:0 +msgid "Return address" +msgstr "" + +#. module: product_warranty +#: view:product.supplierinfo:0 +msgid "Warranty informations" +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 "" + +#. module: product_warranty +#: help:product.supplierinfo,warranty_return_other_address_id:0 +msgid "Where the customer has to send back the product(s) if warranty return is setto 'other'." +msgstr "" + +#. 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 "" + +#. module: product_warranty +#: view:res.company:0 +msgid "Crm product return address" +msgstr "" + +#. 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 "" + +#. 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 +msgid "Is default" +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 +#: help:product.supplierinfo,active_supplier:0 +msgid "Is this supplier still active, only for information" +msgstr "" + +#. module: product_warranty +#: model:ir.model.fields,field_description:product_warranty.field_product_supplierinfo_warranty_return_partner +#: field:product.supplierinfo,warranty_return_partner:0 +msgid "Return type" +msgstr "" + +#. module: product_warranty +#: view:return.instruction:0 +msgid "Return instructions" +msgstr "" + +#. module: product_warranty +#: model:ir.model.fields,field_description:product_warranty.field_product_supplierinfo_return_instructions +#: model:ir.model.fields,field_description:product_warranty.field_return_instruction_instructions +#: field:product.supplierinfo,return_instructions:0 +#: view:return.instruction:0 +#: field:return.instruction,instructions:0 +msgid "Instructions" +msgstr "" + diff --git a/product_warranty/product_warranty.py b/product_warranty/product_warranty.py index e63abdbe..0c2f8b50 100644 --- a/product_warranty/product_warranty.py +++ b/product_warranty/product_warranty.py @@ -28,8 +28,11 @@ class return_instruction(orm.Model): _description = "Instructions for product return" _columns = { 'name': fields.char('Title', size=128, 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"), + '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): @@ -40,13 +43,12 @@ class product_supplierinfo(orm.Model): ('company','Company'), ('supplier','Supplier'), ('other','Other'),] - if self.pool.get('ir.module.module').search(cr, uid, [('name','like','product_brand'),('state','like','installed')]): - result.append(('brand','Brand manufacturer'),) return result # Get selected lines to add to exchange def _get_default_instructions(self, cr, uid, context=None): - instruction_ids = self.pool.get('return.instruction').search(cr, uid, [('is_default','=','FALSE')]) + instruction_ids = self.pool.get('return.instruction').search(cr, uid, + [('is_default','=','FALSE')]) if instruction_ids: return instruction_ids[0] # TODO f(supplier) + other. @@ -54,46 +56,55 @@ class product_supplierinfo(orm.Model): 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. + # dedicated_delivery_address stand for the case a new type of address more particularly + # dedicated to return delivery would be implemented. result ={} address_obj = self.pool.get('res.partner') for supplier_info in self.browse(cr, uid, ids, context=context): result[supplier_info.id] = {} address_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 == 'brand': - if not supplier_info.product_id.product_brand_id.partner_id: - raise osv.except_osv(_('Error !'), _('You need to define a partner for the brand of the product !')) - partner_id = supplier_info.product_id.product_brand_id.partner_id.id - else: - partner_id = supplier_info.company_id.partner_id.id -# TODO : Find the partner with a delivery address, child of the partner -# v6.1 code with res.partner.address : -# address_id = address_obj.search(cr, uid, [('partner_id', '=', partner_id), ('type', 'like', 'dedicated_delivery')], context=context) -# if not address_id: -# address_id = address_obj.search(cr, uid, [('partner_id','=', partner_id), ('type','like','delivery')], context=context) -# if not address_id: -# address_id = address_obj.search(cr, uid, [('partner_id', '=', partner_id), ('type', 'like', 'default')], context=context) -# if not address_id: -# raise osv.except_osv(_('Error !'), _('No address define for the %s!') % return_partner) -# #result[supplier_info.id] = address_id[0] + 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('Warranty', 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, 'Warrantee return', size=128, 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',help="Instructions for product return"), - 'active_supplier' : fields.boolean('Active supplier', help=""), - 'warranty_return_address': fields.function(_get_warranty_return_address, type='many2one', relation='res.partner', string="Warranty return address"), + "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 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', + 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': lambda *a: 'company', 'return_instructions': _get_default_instructions, } - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/product_warranty/product_warranty_view.xml b/product_warranty/product_warranty_view.xml index 1ab3e23f..bf59e48b 100644 --- a/product_warranty/product_warranty_view.xml +++ b/product_warranty/product_warranty_view.xml @@ -84,12 +84,24 @@ product.supplierinfo - - - - - - + + + + + + + + + + +
+
+
+
+
diff --git a/product_warranty/res_company.py b/product_warranty/res_company.py new file mode 100644 index 00000000..e0d132fd --- /dev/null +++ b/product_warranty/res_company.py @@ -0,0 +1,38 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Copyright 2013 Camptocamp +# Copyright 2009-2013 Akretion, +# Author: Emmanuel Samyn, Raphaël Valyi, Sébastien Beau, Joel Grand-Guillaume +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +from openerp.osv import fields, orm, osv + + +class res_company(orm.Model): + + _inherit = "res.company" + + _columns = { + 'crm_return_address_id': fields.many2one('res.partner', + 'Return address', + help="Default address where the customers has to send back the " + "returned product. If empty, the address is the " + "company address"), + } + + diff --git a/product_warranty/res_company_view.xml b/product_warranty/res_company_view.xml new file mode 100644 index 00000000..492be670 --- /dev/null +++ b/product_warranty/res_company_view.xml @@ -0,0 +1,23 @@ + + + + + + + crm_claim_rma.company_form + res.company + + + + + + + + + + + + + + +