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?
Esta pergunta foi sinalizada
1
Responder
2890
Visualizações
For anyone in the same situation.
if self._origin:
self._origin.write(vals).
Está gostando da discussão? Não fique apenas lendo, participe!
Crie uma conta hoje mesmo para aproveitar os recursos exclusivos e interagir com nossa incrível comunidade!
Inscrever-se| Publicações relacionadas | Respostas | Visualizações | Atividade | |
|---|---|---|---|---|
|
|
0
dez. 24
|
3045 | ||
|
|
1
mai. 24
|
4830 | ||
|
|
1
jan. 24
|
2994 | ||
|
How can I get ID of New record?
Resolvido
|
|
2
dez. 24
|
17453 | |
|
|
0
fev. 19
|
3928 |