Community mailing list archives

community@mail.odoo.com

NEW API-BROWSING ANOTHER MODEL

by
mudoko
- 02/27/2016 04:19:42
Hi guys, am trying to use an an @api onchange event to alter quanties of components in bill of material   form , The essence is everytime we have production required capacity that is entered manuallyon the bom list view that should trigger this update, This is the script:

@api.onchange('quantity','batch')
    def onchangeQuantity(self):
   for rec in self:
       rec.batch=rec.quantity/rec.product_qty
self.bom_Calc(rec.batch)
     @api.model
def bom_Calc(self,value):
'''update the component bom lines'''
   for rec in self:
id=rec.id
bom_obj = rec.env['mrp.bom.line'].search([('id', '=', id)])
bom_obj.quantityRequired=bom_obj.quantityRequired*value
bom_obj.shortage=bom_obj.quantityRequired-bom_obj.qoh
I need to see the changes when bom is exploded


Systems developer

Laballieds,

Nairobi:gate 256, Nairobi.

P.O.Box - 45855 -00100, Nairobi.

Tel:+254 721449067

Email petypi@gmail.com

Mobile: +254 721449067

Website www.softlinkoptions.com