Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
1 Ответить
3127 Представления

Hi guys

I just created a new model picking.process in a custom module.
Something strange happens. If someone can help me it would be great.

When i do this : 

class PickingProcess(models.Model):
    _inherit = "mail.thread"
    _name = 'picking.process'

    input_action = fields.Char("Action" ,store=True)

    @api.onchange("input_action")
    def on_change_input_action(self):
      _logger.error("ooooooooooooooooooooo")
        if self.input_action != self.input_action2 :
            self.pick = 4909
            _logger.error(self.pick)
            for pack in self.pick.pack_operation_ids:
      pack.qty_done = 1

the qty_done is not save BUT if i do pack.write({"qty_done":1}) it works. 

If i do that on a _compute with a for record in self: .....

it s the same thing so i imagine it s not the on_change the mistake. 


Could you explain me why? and what can i do for correct this bug it works perfectly in others model i made  :( 


Thanks a lot 

Аватар
Отменить
Лучший ответ

Hi Thomas,

from your code it seems 'input_action' is a compute field and will get changed based on its compute function.


Try to create 'qty_done' as a compute field.


@api.depends(input_action, input_action2)

def _compute_qty_done(self):

logic here..



Hope this will work

Regards,




Email:     odoo@aktivsoftware.com  

Skype: kalpeshmaheshwari

   

Аватар
Отменить
Related Posts Ответы Просмотры Активность
2
сент. 19
18381
1
июл. 17
4884
1
янв. 19
3878
1
окт. 17
11418
2
мая 17
9432