Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
7 Odpowiedzi
6760 Widoki

Hello Community,

I have created one product(test) with two variants(color:white,black) and added internal reference to test in product.template.

I added internal reference for all two variants. But the problem is it hides internal reference field and also remove its value from product.template(test).

I want to manage internal reference for all(test,test:white,test:black). How can I achieve this? I tried to inherit _compute_default_code and search_read() but it doesn't work out.

Any idea how to achieve this?

Thanks in advance.

Awatar
Odrzuć

What is the purpose of the INTERNAL REFERENCE for the Template? Once you have Variants, the idea is that the product.template is no longer a product - it is just the place where all the common information for each variant is stored. You can't buy, sell or store a TEST, you can just buy, sell and store a TEST:WHITE and a TEST:BLACK.

Autor

In my case i need "Internal Reference" for both Template product(Test) and Variant product (Test : black).

How have you added the internal reference? If you extend product.template, that field should also exist in product.product (as product.product inherits from product.template). And in theory the field should not disappear.

Otherwise, I would suggest to work around the issue by accessing the product.template via product.product_tmpl_id. Or do you need to change the internal reference?

Najlepsza odpowiedź

Odoo 10 Community or Enterprise?

Awatar
Odrzuć
Najlepsza odpowiedź

The variants are saved in product.product not product.template, which is essentially a template (thus the name) from which variants are created. These are then saved as product.product. So, if you want to find your internal reference, search in product.product.

Awatar
Odrzuć
Autor

But i want internal reference for both product(product.template) and also for variants(product.product) too.

Do you have idea how to achieve this?

The only thing I can think of is to use the field product_tmpl_id of product.product to get the product.template it was created from. That way, you can obtain the product.template belonging to your product.product with the internal reference.

Nevertheless, could you clarify what the internal reference is for? To me it sounds like you might be trying to use product.template for something it is not intended for (which might hurt you in the long run).

Powiązane posty Odpowiedzi Widoki Czynność
1
paź 23
1815
0
kwi 20
2358
3
sty 19
2940
1
gru 17
2707
0
maj 17
2491