This question has been flagged

Hello everyone, i am trying to sync my Odoo application with a external ecommerce. When I import products by CSV, I need to then upload the products to this ecommerce. For this, was trying to overwrite the create and write methods Odoo provudes, to perform the syncing inside these methods. 

However, when I run the Test Import, the create method is called anyways and so is my external upload method. Is there a way I can differ when the methods are being called by a test or an actual import?

Avatar
Discard
Best Answer

Hello Arthur,

while syncing add any identification on context   

ex : super(yourmodel,self.with_context(sync=True)).create(vals)

so context.get('sync',False)   it will give true while sync and false while normal import

Avatar
Discard