mirror of
https://github.com/OCA/rma.git
synced 2025-02-16 17:11:47 +02:00
[MERGE]
This commit is contained in:
@@ -323,15 +323,17 @@
|
||||
res_model="account.invoice"
|
||||
src_model="crm.claim"/>
|
||||
<!-- Right side link to picking in -->
|
||||
<act_window
|
||||
domain="[('type', '=', 'in'),('partner_id', 'in', [partner_id])]"
|
||||
<act_window
|
||||
context="{'search_default_partner_id': [partner_id]}"
|
||||
domain="[('type', '=', 'in')]"
|
||||
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])]"
|
||||
context="{'search_default_partner_id': [partner_id]}"
|
||||
domain="[('type', '=', 'out')]"
|
||||
id="act_crm_claim_rma_picking_out"
|
||||
name="Partner picking OUT"
|
||||
res_model="stock.picking"
|
||||
|
||||
@@ -116,7 +116,6 @@ class claim_make_picking(osv.osv_memory):
|
||||
view_name = 'stock.picking.in.form'
|
||||
view_id = view_obj.search(cr, uid, [
|
||||
('xml_id', '=', view_xml_id),
|
||||
('model', '=', 'stock.picking'),
|
||||
('type', '=', 'form'),
|
||||
('name', '=', view_name)
|
||||
], context=context)[0]
|
||||
@@ -130,7 +129,7 @@ class claim_make_picking(osv.osv_memory):
|
||||
'move_type': 'one', # direct
|
||||
'state': 'draft',
|
||||
'date': time.strftime(DEFAULT_SERVER_DATETIME_FORMAT),
|
||||
'address_id': claim.partner_address_id.id,
|
||||
'partner_id': claim.partner_id.id,
|
||||
'invoice_state': "none",
|
||||
'company_id': claim.company_id.id,
|
||||
'location_id': wizard.claim_line_source_location.id,
|
||||
@@ -150,7 +149,7 @@ class claim_make_picking(osv.osv_memory):
|
||||
'product_id': wizard_claim_line.product_id.id,
|
||||
'product_qty': wizard_claim_line.product_returned_quantity,
|
||||
'product_uom': wizard_claim_line.product_id.uom_id.id,
|
||||
'address_id': claim.partner_address_id.id,
|
||||
'partner_id': claim.partner_id.id,
|
||||
'prodlot_id': wizard_claim_line.prodlot_id.id,
|
||||
# 'tracking_id':
|
||||
'picking_id': picking_id,
|
||||
|
||||
@@ -93,7 +93,7 @@ class claim_make_picking_from_picking(osv.osv_memory):
|
||||
'move_type': 'one', # direct
|
||||
'state': 'draft',
|
||||
'date': time.strftime(DEFAULT_SERVER_DATETIME_FORMAT),
|
||||
'address_id': prev_picking.address_id.id,
|
||||
'partner_id': prev_picking.partner_id.id,
|
||||
'invoice_state': "none",
|
||||
'company_id': prev_picking.company_id.id,
|
||||
'location_id': wizard.picking_line_source_location.id,
|
||||
@@ -112,7 +112,7 @@ class claim_make_picking_from_picking(osv.osv_memory):
|
||||
'product_id': wizard_picking_line.product_id.id,
|
||||
'product_qty': wizard_picking_line.product_qty,
|
||||
'product_uom': wizard_picking_line.product_uom.id,
|
||||
'address_id': prev_picking.address_id.id,
|
||||
'partner_id': prev_picking.partner_id.id,
|
||||
'prodlot_id': wizard_picking_line.prodlot_id.id,
|
||||
# 'tracking_id':
|
||||
'picking_id': picking_id,
|
||||
|
||||
@@ -31,7 +31,7 @@ class picking_out_from_exchange_lines(osv.osv_memory):
|
||||
_columns = {
|
||||
'exchange_line_ids' : fields.many2many('temp.exchange.line', string='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']
|
||||
@@ -46,13 +46,13 @@ class picking_out_from_exchange_lines(osv.osv_memory):
|
||||
'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,
|
||||
'replacement_prodlot_id': line.replacement_product_serial.id,
|
||||
}))
|
||||
return M2M
|
||||
|
||||
return M2M
|
||||
|
||||
_defaults = {
|
||||
'exchange_line_ids': _get_selected_lines,
|
||||
}
|
||||
}
|
||||
|
||||
# If "Cancel" button pressed
|
||||
def action_cancel(self,cr,uid,ids,conect=None):
|
||||
@@ -70,13 +70,13 @@ class picking_out_from_exchange_lines(osv.osv_memory):
|
||||
'move_type': 'one', # direct
|
||||
'state': 'draft',
|
||||
'date': time.strftime('%Y-%m-%d %H:%M:%S'),
|
||||
'address_id': claim_id.partner_address_id.id,
|
||||
'partner_id': claim_id.partner_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',
|
||||
'note' : 'RMA picking in',
|
||||
})
|
||||
# Create picking lines
|
||||
for exchange_line in exchange_lines.exchange_line_ids:
|
||||
@@ -89,7 +89,7 @@ class picking_out_from_exchange_lines(osv.osv_memory):
|
||||
'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,
|
||||
'partner_id': claim_id.partner_id.id,
|
||||
'prodlot_id': exchange_line.replacement_prodlot_id,
|
||||
# 'tracking_id':
|
||||
'picking_id': picking_id,
|
||||
@@ -99,7 +99,7 @@ class picking_out_from_exchange_lines(osv.osv_memory):
|
||||
'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',
|
||||
'note': 'RMA Refound',
|
||||
})
|
||||
view = {
|
||||
'name': 'Customer Picking OUT',
|
||||
@@ -110,7 +110,7 @@ class picking_out_from_exchange_lines(osv.osv_memory):
|
||||
'type': 'ir.actions.act_window',
|
||||
}
|
||||
return view
|
||||
|
||||
|
||||
picking_out_from_exchange_lines()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -32,7 +32,7 @@ class picking_in_from_returned_lines(osv.osv_memory):
|
||||
'claim_line_location' : fields.many2one('stock.location', 'Dest. Location',help="Location where the system will stock the returned products.", select=True),
|
||||
'claim_line_ids' : fields.many2many('temp.claim.line',string='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'], ['claim_line_ids'])['claim_line_ids']
|
||||
@@ -53,12 +53,12 @@ class picking_in_from_returned_lines(osv.osv_memory):
|
||||
# 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 = {
|
||||
'claim_line_ids': _get_selected_lines,
|
||||
'claim_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',}
|
||||
@@ -84,7 +84,7 @@ class picking_in_from_returned_lines(osv.osv_memory):
|
||||
'move_type': 'one', # direct
|
||||
'state': 'draft',
|
||||
'date': time.strftime('%Y-%m-%d %H:%M:%S'),
|
||||
'address_id': claim_id.partner_address_id.id,
|
||||
'partner_id': claim_id.partner_id.id,
|
||||
'invoice_state': "none",
|
||||
'company_id': claim_id.company_id.id,
|
||||
'location_id': location,
|
||||
@@ -103,7 +103,7 @@ class picking_in_from_returned_lines(osv.osv_memory):
|
||||
'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,
|
||||
'partner_id': claim_id.partner_id.id,
|
||||
'prodlot_id': picking_line.prodlot_id.id,
|
||||
# 'tracking_id':
|
||||
'picking_id': picking_id,
|
||||
@@ -125,7 +125,7 @@ class picking_in_from_returned_lines(osv.osv_memory):
|
||||
'res_model': 'stock.picking',
|
||||
'type': 'ir.actions.act_window',
|
||||
}
|
||||
|
||||
|
||||
picking_in_from_returned_lines()
|
||||
|
||||
# Class to create a picking out from selected return lines
|
||||
@@ -135,7 +135,7 @@ class picking_out_from_returned_lines(osv.osv_memory):
|
||||
_columns = {
|
||||
'claim_line_ids' : fields.many2many('temp.claim.line', string='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'], ['claim_line_ids'])['claim_line_ids']
|
||||
@@ -151,11 +151,11 @@ class picking_out_from_returned_lines(osv.osv_memory):
|
||||
'prodlot_id' : line.prodlot_id.id,
|
||||
'price_unit' : line.unit_sale_price,
|
||||
}))
|
||||
return M2M
|
||||
|
||||
return M2M
|
||||
|
||||
_defaults = {
|
||||
'claim_line_ids': _get_selected_lines,
|
||||
}
|
||||
}
|
||||
|
||||
# If "Cancel" button pressed
|
||||
def action_cancel(self,cr,uid,ids,context=None):
|
||||
@@ -180,7 +180,7 @@ class picking_out_from_returned_lines(osv.osv_memory):
|
||||
'move_type': 'one', # direct
|
||||
'state': 'draft',
|
||||
'date': time.strftime('%Y-%m-%d %H:%M:%S'),
|
||||
'address_id': claim_id.partner_address_id.id,
|
||||
'partner_id': claim_id.partner_id.id,
|
||||
'invoice_state': "none",
|
||||
'company_id': claim_id.company_id.id,
|
||||
# 'stock_journal_id': fields.many2one('stock.journal','Stock Journal', select=True),
|
||||
@@ -200,7 +200,7 @@ class picking_out_from_returned_lines(osv.osv_memory):
|
||||
'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,
|
||||
'partner_id': claim_id.partner_id.id,
|
||||
'prodlot_id': picking_line.prodlot_id.id,
|
||||
# 'tracking_id':
|
||||
'picking_id': picking_id,
|
||||
|
||||
@@ -31,7 +31,7 @@ class refund_from_returned_lines(osv.osv_memory):
|
||||
'refund_journal' : fields.many2one('account.journal', 'Refund journal', select=True),
|
||||
'claim_line_ids' : fields.many2many('temp.claim.line', string='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'], ['claim_line_ids'])['claim_line_ids']
|
||||
@@ -47,18 +47,18 @@ class refund_from_returned_lines(osv.osv_memory):
|
||||
'prodlot_id' : line.prodlot_id.id,
|
||||
'price_unit' : line.unit_sale_price,
|
||||
}))
|
||||
return M2M
|
||||
return M2M
|
||||
|
||||
# Get default journal
|
||||
def _get_journal(self, cr, uid,context):
|
||||
#('company_id','=',claim_id.company_id.id)
|
||||
# ,('refund_journal','=','True')
|
||||
return self.pool.get('account.journal').search(cr, uid, [('type','=','sale_refund')],limit=1)[0]
|
||||
|
||||
|
||||
_defaults = {
|
||||
'claim_line_ids': _get_selected_lines,
|
||||
'refund_journal' : _get_journal,
|
||||
}
|
||||
}
|
||||
|
||||
# On "Cancel" button
|
||||
def action_cancel(self,cr,uid,ids,context=None):
|
||||
@@ -85,22 +85,22 @@ class refund_from_returned_lines(osv.osv_memory):
|
||||
'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,
|
||||
'partner_id' : claim_id.partner_id.id,
|
||||
'commercial_partner_id' : claim_id.partner_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 Refund',
|
||||
'claim_id': claim_id.id,
|
||||
})
|
||||
# Create invoice lines
|
||||
for refund_line in refund.claim_line_ids:
|
||||
})
|
||||
# Create invoice lines
|
||||
for refund_line in refund.claim_line_ids:
|
||||
if refund_line.invoice_id:
|
||||
invoice_line_id = self.pool.get('account.invoice.line').create(cr, uid, {
|
||||
'name' : refund_line.product_id.name_template,
|
||||
'origin' : claim_id.sequence,
|
||||
'invoice_id' : invoice_id,
|
||||
'origin' : claim_id.sequence,
|
||||
'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,
|
||||
@@ -111,7 +111,7 @@ class refund_from_returned_lines(osv.osv_memory):
|
||||
# 'account_analytic_id':
|
||||
'company_id' : claim_id.company_id.id,
|
||||
'partner_id' : refund_line.invoice_id.partner_id.id,
|
||||
'note': 'RMA Refund',
|
||||
'note': 'RMA Refund',
|
||||
})
|
||||
else:
|
||||
raise osv.except_osv(_('Error !'), _('Cannot find any invoice for the return line!'))
|
||||
@@ -123,7 +123,7 @@ class refund_from_returned_lines(osv.osv_memory):
|
||||
'res_model': 'account.invoice',
|
||||
'type': 'ir.actions.act_window',
|
||||
}
|
||||
|
||||
|
||||
refund_from_returned_lines()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
Reference in New Issue
Block a user