Skip to Content
Odoo Menu
  • Prihlásiť sa
  • Vyskúšajte zadarmo
  • Aplikácie
    Financie
    • Účtovníctvo
    • Fakturácia
    • Výdavky
    • Tabuľka (BI)
    • Dokumenty
    • Podpis
    Predaj
    • CRM
    • Predaj
    • POS Shop
    • POS Restaurant
    • Manažment odberu
    • Požičovňa
    Webstránky
    • Tvorca webstránok
    • eShop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Supply Chain
    • Sklad
    • Výroba
    • Správa životného cyklu produktu
    • Nákup
    • Údržba
    • Manažment kvality
    Ľudské zdroje
    • Zamestnanci
    • Nábor zamestnancov
    • Voľné dni
    • Hodnotenia
    • Odporúčania
    • Vozový park
    Marketing
    • Marketing sociálnych sietí
    • Email marketing
    • SMS marketing
    • Eventy
    • Marketingová automatizácia
    • Prieskumy
    Služby
    • Projektové riadenie
    • Pracovné výkazy
    • Práca v teréne
    • Helpdesk
    • Plánovanie
    • Schôdzky
    Produktivita
    • Tímová komunikácia
    • Schvalovania
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Managament
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Výroba
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware and Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Komunita
    Vzdelávanie
    • Tutoriály
    • Dokumentácia
    • Certifikácie
    • Školenie
    • Blog
    • Podcast
    Empower Education
    • Vzdelávací program
    • Scale Up! Business Game
    • Visit Odoo
    Softvér
    • Stiahnuť
    • Porovnanie Community a Enterprise vierzie
    • Releases
    Spolupráca
    • Github
    • Fórum
    • Eventy
    • Preklady
    • Staň sa partnerom
    • Services for Partners
    • Register your Accounting Firm
    Služby
    • Nájdite partnera
    • Nájdite účtovníka
    • Meet an advisor
    • Implementation Services
    • Zákaznícke referencie
    • Podpora
    • Upgrades
    ​Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Získajte demo
  • Cenník
  • Help

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

  • CRM
  • e-Commerce
  • Účtovníctvo
  • Sklady
  • PoS
  • Projektové riadenie
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
Pomoc

How to add field into product.template model form view's Purchase tab line?

Odoberať

Get notified when there's activity on this post

This question has been flagged
salesinheritanceodooV8
2 Replies
2197 Zobrazenia
Avatar
Arjun Baidya

I added this 

class SupplierInherit(models.Model):
_inherit = 'product.supplierinfo'

vendor_stockinfo = fields.Integer(string="Vendor Stock")
<record id="inherit_supplierinfo_tree_view_vendor_stockinfo" model="ir.ui.view">
<field name="name">Add vendor_stockinfo to product.product_supplierinfo_tree_view</field>
<field name="model">product.supplierinfo</field>
<field name="inherit_id" ref="product.product_supplierinfo_tree_view"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='product_code']" position="after">
<field name="vendor_stockinfo"/>
</xpath>
</field>
</record>
<record id="product_template_form_view_inherit_override_seller_ids" model="ir.ui.view">
    <field name="name">Override seller_ids with custom tree</field>
    <field name="model">product.template</field>
    <field name="inherit_id" ref="product.product_template_form_view"/>
    <field name="arch" type="xml">
        <xpath expr="//field[@name='seller_ids']" position="replace">
            <field name="seller_ids"
                   context="{'default_product_tmpl_id': id, 'list_view_ref': 'your_module.custom_supplierinfo_tree_view_with_vendor_stock'}"
                   nolabel="1"
                   invisible="product_variant_count &gt; 1"
                   readonly="product_variant_count &gt; 1"
            />
        </xpath>
    </field>
</record>


but field is not showing
0
Avatar
Zrušiť
Christoph Farnleitner

Source looks fine. What are your manifest and init files and what is your folder structure looking?

Avatar
Cybrosys Techno Solutions Pvt.Ltd
Best Answer

Hi,

Please refer to the code below:

Python

class SupplierInherit(models.Model):
_inherit = 'product.supplierinfo'

vendor_stockinfo = fields.Integer(string="Vendor Stock")

XML


<record id="product_supplierinfo_subcontractor_tree_view" model="ir.ui.view">
<field name="name">product.supplierinfo.subcontractor.list.view</field>
<field name="model">product.supplierinfo</field>
<field name="inherit_id" ref="product.product_supplierinfo_tree_view"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='product_code']" position="after">
<field name="vendor_stockinfo"/>
</xpath>
</field>
</record>

Result:




Hope it helps.

1
Avatar
Zrušiť
Arjun Baidya
Autor

It doesn't work for me.

Avatar
D Enterprise
Best Answer

Hii,

Define the vendor_stockinfo Field in product.supplierinfo

