Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
4426 Lượt xem

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.

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
4
thg 7 19
12632
0
thg 11 17
4051
0
thg 4 16
128
0
thg 12 15
6942
5
thg 11 15
5809