Skip to Content
Menu
This question has been flagged
2 Replies
2866 Views

Hi all odoo developer, I would like to ask that : 
- 1-/ First I have two module my module and sale module 

- 2-/ When I create data in my module , I want to auto create data in sale module too

How many ways I can do this task ? Plz guide me 

Avatar
Discard

You just need to override Odoo's Create Function: https://goo.gl/4BkizH

Best Answer

   On your Module you inherit create function as the following:

   and before applying the event (create event) you call your custom method which you used to create in the other module

   @api.model

def create(self, vals):
self.create_otherModule_data()
res = super(Guest, self).create(vals)
return res

def create_otherModule_data(self):
line_dic = {
'name': name,
'complete_name': self.complete_name,
'code': code,
'active': True,
}
self.env['module.modelname'].create(line_dic)


I Hope this answer help you
Avatar
Discard
Author Best Answer
Ahmed Salah, Thank you so much. 
Avatar
Discard

you are welcome