Reputation: 55
Im learner of Openerp May be it will be the basic question .
Below is my code:
def add_slab_info(self, cr, uid, ids, context={}):
sqty=2
for qty in range(0,sqty):
area = (length) * (width)
Self.pool.get(object).create(cr, uid, {'product_id':value.product_id.id,
'sno':no,'length':length,'width':width,'price':price,
'area':area,
})
self.pool.get('purchase.order.line').write(cr,uid,record_id,
'product_qty': sum(area),
'product_field':product})
if sqty = 2 so it creates 2 lines
L W A
1 2 2
1 2 2
4 Sum(A)
I want to get the sum of area . could anyone help me?
Upvotes: 0
Views: 377
Reputation: 485
You can try this. Hope this will help
def add_slab_info(self, cr, uid, ids, context={}):
sqty=2
for qty in range(0,sqty):
area = (length) * (width)
Self.pool.get(object).create(cr, uid, {'product_id':value.product_id.id,
'sno':no,'length':length,'width':width,'price':price,
'area':area,
})
Sum_area += area
self.pool.get('purchase.order.line').write(cr,uid,record_id,
'product_qty': Sum_area,
'product_field':product})
Upvotes: 1