[IMP] Move the support of return address per company in product_warranty module

[IMP] Adapt the computation of the return address
[IMP] Allow the user to define manually the return address if type = other
[IMP] Improve the views and adapt the wizard
[IMP] Adapt translation .pot files
This commit is contained in:
Joel Grand-Guillaume
2013-11-21 16:08:21 +01:00
parent e5e4bc1bbf
commit 13078f2943
13 changed files with 201 additions and 148 deletions

View File

@@ -23,4 +23,3 @@ from . import wizard
from . import crm_claim_rma
from . import account_invoice
from . import stock
from . import res_company

View File

@@ -57,7 +57,6 @@ Using this module make the logistic flow of return this way:
'security/ir.model.access.csv',
'account_invoice_view.xml',
'stock_view.xml',
'res_company_view.xml',
'crm_claim_rma_data.xml',
],
'images': ['images/product_return.png', 'images/claim.png','images/return_line.png','images/exchange.png'],

View File

@@ -75,7 +75,12 @@ class claim_line(orm.Model):
std_default.update(default)
return super(claim_line, self).copy_data(
cr, uid, id, default=std_default, context=context)
def get_warranty_return_partner(self, cr, uid, context=None):
seller = self.pool.get('product.supplierinfo')
result = seller.get_warranty_return_partner(cr, uid, context=context)
return result
_columns = {
'name': fields.char('Description', size=64,required=True),
'claim_origine': fields.selection([('none','Not specified'),
@@ -119,13 +124,17 @@ class claim_line(orm.Model):
'warning': fields.char('Warranty', size=64,
readonly=True,
help="If warranty has expired"),
'warranty_type': fields.char('Warranty type',
size=64,
"warranty_type": fields.selection(get_warranty_return_partner,
'Warranty type',
readonly=True,
help="From product form"),
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"),
"warranty_return_partner" : fields.many2one('res.partner',
'Warranty return',
help="Where the customer has to send back the product(s)"),
'Warranty Address',
help="Where the customer has to send back the product(s)"),
'claim_id': fields.many2one('crm.claim', 'Related claim',
help="To link to the case.claim object"),
'state' : fields.selection([('draft','Draft'),
@@ -195,18 +204,18 @@ class claim_line(orm.Model):
def get_destination_location(self, cr, uid, product_id,
warehouse_id, context=None):
"""Compute and return the destination location ID to take
for a return."""
for a return. Always take 'Supplier' one when return type different
from company."""
prod_obj = self.pool.get('product.product')
prod = prod_obj.browse(cr, uid, product_id, context=context)
wh_obj = self.pool.get('stock.warehouse')
wh = wh_obj.browse(cr, uid, warehouse_id, context=context)
location_dest_id = wh.lot_stock_id.id
return_type = 'company'
if prod:
seller = prod.seller_info_id
if seller:
return_type = seller.warranty_return_partner
if return_type == 'supplier':
if return_type != 'company':
location_dest_id = seller.name.property_stock_supplier.id
return location_dest_id
@@ -220,17 +229,10 @@ class claim_line(orm.Model):
if specified
- supplier: return to the supplier address"""
return_address = None
return_type = 'company'
seller = claim_line.product_id.seller_info_id
claim_company = claim_line.claim_id.company_id
if claim_company.crm_return_address_id:
return_address = claim_company.crm_return_address_id.id
else:
return_address = claim_company.partner_id.id
if seller:
return_type = seller.warranty_return_partner
if return_type == 'supplier':
return_address = seller.warranty_return_address.id
return_address = seller.warranty_return_address.id
return_type = seller.warranty_return_partner
location_dest_id = self.get_destination_location(cr, uid,
claim_line.product_id.id,
claim_line.claim_id.warehouse_id.id,

View File

@@ -61,7 +61,8 @@
<field name="name"/>
<field name="prodlot_id"/>
<field name="warning"/>
<field name="location_dest_id"/>
<field name="warranty_type"/>
<field name="warranty_return_partner"/>
<button name="set_warranty" string="Compute Waranty" type="object" icon="gtk-justify-fill"/>
<field name="product_returned_quantity"/>
<field name="claim_origine"/>

View File

@@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 7.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2013-11-15 14:51+0000\n"
"PO-Revision-Date: 2013-11-15 14:51+0000\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"
@@ -21,8 +21,8 @@ msgid "Returned good"
msgstr ""
#. module: crm_claim_rma
#: view:res.company:0
msgid "Crm product return address"
#: view:claim_make_picking.wizard:0
msgid "Locations"
msgstr ""
#. module: crm_claim_rma
@@ -30,6 +30,11 @@ msgstr ""
msgid "Draft and Open Claims"
msgstr ""
#. module: crm_claim_rma
#: 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: crm_claim_rma
#: view:claim.line:0
msgid "Group By..."
@@ -47,9 +52,9 @@ msgid "Warranty limit"
msgstr ""
#. module: crm_claim_rma
#: model:ir.model.fields,field_description:crm_claim_rma.field_res_company_crm_return_address_id
#: field:res.company,crm_return_address_id:0
msgid "Crm return address"
#: selection:claim.line,applicable_guarantee:0
#: selection:crm.claim,claim_type:0
msgid "Supplier"
msgstr ""
#. module: crm_claim_rma
@@ -64,11 +69,6 @@ msgstr ""
msgid "Refund Line"
msgstr ""
#. module: crm_claim_rma
#: help:res.company,crm_return_address_id:0
msgid "Default address where the customers has to send back the returned product in a crm claim. If empty the address is the company address"
msgstr ""
#. module: crm_claim_rma
#: selection:claim.line,applicable_guarantee:0
msgid "Company"
@@ -82,8 +82,6 @@ msgstr ""
#. module: crm_claim_rma
#: field:claim_make_picking.wizard,claim_line_dest_location:0
#: field:claim_make_picking_from_picking.wizard,picking_line_dest_location:0
#: model:ir.model.fields,field_description:crm_claim_rma.field_claim_make_picking_from_picking_wizard_picking_line_dest_location
#: model:ir.model.fields,field_description:crm_claim_rma.field_claim_make_picking_wizard_claim_line_dest_location
msgid "Dest. Location"
msgstr ""
@@ -149,11 +147,6 @@ msgstr ""
msgid "Claim"
msgstr ""
#. module: crm_claim_rma
#: help:claim.line,location_dest_id:0
msgid "The return stock location of the returned product"
msgstr ""
#. module: crm_claim_rma
#: help:claim.line,substate_id:0
msgid "Select a sub state to precise the standard state. Example 1: state = refused; substate could be warranty over, not in warranty, no problem,... . Example 2: state = to treate; substate could be to refund, to exchange, to repair,..."
@@ -170,7 +163,6 @@ msgid "Create Outgoing Shipments"
msgstr ""
#. module: crm_claim_rma
#: field:claim.line,warranty_return_partner:0
#: model:ir.model.fields,field_description:crm_claim_rma.field_claim_line_warranty_return_partner
msgid "Warranty return"
msgstr ""
@@ -182,11 +174,6 @@ msgstr ""
msgid "Warranty"
msgstr ""
#. module: crm_claim_rma
#: help:claim.line,warning:0
msgid "If warranty has expired"
msgstr ""
#. module: crm_claim_rma
#: model:crm.case.categ,name:crm_claim_rma.categ_claim11
msgid "Customer Return"
@@ -224,19 +211,13 @@ msgstr ""
msgid "Receptions / Deliveries"
msgstr ""
#. module: crm_claim_rma
#: field:claim.line,location_dest_id:0
#: model:ir.model.fields,field_description:crm_claim_rma.field_claim_line_location_dest_id
msgid "Return Stock Location"
msgstr ""
#. module: crm_claim_rma
#: model:ir.model,name:crm_claim_rma.model_stock_picking_out
msgid "Delivery Orders"
msgstr ""
#. module: crm_claim_rma
#: code:addons/crm_claim_rma/crm_claim_rma.py:185
#: code:addons/crm_claim_rma/crm_claim_rma.py:194
#, python-format
msgid "valid"
msgstr ""
@@ -246,15 +227,20 @@ msgstr ""
msgid "To set the last state / substate change"
msgstr ""
#. module: crm_claim_rma
#: model:ir.model.fields,field_description:crm_claim_rma.field_res_company_crm_return_address_id
#: field:res.company,crm_return_address_id:0
msgid "Return address"
msgstr ""
#. module: crm_claim_rma
#: model:ir.model,name:crm_claim_rma.model_returned_lines_from_serial_wizard
msgid "Wizard to create product return lines from serial numbers"
msgstr ""
#. module: crm_claim_rma
#: help:claim_make_picking.wizard,claim_line_source_location:0
#: help:claim_make_picking_from_picking.wizard,picking_line_source_location:0
msgid "Location where the returned products are from."
#: selection:claim.line,claim_origine:0
msgid "Not specified"
msgstr ""
#. module: crm_claim_rma
@@ -263,14 +249,9 @@ msgid "Returned lines"
msgstr ""
#. module: crm_claim_rma
#: view:claim_make_picking.wizard:0
msgid "Locations"
msgstr ""
#. module: crm_claim_rma
#: selection:claim.line,applicable_guarantee:0
#: selection:crm.claim,claim_type:0
msgid "Supplier"
#: field:crm.claim,number:0
#: model:ir.model.fields,field_description:crm_claim_rma.field_crm_claim_number
msgid "Number"
msgstr ""
#. module: crm_claim_rma
@@ -307,7 +288,6 @@ msgstr ""
#. module: crm_claim_rma
#: help:claim_make_picking.wizard,claim_line_dest_location:0
#: help:claim_make_picking_from_picking.wizard,picking_line_dest_location:0
msgid "Location where the system will stock the returned products."
msgstr ""
@@ -323,10 +303,11 @@ msgstr ""
#. module: crm_claim_rma
#: code:addons/crm_claim_rma/account_invoice.py:73
#: code:addons/crm_claim_rma/crm_claim_rma.py:191
#: code:addons/crm_claim_rma/crm_claim_rma.py:253
#: code:addons/crm_claim_rma/crm_claim_rma.py:200
#: code:addons/crm_claim_rma/crm_claim_rma.py:255
#: code:addons/crm_claim_rma/wizard/claim_make_picking.py:64
#: code:addons/crm_claim_rma/wizard/claim_make_picking.py:167
#: code:addons/crm_claim_rma/wizard/claim_make_picking.py:182
#: code:addons/crm_claim_rma/wizard/claim_make_picking.py:188
#, python-format
msgid "Error !"
msgstr ""
@@ -337,7 +318,7 @@ msgid "The warranty limit is computed as: invoice date + warranty defined on sel
msgstr ""
#. module: crm_claim_rma
#: code:addons/crm_claim_rma/crm_claim_rma.py:254
#: code:addons/crm_claim_rma/crm_claim_rma.py:256
#, python-format
msgid "PLEASE SET PRODUCT & INVOICE!"
msgstr ""
@@ -370,17 +351,6 @@ msgstr ""
msgid "Quantity"
msgstr ""
#. module: crm_claim_rma
#: help:claim.line,warranty_type:0
msgid "From product form"
msgstr ""
#. module: crm_claim_rma
#: field:claim_make_picking_from_picking.wizard,picking_line_ids:0
#: model:ir.model.fields,field_description:crm_claim_rma.field_claim_make_picking_from_picking_wizard_picking_line_ids
msgid "Picking lines"
msgstr ""
#. module: crm_claim_rma
#: selection:claim.line,state:0
msgid "Confirmed, waiting for product"
@@ -416,9 +386,9 @@ msgid "Customer Refunds"
msgstr ""
#. module: crm_claim_rma
#: model:ir.model.fields,field_description:crm_claim_rma.field_stock_warehouse_lot_breakage_loss_id
#: field:stock.warehouse,lot_breakage_loss_id:0
msgid "Location Breakage Loss"
#: field:claim.line,location_dest_id:0
#: model:ir.model.fields,field_description:crm_claim_rma.field_claim_line_location_dest_id
msgid "Return Stock Location"
msgstr ""
#. module: crm_claim_rma
@@ -438,11 +408,16 @@ msgid "Shipping error"
msgstr ""
#. module: crm_claim_rma
#: code:addons/crm_claim_rma/wizard/claim_make_picking.py:168
#: code:addons/crm_claim_rma/wizard/claim_make_picking.py:183
#, python-format
msgid "A product return cannot be created for various destination location, please chose line with a same destination location."
msgstr ""
#. module: crm_claim_rma
#: field:claim.line,warranty_return_partner:0
msgid "Warranty Address"
msgstr ""
#. module: crm_claim_rma
#: help:crm.claim,invoice_id:0
msgid "Related original Cusotmer invoice"
@@ -497,6 +472,12 @@ msgstr ""
msgid "The serial/lot of the returned product"
msgstr ""
#. module: crm_claim_rma
#: code:addons/crm_claim_rma/wizard/claim_make_picking.py:189
#, python-format
msgid "A product return cannot be created for various destination address, please chose line with a same address."
msgstr ""
#. module: crm_claim_rma
#: view:crm.claim:0
msgid "New Refund"
@@ -574,7 +555,7 @@ msgid "The refund line related to the returned product"
msgstr ""
#. module: crm_claim_rma
#: code:addons/crm_claim_rma/crm_claim_rma.py:183
#: code:addons/crm_claim_rma/crm_claim_rma.py:192
#, python-format
msgid "expired"
msgstr ""
@@ -595,8 +576,8 @@ msgid "Claim line substates"
msgstr ""
#. module: crm_claim_rma
#: selection:claim.line,claim_origine:0
msgid "Not specified"
#: help:claim_make_picking.wizard,claim_line_source_location:0
msgid "Location where the returned products are from."
msgstr ""
#. module: crm_claim_rma
@@ -609,9 +590,8 @@ msgid "RMA"
msgstr ""
#. module: crm_claim_rma
#: model:ir.model.fields,field_description:crm_claim_rma.field_stock_warehouse_lot_rma_id
#: field:stock.warehouse,lot_rma_id:0
msgid "Location RMA"
#: help:claim.line,warranty_type: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: crm_claim_rma
@@ -641,7 +621,7 @@ msgid "Where the customer has to send back the product(s)"
msgstr ""
#. module: crm_claim_rma
#: code:addons/crm_claim_rma/crm_claim_rma.py:274
#: code:addons/crm_claim_rma/crm_claim_rma.py:276
#, python-format
msgid "There is no warehouse for the current user's company!"
msgstr ""
@@ -664,7 +644,7 @@ msgid "Claim lines"
msgstr ""
#. module: crm_claim_rma
#: code:addons/crm_claim_rma/crm_claim_rma.py:192
#: code:addons/crm_claim_rma/crm_claim_rma.py:201
#, python-format
msgid "Cannot find any date for invoice ! Must be a validated invoice !"
msgstr ""
@@ -718,8 +698,6 @@ msgstr ""
#. module: crm_claim_rma
#: field:claim_make_picking.wizard,claim_line_source_location:0
#: field:claim_make_picking_from_picking.wizard,picking_line_source_location:0
#: model:ir.model.fields,field_description:crm_claim_rma.field_claim_make_picking_from_picking_wizard_picking_line_source_location
#: model:ir.model.fields,field_description:crm_claim_rma.field_claim_make_picking_wizard_claim_line_source_location
msgid "Source Location"
msgstr ""
@@ -788,7 +766,7 @@ msgid "substate that precise a given state"
msgstr ""
#. module: crm_claim_rma
#: code:addons/crm_claim_rma/crm_claim_rma.py:170
#: code:addons/crm_claim_rma/crm_claim_rma.py:179
#, python-format
msgid "not_define"
msgstr ""
@@ -857,21 +835,19 @@ msgid "Unit sale price of the product. Auto filed if retrun done by invoice sele
msgstr ""
#. module: crm_claim_rma
#: code:addons/crm_claim_rma/crm_claim_rma.py:273
#: code:addons/crm_claim_rma/crm_claim_rma.py:275
#, python-format
msgid "Error!"
msgstr ""
#. module: crm_claim_rma
#: field:crm.claim,number:0
#: model:ir.model.fields,field_description:crm_claim_rma.field_crm_claim_number
msgid "Number"
#: help:claim.line,location_dest_id:0
msgid "The return stock location of the returned product"
msgstr ""
#. module: crm_claim_rma
#: model:ir.model.fields,field_description:crm_claim_rma.field_stock_warehouse_lot_carrier_loss_id
#: field:stock.warehouse,lot_carrier_loss_id:0
msgid "Location Carrier Loss"
#: help:claim.line,warning:0
msgid "If warranty has expired"
msgstr ""
#. module: crm_claim_rma
@@ -963,9 +939,3 @@ msgstr ""
msgid "In Progress Claims"
msgstr ""
#. module: crm_claim_rma
#: model:ir.model.fields,field_description:crm_claim_rma.field_stock_warehouse_lot_refurbish_id
#: field:stock.warehouse,lot_refurbish_id:0
msgid "Location Refurbish"
msgstr ""

View File

@@ -84,7 +84,7 @@ class claim_make_picking(orm.TransientModel):
return loc_id
def _get_common_dest_location_from_line(self, cr, uid, line_ids, context):
"""Return the ID of the common location between all lines. If notecommon
"""Return the ID of the common location between all lines. If no common
destination was found, return False"""
loc_id = False
line_obj = self.pool.get('claim.line')
@@ -96,6 +96,20 @@ class claim_make_picking(orm.TransientModel):
loc_id = line_location[0]
return loc_id
def _get_common_partner_from_line(self, cr, uid, line_ids, context):
"""Return the ID of the common partner between all lines. If no common
partner was found, return False"""
partner_id = False
line_obj = self.pool.get('claim.line')
line_partner = []
for line in line_obj.browse(cr, uid, line_ids, context=context):
if (line.warranty_return_partner and line.warranty_return_partner.id
not in line_partner):
line_partner.append(line.warranty_return_partner.id)
if len (line_partner) == 1:
partner_id = line_partner[0]
return partner_id
# Get default destination location
def _get_dest_loc(self, cr, uid, context):
"""Return the location_id to use as destination.
@@ -160,6 +174,7 @@ class claim_make_picking(orm.TransientModel):
line_ids = [x.id for x in wizard.claim_line_ids]
# In case of product return, we don't allow one picking for various
# product if location are different
# or if partner address is different
if context.get('product_return'):
common_dest_loc_id = self._get_common_dest_location_from_line(cr, uid,
line_ids, context=context)
@@ -167,6 +182,14 @@ class claim_make_picking(orm.TransientModel):
raise osv.except_osv(_('Error !'),
_('A product return cannot be created for various destination location, please '
'chose line with a same destination location.'))
common_dest_partner_id = self._get_common_partner_from_line(cr, uid,
line_ids, context=context)
if not common_dest_partner_id:
raise osv.except_osv(_('Error !'),
_('A product return cannot be created for various destination address, please '
'chose line with a same address.'))
else:
partner_id = common_dest_partner_id
# create picking
picking_id = picking_obj.create(cr, uid, {
'origin': claim.number,
@@ -174,7 +197,7 @@ class claim_make_picking(orm.TransientModel):
'move_type': 'one', # direct
'state': 'draft',
'date': time.strftime(DEFAULT_SERVER_DATETIME_FORMAT),
'partner_id': claim.partner_id.id,
'partner_id': partner_id,
'invoice_state': "none",
'company_id': claim.company_id.id,
'location_id': wizard.claim_line_source_location.id,
@@ -193,7 +216,7 @@ class claim_make_picking(orm.TransientModel):
'product_id': wizard_claim_line.product_id.id,
'product_qty': wizard_claim_line.product_returned_quantity,
'product_uom': wizard_claim_line.product_id.uom_id.id,
'partner_id': claim.partner_id.id,
'partner_id': partner_id,
'prodlot_id': wizard_claim_line.prodlot_id.id,
# 'tracking_id':
'picking_id': picking_id,

View File

@@ -20,3 +20,4 @@
#along with this program. If not, see <http://www.gnu.org/licenses/>. #
#########################################################################
from . import product_warranty
from . import res_company

View File

@@ -32,8 +32,10 @@ Product Warranty
Extend the product warranty management with warranty details on product / supplier relation:
* supplier warranty duration
* 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.
""",
@@ -42,6 +44,7 @@ Those informations are used in the RMA Claim (Product Return Management) module.
'depends': ['product'],
'data': [
'security/ir.model.access.csv',
'res_company_view.xml',
'product_warranty_view.xml',
],
'demo_xml': [],

View File

@@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 7.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2013-11-15 13:30+0000\n"
"PO-Revision-Date: 2013-11-15 13:30+0000\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"
@@ -16,15 +16,49 @@ msgstr ""
"Plural-Forms: \n"
#. module: product_warranty
#: model:ir.model.fields,field_description:product_warranty.field_product_supplierinfo_warranty_duration
#: field:product.supplierinfo,warranty_duration:0
msgid "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
#: model:ir.model.fields,field_description:product_warranty.field_product_supplierinfo_warranty_return_address
#: field:product.supplierinfo,warranty_return_address:0
msgid "Warranty return address"
#: 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
@@ -34,15 +68,8 @@ msgid "Title"
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
#: 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"
#: model:ir.model,name:product_warranty.model_res_company
msgid "Companies"
msgstr ""
#. module: product_warranty
@@ -57,6 +84,11 @@ msgstr ""
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"
@@ -74,14 +106,14 @@ msgid "Information about a product supplier"
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 "Warrantee return"
#: help:product.supplierinfo,active_supplier:0
msgid "Is this supplier still active, only for information"
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"
#: 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 File

@@ -64,21 +64,26 @@ class product_supplierinfo(orm.Model):
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
else:
partner_id = supplier_info.company_id.partner_id.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('Warranty',
"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,
'Warrantee return',
"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 "
@@ -88,9 +93,15 @@ class product_supplierinfo(orm.Model):
'return_instructions': fields.many2one('return.instruction',
'Instructions',
help="Instructions for product return"),
'active_supplier': fields.boolean('Active supplier'),
'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="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',

View File

@@ -84,12 +84,24 @@
<field name="model">product.supplierinfo</field>
<field name="inherit_id" ref="product.product_supplierinfo_form_view" />
<field name="arch" type="xml">
<field position="after" name="delay">
<field name="warranty_duration"/>
<field name="warranty_return_partner" readonly="0"/>
<field name="warranty_return_address"/>
<field name="active_supplier"/>
<field name="return_instructions"/>
<field position="after" name="company_id" groups="base.group_multi_company" widget="selection">
<group string="Warranty informations" colspan="4">
<field name="active_supplier"/>
<field name="warranty_duration"/>
<field name="return_instructions"/>
<group colspan="4" col="6">
<group>
<field name="warranty_return_partner"/>
</group>
<group>
<div>
<label for="warranty_return_other_address_id"/>
<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>
</field>
</field>
</record>

View File

@@ -29,9 +29,9 @@ class res_company(orm.Model):
_columns = {
'crm_return_address_id': fields.many2one('res.partner',
'Crm return address',
'Return address',
help="Default address where the customers has to send back the "
"returned product in a crm claim. If empty the address is the "
"returned product. If empty, the address is the "
"company address"),
}