콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
3252 화면

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

   

아바타
취소
관련 게시물 답글 화면 활동
2
9월 19
18484
1
7월 17
4980
1
1월 19
4008
1
10월 17
11564
2
5월 17
9533