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()
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?
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ść | |
|---|---|---|---|---|
|
1
cze 20
|
6850 | |||
|
2
mar 15
|
5523 | |||
|
Patch unlink() 'states check' on Sale Order
Rozwiązane
|
1
paź 22
|
3623 | ||
|
4
paź 20
|
75766 | |||
|
How to unlink record from Ony2Many relation?
Rozwiązane
|
6
gru 19
|
20806 |
1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.