[FIX] fix on crm_claim_rma by Sebastien Beau

This commit is contained in:
Sébastien Beau
2012-08-28 14:57:05 +02:00
committed by Benoit Guillot
parent c58830b788
commit 98920be484
7 changed files with 31 additions and 13 deletions

View File

@@ -75,6 +75,7 @@ class return_line(osv.osv):
('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,..."),
@@ -166,9 +167,16 @@ class return_line(osv.osv):
warranty_type = 'other'
# TO BE IMPLEMENTED if something to do...
else :
raise osv.except_osv(_('Error !'), _('Cannot find any warranty return partner for this product !'))
#TODO fix me use default address
self.write(cr,uid,ids,{'warranty_return_partner':1,'warranty_type': 'company'})
return True
#raise osv.except_osv(_('Error !'), _('Cannot find any warranty return partner for this product !'))
else :
raise osv.except_osv(_('Error !'), _('Cannot find any supplier for this product !'))
#TODO fix me use default address
self.write(cr,uid,ids,{'warranty_return_partner':1,'warranty_type': 'company'})
return True
#raise osv.except_osv(_('Error !'), _('Cannot find any supplier for this product !'))
self.write(cr,uid,ids,{'warranty_return_partner':return_address,'warranty_type':warranty_type})
return True
@@ -283,6 +291,15 @@ class crm_claim_product_return(osv.osv):
for line in self.browse(cr,uid,ids)[0].return_line_ids:
return_obj.write(cr,uid,line.id,{'selected':False})
return True
def refund(self, cr, uid, ids, context=None):
mod_obj = self.pool.get('ir.model.data')
xml_id = 'action_account_invoice_refund'
result = mod_obj.get_object_reference(cr, uid, 'account', xml_id)
id = result and result[1] or False
result = act_obj.read(cr, uid, id, context=context)
print 'result', result
return result
crm_claim_product_return()

View File

@@ -236,15 +236,16 @@
<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"/>
<button name="refund" string="New refund" states="draft,open" type="object"/>
<!--<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">
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">

View File

@@ -258,7 +258,7 @@ msgstr "Non spécifé"
#. module: crm_claim_rma
#: view:crm.claim:0
msgid "New picking IN"
msgstr "Nouvelle réception"
msgstr "Nouvelle réception / perte de marchandise"
#. module: crm_claim_rma
#: field:temp.return.line,invoice_line_id:0

View File

@@ -38,7 +38,7 @@ class exchange_from_returned_lines(osv.osv_memory):
returned_lines = self.pool.get('return.line').browse(cr, uid,returned_line_ids)
M2M = []
for line in returned_lines:
if line.selected:
if True: # ADD ALL LINE line.selected:
M2M.append(self.pool.get('temp.exchange.line').create(cr, uid, {
'name' : "none",
'returned_product_id' : line.product_id.id,

View File

@@ -38,7 +38,7 @@ class picking_out_from_exchange_lines(osv.osv_memory):
exchange_lines = self.pool.get('product.exchange').browse(cr, uid,exchange_line_ids)
M2M = []
for line in exchange_lines:
if line.selected:
if True: #line.selected:
M2M.append(self.pool.get('temp.exchange.line').create(cr, uid, {
'name' : "#",
'returned_product_id' : line.returned_product.id,

View File

@@ -39,7 +39,7 @@ class picking_in_from_returned_lines(osv.osv_memory):
returned_lines = self.pool.get('return.line').browse(cr, uid,returned_line_ids)
M2M = []
for line in returned_lines:
if line.selected:
if True: #line.selected:
M2M.append(self.pool.get('temp.return.line').create(cr, uid, {
'claim_origine' : "none",
'invoice_id' : line.invoice_id.id,
@@ -78,7 +78,7 @@ class picking_in_from_returned_lines(osv.osv_memory):
location = claim_id.partner_id.property_stock_supplier.id
# create picking
picking_id = self.pool.get('stock.picking').create(cr, uid, {
'origin': "RMA/"+`claim_id.sequence`,
'origin': claim_id.sequence,
'type': 'in',
'move_type': 'one', # direct
'state': 'draft',
@@ -141,7 +141,7 @@ class picking_out_from_returned_lines(osv.osv_memory):
returned_lines = self.pool.get('return.line').browse(cr, uid,returned_line_ids)
M2M = []
for line in returned_lines:
if line.selected:
if True: # line.selected:
M2M.append(self.pool.get('temp.return.line').create(cr, uid, {
'claim_origine' : "none",
'invoice_id' : line.invoice_id.id,
@@ -174,7 +174,7 @@ class picking_out_from_returned_lines(osv.osv_memory):
location = claim_id.partner_id.property_stock_supplier.id
# create picking
picking_id = self.pool.get('stock.picking').create(cr, uid, {
'origin': "RMA/"+`claim_id.id`,
'origin': claim_id.sequence,
'type': 'out',
'move_type': 'one', # direct
'state': 'draft',

View File

@@ -38,7 +38,7 @@ class refund_from_returned_lines(osv.osv_memory):
returned_lines = self.pool.get('return.line').browse(cr, uid,returned_line_ids)
M2M = []
for line in returned_lines:
if line.selected:
if True: #line.selected:
M2M.append(self.pool.get('temp.return.line').create(cr, uid, {
'claim_origine' : "none",
'invoice_id' : line.invoice_id.id,