# How to calculate subtotal price in Order Lines

By
Aldi Sugandi
on 12/15/15, 8:37 PM 766 views

Haii , i'm a beginner in technical odoo and python.

i was create a new module, i'm totally copied the code from another module basicly similiar like my module , and i stuck in calculate subtotal, this is my code :

def create(self, cr, uid, vals, context=None):

if not vals['work_lines'] :

raise osv.except_osv(('Perhatian !'), ("Detail Transaksi Belum di Isi"))

vals['date'] = time.strftime('%Y-%m-%d')

self._get_wo(cr, uid, vals['branch_id'], vals ['type'],vals['date'],vals['tanggal_pembelian'],vals['kpb_ke'])

vals['name'] = self.pool.get('ir.sequence').get_per_branch(cr, uid, vals['branch_id'], 'WO')

work_order = super(pesan_service, self).create(cr, uid, vals, context=context)

if work_order:

obj_lot = self.pool.get('stock.production.lot')

lot_update_reserve = obj_lot.write(cr,uid,vals['lot_id'],{'no_polisi':vals['no_pol'],'product_id':vals['product_id']})

return work_order

i want to remove lot_it , because i not use it in my new module. how to changes it into branch_id maybe ?

if i change it i get an error code who was reference with lot_id but if i not change it i get Key Error : Lot_id

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.

### Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

1 follower(s)

### Stats

 Asked: 12/15/15, 8:37 PM Seen: 766 times Last updated: 12/15/15, 11:51 PM