If you want transfer stock in Product module you have to follow the following code in your .py file.
class stock_immediate_transfer(models.TransientModel):
_inherit = 'stock.immediate.transfer'
@api.multi
def process(self):
self.ensure_one()
# If still in draft => confirm and assign
if self.pick_id.state == 'draft':
self.pick_id.action_confirm()
if self.pick_id.state != 'assigned':
self.pick_id.action_assign()
if self.pick_id.state != 'assigned':
raise UserError(_("Could not reserve all requested products. Please use the \'Mark as Todo\' button to handle the reservation manually."))
for pack in self.pick_id.pack_operation_ids:
if pack.product_qty > 0:
pack.write({'qty_done': pack.product_qty})
else:
pack.unlink()
self.pick_id.do_transfer()
in_rent_list = []
in_type_id = self.pool.get('stock.picking.type').search(self.env.cr,self.env.uid,[('name','=','Receipts')])
if self.pick_id:
if self.pick_id.picking_type_id.id == in_type_id[0]:
in_rent_list = self.pool.get('rent.order').search(self.env.cr,self.env.uid,[('in_picking_id','=',self.pick_id.id)])
else:
rent_list = self.pool.get('rent.order').search(self.env.cr,self.env.uid,[('out_picking_id','=',self.pick_id.id)])
if rent_list:
self.pool.get('rent.order').action_ongoing(self.env.cr,self.env.uid,rent_list[0])
if in_rent_list:
self.pool.get('rent.order').write(self.env.cr,self.env.uid,in_rent_list[0],{'state':'done'})
class account_invoice_line(osv.Model):
_inherit = 'account.invoice.line'
_columns = {
'maintenance_Plan': fields.float('Mentinance Price', digits_compute= dp.get_precision('Mentinance Price')),
}
account_invoice_line()
0 Comment(s)