Ir al contenido
Menú
Se marcó esta pregunta
2 Respuestas
19822 Vistas

Hi!

product.product vs product.template

I have already search quite a lot about this subject and studied the source code, but still cant wrap my head around it.

Example from the POS source code:
class ProductTemplate(models.Model):
_inherit = 'product.template'

available_in_pos = fields.Boolean(string='Available in Point of Sale', help='Check if you want this product to appear in the Point of Sale', default=True)
to_weight = fields.Boolean(string='To Weigh With Scale', help="Check if the product should be weighted using the hardware scale integration")
pos_categ_id = fields.Many2one(
'pos.category', string='Point of Sale Category',
help="Those categories are used to group similar products for point of sale.")

Ok, so POS inherits from product.template, but still in the data files (point_of_sale_demo.xml) it uses product.product like so:

<record id="boni_orange" model="product.product">
<field name="available_in_pos">True</field>
<field name="list_price">1.98</field>
<field name="name">Boni Oranges</field>
<field name="to_weight">True</field>
<field name="barcode">2100002000003</field>
<field name="taxes_id">False</field>
<field name="pos_categ_id" ref="fruits_vegetables"/>
<field name="uom_id" ref="product.product_uom_kgm" />
<field name="uom_po_id" ref="product.product_uom_kgm" />
<field name="image" type="base64" file="point_of_sale/static/img/boni_orange-image.jpg"/>
</record>

What is the difference?

Whats really going on here?

Which of the models should I use?

This is very confusing and I can't find a good explanation anywhere, someone care to try?

Thanks! :)


PS. I know there are answers out there trying to expain this, but I still don't get it. Example:

https://www.odoo.com/forum/help-1/question/product-template-vs-product-product-94430



Avatar
Descartar
Mejor respuesta
  • product.template(Products Menu): Actually it is not a product it is Product template whenever you are creating Product (product.template) than same will be created in also (product.product) it contains the main product and with list of product variant (attributes)

  • product.product (Product Variants): Here there are actual products with their variants as a separate products.Whenever you are creating SO or PO than actually you are using Product variants not Products.


Avatar
Descartar

Thank you for being so kind 🙏, I posted what I felt was a need.

Mejor respuesta

Hello 

you can get more idea from below link. https://www.odoo.com/documentation/user/9.0/inventory/settings/products/variants.html

let me give you one example.

you have one product name is " Iphone6 " so this product.template. but the Iphone6 is available in different different  attribute like color, memory. and attribute value like color: red, black,   memory like 16gb, 32gb. 

so the Iphone6 product is like

   1. Iphone6 - 16gb, red

   2. Iphone6 - 16gb, black

   3. Iphone6 - 32gb, red

   4. Iphone6 - 32gb, black.

this above 4 Iphone6 is the variants and store into the product.product.

so the Iphone6 product store is exist into the product.template but the above variants store into the product.product.

Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
1
feb 25
1305
0
may 23
448
1
ago 21
4661
2
dic 19
3925
2
ago 23
4129