Odoo Help

Welcome!

This community 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.

0

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

By
Mani
on 8/13/16, 3:21 AM 232 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.

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

2 follower(s)

Stats

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