Odoo Help

0

0
4 Answers
0
Mayank Gosai
11‏/1‏/2018 11:51 ص

Hello,

Try this:

@api.multi

def button_plan(self):

quantity = 0

res = super(MrpProduction, self).button_plan()

for production in self:

    for workorder in production.workorder_ids:     

         for operation in self.routing_id.operation_ids:

            if operation.compute_equals_order_qty == True:

                quantity = self.product_qty

            if operation.compute_equals_always_one == True:

                    quantity = 1.0

            if operation.compute_equals_workcenter == True:

                    quantity = operation.workcenter_quantity   

            workorder.qty_workorder = quantity

     return res


In your case , you applied 'workorder.qty_workorder = quantity' outside loop.
Make that happen inside loop.

Thanks,

Mayank Gosai

1 Comment
delgertsetseg
11‏/1‏/2018 8:07 م

I fix this error,

workorder.write({'qty_workorder': quantity}) Thanks

0
delgertsetseg
11‏/1‏/2018 5:14 ص

 @api.multi

def button_plan(self):

quantity = 0

res = super(MrpProduction, self).button_plan()

for production in self:

    for workorder in production.workorder_ids:     

         for operation in self.routing_id.operation_ids:

            if operation.compute_equals_order_qty == True:

                quantity = self.product_qty

            if operation.compute_equals_always_one == True:

                    quantity = 1.0

            if operation.compute_equals_workcenter == True:

                    quantity = operation.workcenter_quantity   

         workorder.qty_workorder = quantity

     return res

------------------------------------------------------Output ---------------------------------------

quantity 1.0

quantity 35.0

quantity 56.0

workorder.qty_workorder :::: 56.0

quantity 1.0

quantity 35.0

quantity 56.0

workorder.qty_workorder :::: 56.0

quantity 1.0

quantity 35.0

quantity 56.0

workorder.qty_workorder :::: 56.0

---------------------------------------Righ Output --------------------------------

workorder.qty_workorder =1

workorder.qty_workorder=35

workorder.qty_workorder=56 

Sorry, now understand?




Ask a Question
Keep Informed
1 follower(s)
About This Community

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.

Register
Odoo Training Center

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

Test it now