[INIT] crm_claim_rma & product_warranty

This commit is contained in:
manu
2011-10-12 15:01:59 +02:00
commit 611383f4c3
27 changed files with 3528 additions and 0 deletions

26
crm_claim_rma/__init__.py Normal file
View File

@@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
#########################################################################
# #
# #
#########################################################################
# #
# Copyright (C) 2009-2011 Akretion, Raphaël Valyi, Sébastien Beau, #
# 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/>. #
#########################################################################
import wizard
import crm_claim_rma
import invoice_line_warranty

View File

@@ -0,0 +1,58 @@
# -*- coding: utf-8 -*-
#########################################################################
# #
# #
#########################################################################
# #
# Copyright (C) 2009-2011 Akretion, Raphaël Valyi, Sébastien Beau, #
# 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/>. #
#########################################################################
{
'name': 'CRM Product Return',
'version': '1.0',
'category': 'Generic Modules/CRM & SRM',
'description': """
Add product return functionalities, product exchange and aftersale outsourcing to CRM claim
""",
'author': 'Akretion - Emmanuel Samyn',
'website': 'http://www.akretion.com',
'depends': ['sale','stock','crm_claim'],
'init_xml': ['rma_substate_data.xml',],
'update_xml': [
'wizard/returned_lines_from_serial_wizard_view.xml',
'wizard/returned_lines_from_invoice_wizard_view.xml',
'wizard/picking_from_returned_lines_wizard_view.xml',
'wizard/refund_from_returned_lines_wizard_view.xml',
'wizard/exchange_from_returned_lines_wizard_view.xml',
'wizard/picking_from_exchange_lines_wizard_view.xml',
'wizard/get_empty_serial_view.xml',
'crm_claim_rma_view.xml',
# 'security/ir.model.access.csv',
# 'report/crm_claim_report_view.xml',
],
'demo_xml': [
# 'crm_claim_demo.xml',
],
# 'test': ['test/test_crm_claim.yml'],
'installable': True,
'active': False,
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@@ -0,0 +1,260 @@
# -*- coding: utf-8 -*-
#########################################################################
# #
# #
#########################################################################
# #
# Copyright (C) 2009-2011 Akretion, Raphaël Valyi, Sébastien Beau, #
# 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 osv import fields, osv
from crm import crm
from datetime import datetime
from dateutil.relativedelta import relativedelta
import time
#===== TO REFACTOR IN A GENERIC MODULE
class substate_substate(osv.osv):
"""
To precise a state (state=refused; substates= reason 1, 2,...)
"""
_name = "substate.substate"
_description = "substate that precise a given state"
_columns = {
'name': fields.char('Sub state', size=128, required=True),
'substate_descr' : fields.text('Description', help="To give more information about the sub state"),
# ADD OBJECT TO FILTER
}
substate_substate()
#=====
class return_line(osv.osv):
"""
Class to handle a product return line (corresponding to one invoice line)
"""
_name = "return.line"
_description = "List of product to return"
# Method to calculate total amount of the line : qty*UP
def _line_total_amount(self, cr, uid, ids, field_name, arg,context):
res = {}
for line in self.browse(cr,uid,ids):
res[line.id] = line.unit_sale_price*line.product_returned_quantity
return res
def _get_claim_seq(self, cr, uid, ids, field_name, arg,context):
res = {}
for line in self.browse(cr,uid,ids):
res[line.id] = line.claim_id.sequence
return res
_columns = {
'name': fields.function(_get_claim_seq, method=True, string='Claim n°', type='char', size=64,store=True),
'claim_origine': fields.selection([('none','Not specified'),
('legal','Legal retractation'),
('cancellation','Order cancellation'),
('damaged','Damaged delivered product'),
('error','Shipping error'),
('exchange','Exchange request'),
('lost','Lost during transport'),
('other','Other')], 'Claim Subject', required=True, help="To describe the line product problem"),
'claim_descr' : fields.text('Claim description', help="More precise description of the problem"),
'invoice_id': fields.many2one('account.invoice', 'Invoice',help="The invoice related to the returned product"),
'product_id': fields.many2one('product.product', 'Product',help="Returned product"),
'product_returned_quantity' : fields.float('Quantity', digits=(12,2), help="Quantity of product returned"),
'unit_sale_price' : fields.float('Unit sale price', digits=(12,2), help="Unit sale price of the product. Auto filed if retrun done by invoice selection. BE CAREFUL AND CHECK the automatic value as don't take into account previous refounds, invoice discount, can be for 0 if product for free,..."),
'return_value' : fields.function(_line_total_amount, method=True, string='Total return', type='float', help="Quantity returned * Unit sold price",),
'prodlot_id': fields.many2one('stock.production.lot', 'Serial/Lot n°',help="The serial/lot of the returned product"),
'applicable_guarantee': fields.selection([('us','Us'),('supplier','Supplier'),('brand','Brand manufacturer')], 'Warranty type'),# METTRE CHAMP FONCTION; type supplier might generate an auto draft forward to the supplier
'guarantee_limit': fields.date('Warranty limit', help="The warranty limit is computed as: invoice date + warranty defined on selected product.", readonly=True),
'warning': fields.char('Warranty', size=64, readonly=True,help="If warranty has expired"), #select=1,
"warranty_return_partner" : fields.many2one('res.partner.address', 'Warranty return',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"),
'selected' : fields.boolean('s', help="Check to select"),
'state' : fields.selection([('draft','Draft'),
('refused','Refused'),
('confirmed','Confirmed, waiting for product'),
('in_to_control','Received, to control'),
('in_to_treate','Controlled, to treate'),
('treated','Treated')], 'State'),
'substate_id': fields.many2one('substate.substate', 'Sub state',help="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,..."),
'last_state_change': fields.date('Last change', help="To set the last state / substate change"),
}
_defaults = {
'state': lambda *a: 'draft',
'name': lambda *a: 'none',
}
# Method to calculate warranty limit
def set_warranty_limit(self, cr, uid, ids,context,return_line):
warning = "Valid"
limit = (datetime.strptime(return_line.invoice_id.date_invoice, '%Y-%m-%d') + relativedelta(months=int(return_line.product_id.warranty))).strftime('%Y-%m-%d')
if limit < return_line.claim_id.date:
warning = 'Expired'
self.write(cr,uid,ids,{
'guarantee_limit' : limit,
'warning' : warning,
})
return True
# Method to return the partner delivery address or if none, the default address
def _get_partner_address(self, cr, uid, ids, context,partner):
print "IN GET COMP"
print "partner: ",partner
delivery_address_id = self.pool.get('res.partner.address').search(cr, uid, [('partner_id','=',partner.id),('type','like','delivery')])
if delivery_address_id:
print delivery_address_id
return delivery_address_id
else:
print "default address : ",self.pool.get('res.partner.address').search(cr, uid, [('partner_id','=',partner.id),('type','like','default')])
return self.pool.get('res.partner.address').search(cr, uid, [('partner_id','=',partner.id),('type','like','default')])
# Method to calculate warranty return address
def set_warranty_return_address(self, cr, uid, ids,context,return_line):
print "IN WAR ADDRESS : ",return_line
return_address = None
if return_line.prodlot_id :
# multi supplier method
print "true"
else :
# first supplier method
if return_line.product_id.seller_ids[0]:
if return_line.product_id.seller_ids[0].warranty_return_partner:
return_partner = return_line.product_id.seller_ids[0].warranty_return_partner
print "adresse retour : ",return_partner
if return_partner == 'company':
return_address = self._get_partner_address(cr, uid, ids, context,return_line.claim_id.company_id.partner_id)[0]
elif return_partner == 'supplier':
return_address = self._get_partner_address(cr, uid, ids, context,return_line.product_id.seller_ids[0].name)[0]
else :
print "brand"
else :
print "popup erreur suppl"
self.write(cr,uid,ids,{'warranty_return_partner' : return_address})
return True
# Method to calculate warranty limit and validity
def set_warranty(self, cr, uid, ids,context):
for return_line in self.browse(cr,uid,ids):
if return_line.product_id and return_line.invoice_id:
self.set_warranty_limit(cr, uid, ids,context,return_line)
self.set_warranty_return_address(cr, uid, ids,context,return_line)
else:
self.write(cr,uid,ids,{'warning' : "PLEASE SET PRODUCT & INVOICE",})
return True
return_line()
#=====
class product_exchange(osv.osv):
"""
Class to manage product exchanges history
"""
_name = "product.exchange"
_description = "exchange history line"
# Method to calculate total amount of the line : qty*UP
def total_amount_returned(self, cr, uid, ids, field_name, arg,context):
res = {}
for line in self.browse(cr,uid,ids):
res[line.id] = line.returned_unit_sale_price*line.returned_product_qty
return res
# Method to calculate total amount of the line : qty*UP
def total_amount_replacement(self, cr, uid, ids, field_name, arg,context):
res = {}
for line in self.browse(cr,uid,ids):
res[line.id] = line.replacement_unit_sale_price*line.replacement_product_qty
return res
# Method to get the replacement product unit price
def get_replacement_price(self, cr, uid, ids, field_name, arg,context):
res = {}
for line in self.browse(cr,uid,ids):
res[line.id] = line.replacement_product.list_price
return res
_columns = {
'name': fields.char('Comment', size=128, required=True),
'exchange_send_date' : fields.date('Exchange date'),
'returned_product' : fields.many2one('product.product', 'Returned product', required=True), # ADD FILTER ON RETURNED PROD
'returned_product_serial' : fields.many2one('stock.production.lot', 'Returned serial/Lot n°'),
'returned_product_qty' : fields.float('Returned quantity', digits=(12,2), help="Quantity of product returned"),
'replacement_product' : fields.many2one('product.product', 'Replacement product', required=True),
'replacement_product_serial' : fields.many2one('stock.production.lot', 'Replacement serial/Lot n°'),
'replacement_product_qty' : fields.float('Replacement quantity', digits=(12,2), help="Quantity of product replaced"),
'claim_return_id' : fields.many2one('crm.claim', 'Related claim'), # To link to the case.claim object
'selected' : fields.boolean('s', help="Check to select"),
'state' : fields.selection([('draft','Draft'),
('confirmed','Confirmed'),
('to_send','To send'),
('sent','Sent')], 'State'),
'returned_unit_sale_price' : fields.float('Unit sale price', digits=(12,2)),
'returned_value' : fields.function(total_amount_returned, method=True, string='Total return', type='float', help="Quantity exchanged * Unit sold price",),
'replacement_unit_sale_price' : fields.function(get_replacement_price, method=True, string='Unit sale price', type='float',),
'replacement_value' : fields.function(total_amount_replacement, method=True, string='Total return', type='float', help="Quantity replaced * Unit sold price",),
}
_defaults = {
'state': lambda *a: 'draft',
}
product_exchange()
#==========
class crm_claim_product_return(osv.osv):
"""
Class to add RMA management on a standard crm.claim object
"""
_name = "crm.claim"
_description = "Add product return functionalities, product exchange and aftersale outsourcing to CRM claim"
_inherit = 'crm.claim'
_columns = {
'sequence': fields.char('Sequence', size=128, required=True,readonly=True, help="Company internal claim unique number"),
'return_line_ids' : fields.one2many('return.line', 'claim_id', 'Return lines'),
'product_exchange_ids': fields.one2many('product.exchange', 'claim_return_id', 'Product exchanges'),
# Aftersale outsourcing
# 'in_supplier_picking_id': fields.many2one('stock.picking', 'Return To Supplier Picking', required=False, select=True),
# 'out_supplier_picking_id': fields.many2one('stock.picking', 'Return From Supplier Picking', required=False, select=True),
# Financial management
'planned_revenue': fields.float('Expected revenue'),
'planned_cost': fields.float('Expected cost'),
'real_revenue': fields.float('Real revenue'), # A VOIR SI COMPTA ANA ou lien vers compte ana ?
'real_cost': fields.float('Real cost'), # A VOIR SI COMPTA ANA ou lien vers compte ana ?
}
_defaults = {
'sequence': lambda obj, cr, uid, context: obj.pool.get('ir.sequence').get(cr, uid, 'crm.claim.rma'),}
#===== Method to select all returned lines =====
def select_all(self,cr, uid, ids,context):
return_obj = self.pool.get('return.line')
for line in self.browse(cr,uid,ids)[0].return_line_ids:
return_obj.write(cr,uid,line.id,{'selected':True})
return True
#===== Method to unselect all returned lines =====
def unselect_all(self,cr, uid, ids,context):
return_obj = self.pool.get('return.line')
for line in self.browse(cr,uid,ids)[0].return_line_ids:
return_obj.write(cr,uid,line.id,{'selected':False})
return True
crm_claim_product_return()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@@ -0,0 +1,83 @@
<?xml version="1.0"?>
<openerp>
<data noupdate="1">
<!-- Claims Sequence n° -->
<record id="seq_type_claim" model="ir.sequence.type">
<field name="name">CRM Claim</field>
<field name="code">crm.claim.rma</field>
</record>
<record id="seq_claim" model="ir.sequence">
<field name="name">CRM Claim</field>
<field name="code">crm.claim.rma</field>
<field eval="5" name="padding"/>
<field name="prefix">RMA-%(year)s/</field>
</record>
<!-- Claims Categories -->
<record model="crm.case.categ" id="categ_claim1">
<field name="name">Factual Claims</field>
<field name="section_id" ref="crm.section_sales_department"/>
<field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/>
</record>
<record model="crm.case.categ" id="categ_claim2">
<field name="name">Value Claims</field>
<field name="section_id" ref="crm.section_sales_department"/>
<field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/>
</record>
<record model="crm.case.categ" id="categ_claim3">
<field name="name">Policy Claims</field>
<field name="section_id" ref="crm.section_sales_department"/>
<field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/>
</record>
<!--
Case Category2
-->
<record model="crm.case.resource.type" id="type_claim1">
<field name="name">Corrective</field>
<field name="section_id" ref="crm.section_sales_department"/>
</record>
<record model="crm.case.resource.type" id="type_claim2">
<field name="name">Preventive</field>
<field name="section_id" ref="crm.section_sales_department"/>
</record>
<!--
Case Stage
-->
<record model="crm.case.stage" id="stage_claim1">
<field name="name">Accepted as Claim</field>
<field name="sequence">1</field>
<field name="type">claim</field>
</record>
<record model="crm.case.stage" id="stage_claim5">
<field name="name">Actions Defined</field>
<field name="sequence">2</field>
<field name="type">claim</field>
</record>
<record model="crm.case.stage" id="stage_claim2">
<field name="name">Actions Done</field>
<field name="sequence">10</field>
<field name="type">claim</field>
</record>
<record model="crm.case.stage" id="stage_claim3">
<field name="name">Won't fix</field>
<field name="sequence">0</field>
<field name="type">claim</field>
</record>
<record model="crm.case.section" id="crm.section_sales_department">
<field name="name">Sales Department</field>
<field name="code">Sales</field>
<field name="stage_ids" eval="[(4, ref('stage_claim1')), (4, ref('stage_claim2')), (4, ref('stage_claim3')), (4, ref('stage_claim5'))]"/>
</record>
</data>
</openerp>

View File

@@ -0,0 +1,331 @@
<?xml version="1.0"?>
<!--
#########################################################################
# #
# #
#########################################################################
# #
# 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/>. #
#########################################################################
-->
<openerp>
<data>
<!-- Return line -->
<record id="view_crm_return_lines_filter" model="ir.ui.view">
<field name="name">CRM - Claims Search</field>
<field name="model">return.line</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Search Claims">
<filter icon="terp-check" string="Current" name="current"
domain="[('state','in',('draft', 'refused', 'treated'))]"
separator="1" help="Draft and Open Claims" />
<filter icon="terp-camera_test"
string="In Progress"
domain="[('state','in',('confirmed','in_to_control','in_to_treate'))]"
separator="1" help="In Progress Claims"/>
<separator orientation="vertical"/>
<field name="state" select='1'/>
<field name="substate_id" select='1'/>
<field name="name" select='1'/>
<field name="warning" select='1'/>
<field name="invoice_id" select='1'/>
<field name="product_id" select='1'/>
<field name="prodlot_id" select='1'/>
<newline/>
<group expand="0" string="More">
<field name="last_state_change" select='1'/>
<field name="guarantee_limit" select='1'/>
<field name="return_value" select='1'/>
<field name="name" select='1'/>
</group>
<newline/>
<group expand="0" string="Group By...">
<filter string="Invoice" icon="terp-dolar"
domain="[]" help="Invoice"
context="{'group_by':'invoice_id'}" />
<filter string="Product" icon="terp-product"
domain="[]" help="Product"
context="{'group_by':'product_id'}" />
<separator orientation="vertical"/>
<filter string="Substate" icon="terp-stage"
domain="[]" context="{'group_by':'substate_id'}" />
<filter string="Claim n°" icon="terp-emblem-documents"
domain="[]" context="{'group_by':'name'}" />
</group>
</search>
</field>
</record>
<record model="ir.ui.view" id="crm_return_line_tree_view">
<field name="name">CRM - Claims Tree</field>
<field name="model">return.line</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree editable="top" string="Returned lines">
<field name="selected"/>
<field name="state"/>
<field name="substate_id"/>
<field name="name"/>
<field name="invoice_id"/>
<field name="product_id"/>
<field name="prodlot_id"/>
<field name="warning"/>
<field name="product_returned_quantity"/>
<field name="claim_origine"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="crm_return_line_form_view">
<field name="name">CRM - Claim product return line Form</field>
<field name="model">return.line</field>
<field name="arch" type="xml">
<form string="Returned line">
<field name="name"/>
<separator string="Returned good" colspan="4"/>
<group col="6" colspan="4">
<field name="invoice_id" domain="[('type', '=', 'out_invoice')]" />
<field name="product_id"/>
<field name="prodlot_id"/>
<field name="product_returned_quantity"/>
<field name="unit_sale_price"/>
<field name="return_value"/>
</group>
<!-- button name="%(action_get_empty_serial)d" string="Get possible values for empty serial" states="draft,confirmed" type="action" target="new"/ -->
<separator string="Problem" colspan="4"/>
<field name="claim_origine" nolabel="1" colspan="4"/>
<field name="claim_descr" nolabel="1" colspan="4"/>
<separator string="Warranty" colspan="4"/>
<button name="set_warranty" string="Calculate warranty state" type="object" colspan="4"/>
<field name="guarantee_limit"/>
<field name="warning"/>
<field name="warranty_return_partner"/>
<!-- field name="guarantee_type"/ -->
<separator string="State" colspan="4"/>
<group col="6" colspan="4">
<field name="state"/>
<field name="substate_id" widget='selection' />
<field name="last_state_change"/>
</group>
</form>
</field>
</record>
<!-- Picking follow -->
<record model="ir.ui.view" id="crm_picking_follow_tree_view">
<field name="name">CRM - Picking follow Tree</field>
<field name="model">picking.follow</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Picking follows">
<field name="picking_id"/>
<field name="related_picking_state"/>
<field name="related_picking_due_date"/>
<field name="related_picking_delivered_date"/>
<field name="name"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="crm_picking_follow_form_view">
<field name="name">CRM - Picking follow Form</field>
<field name="model">picking.follow</field>
<field name="arch" type="xml">
<form string="Picking follow">
<field name="picking_id"/>
<field name="related_picking_state"/>
<field name="related_picking_due_date"/>
<field name="related_picking_delivered_date"/>
<field name="name"/>
</form>
</field>
</record>
<!-- PRODUCT EXCHANGE -->
<record model="ir.ui.view" id="crm_product_exchange_tree_view">
<field name="name">CRM - Product exchange Tree</field>
<field name="model">product.exchange</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Product exchanges" editable="top" >
<field name="selected"/>
<field name="state"/>
<field name="exchange_send_date"/>
<field name="returned_product"/>
<field name="returned_product_serial"/>
<field name="replacement_product"/>
<field name="replacement_product_serial"/>
<field name="returned_value"/>
<field name="replacement_value"/>
<field name="name"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="crm_product_exchange_form_view">
<field name="name">CRM - Product exchange Form</field>
<field name="model">product.exchange</field>
<field name="arch" type="xml">
<form string="Product exchange">
<field name="state"/>
<field name="exchange_send_date"/>
<separator string="Returned product" colspan="2"/>
<separator string="Replacement product" colspan="2"/>
<field name="returned_product"/>
<field name="replacement_product"/>
<field name="returned_product_serial"/>
<field name="replacement_product_serial"/>
<field name="returned_product_qty"/>
<field name="replacement_product_qty"/>
<field name="returned_unit_sale_price"/>
<field name="replacement_unit_sale_price"/>
<field name="returned_value"/>
<field name="replacement_value"/>
<separator string="Comment" colspan="2"/>
<field name="name" colspan="4" nolabel="1"/>
</form>
</field>
</record>
<!-- CLAIM VIEWS -->
<record model="ir.ui.view" id="crm_claim_rma_form_view">
<field name="name">CRM - Claim product return Form</field>
<field name="model">crm.claim</field>
<field name="inherit_id" ref="crm_claim.crm_case_claims_form_view"/>
<field name="arch" type="xml">
<page string="Communication &amp; History" position="after">
<page string="Product return">
<field name="return_line_ids" nolabel="1" colspan="4"/>
<group col="1" rowspan="3">
<separator string="Add lines" colspan="4"/>
<button name="%(action_create_return_serial)d" string="Mass return from serial/lot n°" states="draft,open" type="action" target="new"/>
<button name="%(action_create_return_inv)d" string="Mass return from invoice" states="draft,open" type="action" target="new"/>
</group>
<group col="1" rowspan="3">
<separator string="Line selection" colspan="4"/>
<button name="select_all" string="Select all" states="draft,open" type="object"/>
<button name="unselect_all" string="Select none" states="draft,open" type="object"/>
</group>
<group col="2" rowspan="3">
<separator string="From selected lines" colspan="4"/>
<button name="%(action_picking_in_from_returned_lines)d" string="New picking IN" states="draft,open" type="action" target="new"/>
<button name="%(action_picking_out_from_returned_lines)d" string="New picking OUT" states="draft,open" type="action" target="new"/>
<button name="%(action_refund_from_returned_lines)d" string="New refund" states="draft,open" type="action" target="new"/>
<button name="%(action_exchange_from_returned_lines)d" string="New exchange" states="draft,open" type="action" target="new"/>
</group>
</page>
<page string="Product exchange">
<field name="product_exchange_ids" nolabel="1" colspan="4"/>
<button name="%(action_picking_out_from_exchange_lines)d" string="New picking OUT from exchange" states="draft,open" type="action" target="new"/>
</page>
<!-- page string="Aftersale outsourcing">
<button name="create_picking_out" string="New picking OUT from selected lines" states="draft,open" type="object"/>
</page -->
<!-- page string="Repairs">
<button name="create_repair" string="New picking OUT from selected lines" states="draft,open" type="object"/>
</page -->
<!-- page string="Loans">
<button name="create_loan" string="New picking OUT from selected lines" states="draft,open" type="object"/>
</page -->
<!-- page string="Financial management">
<!separator string="Costs and Incomes" colspan="4"/>
<field name="planned_revenue"/>
<field name="planned_cost"/>
<field name="real_revenue" readonly="1"/>
<field name="real_cost" readonly="1"/ -->
<!-- /page -->
</page>
</field>
</record>
<record model="ir.ui.view" id="crm_claim_rma_form_view2">
<field name="name">CRM - Claim product return Form</field>
<field name="model">crm.claim</field>
<field name="inherit_id" ref="crm_claim.crm_case_claims_form_view"/>
<field name="arch" type="xml">
<field name="date_deadline" position="after">
<field name="sequence"/>
</field>
</field>
</record>
<!-- Right side link to orders -->
<act_window
context="{'search_default_partner_id': [partner_id]}"
id="act_crm_claim_rma_sale_orders"
name="Partner sale orders"
res_model="sale.order"
src_model="crm.claim"/>
<!-- Right side link to invoices -->
<act_window
context="{'search_default_partner_id': [partner_id],}"
domain="[('type', '=', 'out_invoice')]"
id="act_crm_claim_rma_invoice"
name="Partner invoices"
res_model="account.invoice"
src_model="crm.claim"/>
<!-- Right side link to refunds -->
<act_window
context="{'search_default_partner_id': [partner_id],}"
domain="[('type', '=', 'out_refund')]"
id="act_crm_claim_rma_refunds"
name="Partner refunds"
res_model="account.invoice"
src_model="crm.claim"/>
<!-- Right side link to picking in -->
<act_window
domain="[('type', '=', 'in'),('partner_id', 'in', [partner_id])]"
id="act_crm_claim_rma_picking_in"
name="Partner picking IN"
res_model="stock.picking"
src_model="crm.claim"/>
<!-- Right side link to picking out -->
<act_window
domain="[('type', '=', 'out'),('partner_id', 'in', [partner_id])]"
id="act_crm_claim_rma_picking_out"
name="Partner picking OUT"
res_model="stock.picking"
src_model="crm.claim"/>
<!-- Menu -->
<!-- return lines action -->
<record model="ir.actions.act_window" id="act_crm_case_return_lines">
<field name="name">Return lines</field>
<field name="res_model">return.line</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="crm_return_line_tree_view"/>
<!-- field name="context">{'search_default_section_id': section_id, "search_default_current":1,"search_default_user_id":uid, "stage_type":'claim'}</field -->
<field name="search_view_id" ref="view_crm_return_lines_filter"/>
</record>
<!-- substates action -->
<record id="act_crm_claim_substates" model="ir.actions.act_window">
<field name="name">Return line substates</field>
<field name="res_model">substate.substate</field>
<field name="view_type">form</field>
<!-- field name="view_id" ref="crm.crm_case_categ_tree-view"/ -->
</record>
<!-- Menu -->
<menuitem name="Return lines" id="menu_crm_case_claims_return_lines"
parent="base.menu_aftersale" action="act_crm_case_return_lines" sequence="2"/>
<menuitem name="Returned line substates" id="menu_crm_case_claims_return_line_substates"
parent="crm_claim.menu_config_claim" action="act_crm_claim_substates" sequence="2"/>
</data>
</openerp>

889
crm_claim_rma/i18n/fr.po Normal file
View File

@@ -0,0 +1,889 @@
# Translation of OpenERP Server.
# This file contains the translation of the following modules:
# * crm_claim_rma
#
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 6.0.2\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2011-07-13 16:35+0000\n"
"PO-Revision-Date: 2011-07-13 16:35+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: crm_claim_rma
#: view:return.line:0
msgid "Returned good"
msgstr "Marchandise retournée"
#. module: crm_claim_rma
#: model:ir.actions.act_window,name:crm_claim_rma.action_picking_out_from_exchange_lines
msgid "action_picking_out_from_exchange_lines"
msgstr "action_picking_out_from_exchange_lines"
#. module: crm_claim_rma
#: help:return.line,claim_descr:0
msgid "More precise description of the problem"
msgstr "Description détaillée du problème"
#. module: crm_claim_rma
#: field:return.line,guarantee_limit:0
msgid "Warranty limit"
msgstr "Limite de garantie"
#. module: crm_claim_rma
#: selection:return.line,guarantee_type:0
msgid "Supplier"
msgstr "Fournisseur"
#. module: crm_claim_rma
#: field:crm.claim,return_line_ids:0
#: field:returned_lines_from_invoice_line.wizard,return_line_ids:0
msgid "Return lines"
msgstr "Ligne de retour marchandise"
#. module: crm_claim_rma
#: selection:return.line,state:0
msgid "Exchanged"
msgstr "Echangé"
#. module: crm_claim_rma
#: view:returned_lines_from_serial.wizard:0
msgid "Claim short description"
msgstr "Description courte de la réclamation"
#. module: crm_claim_rma
#: view:crm.claim:0
#: view:product.exchange:0
msgid "Product exchange"
msgstr "Echange marchandise"
#. module: crm_claim_rma
#: view:product.exchange:0
#: field:product.exchange,replacement_product:0
#: view:temp.exchange.line:0
#: field:temp.exchange.line,replacement_product_id:0
msgid "Replacement product"
msgstr "Produit de remplacement"
#. module: crm_claim_rma
#: selection:return.line,name:0
#: selection:returned_lines_from_serial.wizard,claim_1:0
#: selection:returned_lines_from_serial.wizard,claim_2:0
#: selection:returned_lines_from_serial.wizard,claim_3:0
#: selection:returned_lines_from_serial.wizard,claim_4:0
#: selection:returned_lines_from_serial.wizard,claim_5:0
#: selection:temp.return.line,name:0
msgid "Order cancellation"
msgstr "Annulation de commande"
#. module: crm_claim_rma
#: view:product.exchange:0
#: field:product.exchange,returned_product:0
#: help:return.line,product_id:0
#: view:temp.exchange.line:0
#: field:temp.exchange.line,returned_product_id:0
msgid "Returned product"
msgstr "Produit retourné"
#. module: crm_claim_rma
#: model:ir.model,name:crm_claim_rma.model_refund_from_returned_lines_wizard
msgid "Wizard to create an refund for selected product return lines"
msgstr "Wizard de création d'un avoir pour les lignes de retour sélectionnées"
#. module: crm_claim_rma
#: view:picking_in_from_returned_lines.wizard:0
#: view:picking_out_from_exchange_lines.wizard:0
#: view:picking_out_from_returned_lines.wizard:0
msgid "Create picking"
msgstr "Créer l'envoi"
#. module: crm_claim_rma
#: view:return.line:0
msgid "Calculate warranty state"
msgstr "Calculer l'état de la garantie"
#. module: crm_claim_rma
#: view:refund_from_returned_lines.wizard:0
msgid "Select return lines to refund"
msgstr "Sélectionner les lignes de retour à rembourser"
#. module: crm_claim_rma
#: model:ir.actions.act_window,name:crm_claim_rma.action_refund_from_returned_lines
msgid "action_refund_from_returned_lines"
msgstr "action_refund_from_returned_lines"
#. module: crm_claim_rma
#: field:picking_in_from_returned_lines.wizard,return_line_ids:0
#: field:picking_out_from_returned_lines.wizard,return_line_ids:0
#: field:refund_from_returned_lines.wizard,return_line_ids:0
msgid "Selected return lines"
msgstr "Lignes de retour sélectionnées"
#. module: crm_claim_rma
#: view:picking_out_from_exchange_lines.wizard:0
msgid "Select exchange lines to add in picking"
msgstr "Sélectionner les lignes de retour à ajouter à l'envoi"
#. module: crm_claim_rma
#: view:returned_lines_from_invoice_invoice.wizard:0
msgid "Select lines to return"
msgstr "Sélectionner les lignes à retourner"
#. module: crm_claim_rma
#: view:return.line:0
#: field:return.line,warning:0
msgid "Warranty"
msgstr "Garantie"
#. module: crm_claim_rma
#: view:crm.claim:0
msgid "Returned goods"
msgstr "Marchandises retournées"
#. module: crm_claim_rma
#: help:product.exchange,returned_product_qty:0
#: help:return.line,product_returned_quantity:0
#: help:temp.exchange.line,returned_product_quantity:0
#: help:temp.return.line,product_returned_quantity:0
msgid "Quantity of product returned"
msgstr "Quantité de produit returnée"
#. module: crm_claim_rma
#: view:returned_lines_from_invoice_line.wizard:0
msgid "Create selected returns"
msgstr "Créer les retours sélectionnés"
#. module: crm_claim_rma
#: field:crm.claim,planned_cost:0
msgid "Expected cost"
msgstr "Coût prévisionnel"
#. 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 "Wizard to create product return lines from serial numbers"
#. module: crm_claim_rma
#: view:crm.claim:0
msgid "New picking OUT from exchange"
msgstr "Nouvelle expédition à partir de l'échange"
#. module: crm_claim_rma
#: view:returned_lines_from_invoice_line.wizard:0
msgid "Select return lines to create "
msgstr "Sélectionner les lignes de retour à créer "
#. module: crm_claim_rma
#: model:ir.module.module,shortdesc:crm_claim_rma.module_meta_information
msgid "CRM Product Return"
msgstr "Retour marchandise"
#. module: crm_claim_rma
#: view:crm.claim:0
msgid "Main informations"
msgstr "Gestion des retours"
#. module: crm_claim_rma
#: help:returned_lines_from_serial.wizard,claim_1:0
msgid "To describe the product problem"
msgstr "Description du problème"
#. module: crm_claim_rma
#: field:returned_lines_from_invoice_invoice.wizard,partner_id:0
#: field:returned_lines_from_serial.wizard,partner_id:0
msgid "Partner"
msgstr "Client"
#. module: crm_claim_rma
#: field:product.exchange,replacement_product_serial:0
msgid "Replacement serial/Lot n°"
msgstr "Lot de remplacement"
#. module: crm_claim_rma
#: selection:product.exchange,state:0
#: selection:return.line,state:0
msgid "Confirmed"
msgstr "Confirmé"
#. module: crm_claim_rma
#: model:ir.actions.act_window,name:crm_claim_rma.action_create_return_serial
msgid "action_create_return_serial"
msgstr "action_create_return_serial"
#. module: crm_claim_rma
#: selection:return.line,name:0
#: selection:returned_lines_from_serial.wizard,claim_1:0
#: selection:returned_lines_from_serial.wizard,claim_2:0
#: selection:returned_lines_from_serial.wizard,claim_3:0
#: selection:returned_lines_from_serial.wizard,claim_4:0
#: selection:returned_lines_from_serial.wizard,claim_5:0
#: selection:temp.return.line,name:0
msgid "Not specified"
msgstr "Non spécifié"
#. module: crm_claim_rma
#: view:crm.claim:0
msgid "New picking IN"
msgstr "Nouvelle réception"
#. module: crm_claim_rma
#: field:temp.return.line,invoice_line_id:0
msgid "Invoice line"
msgstr "Ligne de facture"
#. module: crm_claim_rma
#: field:product.exchange,state:0
#: view:return.line:0
#: field:return.line,state:0
msgid "State"
msgstr "Etat"
#. module: crm_claim_rma
#: model:ir.actions.act_window,name:crm_claim_rma.act_crm_claim_rma_invoice
msgid "Partner invoices"
msgstr "Factures client"
#. module: crm_claim_rma
#: model:ir.actions.act_window,name:crm_claim_rma.act_crm_claim_rma_picking_in
msgid "Partner picking IN"
msgstr "Réceptions client"
#. module: crm_claim_rma
#: help:return.line,name:0
#: help:returned_lines_from_serial.wizard,claim_2:0
#: help:returned_lines_from_serial.wizard,claim_3:0
#: help:returned_lines_from_serial.wizard,claim_4:0
#: help:returned_lines_from_serial.wizard,claim_5:0
#: help:temp.exchange.line,name:0
#: help:temp.return.line,name:0
msgid "To describe the line product problem"
msgstr "Description du problème"
#. module: crm_claim_rma
#: help:picking_in_from_returned_lines.wizard,return_line_location:0
msgid "Location where the system will stock the returned products."
msgstr "Emplacement de destination des marchandises retournées"
#. module: crm_claim_rma
#: help:product.exchange,selected:0
#: help:return.line,selected:0
msgid "Check to select"
msgstr "Cocher la case pour sélectionner"
#. module: crm_claim_rma
#: selection:return.line,name:0
#: selection:returned_lines_from_serial.wizard,claim_1:0
#: selection:returned_lines_from_serial.wizard,claim_2:0
#: selection:returned_lines_from_serial.wizard,claim_3:0
#: selection:returned_lines_from_serial.wizard,claim_4:0
#: selection:returned_lines_from_serial.wizard,claim_5:0
#: selection:temp.return.line,name:0
msgid "Legal retractation"
msgstr "Retractation légale"
#. module: crm_claim_rma
#: view:returned_lines_from_invoice_invoice.wizard:0
msgid "Return all invoice lines"
msgstr "Retourner toutes les lignes de facture"
#. module: crm_claim_rma
#: field:product.exchange,returned_product_serial:0
msgid "Returned serial/Lot n°"
msgstr "Lot retourné"
#. module: crm_claim_rma
#: field:return.line,name:0
#: field:returned_lines_from_serial.wizard,claim_1:0
#: field:returned_lines_from_serial.wizard,claim_2:0
#: field:returned_lines_from_serial.wizard,claim_3:0
#: field:returned_lines_from_serial.wizard,claim_4:0
#: field:returned_lines_from_serial.wizard,claim_5:0
#: field:temp.return.line,name:0
msgid "Claim Subject"
msgstr "Objet de la réclamation"
#. module: crm_claim_rma
#: field:crm.claim,real_cost:0
msgid "Real cost"
msgstr "Coût réél"
#. module: crm_claim_rma
#: view:returned_lines_from_invoice_invoice.wizard:0
msgid "Select invoice"
msgstr "Sélectionner la facture"
#. module: crm_claim_rma
#: view:picking.follow:0
msgid "Picking follows"
msgstr "Suivi des envois"
#. module: crm_claim_rma
#: help:return.line,claim_id:0
msgid "To link to the case.claim object"
msgstr "Lien vers l'objet case.claim"
#. module: crm_claim_rma
#: selection:return.line,state:0
msgid "Waiting product"
msgstr "En attente produit"
#. module: crm_claim_rma
#: view:crm.claim:0
msgid "New exchange"
msgstr "Nouvel échange"
#. module: crm_claim_rma
#: view:returned_lines_from_serial.wizard:0
msgid "Save and new"
msgstr "Enregistrer et nouveau"
#. module: crm_claim_rma
#: field:returned_lines_from_serial.wizard,prodlot_id_2:0
msgid "Serial / Lot Number 2"
msgstr "N° de série/lot 2"
#. module: crm_claim_rma
#: field:crm.claim,planned_revenue:0
msgid "Expected revenue"
msgstr "Revenu attendu"
#. module: crm_claim_rma
#: view:crm.claim:0
msgid "None"
msgstr "Aucun"
#. module: crm_claim_rma
#: view:exchange_from_returned_lines.wizard:0
msgid "Select lines for picking. DON'T FORGET TO SELECT THE REPLACEMENT PRODUCT. "
msgstr "Sélectionner les lignes de remplacement. N'OUBLIEZ PAS DE SELECTIONNER UN PRODUIT DE REMPLACEMENT ! "
#. module: crm_claim_rma
#: field:crm.claim,product_exchange_ids:0
#: view:product.exchange:0
msgid "Product exchanges"
msgstr "Echanges de produit"
#. module: crm_claim_rma
#: field:returned_lines_from_serial.wizard,qty_5:0
msgid "Quantity 5"
msgstr "Quantité 5"
#. module: crm_claim_rma
#: field:returned_lines_from_serial.wizard,qty_4:0
msgid "Quantity 4"
msgstr "Quantité 4"
#. module: crm_claim_rma
#: field:returned_lines_from_serial.wizard,qty_1:0
msgid "Quantity 1"
msgstr "Quantité 1"
#. module: crm_claim_rma
#: field:returned_lines_from_serial.wizard,qty_3:0
msgid "Quantity 3"
msgstr "Quantité 3"
#. module: crm_claim_rma
#: field:returned_lines_from_serial.wizard,qty_2:0
msgid "Quantity 2"
msgstr "Quantité 2"
#. module: crm_claim_rma
#: selection:return.line,name:0
#: selection:returned_lines_from_serial.wizard,claim_1:0
#: selection:returned_lines_from_serial.wizard,claim_2:0
#: selection:returned_lines_from_serial.wizard,claim_3:0
#: selection:returned_lines_from_serial.wizard,claim_4:0
#: selection:returned_lines_from_serial.wizard,claim_5:0
#: selection:temp.return.line,name:0
msgid "Shipping error"
msgstr "Erreur d'expédition"
#. module: crm_claim_rma
#: view:product.exchange:0
#: field:product.exchange,name:0
#: field:temp.exchange.line,name:0
msgid "Comment"
msgstr "Commentaire"
#. module: crm_claim_rma
#: view:crm.claim:0
msgid "Create from selected return lines"
msgstr "Créer à partir des lignes de retour sélectionnées"
#. module: crm_claim_rma
#: field:product.exchange,claim_return_id:0
#: field:return.line,claim_id:0
msgid "Related claim"
msgstr "Réclamation liée"
#. module: crm_claim_rma
#: view:returned_lines_from_serial.wizard:0
msgid "Quantity returned"
msgstr "Quantité returnée"
#. module: crm_claim_rma
#: field:exchange_from_returned_lines.wizard,exchange_line_ids:0
#: field:picking_out_from_exchange_lines.wizard,exchange_line_ids:0
msgid "Selected exchange lines"
msgstr "Lignes d'échange sélectionnées"
#. module: crm_claim_rma
#: field:product.exchange,selected:0
#: field:return.line,selected:0
msgid "s"
msgstr "s"
#. module: crm_claim_rma
#: field:returned_lines_from_serial.wizard,prodlot_id_4:0
msgid "Serial / Lot Number 4"
msgstr "N° de série/lot 4"
#. module: crm_claim_rma
#: help:return.line,prodlot_id:0
msgid "The serial/lot of the returned product"
msgstr "N° de série/lot du produit retourné"
#. module: crm_claim_rma
#: view:picking.follow:0
msgid "Picking follow"
msgstr "Suivi d'envoi"
#. module: crm_claim_rma
#: field:return.line,claim_descr:0
msgid "Claim description"
msgstr "Description de la réclamation"
#. module: crm_claim_rma
#: view:picking_out_from_exchange_lines.wizard:0
msgid "Select lines for picking out "
msgstr "Sélectionner les lignes pour l'expédition "
#. module: crm_claim_rma
#: field:product.exchange,replacement_product_qty:0
#: field:temp.exchange.line,replacement_product_quantity:0
#: help:temp.exchange.line,replacement_product_quantity:0
msgid "Replacement quantity"
msgstr "Quantité de Remplacement"
#. module: crm_claim_rma
#: field:crm.claim,real_revenue:0
msgid "Real revenue"
msgstr "Revenu réél"
#. module: crm_claim_rma
#: help:product.exchange,replacement_product_qty:0
msgid "Quantity of product replaced"
msgstr "Quantité de produit remplacé"
#. module: crm_claim_rma
#: selection:return.line,name:0
#: selection:returned_lines_from_serial.wizard,claim_1:0
#: selection:returned_lines_from_serial.wizard,claim_2:0
#: selection:returned_lines_from_serial.wizard,claim_3:0
#: selection:returned_lines_from_serial.wizard,claim_4:0
#: selection:returned_lines_from_serial.wizard,claim_5:0
#: selection:temp.return.line,name:0
msgid "Lost during transport"
msgstr "Perte durant le transport"
#. module: crm_claim_rma
#: view:refund_from_returned_lines.wizard:0
msgid "Create refund"
msgstr "Créer un avoir"
#. module: crm_claim_rma
#: field:returned_lines_from_serial.wizard,prodlot_id_1:0
msgid "Serial / Lot Number 1"
msgstr "N° de série/lot 1"
#. module: crm_claim_rma
#: view:returned_lines_from_serial.wizard:0
msgid "Save and close"
msgstr "Enregistrer et fermer"
#. module: crm_claim_rma
#: field:returned_lines_from_serial.wizard,prodlot_id_3:0
msgid "Serial / Lot Number 3"
msgstr "N° de série/lot 3"
#. module: crm_claim_rma
#: selection:product.exchange,state:0
#: selection:return.line,state:0
msgid "Draft"
msgstr "Brouillon"
#. module: crm_claim_rma
#: field:returned_lines_from_serial.wizard,prodlot_id_5:0
msgid "Serial / Lot Number 5"
msgstr "N° de série/lot 5"
#. module: crm_claim_rma
#: model:ir.model,name:crm_claim_rma.model_return_line
#: model:ir.model,name:crm_claim_rma.model_temp_return_line
msgid "List of product to return"
msgstr "Liste des produits retournés"
#. module: crm_claim_rma
#: view:crm.claim:0
msgid "Communication & History"
msgstr "Communication et historique"
#. module: crm_claim_rma
#: model:ir.actions.act_window,name:crm_claim_rma.action_create_return_inv
msgid "action_create_return_invoice"
msgstr "action_create_return_invoice"
#. module: crm_claim_rma
#: model:ir.model,name:crm_claim_rma.model_picking_out_from_exchange_lines_wizard
msgid "Wizard to create a picking out from selected exchange lines"
msgstr "Wizard to create a picking out from selected exchange lines"
#. module: crm_claim_rma
#: view:crm.claim:0
msgid "Mass return from serial/lot n°"
msgstr "Retour en masse par n° de série/lot "
#. module: crm_claim_rma
#: selection:return.line,state:0
msgid "Refunded"
msgstr "Remboursé"
#. module: crm_claim_rma
#: field:product.exchange,exchange_send_date:0
msgid "Exchange date"
msgstr "Date d'échange"
#. module: crm_claim_rma
#: field:return.line,guarantee_type:0
msgid "Warranty type"
msgstr "Type de garantie"
#. module: crm_claim_rma
#: view:refund_from_returned_lines.wizard:0
msgid "Select lines for picking "
msgstr "Sélectionner les lignes d'envoi "
#. module: crm_claim_rma
#: view:return.line:0
msgid "Returned line"
msgstr "Ligne retournée"
#. module: crm_claim_rma
#: view:picking_in_from_returned_lines.wizard:0
msgid "Select lines for picking "
msgstr "Sélectionner les lignes d'envoi "
#. module: crm_claim_rma
#: selection:return.line,state:0
msgid "IN to exchange"
msgstr "Reçu à échanger"
#. module: crm_claim_rma
#: view:exchange_from_returned_lines.wizard:0
msgid "Create exchange"
msgstr "Créer l'échange"
#. module: crm_claim_rma
#: view:return.line:0
msgid "Returned lines"
msgstr "Lignes retournées"
#. module: crm_claim_rma
#: selection:return.line,guarantee_type:0
msgid "Manufacturer"
msgstr "Fabricant"
#. module: crm_claim_rma
#: model:ir.model,name:crm_claim_rma.model_picking_in_from_returned_lines_wizard
msgid "Wizard to create a picking in from selected return lines"
msgstr "Wizard to create a picking in from selected return lines"
#. module: crm_claim_rma
#: field:return.line,prodlot_id:0
msgid "Serial/Lot n°"
msgstr "N° de série/lot"
#. module: crm_claim_rma
#: view:picking_in_from_returned_lines.wizard:0
msgid "Destination location"
msgstr "Emplacement de destination"
#. module: crm_claim_rma
#: selection:return.line,name:0
#: selection:returned_lines_from_serial.wizard,claim_1:0
#: selection:returned_lines_from_serial.wizard,claim_2:0
#: selection:returned_lines_from_serial.wizard,claim_3:0
#: selection:returned_lines_from_serial.wizard,claim_4:0
#: selection:returned_lines_from_serial.wizard,claim_5:0
#: selection:temp.return.line,name:0
msgid "Damaged delivered product"
msgstr "Produit endommagé"
#. module: crm_claim_rma
#: view:crm.claim:0
msgid "Product return"
msgstr "Retour marchandise"
#. module: crm_claim_rma
#: model:ir.actions.act_window,name:crm_claim_rma.act_crm_claim_rma_sale_orders
msgid "Partner sale orders"
msgstr "Commandes client"
#. module: crm_claim_rma
#: view:return.line:0
msgid "Problem"
msgstr "Problème"
#. module: crm_claim_rma
#: field:return.line,product_returned_quantity:0
msgid "Quantity"
msgstr "Quantité"
#. module: crm_claim_rma
#: model:ir.actions.act_window,name:crm_claim_rma.act_crm_claim_rma_refunds
msgid "Partner refunds"
msgstr "Remboursements client"
#. module: crm_claim_rma
#: model:ir.model,name:crm_claim_rma.model_crm_claim
msgid "Claim"
msgstr "Réclamation"
#. module: crm_claim_rma
#: view:temp.exchange.line:0
msgid "Temp product exchange"
msgstr "Temp product exchange"
#. module: crm_claim_rma
#: view:crm.claim:0
msgid "Returned lines selection"
msgstr "sélection des lignes de retour"
#. module: crm_claim_rma
#: selection:return.line,guarantee_type:0
msgid "Saler"
msgstr "Vendeur"
#. module: crm_claim_rma
#: help:return.line,guarantee_limit:0
msgid "The warranty limit is computed as: invoice date + warranty defined on selected product."
msgstr "La limite de garantie est calculée par: date de facture + garantie définie sur le produit sélectionné."
#. module: crm_claim_rma
#: model:ir.module.module,description:crm_claim_rma.module_meta_information
msgid "\n"
"Add product return functionalities, product exchange and aftersale outsourcing to CRM claim\n"
" "
msgstr "\n"
"Ajout des fonctionalités de retour de marchandise, échange de produit et sous traitance de la réclamation\n"
" "
#. module: crm_claim_rma
#: view:crm.claim:0
msgid "Mass return from invoice"
msgstr "Retour en masse depuis une facture"
#. module: crm_claim_rma
#: field:return.line,invoice_id:0
#: field:returned_lines_from_invoice_invoice.wizard,invoice_id:0
#: field:temp.return.line,invoice_id:0
msgid "Invoice"
msgstr "Facture"
#. module: crm_claim_rma
#: view:exchange_from_returned_lines.wizard:0
#: view:picking_in_from_returned_lines.wizard:0
#: view:picking_out_from_exchange_lines.wizard:0
#: view:picking_out_from_returned_lines.wizard:0
#: view:refund_from_returned_lines.wizard:0
#: view:returned_lines_from_invoice_invoice.wizard:0
#: view:returned_lines_from_invoice_line.wizard:0
#: view:returned_lines_from_serial.wizard:0
msgid "Cancel"
msgstr "Annuler"
#. module: crm_claim_rma
#: field:picking_in_from_returned_lines.wizard,return_line_location:0
msgid "Dest. Location"
msgstr "Emplacement destination"
#. module: crm_claim_rma
#: selection:return.line,name:0
#: selection:returned_lines_from_serial.wizard,claim_1:0
#: selection:returned_lines_from_serial.wizard,claim_2:0
#: selection:returned_lines_from_serial.wizard,claim_3:0
#: selection:returned_lines_from_serial.wizard,claim_4:0
#: selection:returned_lines_from_serial.wizard,claim_5:0
#: selection:temp.return.line,name:0
msgid "Exchange request"
msgstr "Demande d'échange"
#. module: crm_claim_rma
#: model:ir.model,name:crm_claim_rma.model_account_invoice_line
msgid "Invoice Line"
msgstr "Ligne de facture"
#. module: crm_claim_rma
#: selection:return.line,name:0
#: selection:returned_lines_from_serial.wizard,claim_1:0
#: selection:returned_lines_from_serial.wizard,claim_2:0
#: selection:returned_lines_from_serial.wizard,claim_3:0
#: selection:returned_lines_from_serial.wizard,claim_4:0
#: selection:returned_lines_from_serial.wizard,claim_5:0
#: selection:temp.return.line,name:0
msgid "Other"
msgstr "Autre"
#. module: crm_claim_rma
#: field:temp.exchange.line,returned_prodlot_id:0
msgid "Returned serial/Lot"
msgstr "N° de série/lot retournés"
#. module: crm_claim_rma
#: model:ir.model,name:crm_claim_rma.model_picking_out_from_returned_lines_wizard
msgid "Wizard to create a picking out from selected return lines"
msgstr "Wizard to create a picking out from selected return lines"
#. module: crm_claim_rma
#: field:return.line,product_id:0
#: field:temp.return.line,product_id:0
msgid "Product"
msgstr "Produit"
#. module: crm_claim_rma
#: view:exchange_from_returned_lines.wizard:0
#: view:picking_in_from_returned_lines.wizard:0
#: view:picking_out_from_returned_lines.wizard:0
msgid "Select return lines to add in picking"
msgstr "Sélectionner les lignes de retour à ajouter à l'envoi"
#. module: crm_claim_rma
#: view:picking_out_from_returned_lines.wizard:0
msgid "Select lines for picking out "
msgstr "Sélectionnner les lignes pour expédition "
#. module: crm_claim_rma
#: help:return.line,invoice_id:0
msgid "The invoice related to the returned product"
msgstr "Facture liée au produit retourné"
#. module: crm_claim_rma
#: model:ir.model,name:crm_claim_rma.model_returned_lines_from_invoice_invoice_wizard
#: model:ir.model,name:crm_claim_rma.model_returned_lines_from_invoice_line_wizard
msgid "Wizard to create product return lines from invoice"
msgstr "Wizard to create product return lines from invoice"
#. module: crm_claim_rma
#: selection:product.exchange,state:0
msgid "Sent"
msgstr "Expédié"
#. module: crm_claim_rma
#: help:return.line,warning:0
msgid "If warranty has expired"
msgstr "Si la garantie a expirée"
#. module: crm_claim_rma
#: field:temp.exchange.line,replacement_prodlot_id:0
msgid "Replacement serial/Lot"
msgstr "N° de série/lot de remplacement"
#. module: crm_claim_rma
#: view:returned_lines_from_serial.wizard:0
msgid "Select serial numbers to create"
msgstr "Sélectionner les n° de série/lot à créer"
#. module: crm_claim_rma
#: selection:return.line,state:0
msgid "IN to refund"
msgstr "Reçu à rembourser"
#. module: crm_claim_rma
#: view:temp.return.line:0
msgid "Confirm return lines"
msgstr "Confirmer les lignes de retour"
#. module: crm_claim_rma
#: view:crm.claim:0
msgid "New refund"
msgstr "Nouvel avoir"
#. module: crm_claim_rma
#: model:ir.actions.act_window,name:crm_claim_rma.act_crm_claim_rma_picking_out
msgid "Partner picking OUT"
msgstr "Expéditions client"
#. module: crm_claim_rma
#: view:temp.exchange.line:0
msgid "Confirm exchange lines"
msgstr "Confirmer les lignes d'échange"
#. module: crm_claim_rma
#: field:product.exchange,returned_product_qty:0
#: field:temp.exchange.line,returned_product_quantity:0
#: field:temp.return.line,product_returned_quantity:0
msgid "Returned quantity"
msgstr "Quantité retournée"
#. module: crm_claim_rma
#: view:crm.claim:0
msgid "New picking OUT"
msgstr "Nouvelle expédition"
#. module: crm_claim_rma
#: model:ir.model,name:crm_claim_rma.model_exchange_from_returned_lines_wizard
msgid "Wizard to create an exchange from selected return lines"
msgstr "Wizard to create an exchange from selected return lines"
#. module: crm_claim_rma
#: model:ir.actions.act_window,name:crm_claim_rma.action_picking_out_from_returned_lines
msgid "action_picking_out_from_returned_lines"
msgstr "action_picking_out_from_returned_lines"
#. module: crm_claim_rma
#: view:crm.claim:0
msgid "All"
msgstr "Tout"
#. module: crm_claim_rma
#: model:ir.actions.act_window,name:crm_claim_rma.action_picking_in_from_returned_lines
msgid "action_picking_in_from_returned_lines"
msgstr "action_picking_in_from_returned_lines"
#. module: crm_claim_rma
#: model:ir.model,name:crm_claim_rma.model_product_exchange
msgid "exchange history line"
msgstr "Historique de l'échange"
#. module: crm_claim_rma
#: view:returned_lines_from_invoice_line.wizard:0
msgid "Select return lines to create"
msgstr "Sélectionner les lignes de retour à créer"
#. module: crm_claim_rma
#: selection:product.exchange,state:0
msgid "To send"
msgstr "A envoyer"
#. module: crm_claim_rma
#: model:ir.actions.act_window,name:crm_claim_rma.action_exchange_from_returned_lines
msgid "action_exchange_from_returned_lines"
msgstr "action_exchange_from_returned_lines"
#. module: crm_claim_rma
#: view:returned_lines_from_serial.wizard:0
#: field:temp.return.line,prodlot_id:0
msgid "Serial / Lot Number"
msgstr "N° de série/lot"
#. module: crm_claim_rma
#: model:ir.model,name:crm_claim_rma.model_temp_exchange_line
msgid "List of product to exchange"
msgstr "Liste des produits à échanger"

View File

@@ -0,0 +1,47 @@
# -*- 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 osv import fields, osv
from dateutil.relativedelta import relativedelta
import time
from datetime import datetime
class invoice_line_warranty(osv.osv):
"""
Class to add a method on the invoice line object to return warranty date and statu
"""
_name = "account.invoice.line"
_description = "Add product return functionalities, product exchange and aftersale outsourcing to CRM claim"
_inherit = 'account.invoice.line'
def get_garantee_limit(self,cr, uid, ids,arg,args,context):
claim = self.pool.get('crm.claim').browse(cr,uid,context['active_id'])
filter = {'value':{'guarantee_limit' : False, 'warning' : False }, 'domain':{}}
filter['value']['guarantee_limit'] = time.strftime('%Y-%m-%d %H:%M:%S')
filter['value']['warning'] = 'Valid'
for invoice_line in self.browse(cr,uid,ids):
if invoice_line.product_id.warranty:
filter['value']['guarantee_limit'] = (datetime.strptime(invoice_line.invoice_id.date_invoice, '%Y-%m-%d') + relativedelta(months=int(invoice_line.product_id.warranty))).strftime('%Y-%m-%d')
if filter['value']['guarantee_limit'] < claim.date:
filter['value']['warning'] = 'Expired'
return filter
invoice_line_warranty()

View File

@@ -0,0 +1,52 @@
<?xml version="1.0" ?>
<!-- STANDARD SUBSTATE FOR CLAIM RMA -->
<openerp>
<data>
<!-- TO TREATE -->
<record id="rma_to_treate_refund" model="substate.substate">
<field name="name" eval="&quot;&quot;&quot;To refund&quot;&quot;&quot;"/>
<field name="substate_descr" eval="&quot;&quot;&quot;Returned product has to be refunded&quot;&quot;&quot;" />
</record>
<record id="rma_to_treate_exchange" model="substate.substate">
<field name="name" eval="&quot;&quot;&quot;To exchange&quot;&quot;&quot;"/>
<field name="substate_descr" eval="&quot;&quot;&quot;Returned product has to be exchanged&quot;&quot;&quot;" />
</record>
<record id="rma_to_treate_repair" model="substate.substate">
<field name="name" eval="&quot;&quot;&quot;To repair&quot;&quot;&quot;"/>
<field name="substate_descr" eval="&quot;&quot;&quot;Returned product has to be repaired&quot;&quot;&quot;" />
</record>
<record id="rma_to_treate_send_supplier" model="substate.substate">
<field name="name" eval="&quot;&quot;&quot;To send back to supplier&quot;&quot;&quot;"/>
<field name="substate_descr" eval="&quot;&quot;&quot;Returned product has to be sent back to supplier&quot;&quot;&quot;" />
</record>
<record id="rma_to_treate_back_from_supplier" model="substate.substate">
<field name="name" eval="&quot;&quot;&quot;Back from supplier, to send to customer&quot;&quot;&quot;"/>
<field name="substate_descr" eval="&quot;&quot;&quot;Returned product has to be sent back from supplier and is to be sent back to customer&quot;&quot;&quot;" />
</record>
<!-- TREATED -->
<record id="rma_treated_refund" model="substate.substate">
<field name="name" eval="&quot;&quot;&quot;Refunded and stock&quot;&quot;&quot;"/>
<field name="substate_descr" eval="&quot;&quot;&quot;Returned product refunded and sent back to stock&quot;&quot;&quot;" />
</record>
<record id="rma_treated_refund_waste" model="substate.substate">
<field name="name" eval="&quot;&quot;&quot;Refunded and waste&quot;&quot;&quot;"/>
<field name="substate_descr" eval="&quot;&quot;&quot;Returned product refunded and sent to waste&quot;&quot;&quot;" />
</record>
<record id="rma_treated_exchange" model="substate.substate">
<field name="name" eval="&quot;&quot;&quot;Exchanged&quot;&quot;&quot;"/>
<field name="substate_descr" eval="&quot;&quot;&quot;Returned product exchanged&quot;&quot;&quot;" />
</record>
<record id="rma_treated_repair" model="substate.substate">
<field name="name" eval="&quot;&quot;&quot;Repaired&quot;&quot;&quot;"/>
<field name="substate_descr" eval="&quot;&quot;&quot;Returned product repaired&quot;&quot;&quot;" />
</record>
<record id="rma_treated_sent_to_supplier" model="substate.substate">
<field name="name" eval="&quot;&quot;&quot;Sent to supplier, pending&quot;&quot;&quot;"/>
<field name="substate_descr" eval="&quot;&quot;&quot;Returned product sent to supplier. Waiting for supplier response&quot;&quot;&quot;" />
</record>
<record id="rma_treated_repaired_by_supplier" model="substate.substate">
<field name="name" eval="&quot;&quot;&quot;Repaired by supplier and sent back to customer&quot;&quot;&quot;"/>
<field name="substate_descr" eval="&quot;&quot;&quot;Returned product repaired by supplier and sent back to customer&quot;&quot;&quot;" />
</record>
</data>
</openerp>

View File

@@ -0,0 +1,30 @@
# -*- coding: utf-8 -*-
#########################################################################
# #
# #
#########################################################################
# #
# Copyright (C) 2009-2011 Akretion, Raphaël Valyi, Sébastien Beau, #
# 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/>. #
#########################################################################
import returned_lines_from_serial
import returned_lines_from_invoice
import picking_from_returned_lines
import refund_from_returned_lines
import exchange_from_returned_lines
import picking_from_exchange_lines
import get_empty_serial

View File

@@ -0,0 +1,105 @@
# -*- 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 osv import fields, osv
import pooler
import time
# Class to create a picking in from selected return lines
class exchange_from_returned_lines(osv.osv_memory):
_name='exchange_from_returned_lines.wizard'
_description='Wizard to create an exchange from selected return lines'
_columns = {
'exchange_line_ids' : fields.many2many('temp.exchange.line', 'exchange_rel_refund', 'wizard_id', 'temp_exchange_line_id', 'Selected exchange lines'),
}
# Get selected lines to add to exchange
def _get_selected_lines(self, cr, uid,context):
returned_line_ids = self.pool.get('crm.claim').read(cr, uid, context['active_id'], ['return_line_ids'])['return_line_ids']
returned_lines = self.pool.get('return.line').browse(cr, uid,returned_line_ids)
M2M = []
for line in returned_lines:
if line.selected:
print "_get_selected : ",line.unit_sale_price
M2M.append(self.pool.get('temp.exchange.line').create(cr, uid, {
'name' : "#",
'returned_product_id' : line.product_id.id,
'returned_product_quantity' : line.product_returned_quantity,
'returned_prodlot_id' : line.prodlot_id.id,
'returned_unit_sale_price' : line.unit_sale_price,
}))
return M2M
_defaults = {
'exchange_line_ids': _get_selected_lines,
}
# If "Cancel" button pressed
def action_cancel(self,cr,uid,ids,conect=None):
return {'type': 'ir.actions.act_window_close',}
# If "Create" button pressed
def action_create_exchange(self, cr, uid, ids, context=None):
for exchange in self.browse(cr, uid,ids):
claim_id = self.pool.get('crm.claim').browse(cr, uid, context['active_id'])
# create exchange
for line in exchange.exchange_line_ids:
print "for : ",line.returned_unit_sale_price
exchange_id = self.pool.get('product.exchange').create(cr, uid, {
'name' : "#",
'state': 'draft',
'exchange_send_date': time.strftime('%Y-%m-%d %H:%M:%S'),
'returned_product' : line.returned_product_id.id,
'returned_product_serial' : line.returned_prodlot_id.id,
'returned_product_qty' : line.returned_product_quantity,
'returned_unit_sale_price' : line.returned_unit_sale_price,
'replacement_product' : line.replacement_product_id.id,
'replacement_product_serial' : line.replacement_prodlot_id.id,
'replacement_product_qty' : line.replacement_product_quantity,
'claim_return_id' : claim_id.id
})
return {'type': 'ir.actions.act_window_close',}
exchange_from_returned_lines()
#===== Temp exchange line
class temp_exchange_line(osv.osv_memory):
"""
Class to handle a product exchange line
"""
_name = "temp.exchange.line"
_description = "List of product to exchange"
_columns = {
'name': fields.char('Comment', size=128, help="To describe the line product problem"),
'returned_product_id': fields.many2one('product.product', 'Returned product', required=True),
'returned_product_quantity' : fields.float('Returned quantity', digits=(12,2), help="Quantity of product returned"),
'returned_unit_sale_price' : fields.float('Unit sale price', digits=(12,2),),
'returned_prodlot_id': fields.many2one('stock.production.lot', 'Returned serial/Lot'),
'replacement_product_id': fields.many2one('product.product', 'Replacement product', required=True),
'replacement_product_quantity' : fields.float('Replacement quantity', digits=(12,2), help="Replacement quantity"),
'replacement_prodlot_id': fields.many2one('stock.production.lot', 'Replacement serial/Lot'),
}
temp_exchange_line()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@@ -0,0 +1,90 @@
<?xml version="1.0" encoding="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/>. #
#########################################################################
-->
<openerp>
<data>
<!-- SELECTED RETURN LINES FOR EXCHANGE FORM VIEW -->
<record id="view_exchange_from_returned_lines_form" model="ir.ui.view">
<field name="name">exchange_from_returned_lines_wiew</field>
<field name="model">exchange_from_returned_lines.wizard</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Select return lines to add in picking">
<separator string="Select lines for picking. DON'T FORGET TO SELECT THE REPLACEMENT PRODUCT. " colspan="4"/>
<field name="exchange_line_ids" nolabel="1" colspan="4"/>
<group col="4" colspan="2">
<button special="cancel" string="Cancel" name="action_cancel" type="object" icon='gtk-cancel'/>
<button name="action_create_exchange" string="Create exchange" icon='gtk-ok' type="object"/>
</group>
</form>
</field>
</record>
<!-- SELECTED RETURN LINES FOR EXCHANGE ACTION -->
<record id="action_exchange_from_returned_lines" model="ir.actions.act_window">
<field name="name">action_exchange_from_returned_lines</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">exchange_from_returned_lines.wizard</field>
<field name="src_model">crm.claim</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
<field name="context">{'claim_id':claim_id}</field>
</record>
<!-- TEMP EXCHANGE LINE VIEW -->
<record model="ir.ui.view" id="temp_exchange_line_form_view">
<field name="name">Temp exchange line Form</field>
<field name="model">temp.exchange.line</field>
<field name="arch" type="xml">
<form string="Temp product exchange">
<separator string="Returned product" colspan="2"/>
<separator string="Replacement product" colspan="2"/>
<field name="returned_product_id"/>
<field name="replacement_product_id"/>
<field name="returned_prodlot_id"/>
<field name="replacement_prodlot_id"/>
<field name="returned_product_quantity"/>
<field name="replacement_product_quantity"/>
</form>
</field>
</record>
<record model="ir.ui.view" id="temp_exchange_line_tree_view">
<field name="name">temp_exchange_line_Tree</field>
<field name="model">temp.exchange.line</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Confirm exchange lines">
<field name="returned_product_id"/>
<field name="returned_prodlot_id"/>
<field name="returned_product_quantity"/>
<field name="replacement_product_id"/>
<field name="replacement_prodlot_id"/>
<field name="replacement_product_quantity"/>
</tree>
</field>
</record>
</data>
</openerp>

View File

@@ -0,0 +1,61 @@
# -*- 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 osv import fields, osv
import pooler
class get_empty_serial(osv.osv_memory):
_name='get_empty_serial.wizard'
_description='' # Get possible serial for this return based on claim partner, product, invoice
_columns = {
# 'prodlot_ids': fields.many2many('temp.return.line', 'return_rel', 'wizard_id', 'temp_return_line_id', 'Return lines'),
# 'prodlot_ids': fields.many2one('stock.production.lot', 'Serial / Lot Number 1', required=True),
'temp': fields.text('Resultats'),
}
#
def temp_display_results(self, cr, uid, context):
print "=====> IN TEMP display"
temp_display = ""
print "partner_id : ",self.pool.get('crm.claim').read(cr, uid, context['active_id'], ['partner_id'])['partner_id']
# print "partner_id : ",self.pool.get('crm.claim').read(cr, uid, context['active_id'], ['partner_id'])['partner_id']
print context
# for return_line in self.browse(cr,uid,context):
# print "product_id : ",return_line.product_id.id
return temp_display
_defaults = {
'temp': temp_display_results,
}
# If "Cancel" button pressed
# def action_cancel(self,cr,uid,ids,conect=None):
# return {'type': 'ir.actions.act_window_close',}
# If "Add & close" button pressed
# def action_add_and_close(self, cr, uid, ids, context=None):
# self.add_return_lines(cr, uid, ids, context)
# return {'type': 'ir.actions.act_window_close',}
get_empty_serial()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@@ -0,0 +1,89 @@
<?xml version="1.0" encoding="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/>. #
#########################################################################
-->
<openerp>
<data>
<!-- SELECT INVOICE FORM VIEW -->
<record id="view_get_empty_serial" model="ir.ui.view">
<field name="name">get_empty_serial</field>
<field name="model">get_empty_serial.wizard</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Select invoice">
<!-- field name="prodlot_ids"/ --> <!-- domain="[('partner_id','=',partner_id)]"/ -->
<!-- field name="temp"/ -->
<!-- group col="4" colspan="2">
<button special="cancel" string="Cancel" name="action_cancel" type="object" icon='gtk-cancel'/>
<button name="action_return_all" string="Return all invoice lines" icon='gtk-ok' type="object"/>
<button name="action_select_lines" string="Select lines to return" icon='gtk-ok' type="object"/>
</group -->
</form>
</field>
</record>
<!-- SELECT INVOICE ACTION -->
<record id="action_get_empty_serial" model="ir.actions.act_window">
<field name="name">action_get_empty_serial</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">get_empty_serial.wizard</field>
<field name="src_model">return.line</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
<field name="context">{}</field>
</record>
<!-- SELECT FORM VIEW -->
<!-- record id="view_create_return_invoice_line_form" model="ir.ui.view">
<field name="name">returned_lines_from_invoice_line_wiew</field>
<field name="model">returned_lines_from_invoice_line.wizard</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Select return lines to create">
<separator string="Select return lines to create " colspan="4"/>
<field name="return_line_ids" nolabel="1" colspan="4"/>
<group col="4" colspan="2">
<button special="cancel" string="Cancel" name="action_cancel" type="object" icon='gtk-cancel'/>
<button name="action_create_returns" string="Create selected returns" icon='gtk-ok' type="object"/>
</group>
</form>
</field>
</record -->
<!-- SELECT TEMP RETURN LINES TREE VIEW -->
<!-- record model="ir.ui.view" id="temp_return_line_tree_view">
<field name="name">temp_return_line_Tree</field>
<field name="model">temp.return.line</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Confirm return lines">
<field name="invoice_id"/>
<field name="product_id"/>
<field name="prodlot_id"/>
<field name="product_returned_quantity"/>
</tree>
</field>
</record -->
</data>
</openerp>

View File

@@ -0,0 +1,116 @@
# -*- 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 osv import fields, osv
import pooler
import time
# Class to create a picking out from selected exchange lines
class picking_out_from_returned_lines(osv.osv_memory):
_name='picking_out_from_exchange_lines.wizard'
_description='Wizard to create a picking out from selected exchange lines'
_columns = {
'exchange_line_ids' : fields.many2many('temp.exchange.line', 'return_rel_exchange', 'wizard_id', 'temp_exchange_line_id', 'Selected exchange lines'),
}
# Get selected lines to add to picking in
def _get_selected_lines(self, cr, uid,context):
exchange_line_ids = self.pool.get('crm.claim').read(cr, uid, context['active_id'], ['product_exchange_ids'])['product_exchange_ids']
exchange_lines = self.pool.get('product.exchange').browse(cr, uid,exchange_line_ids)
M2M = []
for line in exchange_lines:
if line.selected:
M2M.append(self.pool.get('temp.exchange.line').create(cr, uid, {
'name' : "#",
'returned_product_id' : line.returned_product.id,
'returned_product_quantity' : line.returned_product_qty,
'returned_prodlot_id' : line.returned_product_serial.id,
'replacement_product_id': line.replacement_product.id,
'replacement_product_quantity' : line.replacement_product_qty,
'replacement_prodlot_id': line.replacement_product_serial.id,
}))
return M2M
_defaults = {
'exchange_line_ids': _get_selected_lines,
}
# If "Cancel" button pressed
def action_cancel(self,cr,uid,ids,conect=None):
return {'type': 'ir.actions.act_window_close',}
# If "Create" button pressed
def action_create_picking(self, cr, uid, ids, context=None):
for exchange_lines in self.browse(cr, uid,ids):
claim_id = self.pool.get('crm.claim').browse(cr, uid, context['active_id'])
partner_id = claim_id.partner_id.id
# create picking
picking_id = self.pool.get('stock.picking').create(cr, uid, {
'origin': "RMA/"+`claim_id.id`,
'type': 'out',
'move_type': 'one', # direct
'state': 'draft',
'date': time.strftime('%Y-%m-%d %H:%M:%S'),
'address_id': claim_id.partner_address_id.id,
'invoice_state': "none",
'company_id': claim_id.company_id.id,
# 'stock_journal_id': fields.many2one('stock.journal','Stock Journal', select=True),
'location_id': self.pool.get('stock.warehouse').read(cr, uid, [1],['lot_input_id'])[0]['lot_input_id'][0],
'location_dest_id': claim_id.partner_id.property_stock_customer.id,
'note' : 'RMA picking in',
})
# Create picking lines
for exchange_line in exchange_lines.exchange_line_ids:
move_id = self.pool.get('stock.move').create(cr, uid, {
'name' : exchange_line.replacement_product_id.name_template, # Motif : crm id ? stock_picking_id ?
'priority': '0',
#'create_date':
'date': time.strftime('%Y-%m-%d %H:%M:%S'),
'date_expected': time.strftime('%Y-%m-%d %H:%M:%S'),
'product_id': exchange_line.replacement_product_id.id,
'product_qty': exchange_line.replacement_product_quantity,
'product_uom': exchange_line.replacement_product_id.uom_id.id,
'address_id': claim_id.partner_address_id.id,
'prodlot_id': exchange_line.replacement_prodlot_id,
# 'tracking_id':
'picking_id': picking_id,
'state': 'draft',
# 'price_unit': 1.0, # to get from invoice line
# 'price_currency_id': claim_id.company_id.currency_id.id, # from invoice ???
'company_id': claim_id.company_id.id,
'location_id': self.pool.get('stock.warehouse').read(cr, uid, [1],['lot_input_id'])[0]['lot_input_id'][0],
'location_dest_id': claim_id.partner_id.property_stock_customer.id,
'note': 'RMA Refound',
})
view = {
'name': 'Customer Picking OUT',
'view_type': 'form',
'view_mode': 'tree,form',
'domain' : "[('type', '=', 'out'),('partner_id','=',%s)]"%partner_id,
'res_model': 'stock.picking',
'type': 'ir.actions.act_window',
}
return view
picking_out_from_returned_lines()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="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/>. #
#########################################################################
-->
<openerp>
<data>
<!-- SELECTED exchange LINES FOR PICKING OUT FORM VIEW -->
<record id="view_picking_out_from_exchange_lines_form" model="ir.ui.view">
<field name="name">picking_out_from_exchange_lines_wiew</field>
<field name="model">picking_out_from_exchange_lines.wizard</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Select exchange lines to add in picking">
<separator string="Select lines for picking out " colspan="4"/>
<field name="exchange_line_ids" nolabel="1" colspan="4"/>
<group col="4" colspan="2">
<button special="cancel" string="Cancel" name="action_cancel" type="object" icon='gtk-cancel'/>
<button name="action_create_picking" string="Create picking" icon='gtk-ok' type="object"/>
</group>
</form>
</field>
</record>
<!-- SELECTED exchange LINES FOR PICKING OUT ACTION -->
<record id="action_picking_out_from_exchange_lines" model="ir.actions.act_window">
<field name="name">action_picking_out_from_exchange_lines</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">picking_out_from_exchange_lines.wizard</field>
<field name="src_model">crm.claim</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
<field name="context">{'claim_id':claim_id}</field>
</record>
</data>
</openerp>

View File

@@ -0,0 +1,213 @@
# -*- 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 osv import fields, osv
import pooler
import time
# Class to create a picking in from selected return lines
class picking_in_from_returned_lines(osv.osv_memory):
_name='picking_in_from_returned_lines.wizard'
_description='Wizard to create a picking in from selected return lines'
_columns = {
'return_line_location' : fields.many2one('stock.location', 'Dest. Location',help="Location where the system will stock the returned products.", select=True),
'return_line_ids' : fields.many2many('temp.return.line', 'return_rel_refund', 'wizard_id', 'temp_return_line_id', 'Selected return lines'),
}
# Get selected lines to add to picking in
def _get_selected_lines(self, cr, uid,context):
returned_line_ids = self.pool.get('crm.claim').read(cr, uid, context['active_id'], ['return_line_ids'])['return_line_ids']
returned_lines = self.pool.get('return.line').browse(cr, uid,returned_line_ids)
M2M = []
for line in returned_lines:
if line.selected:
M2M.append(self.pool.get('temp.return.line').create(cr, uid, {
'name' : "#",
'invoice_id' : line.invoice_id.id,
'product_id' : line.product_id.id,
'product_returned_quantity' : line.product_returned_quantity,
'prodlot_id' : line.prodlot_id.id,
}))
return M2M
# Get default destination location
def _get_dest_loc(self, cr, uid,context):
return self.pool.get('stock.warehouse').read(cr, uid, [1],['lot_input_id'])[0]['lot_input_id'][0]
_defaults = {
'return_line_ids': _get_selected_lines,
'return_line_location' : _get_dest_loc,
}
# If "Cancel" button pressed
def action_cancel(self,cr,uid,ids,conect=None):
return {'type': 'ir.actions.act_window_close',}
# If "Create" button pressed
def action_create_picking(self, cr, uid, ids, context=None):
partner_id = 0
for picking in self.browse(cr, uid,ids):
print "picking dest : ", picking.return_line_location.id
picking.return_line_location
claim_id = self.pool.get('crm.claim').browse(cr, uid, context['active_id'])
partner_id = claim_id.partner_id.id
# create picking
picking_id = self.pool.get('stock.picking').create(cr, uid, {
'origin': "RMA/"+`claim_id.id`,
'type': 'in',
'move_type': 'one', # direct
'state': 'draft',
'date': time.strftime('%Y-%m-%d %H:%M:%S'),
'address_id': claim_id.partner_address_id.id,
'invoice_state': "none",
'company_id': claim_id.company_id.id,
'location_id': claim_id.partner_id.property_stock_customer.id,
'location_dest_id': picking.return_line_location.id,
'note' : 'RMA picking in',
})
# Create picking lines
for picking_line in picking.return_line_ids:
move_id = self.pool.get('stock.move').create(cr, uid, {
'name' : picking_line.product_id.name_template, # Motif : crm id ? stock_picking_id ?
'priority': '0',
#'create_date':
'date': time.strftime('%Y-%m-%d %H:%M:%S'),
'date_expected': time.strftime('%Y-%m-%d %H:%M:%S'),
'product_id': picking_line.product_id.id,
'product_qty': picking_line.product_returned_quantity,
'product_uom': picking_line.product_id.uom_id.id,
'address_id': claim_id.partner_address_id.id,
'prodlot_id': picking_line.prodlot_id.id,
# 'tracking_id':
'picking_id': picking_id,
'state': 'draft',
# 'price_unit': 1.0, # to get from invoice line
# 'price_currency_id': claim_id.company_id.currency_id.id, # from invoice ???
'company_id': claim_id.company_id.id,
'location_id': claim_id.partner_id.property_stock_customer.id,
'location_dest_id': picking.return_line_location.id,
#self.pool.get('stock.warehouse').read(cr, uid, [1],['lot_input_id'])[0]['lot_input_id'][0],
'note': 'RMA Refound',
})
return {
'name': 'Customer Picking IN',
'view_type': 'form',
'view_mode': 'tree,form',
'domain' : "[('type', '=', 'in'),('partner_id','=',%s)]"%partner_id,
'res_model': 'stock.picking',
'type': 'ir.actions.act_window',
}
picking_in_from_returned_lines()
# Class to create a picking out from selected return lines
class picking_out_from_returned_lines(osv.osv_memory):
_name='picking_out_from_returned_lines.wizard'
_description='Wizard to create a picking out from selected return lines'
_columns = {
'return_line_ids' : fields.many2many('temp.return.line', 'return_rel_refund', 'wizard_id', 'temp_return_line_id', 'Selected return lines'),
}
# Get selected lines to add to picking in
def _get_selected_lines(self, cr, uid,context):
returned_line_ids = self.pool.get('crm.claim').read(cr, uid, context['active_id'], ['return_line_ids'])['return_line_ids']
returned_lines = self.pool.get('return.line').browse(cr, uid,returned_line_ids)
M2M = []
for line in returned_lines:
if line.selected:
M2M.append(self.pool.get('temp.return.line').create(cr, uid, {
'name' : "#",
'invoice_id' : line.invoice_id.id,
'product_id' : line.product_id.id,
'product_returned_quantity' : line.product_returned_quantity,
'prodlot_id' : line.prodlot_id.id,
}))
return M2M
_defaults = {
'return_line_ids': _get_selected_lines,
}
# If "Cancel" button pressed
def action_cancel(self,cr,uid,ids,conect=None):
return {'type': 'ir.actions.act_window_close',}
# If "Create" button pressed
def action_create_picking(self, cr, uid, ids, context=None):
partner_id = 0
for picking in self.browse(cr, uid,ids):
claim_id = self.pool.get('crm.claim').browse(cr, uid, context['active_id'])
partner_id = claim_id.partner_id.id
# create picking
picking_id = self.pool.get('stock.picking').create(cr, uid, {
'origin': "RMA/"+`claim_id.id`,
'type': 'out',
'move_type': 'one', # direct
'state': 'draft',
'date': time.strftime('%Y-%m-%d %H:%M:%S'),
'address_id': claim_id.partner_address_id.id,
'invoice_state': "none",
'company_id': claim_id.company_id.id,
# 'stock_journal_id': fields.many2one('stock.journal','Stock Journal', select=True),
'location_id': self.pool.get('stock.warehouse').read(cr, uid, [1],['lot_input_id'])[0]['lot_input_id'][0],
'location_dest_id': claim_id.partner_id.property_stock_customer.id,
'note' : 'RMA picking in',
})
# Create picking lines
for picking_line in picking.return_line_ids:
move_id = self.pool.get('stock.move').create(cr, uid, {
'name' : picking_line.product_id.name_template, # Motif : crm id ? stock_picking_id ?
'priority': '0',
#'create_date':
'date': time.strftime('%Y-%m-%d %H:%M:%S'),
'date_expected': time.strftime('%Y-%m-%d %H:%M:%S'),
'product_id': picking_line.product_id.id,
'product_qty': picking_line.product_returned_quantity,
'product_uom': picking_line.product_id.uom_id.id,
'address_id': claim_id.partner_address_id.id,
'prodlot_id': picking_line.prodlot_id.id,
# 'tracking_id':
'picking_id': picking_id,
'state': 'draft',
# 'price_unit': 1.0, # to get from invoice line
# 'price_currency_id': claim_id.company_id.currency_id.id, # from invoice ???
'company_id': claim_id.company_id.id,
'location_id': self.pool.get('stock.warehouse').read(cr, uid, [1],['lot_input_id'])[0]['lot_input_id'][0],
'location_dest_id': claim_id.partner_id.property_stock_customer.id,
'note': 'RMA Refound',
})
return {
'name': 'Customer Picking OUT',
'view_type': 'form',
'view_mode': 'tree,form',
'domain' : "[('type', '=', 'out'),('partner_id','=',%s)]"%partner_id,
'res_model': 'stock.picking',
'type': 'ir.actions.act_window',
}
picking_out_from_returned_lines()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@@ -0,0 +1,89 @@
<?xml version="1.0" encoding="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/>. #
#########################################################################
-->
<openerp>
<data>
<!-- SELECTED RETURN LINES FOR PICKING IN FORM VIEW -->
<record id="view_picking_in_from_returned_lines_form" model="ir.ui.view">
<field name="name">picking_in_from_returned_lines_wiew</field>
<field name="model">picking_in_from_returned_lines.wizard</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Select return lines to add in picking">
<separator string="Destination location" colspan="4"/>
<field name="return_line_location" nolabel="1" /> <!-- domain="[('usage','=','internal')]" -->
<separator string="Select lines for picking " colspan="4"/>
<field name="return_line_ids" nolabel="1" colspan="4"/>
<group col="4" colspan="2">
<button special="cancel" string="Cancel" name="action_cancel" type="object" icon='gtk-cancel'/>
<button name="action_create_picking" string="Create picking" icon='gtk-ok' type="object"/>
</group>
</form>
</field>
</record>
<!-- SELECTED RETURN LINES FOR PICKING IN ACTION -->
<record id="action_picking_in_from_returned_lines" model="ir.actions.act_window">
<field name="name">action_picking_in_from_returned_lines</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">picking_in_from_returned_lines.wizard</field>
<field name="src_model">crm.claim</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
<!-- field name="domain">['claim_id','=',claim_id}</field -->
<field name="context">{'claim_id':claim_id}</field>
</record>
<!-- SELECTED RETURN LINES FOR PICKING OUT FORM VIEW -->
<record id="view_picking_out_from_returned_lines_form" model="ir.ui.view">
<field name="name">picking_out_from_returned_lines_wiew</field>
<field name="model">picking_out_from_returned_lines.wizard</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Select return lines to add in picking">
<separator string="Select lines for picking out " colspan="4"/>
<field name="return_line_ids" nolabel="1" colspan="4"/>
<group col="4" colspan="2">
<button special="cancel" string="Cancel" name="action_cancel" type="object" icon='gtk-cancel'/>
<button name="action_create_picking" string="Create picking" icon='gtk-ok' type="object"/>
</group>
</form>
</field>
</record>
<!-- SELECTED RETURN LINES FOR PICKING OUT ACTION -->
<record id="action_picking_out_from_returned_lines" model="ir.actions.act_window">
<field name="name">action_picking_out_from_returned_lines</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">picking_out_from_returned_lines.wizard</field>
<field name="src_model">crm.claim</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
<field name="context">{'claim_id':claim_id}</field>
</record>
</data>
</openerp>

View File

@@ -0,0 +1,121 @@
# -*- 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 osv import fields, osv
import pooler
import time
class refund_from_returned_lines(osv.osv_memory):
_name='refund_from_returned_lines.wizard'
_description='Wizard to create an refund for selected product return lines'
_columns = {
'refund_journal' : fields.many2one('account.journal', 'Refund journal', select=True),
'return_line_ids' : fields.many2many('temp.return.line', 'return_rel_refund', 'wizard_id', 'temp_return_line_id', 'Selected return lines'),
}
# Get selected lines to add to picking in
def _get_selected_lines(self, cr, uid,context):
returned_line_ids = self.pool.get('crm.claim').read(cr, uid, context['active_id'], ['return_line_ids'])['return_line_ids']
returned_lines = self.pool.get('return.line').browse(cr, uid,returned_line_ids)
M2M = []
for line in returned_lines:
if line.selected:
M2M.append(self.pool.get('temp.return.line').create(cr, uid, {
'name' : "#",
'invoice_id' : line.invoice_id.id,
'product_id' : line.product_id.id,
'product_returned_quantity' : line.product_returned_quantity,
#'prodlot_id' : invoice_line.,
}))
return M2M
# Get default journal
def _get_journal(self, cr, uid,context):
#('company_id','=',claim_id.company_id.id)
# ,('refund_journal','=','True')
print "get journal with refund_journal=True: ",self.pool.get('account.journal').search(cr, uid, [('type','=','sale_refund'),('refund_journal','=','True')],limit=1)
return self.pool.get('account.journal').search(cr, uid, [('type','=','sale_refund')],limit=1)[0]
_defaults = {
'return_line_ids': _get_selected_lines,
'refund_journal' : _get_journal,
}
# On "Cancel" button
def action_cancel(self,cr,uid,ids,conect=None):
return {'type': 'ir.actions.act_window_close',}
# On "Create" button
def action_create_refund(self, cr, uid, ids, context=None):
partner_id = 0
for refund in self.browse(cr, uid,ids):
claim_id = self.pool.get('crm.claim').browse(cr, uid, context['active_id'])
partner_id = claim_id.partner_id.id
# create invoice
invoice_id = self.pool.get('account.invoice').create(cr, uid, {
'name' : "#",
'origin' : claim_id.id,
'type' : 'out_refund',
'state' : 'draft',
'partner_id' : claim_id.partner_id.id,
'user_id' : uid,
'reference_type': 'none',
'date_invoice': time.strftime('%Y-%m-%d %H:%M:%S'),
# 'date_due':
'address_contact_id' : claim_id.partner_address_id.id,
'address_invoice_id' : claim_id.partner_address_id.id,
'account_id' : claim_id.partner_id.property_account_receivable.id,
'currency_id' : claim_id.company_id.currency_id.id, # from invoice ???
'journal_id' : refund.refund_journal.id,
'company_id' : claim_id.company_id.id,
'comment' : 'RMA Refound',
})
# Create invoice lines
for refund_line in refund.return_line_ids:
invoice_line_id = self.pool.get('account.invoice.line').create(cr, uid, {
'name' : refund_line.product_id.name_template,
'origin' : claim_id.id,
'invoice_id' : invoice_id,
'uos_id' : refund_line.product_id.uom_id.id,
'product_id':refund_line.product_id.id,
'account_id': claim_id.partner_id.property_account_receivable.id, # refund_line.product_id.property_account_expense.id,
'price_unit':1.0, # to get from invoice line
'quantity': refund_line.product_returned_quantity,
# 'discount':
# 'invoice_line_tax_id':
# 'account_analytic_id':
# 'company_id' : claim_id.company_id.id,
# 'partner_id' : claim_id.partner_id.id,
'note': 'RMA Refound',
})
return {
'name': 'Customer Refounds',
'view_type': 'form',
'view_mode': 'tree,form',
'domain' : "[('type', '=', 'out_refund'),('partner_id','=',%s)]"%partner_id,
'res_model': 'account.invoice',
'type': 'ir.actions.act_window',
}
refund_from_returned_lines()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="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/>. #
#########################################################################
-->
<openerp>
<data>
<!-- SELECT FORM VIEW -->
<record id="view_refund_from_returned_lines_form" model="ir.ui.view">
<field name="name">refund_from_returned_lines_wiew</field>
<field name="model">refund_from_returned_lines.wizard</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Select return lines to refund">
<separator string="Select lines for picking " colspan="4"/>
<field name="refund_journal"/>
<field name="return_line_ids" nolabel="1" colspan="4"/>
<group col="4" colspan="2">
<button special="cancel" string="Cancel" name="action_cancel" type="object" icon='gtk-cancel'/>
<button name="action_create_refund" string="Create refund" icon='gtk-ok' type="object"/>
</group>
</form>
</field>
</record>
<!-- SELECT ACTION -->
<record id="action_refund_from_returned_lines" model="ir.actions.act_window">
<field name="name">action_refund_from_returned_lines</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">refund_from_returned_lines.wizard</field>
<field name="src_model">crm.claim</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
<field name="context">{'claim_id':claim_id}</field>
</record>
</data>
</openerp>

View File

@@ -0,0 +1,180 @@
# -*- 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 osv import fields, osv
import pooler
#import time
#from datetime import datetime
#from dateutil.relativedelta import relativedelta
#===== WIZ STEP 1 : Invoice selection
class returned_lines_from_invoice_invoice(osv.osv_memory):
_name='returned_lines_from_invoice_invoice.wizard'
_description='Wizard to create product return lines from invoice'
_columns = {
'invoice_id': fields.many2one('account.invoice', 'Invoice', required=True),
'partner_id': fields.many2one('res.partner', 'Partner'),
}
# Get partner from case is set
def _get_default_partner_id(self, cr, uid, context):
return self.pool.get('crm.claim').read(cr, uid, context['active_id'], ['partner_id'])['partner_id']
_defaults = {
'partner_id': _get_default_partner_id,
}
# If "Cancel" button pressed
def action_cancel(self,cr,uid,ids,conect=None):
return {'type': 'ir.actions.act_window_close',}
# If "Return all" button pressed
def action_return_all(self, cr, uid, ids, context):
# Get invoice id
inv_id = 0
for wiz_obj in self.browse(cr,uid,ids):
inv_id = wiz_obj.invoice_id.id
# Get invoice line ids from invoice id
invoice_line_pool = self.pool.get('account.invoice.line')
invoice_lines_ids = invoice_line_pool.search(cr, uid, [('invoice_id', '=', inv_id)])
# Get invoice lines from invoice line ids
for invoice_line in invoice_line_pool.browse(cr,uid,invoice_lines_ids):
context
warranty = invoice_line.get_garantee_limit(cr, uid, context)
self.pool.get('return.line').create(cr, uid, {
'name' : "none",
'invoice_id' : invoice_line.invoice_id.id,
'product_id' : invoice_line.product_id.id,
'product_returned_quantity' : invoice_line.quantity,
'unit_sale_price' : invoice_line.price_unit,
#'prodlot_id' : invoice_line.,
#'guarantee_type':
'guarantee_limit' : warranty['value']['guarantee_limit'],
'warning' : warranty['value']['warning'],
'claim_id' : context['active_id'],
'selected' : False,
'state' : 'draft',
})
return {'type': 'ir.actions.act_window_close',}
# If "Select lines" button pressed
def action_select_lines(self, cr, uid, ids, context):
# Add invoice_id to context
for wiz_obj in self.browse(cr,uid,ids):
context['invoice_id'] = wiz_obj.invoice_id.id
return {
'context': context,
'view_type': 'form',
'view_mode': 'form',
'res_model': 'returned_lines_from_invoice_line.wizard',
'view_id': False,
'type': 'ir.actions.act_window',
'target': 'new',
}
returned_lines_from_invoice_invoice()
#===== WIZ STEP 2 : line selection
class returned_lines_from_invoice_lines(osv.osv_memory):
_name='returned_lines_from_invoice_line.wizard'
_description='Wizard to create product return lines from invoice'
_columns = {
'return_line_ids' : fields.many2many('temp.return.line', 'return_rel', 'wizard_id', 'temp_return_line_id', 'Return lines'),
}
# Get possible returns from invoice
def _get_possible_returns_from_invoice(self, cr, uid, context):
# Get invoice lines from invoice
invoice_lines_ids = self.pool.get('account.invoice.line').search(cr, uid, [('invoice_id', '=', context['invoice_id'])])
M2M = []
# Create return lines from invoice lines
for invoice_line in self.pool.get('account.invoice.line').browse(cr,uid,invoice_lines_ids):
M2M.append(self.pool.get('temp.return.line').create(cr, uid, {
'name' : "none",
'invoice_id' : invoice_line.invoice_id.id,
'invoice_line_id' : invoice_line.id,
'product_id' : invoice_line.product_id.id,
'product_returned_quantity' : invoice_line.quantity,
#'prodlot_id' : invoice_line.,
}))
return M2M
_defaults = {
'return_line_ids': _get_possible_returns_from_invoice,
}
# If "Cancel" button pressed
def action_cancel(self,cr,uid,ids,conect=None):
return {'type': 'ir.actions.act_window_close',}
# If "Create" button pressed, for all temp return line create return line
def action_create_returns(self, cr, uid, ids, context=None):
for wiz_obj in self.browse(cr,uid,ids):
for line in wiz_obj.return_line_ids:
warranty = line.invoice_line_id.get_garantee_limit(cr, uid, context)
self.pool.get('return.line').create(cr, uid, {
'name' : line.name,
'invoice_id' : line.invoice_id.id,
'product_id' : line.product_id.id,
'product_returned_quantity' : line.product_returned_quantity,
'unit_sale_price' : invoice_line.price_unit,
#'prodlot_id' : invoice_line.,
#'guarantee_type':
'guarantee_limit' : warranty['value']['guarantee_limit'],
'warning' : warranty['value']['warning'],
'claim_id' : context['active_id'],
'selected' : False,
'state' : 'draft',
})
return {
'type': 'ir.actions.act_window_close',
}
returned_lines_from_invoice_lines()
#===== Temp returned line
class temp_return_line(osv.osv_memory):
"""
Class to handle a product return line (corresponding to one invoice line)
"""
_name = "temp.return.line"
_description = "List of product to return"
_columns = {
'name': fields.selection([('none','Not specified'),
('legal','Legal retractation'),
('cancellation','Order cancellation'),
('damaged','Damaged delivered product'),
('error','Shipping error'),
('exchange','Exchange request'),
('lost','Lost during transport'),
('other','Other')], 'Claim Subject', required=True, help="To describe the line product problem"),
'invoice_id': fields.many2one('account.invoice', 'Invoice'),
'invoice_line_id' : fields.many2one('account.invoice.line', 'Invoice line'),
'product_id': fields.many2one('product.product', 'Product'),
'product_returned_quantity' : fields.float('Returned quantity', digits=(12,2), help="Quantity of product returned"),
'prodlot_id': fields.many2one('stock.production.lot', 'Serial / Lot Number'),
}
temp_return_line()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@@ -0,0 +1,89 @@
<?xml version="1.0" encoding="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/>. #
#########################################################################
-->
<openerp>
<data>
<!-- SELECT INVOICE FORM VIEW -->
<record id="view_create_return_invoice_form" model="ir.ui.view">
<field name="name">returned_lines_from_invoice_wiew</field>
<field name="model">returned_lines_from_invoice_invoice.wizard</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Select invoice">
<field name="invoice_id" domain="[('partner_id','=',partner_id)]"/>
<field name="partner_id"/>
<group col="4" colspan="2">
<button special="cancel" string="Cancel" name="action_cancel" type="object" icon='gtk-cancel'/>
<button name="action_return_all" string="Return all invoice lines" icon='gtk-ok' type="object"/>
<button name="action_select_lines" string="Select lines to return" icon='gtk-ok' type="object"/>
</group>
</form>
</field>
</record>
<!-- SELECT INVOICE ACTION -->
<record id="action_create_return_inv" model="ir.actions.act_window">
<field name="name">action_create_return_invoice</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">returned_lines_from_invoice_invoice.wizard</field>
<field name="src_model">crm.claim</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
<field name="context">{}</field>
</record>
<!-- SELECT FORM VIEW -->
<record id="view_create_return_invoice_line_form" model="ir.ui.view">
<field name="name">returned_lines_from_invoice_line_wiew</field>
<field name="model">returned_lines_from_invoice_line.wizard</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Select return lines to create">
<separator string="Select return lines to create " colspan="4"/>
<field name="return_line_ids" nolabel="1" colspan="4"/>
<group col="4" colspan="2">
<button special="cancel" string="Cancel" name="action_cancel" type="object" icon='gtk-cancel'/>
<button name="action_create_returns" string="Create selected returns" icon='gtk-ok' type="object"/>
</group>
</form>
</field>
</record>
<!-- SELECT TEMP RETURN LINES TREE VIEW -->
<record model="ir.ui.view" id="temp_return_line_tree_view">
<field name="name">temp_return_line_Tree</field>
<field name="model">temp.return.line</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Confirm return lines">
<field name="invoice_id"/>
<field name="product_id"/>
<field name="prodlot_id"/>
<field name="product_returned_quantity"/>
</tree>
</field>
</record>
</data>
</openerp>

View File

@@ -0,0 +1,244 @@
# -*- 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 osv import fields, osv
import pooler
class returned_lines_from_serial(osv.osv_memory):
_name='returned_lines_from_serial.wizard'
_description='Wizard to create product return lines from serial numbers'
_columns = {
'prodlot_id_1': fields.many2one('stock.production.lot', 'Serial / Lot Number 1', required=True),
'prodlot_id_2': fields.many2one('stock.production.lot', 'Serial / Lot Number 2'),
'prodlot_id_3': fields.many2one('stock.production.lot', 'Serial / Lot Number 3'),
'prodlot_id_4': fields.many2one('stock.production.lot', 'Serial / Lot Number 4'),
'prodlot_id_5': fields.many2one('stock.production.lot', 'Serial / Lot Number 5'),
'qty_1' : fields.float('Quantity 1', digits=(12,2), required=True),
'qty_2' : fields.float('Quantity 2', digits=(12,2)),
'qty_3' : fields.float('Quantity 3', digits=(12,2)),
'qty_4' : fields.float('Quantity 4', digits=(12,2)),
'qty_5' : fields.float('Quantity 5', digits=(12,2)),
'claim_1': fields.selection([('none','Not specified'),
('legal','Legal retractation'),
('cancellation','Order cancellation'),
('damaged','Damaged delivered product'),
('error','Shipping error'),
('exchange','Exchange request'),
('lost','Lost during transport'),
('other','Other')], 'Claim Subject', required=True, help="To describe the product problem"),
'claim_2': fields.selection([('none','Not specified'),
('legal','Legal retractation'),
('cancellation','Order cancellation'),
('damaged','Damaged delivered product'),
('error','Shipping error'),
('exchange','Exchange request'),
('lost','Lost during transport'),
('other','Other')], 'Claim Subject', required=True, help="To describe the line product problem"),
'claim_3': fields.selection([('none','Not specified'),
('legal','Legal retractation'),
('cancellation','Order cancellation'),
('damaged','Damaged delivered product'),
('error','Shipping error'),
('exchange','Exchange request'),
('lost','Lost during transport'),
('other','Other')], 'Claim Subject', required=True, help="To describe the line product problem"),
'claim_4': fields.selection([('none','Not specified'),
('legal','Legal retractation'),
('cancellation','Order cancellation'),
('damaged','Damaged delivered product'),
('error','Shipping error'),
('exchange','Exchange request'),
('lost','Lost during transport'),
('other','Other')], 'Claim Subject', required=True, help="To describe the line product problem"),
'claim_5': fields.selection([('none','Not specified'),
('legal','Legal retractation'),
('cancellation','Order cancellation'),
('damaged','Damaged delivered product'),
('error','Shipping error'),
('exchange','Exchange request'),
('lost','Lost during transport'),
('other','Other')], 'Claim Subject', required=True, help="To describe the line product problem"),
'partner_id': fields.many2one('res.partner', 'Partner'),
}
# Get partner from case is set to filter serials
def _get_default_partner_id(self, cr, uid, context):
return self.pool.get('crm.claim').read(cr, uid, context['active_id'], ['partner_id'])['partner_id']
_defaults = {
'qty_1': lambda *a: 1.0,
'qty_2': lambda *a: 1.0,
'qty_3': lambda *a: 1.0,
'qty_4': lambda *a: 1.0,
'qty_5': lambda *a: 1.0,
'claim_1': lambda *a: "none",
'claim_2': lambda *a: "none",
'claim_3': lambda *a: "none",
'claim_4': lambda *a: "none",
'claim_5': lambda *a: "none",
'partner_id': _get_default_partner_id,
}
# If "Cancel" button pressed
def action_cancel(self,cr,uid,ids,conect=None):
return {'type': 'ir.actions.act_window_close',}
# If "Add & close" button pressed
def action_add_and_close(self, cr, uid, ids, context=None):
self.add_return_lines(cr, uid, ids, context)
return {'type': 'ir.actions.act_window_close',}
# If "Add & new" button pressed
def action_add_and_new(self, cr, uid, ids, context=None):
self.add_return_lines(cr, uid, ids, context)
return {
'context': context,
'view_type': 'form',
'view_mode': 'form',
'res_model': 'returned_lines_from_serial.wizard',
'view_id': False,
'type': 'ir.actions.act_window',
'target': 'new',
}
# Method to get the product id from set
def get_product_id(self, cr, uid,ids,product_set, context=None):
product_id = False
for product in self.prodlot_2_product(cr, uid,[product_set]):
product_id = product
return product_id
# Method to create return lines
def add_return_lines(self, cr, uid, ids, context=None):
result = self.browse(cr,uid,ids)[0]
return_line = self.pool.get('return.line')
# Refactor code : create 1 "createmethode" called by each if with values as parameters
return_line.create(cr, uid, {
'claim_id': context['active_id'],
'name': result.claim_1,
'product_id' : self.get_product_id(cr, uid,ids,result.prodlot_id_1.id,context),
#'invoice_id' : self.prodlot_2_invoice(cr, uid,[result.prodlot_id_1.id],[result.prodlot_id_1.product_id.id]), #PRODLOT_ID can be in many invoice !!
'product_returned_quantity' : result.qty_1,
'prodlot_id' : result.prodlot_id_1.id,
'selected' : False,
'state' : 'draft',
#'guarantee_limit' : warranty['value']['guarantee_limit'],
#'warning' : warranty['value']['warning'],
})
if result.prodlot_id_2.id :
return_line.create(cr, uid, {
'claim_id': context['active_id'],
'name': result.claim_2,
'product_id' : self.get_product_id(cr, uid,ids,result.prodlot_id_2.id,context),
# 'invoice_id' : self.prodlot_2_invoice(cr, uid,[result.prodlot_id_1.id]),
'product_returned_quantity' : result.qty_2,
'prodlot_id' : result.prodlot_id_2.id,
'selected' : False,
'state' : 'draft',
#'guarantee_limit' : warranty['value']['guarantee_limit'],
#'warning' : warranty['value']['warning'],
})
if result.prodlot_id_3.id :
return_line.create(cr, uid, {
'claim_id': context['active_id'],
'name': result.claim_3,
'product_id' : self.get_product_id(cr, uid,ids,result.prodlot_id_3.id,context),
# 'invoice_id' : self.prodlot_2_invoice(cr, uid,[result.prodlot_id_1.id]),
'product_returned_quantity' : result.qty_3,
'prodlot_id' : result.prodlot_id_3.id,
'selected' : False,
'state' : 'draft',
#'guarantee_limit' : warranty['value']['guarantee_limit'],
#'warning' : warranty['value']['warning'],
})
if result.prodlot_id_4.id :
return_line.create(cr, uid, {
'claim_id': context['active_id'],
'name': result.claim_4,
'product_id' : self.get_product_id(cr, uid,ids,result.prodlot_id_4.id,context),
# 'invoice_id' : self.prodlot_2_invoice(cr, uid,[result.prodlot_id_1.id]),
'product_returned_quantity' : result.qty_4,
'prodlot_id' : result.prodlot_id_4.id,
'selected' : False,
'state' : 'draft',
#'guarantee_limit' : warranty['value']['guarantee_limit'],
#'warning' : warranty['value']['warning'],
})
if result.prodlot_id_5.id :
return_line.create(cr, uid, {
'claim_id': context['active_id'],
'name': result.claim_5,
'product_id' : self.get_product_id(cr, uid,ids,result.prodlot_id_5.id,context),
# 'invoice_id' : self.prodlot_2_invoice(cr, uid,[result.prodlot_id_1.id],[result.prodlot_id_1.product_id.id]),
'product_returned_quantity' : result.qty_5,
'prodlot_id' : result.prodlot_id_5.id,
'selected' : False,
'state' : 'draft',
#'guarantee_type':
#'guarantee_limit' : warranty['value']['guarantee_limit'],
#'warning' : warranty['value']['warning'],
})
return True
def prodlot_2_product(self,cr, uid, prodlot_ids):
stock_move_ids=self.pool.get('stock.move').search(cr, uid, [('prodlot_id', 'in', prodlot_ids)])
res=self.pool.get('stock.move').read(cr, uid, stock_move_ids, ['product_id'])
return set([x['product_id'][0] for x in res if x['product_id']])
def prodlot_2_invoice(self,cr, uid, prodlot_id,product_id):
print "prodlot_ids : ", prodlot_id
print "product_id : ", product_id
# get stock_move_ids
stock_move_ids = self.pool.get('stock.move').search(cr, uid, [('prodlot_id', 'in', prodlot_id)])
print "stock_move_ids : ", stock_move_ids
# if 1 id
# (get stock picking (filter on out ?))
# get invoice_ids from stock_move_id where invoice.line.product = prodlot_product and invoice customer = claim_partner
# if 1 id
# return invoice_id
# else
# else : move_in / move_out ; 1 move per order line so if many order lines with same lot, ...
#
#return set(self.stock_move_2_invoice(cr, uid, stock_move_ids))
return True
def stock_move_2_invoice(self, cr, uid, stock_move_ids):
inv_line_ids = []
res=self.pool.get('stock.move').read(cr, uid, stock_move_ids, ['sale_line_id'])
sale_line_ids = [x['sale_line_id'][0] for x in res if x['sale_line_id']]
if not sale_line_ids:
return []
cr.execute("select invoice_id from sale_order_line_invoice_rel where order_line_id in ("+ ','.join(map(lambda x: str(x),sale_line_ids))+')')
res = cr.fetchall()
for i in res:
for j in i:
inv_line_ids.append(j)
res=self.pool.get('account.invoice.line').read(cr, uid, inv_line_ids,['invoice_id'])
return [x['invoice_id'][0] for x in res if x['invoice_id']]
returned_lines_from_serial()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="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/>. #
#########################################################################
-->
<openerp>
<data>
<!-- SELECT FORM VIEW -->
<record id="view_create_return_serial_form" model="ir.ui.view">
<field name="name">returned_lines_from_serial_wiew</field>
<field name="model">returned_lines_from_serial.wizard</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Select serial numbers to create">
<group col="3" colspan="4">
<separator string="Serial / Lot Number" colspan="1"/>
<separator string="Quantity returned" colspan="1"/>
<separator string="Claim short description" colspan="1"/>
<field name="prodlot_id_1" nolabel="1"/>
<field name="qty_1" nolabel="1"/>
<field name="claim_1" nolabel="1"/>
<field name="prodlot_id_2" nolabel="1"/>
<field name="qty_2" nolabel="1"/>
<field name="claim_2" nolabel="1"/>
<field name="prodlot_id_3" nolabel="1"/>
<field name="qty_3" nolabel="1"/>
<field name="claim_3" nolabel="1"/>
<field name="prodlot_id_4" nolabel="1"/>
<field name="qty_4" nolabel="1"/>
<field name="claim_4" nolabel="1"/>
<field name="prodlot_id_5" nolabel="1"/>
<field name="qty_5" nolabel="1"/>
<field name="claim_5" nolabel="1"/>
</group>
<group col="4" colspan="2">
<button special="cancel" string="Cancel" name="action_cancel" type="object" icon='gtk-cancel'/>
<button name="action_add_and_close" string="Save and close" icon='gtk-ok' type="object"/>
<button name="action_add_and_new" string="Save and new" icon='gtk-add' type="object"/>
</group>
</form>
</field>
</record>
<!-- SELECT ACTION -->
<record id="action_create_return_serial" model="ir.actions.act_window">
<field name="name">action_create_return_serial</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">returned_lines_from_serial.wizard</field>
<field name="src_model">crm.claim</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
</data>
</openerp>

View File

@@ -0,0 +1,23 @@
# -*- 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/>. #
#########################################################################
import product_warranty

View File

@@ -0,0 +1,45 @@
# -*- 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/>. #
#########################################################################
{
'name': 'Product warranty',
'version': '1.0',
'category': 'Generic Modules/Product',
'description': """
Extend the product warranty management with warranty details on prodcut / supplier relation
""",
'author': 'Akretion',
'website': 'http://www.akretion.com',
'depends': ['product'],
'init_xml': [],
'update_xml': [
'product_warranty_view.xml',
],
'demo_xml': [],
'test': [],
'installable': True,
'active': False,
'certificate' : '',
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@@ -0,0 +1,46 @@
# -*- 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 osv import fields, osv
class product_supplierinfo(osv.osv):
_inherit = "product.supplierinfo"
def get_warranty_return_partner(self, cr, uid, context=None):
if self.pool.get('ir.module.module').search(cr, uid, [('name','like','product_brand'),('state','like','installed')]):
return [
('company','Company'),
('supplier','Supplier'),
('brand','Brand manufacturer'),]
else:
return [
('company','Company'),
('brand','Brand manufacturer'),]
_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"),
}
product_supplierinfo()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@@ -0,0 +1,53 @@
<?xml version="1.0"?>
<!--
#########################################################################
# #
# 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/>. #
#########################################################################
-->
<openerp>
<data>
<!-- supplier info tree view -->
<record model="ir.ui.view" id="product_supplierinfo_warranty_tree_view">
<field name="name">product.supplierinfo.warranty.tree</field>
<field name="model">product.supplierinfo</field>
<field name="inherit_id" ref="product.product_supplierinfo_tree_view" />
<field name="type">tree</field>
<field name="arch" type="xml">
<field position="after" name="delay">
<field name="warranty_duration"/>
<field name="warranty_return_partner"/>
</field>
</field>
</record>
<!-- supplier info form view -->
<record model="ir.ui.view" id="product_supplierinfo_warranty_form_view">
<field name="name">product.supplierinfo.warranty.form</field>
<field name="model">product.supplierinfo</field>
<field name="inherit_id" ref="product.product_supplierinfo_form_view" />
<field name="type">form</field>
<field name="arch" type="xml">
<field position="after" name="delay">
<field name="warranty_duration"/>
<field name="warranty_return_partner" readonly="0"/>
</field>
</field>
</record>
</data>
</openerp>