Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie

I added 'A' attribute to sale.order model. I want the server to suggest a particular value for field A (value is computed in a function) based on partner_id value But I want it to be editable and I want no change to occur to already existing records as a result I cant use compute and inverse. what should I do?

thanks in advance.

Awatar
Odrzuć
Autor Najlepsza odpowiedź

done it like this:

class SaleOrderInherit(models.Model):
_inherit = 'sale.order'

A = fields.Char(string="A", required=True)
@api.onchange('partner_id')
def _set_A(self):
for r in self:
if not r.partner_id:
r.A = ''
else:
            // my case

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
1
maj 24
2683
0
sty 24
169
1
sie 21
2267
1
wrz 24
1354
2
kwi 24
4112