Skip to Content
Odoo Meniu
  • Autentificare
  • Try it free
  • Aplicații
    Finanțe
    • Contabilitate
    • Facturare
    • Cheltuieli
    • Spreadsheet (BI)
    • Documente
    • Semn
    Vânzări
    • CRM
    • Vânzări
    • POS Shop
    • POS Restaurant
    • Abonamente
    • Închiriere
    Site-uri web
    • Constructor de site-uri
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Lanț Aprovizionare
    • Inventar
    • Producție
    • PLM
    • Achiziție
    • Maintenance
    • Calitate
    Resurse Umane
    • Angajați
    • Recrutare
    • Time Off
    • Evaluări
    • Referințe
    • Flotă
    Marketing
    • Social Marketing
    • Marketing prin email
    • SMS Marketing
    • Evenimente
    • Automatizare marketing
    • Sondaje
    Servicii
    • Proiect
    • Foi de pontaj
    • Servicii de teren
    • Centru de asistență
    • Planificare
    • Programări
    Productivitate
    • Discuss
    • Aprobări
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Aplicații Terțe Odoo Studio Platforma Odoo Cloud
  • Industrii
    Retail
    • Book Store
    • Magazin de îmbrăcăminte
    • Magazin de Mobilă
    • Magazin alimentar
    • Magazin de materiale de construcții
    • Magazin de jucării
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Distribuitor de băuturi
    • Hotel
    Proprietate imobiliara
    • Real Estate Agency
    • Firmă de Arhitectură
    • Construcție
    • Estate Managament
    • Grădinărit
    • Asociația Proprietarilor de Proprietăți
    Consultanta
    • Firma de Contabilitate
    • Partener Odoo
    • Agenție de marketing
    • Law firm
    • Atragere de talente
    • Audit & Certification
    Producție
    • Textil
    • Metal
    • Mobilier
    • Mâncare
    • Brewery
    • Cadouri corporate
    Health & Fitness
    • Club Sportiv
    • Magazin de ochelari
    • Centru de Fitness
    • Wellness Practitioners
    • Farmacie
    • Salon de coafură
    Trades
    • Handyman
    • IT Hardware and Support
    • Asigurare socială de stat
    • Cizmar
    • Servicii de curățenie
    • HVAC Services
    Altele
    • Organizație nonprofit
    • Agenție de Mediu
    • Închiriere panouri publicitare
    • Fotografie
    • Închiriere biciclete
    • Asigurare socială
    Browse all Industries
  • Comunitate
    Învăță
    • Tutorials
    • Documentație
    • Certificări
    • Instruire
    • Blog
    • Podcast
    Empower Education
    • Program Educațional
    • Scale Up! Business Game
    • Visit Odoo
    Obține Software-ul
    • Descărcare
    • Compară Edițiile
    • Lansări
    Colaborați
    • Github
    • Forum
    • Evenimente
    • Translations
    • Devino Partener
    • Services for Partners
    • Înregistrează-ți Firma de Contabilitate
    Obține Servicii
    • Găsește un Partener
    • Găsiți un contabil
    • Meet an advisor
    • Servicii de Implementare
    • Referințe ale clienților
    • Suport
    • Actualizări
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obține un demo
  • Prețuri
  • Ajutor

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Contabilitate
  • Inventar
  • PoS
  • Proiect
  • MRP
All apps
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Suport

How to add a field in product.product after made some changes in product template ?

Abonare

Primiți o notificare când există activitate la acestă postare

Această întrebare a fost marcată
v8fieldsinheritproduct.productproduct.template
1 Răspunde
12186 Vizualizări
Imagine profil
Anabela Damas

Hi, 

I am trying to understand the connection of product.template to the product.product. 

I read in some question that : 

If you add a field to product.template (template), then the field value will be shared to all variants (product.product) of that template.
If you add a field to product.product (variant), then the field value will be different in each variant of the same template (product.template)

This make sense to me, and I add some fields in template that I wanted the value to be the same in all variants (product.product): 

class product_template(osv.osv):

_inherit = 'product.template'

