Odoo Help


how can i create a stock move ???

on 12/17/15, 4:02 AM 827 views

in my custom module there is  product line .and when ever i am  creating an invoice i also need a stock move for the product line..how can i do that..

plz give me some answerss

Deepak Krishna
On 12/29/15, 6:05 AM


You can call stock move from invoice creation.i have created a similar stock move for membership module..just check whether it is usefull or not..

class membership_invoice(osv.osv):
def membership_stock_move(self,cr,uid,ids,context=None):
res = {}
vals = []
member_inv_obj = self.pool.get('membership.invoice')
member_inv_line_obj = self.pool.get('membership.invoice.line')

partner_id = member_inv_obj.browse(cruidids,,[0]).cust_name.id
dest_id = member_inv_obj.browse(cruidids,,[0]).cust_name.property_stock_customer.id,
#~ print dest_id[0],'??????????????'
company_id = self.pool.get('res.users')._get_company(cruid, , context=context)
warehouse_ids = self.pool.get('stock.warehouse').search(cruid, , [('company_id''=', , company_id)], context=context)

source_id = self.pool.get('stock.warehouse').browse(cruid,,warehouse_ids[0]).lot_stock_id.id
move_line_ids = member_inv_line_obj.search(cruid, , [('order_id''=',,ids[0])])
if move_line_ids:
for in li move_line_ids:
res = {
picking_id = move_obj.create(cruid, , res, context=context)
print vals,'?????????????????????????????????????????'
class stock_move(osv.osv):
"""Membership Invoice"""
_inherit = "stock.move"
_description = "Membership Stock"

_columns = {
'membership_id':fields.many2one('membership.invoice''Membership Invoice',),

class stock_picking(osv.osv):
"""Membership Invoice"""
_inherit = "stock.picking"
_description = "Membership Stock"

_columns = {
'membership_id':fields.many2one('membership.invoice''Membership Invoice',),

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 12/17/15, 4:02 AM
Seen: 827 times
Last updated: 12/29/15, 6:08 AM