[Update] refund & picking to apply for both supplier/customer claim type

This commit is contained in:
manu
2011-10-17 17:18:40 +02:00
parent 74e23f1df8
commit 1acbf560bc
2 changed files with 6 additions and 2 deletions

View File

@@ -164,7 +164,7 @@ class picking_out_from_returned_lines(osv.osv_memory):
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
# location type
# location type
location = -1
if claim_id.claim_type == "customer":
location = claim_id.partner_id.property_stock_customer.id

View File

@@ -71,6 +71,10 @@ class refund_from_returned_lines(osv.osv_memory):
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
# invoice type
invoice_type = 'out_refund'
if claim_id.claim_type == "supplier":
invoice_type = 'in_refund'
# create invoice
invoice_id = self.pool.get('account.invoice').create(cr, uid, {
'claim_origine' : "none",
@@ -112,7 +116,7 @@ class refund_from_returned_lines(osv.osv_memory):
'name': 'Customer Refounds',
'view_type': 'form',
'view_mode': 'tree,form',
'domain' : "[('type', '=', 'out_refund'),('partner_id','=',%s)]"%partner_id,
'domain' : "[('type', '=', %s),('partner_id','=',%s)]"%(invoice_type,partner_id),
'res_model': 'account.invoice',
'type': 'ir.actions.act_window',
}