_columns = {

'date': fields.boolean('Date'),

'date_start': fields.date('Date Start),

'date_stop': fields.date('Date Stop),
}


<record id="product_template_form_view_inherit" model="ir.ui.view">

<field name="name">product.template.inherit.form</field>

<field name="model">product.template</field>

<field name="inherit_id" ref="product.product_template_form_view"/>

<field name="arch" type="xml">

<div name="options" position="after">

<div class="oe_left" name="options" groups="base.group_user">

<div>

<field name="date"/>

<label for="date"/>

</div>

</div>

</div>

<xpath expr="/form/sheet/notebook/page[@string='Information']" position='after'>

<page name="date" string="Dates" attrs="{'invisible': [ ('date','=',False)]}" >

<group>

<group>

<field name="date_start"/>

<field name="date_stop"/>

</group>

</group>

</page>

</xpath>

</field>

</record>

But now I'm trying to add a field that I want to be specific for each variant (product.product). And I want to put the field in the page  ("date") that I added before to product.template. 

I tried like this :

<record id="product_normal_form_view_inherit" model="ir.ui.view">
<field name="name">product.normal.inh.form</field>
<field name="model">product.product</field>
<field name="inherit_id" ref="product.product_normal_form_view"/>
<field name="arch" type="xml">
 <xpath expr="/form/sheet/notebook/page[@string='Dates']" position='inside'>
<field name="stock_discount"/>
</xpath>
</field>
</record>

ERROR: 

Error details:
Element '<xpath expr="/form/sheet/notebook/page[@string='Dates']">' cannot be located in parent view

Error context:
View `product.normal.inh.form`
[view_id: 1224, xml_id: n/a, model: product.product, parent_id: 477]" while parsing /opt/odoo/openerp/addon/change_product/product_view.xml:103,


Now I try this: 

<record id="product_normal_form_view_inherit" model="ir.ui.view">
   <field name="name">product.normal.inh.form</field>
            <field name="model">product.product</field>
            <field eval="57" name="priority"/>
            <field name="inherit_id" ref="product_template_form_view_inherit"/>
            <field name="arch" type="xml">
	        <xpath expr="/form/sheet/notebook/page[@string='Dates']" position='inside'>
		    <group>
			<field name="stock_discount"/>
		    </group>
		</xpath>
	    </field>
       </record>

And with this code I don't have any error but I also doesn't have the field in the view.... 

How can I put the new field of product.product in the new page of product.template? 

Thanks

0
Imagine profil
Abandonează
Imagine profil
Maurice Agée
Cel mai bun răspuns

Test without visibility condition

                page name="date" string="Dates" attrs="{'invisible': [ ('date','=',False)]}

0
Imagine profil
Abandonează
Anabela Damas
Autor

I tried that but the error is the same... I think is because I add the page to product.template and I'm trying to inherit the product.product.... I really don't know what view to inherit to add the new field to the new page ... I think the error is in this line :

Anabela Damas
Autor

field name="inherit_id" ref="product.product_normal_form_view"

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Înscrie-te
Related Posts Răspunsuri Vizualizări Activitate
isn't standard_price must be depend on the product.product?
fields product.product prices product.template
Imagine profil
Imagine profil
1
dec. 15
4708
[8] how to add field in a view from another?
views fields product.product purchase.order product.template
Imagine profil
Imagine profil
Imagine profil
3
iun. 17
5585
What is the way that product.product and product.template synchronize data? Rezolvat
product.product product.template
Imagine profil
Imagine profil
Imagine profil
2
aug. 23
6070
Making a variantproduct from existing product templates
product.product product.template
Imagine profil
0
oct. 21
2351
how to update field in product.product model Rezolvat
product.product product.template
Imagine profil
Imagine profil
1
sept. 19
6002
Comunitate
  • Tutorials
  • Documentație
  • Forum
Open Source
  • Descărcare
  • Github
  • Runbot
  • Translations
Servicii
  • Hosting Odoo.sh
  • Suport
  • Actualizare
  • Custom Developments
  • Educație
  • Găsiți un contabil
  • Găsește un Partener
  • Devino Partener
Despre Noi
  • Compania noastră
  • Active de marcă
  • Contactați-ne
  • Locuri de muncă
  • Evenimente
  • Podcast
  • Blog
  • Clienți
  • Aspecte juridice • Confidențialitate
  • Securitate
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo este o suită de aplicații de afaceri open source care acoperă toate nevoile companiei dvs.: CRM, comerț electronic, contabilitate, inventar, punct de vânzare, management de proiect etc.

Propunerea de valoare unică a Odoo este să fie în același timp foarte ușor de utilizat și complet integrat.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now