Skip to Content
Menu
This question has been flagged

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.

Avatar
Discard
Related Posts Replies Views Activity
4
Jul 19
11298
0
Nov 17
3299
0
Apr 16
128
0
Dec 15
5707
5
Nov 15
4745