Odoo Help

0

0
2 Answers
0
Avatar

Ray Carnes

--Ray Carnes--
2747
| 5 2 8
Beaumont, Stati Uniti d'America
--Ray Carnes--

Business Analyst - Custom Projects

https://www.linkedin.com/in/raycarnes

Ray Carnes
06/04/19, 14:33

Create an Automated Action?




1 Comment
Reinhart
08/04/19, 03:36

Thanks for the reply, but i already solved it, my problem was i had to overwrite unlink in product.template also

0
Avatar

Niyas Raphy

--Niyas Raphy--
24541
| 7 7 11
Wayanad, India
--Niyas Raphy--

Odoo Techno Functionalist

Feel free to connect :  niyasraphyk@gmail.com

Twitter:https://twitter.com/niyasraphy
LinkedIn: https://www.linkedin.com/in/niyasraphy/
FB:https://www.facebook.com/niyasraphy123

Happy to help :)

Niyas Raphy
05/04/19, 11:31

Hi,

In the database there might not be a product with the given external id, mymodule.myproductid , So update your code like this,

@api.multi
def unlink(self):
product_id = False
product = self.env.ref('mymodule.myproductid')
if product:
product_id = product.id
if product_id:
for rec in self:
if rec.id == product_id:
raise UserError('You shall not unlink!!')
return super(ProductProduct, self).unlink()

Thanks

1 Comment
Reinhart
08/04/19, 03:34

No, that ID should exists, if not the product is already been deleted

Ask a Question
Writer
Tags
Keep Informed
1 follower(s)
About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register
Odoo Training Center

Access to our eLearning platform and experience all Odoo Apps through learning videos, use cases and quizzes.

Test it now