Skip to Content
Odoo Menu
  • Zaloguj się
  • Wypróbuj za darmo
  • Aplikacje
    Finanse
    • Księgowość
    • Fakturowanie
    • Wydatki
    • Arkusz kalkulacyjny (BI)
    • Dokumenty
    • Podpisy
    Sprzedaż
    • CRM
    • Sprzedaż
    • PoS Sklep
    • PoS Restauracja
    • Subskrypcje
    • Wypożyczalnia
    Strony Internetowe
    • Kreator Stron Internetowych
    • eCommerce
    • Blog
    • Forum
    • Czat na Żywo
    • eLearning
    Łańcuch dostaw
    • Magazyn
    • Produkcja
    • PLM
    • Zakupy
    • Konserwacja
    • Jakość
    Zasoby Ludzkie
    • Pracownicy
    • Rekrutacja
    • Urlopy
    • Ocena pracy
    • Polecenia Pracownicze
    • Flota
    Marketing
    • Marketing Społecznościowy
    • E-mail Marketing
    • SMS Marketing
    • Wydarzenia
    • Automatyzacja Marketingu
    • Ankiety
    Usługi
    • Projekt
    • Ewidencja czasu pracy
    • Usługi Terenowe
    • Helpdesk
    • Planowanie
    • Spotkania
    Produktywność
    • Dyskusje
    • Zatwierdzenia
    • IoT
    • VoIP
    • Baza wiedzy
    • WhatsApp
    Aplikacje trzecich stron Studio Odoo Odoo Cloud Platform
  • Branże
    Sprzedaż detaliczna
    • Księgarnia
    • Sklep odzieżowy
    • Sklep meblowy
    • Sklep spożywczy
    • Sklep z narzędziami
    • Sklep z zabawkami
    Żywienie i hotelarstwo
    • Bar i Pub
    • Restauracja
    • Fast Food
    • Pensjonat
    • Dystrybutor napojów
    • Hotel
    Agencja nieruchomości
    • Agencja nieruchomości
    • Biuro architektoniczne
    • Budowa
    • Zarządzanie nieruchomościami
    • Ogrodnictwo
    • Stowarzyszenie właścicieli nieruchomości
    Doradztwo
    • Biuro księgowe
    • Partner Odoo
    • Agencja marketingowa
    • Kancelaria prawna
    • Agencja rekrutacyjna
    • Audyt i certyfikacja
    Produkcja
    • Tekstylia
    • Metal
    • Meble
    • Jedzenie
    • Browar
    • Prezenty firmowe
    Zdrowie & Fitness
    • Klub sportowy
    • Salon optyczny
    • Centrum fitness
    • Praktycy Wellness
    • Apteka
    • Salon fryzjerski
    Transakcje
    • Złota rączka
    • Wsparcie Sprzętu IT
    • Systemy energii słonecznej
    • Szewc
    • Firma sprzątająca
    • Usługi HVAC
    Inne
    • Organizacja non-profit
    • Agencja Środowiskowa
    • Wynajem billboardów
    • Fotografia
    • Leasing rowerów
    • Sprzedawca oprogramowania
    Przeglądaj wszystkie branże
  • Community
    Ucz się
    • Samouczki
    • Dokumentacja
    • Certyfikacje
    • Szkolenie
    • Blog
    • Podcast
    Pomóż w nauce innym
    • Program Edukacyjny
    • Scale Up! Gra biznesowa
    • Odwiedź Odoo
    Skorzystaj z oprogramowania
    • Pobierz
    • Porównaj edycje
    • Wydania
    Współpracuj
    • Github
    • Forum
    • Wydarzenia
    • Tłumaczenia
    • Zostań partnerem
    • Usługi dla partnerów
    • Zarejestruj swoją firmę rachunkową
    Skorzystaj z usług
    • Znajdź partnera
    • Znajdź księgowego
    • Spotkaj się z doradcą
    • Usługi wdrożenia
    • Opinie klientów
    • Wsparcie
    • Aktualizacje
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Zaplanuj demo
  • Cennik
  • Pomoc

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

  • CRM
  • e-Commerce
  • Księgowość
  • Zapasy
  • PoS
  • Projekt
  • MRP
All apps
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Pomoc

Modifying product.template from within a module

Zaprenumeruj

Otrzymaj powiadomienie o aktywności w tym poście

To pytanie dostało ostrzeżenie
modulesinheritance
1 Odpowiedz
10984 Widoki
Awatar
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
Awatar
Odrzuć
Sandy Pyke
Autor

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

Awatar
Simplify it!
Najlepsza odpowiedź

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
Awatar
Odrzuć
Podoba Ci się ta dyskusja? Dołącz do niej!

Stwórz konto dzisiaj, aby cieszyć się ekskluzywnymi funkcjami i wchodzić w interakcje z naszą wspaniałą społecznością!

Zarejestruj się
Powiązane posty Odpowiedzi Widoki Czynność
Inherit without changing original module
modules inheritance
Awatar
Awatar
Awatar
5
paź 20
8132
How to change inheritance order of models?
modules inheritance
Awatar
0
lis 24
6171
Inheritance not working in code Rozwiązane
modules product inheritance
Awatar
Awatar
2
cze 20
5670
how to inherit the timesheet view in my new modul.
modules inheritance odoo8.0
Awatar
1
cze 16
4149
Inheritance of module odoo in order to change product design
modules product inheritance
Awatar
Awatar
1
cze 15
1182
Społeczność
  • Samouczki
  • Dokumentacja
  • Forum
Open Source
  • Pobierz
  • Github
  • Runbot
  • Tłumaczenia
Usługi
  • Hosting Odoo.sh
  • Wsparcie
  • Aktualizacja
  • Indywidualne rozwiązania
  • Edukacja
  • Znajdź księgowego
  • Znajdź partnera
  • Zostań partnerem
O nas
  • Nasza firma
  • Zasoby marki
  • Skontaktuj się z nami
  • Oferty pracy
  • Wydarzenia
  • Podcast
  • Blog
  • Klienci
  • Informacje prawne • Prywatność
  • Bezpieczeństwo Odoo
الْعَرَبيّة 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 to pakiet aplikacji biznesowych typu open source, które zaspokoją wszystkie potrzeby Twojej firmy: CRM, eCommerce, księgowość, inwentaryzacja, punkt sprzedaży, zarządzanie projektami itp.

Unikalną wartością Odoo jest to, że jest jednocześnie bardzo łatwe w użyciu i w pełni zintegrowane.

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