Skip to Content
Odoo Menu
  • Prisijungti
  • Išbandykite nemokamai
  • Programėlės
    Finansai
    • Apskaita
    • Pateikimas apmokėjimui
    • Sąnaudos
    • Skaičiuoklė (BI)
    • Dokumentai
    • Pasirašymas
    Pardavimai
    • CRM
    • Pardavimai
    • Kasų sistema - Parduotuvė
    • Kasų sistema - Restoranas
    • Prenumeratos
    • Nuoma
    Svetainės
    • Svetainių kūrėjimo įrankis
    • El. Prekyba
    • Internetinis Tinklaraštis
    • Forumas
    • Tiesioginis pokalbis
    • eMokymasis
    Tiekimo grandinė
    • Atsarga
    • Gamyba
    • PLM
    • Įsigijimai
    • Priežiūra
    • Kokybė
    Žmogaus ištekliai
    • Darbuotojai
    • Įdarbinimas
    • Atostogos
    • Įvertinimai
    • Rekomendacijos
    • Transporto priemonės
    Rinkodara
    • Socialinė rinkodara
    • Rinkodara el. paštu
    • SMS rinkodara
    • Renginiai
    • Rinkodaros automatizavimas
    • Apklausos
    Paslaugos
    • Projektas
    • Darbo laiko žiniaraščiai
    • Priežiūros tarnyba
    • Pagalbos tarnyba
    • Planavimas
    • Rezervacijos
    Produktyvumas
    • Diskucija
    • Patvirtinimai
    • IoT
    • VoIP
    • Žinių biblioteka
    • WhatsApp
    Trečiųjų šalių programos Odoo Studija Odoo debesijos platforma
  • Pramonės šakos
    Mažmeninė prekyba
    • Knygynas
    • Drabužių parduotuvė
    • Baldų parduotuvė
    • Maisto prekių parduotuvė
    • Techninės įrangos parduotuvė
    • Žaislų parduotuvė
    Food & Hospitality
    • Barai ir pub'ai
    • Restoranas
    • Greitasis maistas
    • Guest House
    • Gėrimų platintojas
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architektūros įmonė
    • Konstrukcija
    • Estate Managament
    • Sodininkauti
    • Turto savininkų asociacija
    Consulting
    • Accounting Firm
    • Odoo Partneris
    • Marketing Agency
    • Teisinė firma
    • Talentų paieška
    • Auditai & sertifikavimas
    Gamyba
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Įmonių dovanos
    Sveikata & Fitnesas
    • Sporto klubas
    • Akinių parduotuvė
    • Fitneso Centras
    • Sveikatos praktikai
    • Vaistinė
    • Kirpėjas
    Trades
    • Handyman
    • IT įranga ir palaikymas
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Aplinkos agentūra
    • Reklaminių stendų nuoma
    • Fotografavimas
    • Dviračių nuoma
    • Programinės įrangos perpardavėjas
    Browse all Industries
  • Bendrija
    Mokykitės
    • Mokomosios medžiagos
    • Dokumentacija
    • Sertifikatai
    • Mokymai
    • Internetinis Tinklaraštis
    • Tinklalaidės
    Skatinkite švietinimą
    • Švietimo programa
    • Scale Up! Verslo žaidimas
    • Aplankykite Odoo
    Gaukite programinę įrangą
    • Atsisiųsti
    • Palyginkite versijas
    • Leidimai
    Bendradarbiauti
    • Github
    • Forumas
    • Renginiai
    • Vertimai
    • Tapkite partneriu
    • Services for Partners
    • Registruokite jūsų apskaitos įmonę
    Gaukite paslaugas
    • Susiraskite partnerį
    • Susirask buhalterį
    • Susitikti su konsultantu
    • Diegimo paslaugos
    • Klientų rekomendavimas
    • Palaikymas
    • Atnaujinimai
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Gaukite demo
  • Kainodara
  • Pagalba

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

  • CRM
  • e-Commerce
  • Apskaita
  • Atsarga
  • PoS
  • Projektas
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Žymos (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Žymos (View all)
odoo accounting v14 pos v15
About this forum
Pagalba

Modifying product.template from within a module

Prenumeruoti

Get notified when there's activity on this post

This question has been flagged
modulesinheritance
1 Atsakyti
10968 Rodiniai
Portretas
Sandy Pyke

Hi all,

I'm trying to modify product.template from within a module. Specifically I am looking to make the Internal Reference (default_code) field sortable. I've managed to build up a module that modifies an esiting form, but I can't seem to manage to get the changes to product.template to work.

My __init__.py looks like this:

 # -*- coding: utf-8 -*-
from . import addIntRef
My addIntRef.py looks like this:

 
# -*- coding: utf-8 -*- from openerp.osv import fields, osv class product_template2(osv.osv): _name = 'product.template' _inherit = 'product.template' _columns = { 'default_code': fields.related('product_variant_ids', 'default_code', type='char', string='Internal Reference'), } product_template2()
Note: I am only trying to change the field label in the example above. Ultimately I would like this to make this field sortable...

My __openerp__.py looks like this:

 
# -*- coding: utf-8 -*- { 'name': "Add Internal Reference", 'summary': """Add Internal Reference field to standard forms.""", 'description': """ Adds the default internal reference field to forms so it is visible. This is used for internal part numbers so access to this is important. """, 'author': "Peck Tech Consulting Ltd.", 'website': "http://www.pecktech.ca", 'category': 'Tool', 'version': '0.1', 'depends': ['product'], 'data': ['addIntRef.xml'], 'demo': [], }
And my addIntRef.xml looks like this:

 
<?xml version="1.0"?> <openerp> <data> <record id="product.product_template_tree_view2" model="ir.ui.view"> <field name="name">product.template.product.tree2</field> <field name="model">product.template</field> <field name="inherit_id" ref="product.product_template_tree_view"/> <field name="arch" type="xml"> <xpath expr="//field[@name='name']" position="before"> <field name="default_code"/> </xpath> </field> </record> </data> </openerp>
I loadup the module just fine, and the product.template.product.tree2 view is loaded in and replaces the default one as expected. When I look at the module definition under Settings > Modules > product.template however I see no change to this template.

I've tried marking this field as sortable from the web interface, it does not allow me to save those changes. Plus that would be non-upgrade freindly... I think I am close, but just need some help getting over this last hump.

Oh and if it makes a difference I have Odoo 8 running on a Ubuntu server and I am accessing it from my local Windows 10 box with Chrome browser. I just updated Odoo this AM so should be on latest and greatest...

Any help / hints here would be much appreciated! Thanks!!!

0
Portretas
Atmesti
Sandy Pyke
Autorius

Thanks for the feedback Groover. What I am trying to achieve here is to have the product.template.product.tree view sortable on Internal Reference (default_code) field that I've added. As it is now, I can click on the Name, Internal Category, Product Type and Status and have the records sorted on those. But the newly added field in the tree view is not sortable. I though it was to do with the product.template default_code value not being set to searchable, but looking at some of those other fields it looks like those are not either... So this leads me to believe that I need to change an attribute on that field that I've added to make that work. I still don't know why my product.template changes are not working, but that's secondary now... By the way I did try your suggestion but that did not work. Thinking it has more to do with my implementation though... Time for some more digging! If I look at the product.template (which is ithe source for this view, I find that those fields

Portretas
Simplify it!
Best Answer

Hello

Templates don't change, they are going to be called pn-the-fly and your xpath is going to work there.... So there is nothing that is going to change. About sortable, i'm not sure if I understood your question but that can be solved adding _order = "default_code" to the model definition.

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

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

Registracija
Related Posts Replies Rodiniai Veikla
Inherit without changing original module
modules inheritance
Portretas
Portretas
Portretas
5
spal. 20
8122
How to change inheritance order of models?
modules inheritance
Portretas
0
lapkr. 24
6165
Inheritance not working in code Solved
modules product inheritance
Portretas
Portretas
2
birž. 20
5660
how to inherit the timesheet view in my new modul.
modules inheritance odoo8.0
Portretas
1
birž. 16
4145
Inheritance of module odoo in order to change product design
modules product inheritance
Portretas
Portretas
1
birž. 15
1182
Bendrija
  • Mokomosios medžiagos
  • Dokumentacija
  • Forumas
Atvirasis kodas
  • Atsisiųsti
  • Github
  • Runbot
  • Vertimai
Paslaugos
  • Odoo.sh talpinimas
  • Palaikymas
  • Atnaujinti
  • Pritaikytas programavimo kūrimas
  • Švietimas
  • Susirask buhalterį
  • Susiraskite partnerį
  • Tapkite partneriu
Apie mus
  • Mūsų įmonė
  • Prekės ženklo turtas
  • Susisiekite su mumis
  • Darbo pasiūlymai
  • Renginiai
  • Tinklalaidės
  • Internetinis Tinklaraštis
  • Klientai
  • Teisinis • Privatumas
  • Saugumas
الْعَرَبيّة 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 yra atvirojo kodo verslo programų rinkinys, kuris apima visas įmonės poreikius: CRM, El. Prekybą, Apskaitą, Atsargų, Kasų sistemą, Projektų valdymą ir kt.

Unikali Odoo vertės pasiūla – būti tuo pačiu metu labai lengvai naudojama ir visiškai integruota sistema.

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