Pular para o conteúdo
Menu
Esta pergunta foi sinalizada
1 Responder
3189 Visualizações

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 

Avatar
Cancelar
Melhor resposta

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

   

Avatar
Cancelar
Publicações relacionadas Respostas Visualizações Atividade
2
set. 19
18431
1
jul. 17
4926
1
jan. 19
3906
1
out. 17
11472
2
mai. 17
9494