Odoo Help

0

How to stock of the product in product table while purchase?

By
Mani
on 8/13/16, 3:21 AM 496 views

I am doing simple custom inventory module. In that, my product and purchase fields i listed below.

product table 

 _name = "ims.product"
_description = "Product Module"
_columns = {
'name': fields.char('Product Name', required=True),
'cost': fields.float('Product Cost',digits=(12,2), required=True),
'stock': fields.integer('Stock'),
'category': fields.many2one('ims.category', 'Category', required=True),
}

Purchase table

 _columns = {
'supplier': fields.many2one('ims.supplier', 'Supplier', required=True),
'address': fields.char('Address'),
'phone': fields.char('Phone'),
'email': fields.char('Email'),
'product': fields.one2many('ims.purchase.list','purchase_id','Items', required=True),
'grand_total': fields.function(_amount_all_wrapper, digits_compute=dp.get_precision('Account'), string='Grand Total',
store={
'ims.purchase': (lambda self, cr, uid, ids, c={}: ids, ['product'], 10),
'ims.purchase.list': (_get_order, ['price_unit'], 10),
},
multi='sums', help="The total amount."),

while purchase i have to update the stock(Old+new stock) from the purchase.

I am new to odoo. If anything is very basic, am sorry to that.

Thanks for your helps.

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.

Register

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

2 follower(s)

Stats

Asked: 8/13/16, 3:21 AM
Seen: 496 times
Last updated: 8/13/16, 6:23 AM