First, you correctly define the vendor_stockinfo field in the product.supplierinfo model.

class SupplierInherit(models.Model): _inherit = 'product.supplierinfo' vendor_stockinfo = fields.Integer(string="Vendor Stock")

Modify the product.supplierinfo Tree View to Display vendor_stockinfo

Now, you need to modify the tree view for the product.supplierinfo model to display the vendor_stockinfo field. You can inherit and update the view like this:

<record id="inherit_supplierinfo_tree_view_vendor_stockinfo" model="ir.ui.view"> <field name="name">Add vendor_stockinfo to product_supplierinfo_tree_view</field> <field name="model">product.supplierinfo</field> <field name="inherit_id" ref="product.product_supplierinfo_tree_view"/> <field name="arch" type="xml"> <xpath expr="//field[@name='product_code']" position="after"> <field name="vendor_stockinfo"/> </xpath> </field> </record>

Override the product.template Form View to Display the Custom Tree View

The seller_ids field in the product.template form view needs to be replaced with a custom tree view that includes the vendor_stockinfo field.

Here’s how to do it:

<record id="product_template_form_view_inherit_override_seller_ids" model="ir.ui.view"> <field name="name">Override seller_ids with custom tree</field> <field name="model">product.template</field> <field name="inherit_id" ref="product.product_template_form_view"/> <field name="arch" type="xml"> <xpath expr="//field[@name='seller_ids']" position="replace"> <field name="seller_ids" context="{'default_product_tmpl_id': id, 'list_view_ref': 'your_module.custom_supplierinfo_tree_view_with_vendor_stock'}" nolabel="1" invisible="product_variant_count &gt; 1" readonly="product_variant_count &gt; 1" /> </xpath> </field> </record>

Define the Custom Tree View for product.supplierinfo

You need to create a custom tree view that includes the vendor_stockinfo field. Here’s how to define the tree view:

<record id="custom_supplierinfo_tree_view_with_vendor_stock" model="ir.ui.view"> <field name="name">product.supplierinfo.tree.with.vendor.stock</field> <field name="model">product.supplierinfo</field> <field name="arch" type="xml"> <tree> <field name="product_code"/> <field name="vendor_stockinfo"/> <!-- Your custom field here --> <field name="price"/> <field name="min_qty"/> <!-- Add other necessary fields here --> </tree> </field> </record>

Ensure Your Module is Loaded Correctly

Make sure your module's manifest file references the correct XML files, and then update your module.

__manifest__.py:


{ 'name': 'Plantillas Personalizadas', 'version': '1.0', 'summary': 'Plantillas Servicio Externo', 'description': 'Aplicación que guarda las plantillas para la aplicación servicio externo', 'depends': ['product'], 'data': [ 'views/worksheet_template_views.xml', # Your custom view file 'views/product_template_form_view_inherit.xml', # Form view inheritance ], 'license': 'LGPL-3', }

i hope it is use full

-1
Avatar
Zrušiť
Arjun Baidya
Autor

not worked

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

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

Registrácia
Related Posts Replies Zobrazenia Aktivita
Blocked with Odoo. Invalid Account Receivable/Payable. What's wrong?
sales odooV8
Avatar
Avatar
3
sep 15
7001
How to pass data from a class to another Solved
inheritance odooV8
Avatar
Avatar
Avatar
Avatar
Avatar
8
aug 15
17405
Odoo 8 view inheritance problem
inheritance odooV8
Avatar
Avatar
1
mar 15
3830
odoo16 sale
sales inheritance sale.order.line
Avatar
Avatar
1
mar 23
2492
How to add sales commission
sales odooV8 commissions
Avatar
Avatar
Avatar
Avatar
3
apr 17
6066
Komunita
  • Tutoriály
  • Dokumentácia
  • Fórum
Open Source
  • Stiahnuť
  • Github
  • Runbot
  • Preklady
Služby
  • Odoo.sh hosting
  • Podpora
  • Vyššia verzia
  • Custom Developments
  • Vzdelávanie
  • Nájdite účtovníka
  • Nájdite partnera
  • Staň sa partnerom
O nás
  • Naša spoločnosť
  • Majetok značky
  • Kontaktujte nás
  • Pracovné ponuky
  • Eventy
  • Podcast
  • Blog
  • Zákazníci
  • Právne dokumenty • Súkromie
  • Bezpečnosť
الْعَرَبيّة 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 je sada podnikových aplikácií s otvoreným zdrojovým kódom, ktoré pokrývajú všetky potreby vašej spoločnosti: CRM, e-shop, účtovníctvo, skladové hospodárstvo, miesto predaja, projektový manažment atď.

Odoo prináša vysokú pridanú hodnotu v jednoduchom použití a súčasne plne integrovanými biznis aplikáciami.

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