From 20a459015f176f99b8fab5351efaccddbab5b8e0 Mon Sep 17 00:00:00 2001 From: manu Date: Thu, 20 Oct 2011 19:19:44 +0200 Subject: [PATCH] [ADD] default return instructions to product_supplierinfo --- product_warranty/product_warranty.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/product_warranty/product_warranty.py b/product_warranty/product_warranty.py index d6470e16..d66d1cb3 100644 --- a/product_warranty/product_warranty.py +++ b/product_warranty/product_warranty.py @@ -49,7 +49,13 @@ class product_supplierinfo(osv.osv): ('company','Company'), ('brand','Brand manufacturer'), ('other','Other'),] - + + # Get selected lines to add to exchange + def _get_default_instructions(self, cr, uid,context): + instruction_ids = self.pool.get('return.instruction').search(cr, uid, [('is_default','=','FALSE')]) + if instruction_ids: + return instruction_ids[0] + _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"), @@ -58,6 +64,7 @@ class product_supplierinfo(osv.osv): } _defaults = { 'warranty_return_partner': lambda *a: 'company', + 'return_instructions': _get_default_instructions, } product_supplierinfo()