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

I have something like this in a wizard:

class SaleOrderLine():
    _inherit = 'sale.order.line'
    boolean_field = fields.Boolean(compute='_compute_boolean_field', store=True)

    @api.depends('product_id', 'qty')
    def _compute_boolean_field(self):
        self.flush_recordset()
        # execute query that uses the each recordset's product_id qty
        # loop and update boolean_field

My issue is when I'm updating sale.order.line from the parent(sale.order) in the UI, the query does not work with my recent change to product_id and so the boolean_field computation is wrong despite flush_recordset()(and all other forms of flushes even self.env.cr.commit()). 

How do I force the UI changes on sale.order.line to the database before the user saves the record so the query works as expected? 

아바타
취소
작성자 베스트 답변

For anyone in the same situation. 
if self._origin:
​self._origin.write(vals).

아바타
취소
관련 게시물 답글 화면 활동
0
12월 24
1204
1
5월 24
2602
1
1월 24
1658
2
12월 24
14936
0
2월 19
2372