Odoo Help


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.


How to calculate subtotal price in Order Lines

Aldi Sugandi
on 12/15/15, 8:37 PM 335 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
Please help me to fix it , Thanks

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

1 follower(s)


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