i want to delete all products and leave products which is reference to another model.
@api.multi
def unlink(self):
for prod in self:
super(ProductProduct, prod).unlink()
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
i want to delete all products and leave products which is reference to another model.
@api.multi
def unlink(self):
for prod in self:
super(ProductProduct, prod).unlink()
b
lets say your product have relation to model example.example which is named in your product model example_id then you need to check if the example_id is null or not by this:
@api.multi
def unlink(self):
for prod in self:
if not prod.example_id:
super(ProductProduct, self).unlink()
but as far as i know product.product model is important model.. which is the original product.product model has many relations to another model..
product_id is foreign key in (sales.order.line or purchase.order.line ) not the opposite
yes and?
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign upRelated Posts | Replies | Views | Activity | |
---|---|---|---|---|
|
1
Jun 20
|
3737 | ||
|
2
Mar 15
|
3383 | ||
|
1
Oct 22
|
1014 | ||
|
4
Oct 20
|
70267 | ||
|
6
Dec 19
|
16188 |