Hi,
Is it possible to create a record in a model B while creating a record in model A depending on some conditions.
if so, can any one help with the way to do it :)
Thank you.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
Hi,
Is it possible to create a record in a model B while creating a record in model A depending on some conditions.
if so, can any one help with the way to do it :)
Thank you.
Hi,
You can override the create method of the model A and then calling create function of the model B you can create the record.
Sample:
class Model_A(models.Model):
_inherit = 'model.a'
@api.model
def create(self, values):
res = super(Model_A, self).create(values)
vals = {
'field_1': 'test',
'field_2': 'test'
}
self.env['model_b'].create(vals)
return res
Thanks
Thank you very much
Stwórz konto dzisiaj, aby cieszyć się ekskluzywnymi funkcjami i wchodzić w interakcje z naszą wspaniałą społecznością!
Zarejestruj sięPowiązane posty | Odpowiedzi | Widoki | Czynność | |
---|---|---|---|---|
override create/write method on odoo 12
Rozwiązane
|
|
5
cze 20
|
31591 | |
How to Override the Based Method in Odoo?
Rozwiązane
|
|
1
gru 19
|
4136 | |
Odoo Mail Sending Limit
Rozwiązane
|
|
2
gru 23
|
14645 | |
|
0
paź 23
|
33 | ||
|
3
paź 23
|
788 |
How to override Odoo functions: https://goo.gl/4BkizH