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
  • Priemyselné odvetvia
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Reštaurácia
    • Fast Food
    • Guest House
    • Beverage distributor
    • Hotel
    Reality
    • Real Estate Agency
    • Architecture Firm
    • Konštrukcia
    • Estate Managament
    • Gardening
    • Property Owner Association
    Poradenstvo
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Výroba
    • Textile
    • Metal
    • Furnitures
    • Jedlo
    • 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
    Iní
    • 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
  • Pomoc

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 display field form inherit class

Odoberať

Get notified when there's activity on this post

This question has been flagged
xmlinheritclass
1 Odpoveď
7362 Zobrazenia
Avatar
panmarcin

Hi,

i have this code

class sprzedaz(osv.osv):



    _name="sprzedaz"
    _defaults = {
                'data': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S') 
                }


    _columns= {
            'produkt_id': fields.many2one('produkt.rodzaj', 'Produkt', required=True),
            'ilosc': fields.integer('Ilość', size=12, required=True),
            'miejsce_id': fields.many2one('miejsce', 'Miejsce', required=True),
            'data': fields.datetime('Data', required=True),
            #'razem': fields.char('Razem', required=True),
           # 'razem': fields.function(suma, 'Razem', type="float"),
            #zrobic funkcje wyliczajaca sume zakupu
               }

    def suma(self, cr, uid, ids,args,name, context=None):

        razem = 0
        return razem


sprzedaz()

class sprzedaz_inh(osv.osv):

    _name = "sprzedaz.inh"
    _inherit="sprzedaz"

    def suma(self, cr, uid, ids,args,name, context=None):
        razem=super(sprzedaz,self).suma(cr,uid,ids,args,name,context)
        print ids
        for id in ids:
            r= self.browse(cr,uid,id)
            c= self.pool.get('sprzedaz').browse(cr,uid,id).produkt_id.cena
            print c.cena
            pom = r.ilosc * c
            razem+=pom
        return razem
    _columns= {
            #'razem': fields.char('Razem', required=True),
            'razem': fields.function(suma, 'Razem', type="float"),
            #zrobic funkcje wyliczajaca sume zakupu
               }



sprzedaz()

and xml

<record model="ir.actions.act_window" id="action_sprzedaz_form">
    <field name="res_model">sprzedaz</field>
</record>

<record model="ir.ui.view" id="sprzedaz_form">
<field name="name">sprzedaz</field>
<field name="model">sprzedaz</field>
<field name="type">tree</field>
<field name="arch" type="xml">
    <tree string="Sprzedaz">
        <field name="produkt_id"/>
        <field name="ilosc"/>
        <field name="miejsce_id"/>
        <field name="data"/>
        <field name="razem"/>

        </tree>
    </field>
</record>

<menuitem name="Sprzedaz" id="menu_action_sprzedaz_form" 
action="action_sprzedaz_form" 
parent="menu_action_oktoberfest"/>

How can i display field razem form class sprzedaz_inh?

I have this error:

View error

Can't find field 'razem' in the following view parts composing the view of object model 'sprzedaz':
 * sprzedaz

Either you wrongly customized this view, or some modules bringing those views are not compatible with your current data model

Anyone can help me?

0
Avatar
Zrušiť
Avatar
Simplify it!
Best Answer

Actually I don't understand why are you creating two classes when you only need one. Anyways it's because you are giving sprzedaz_inh a name. So you have to delete that name if you want to extend the other class. just leave the inherit.

That's because if you are giving a _name to the inherited class then you are creating another class with the same attributes, but it's another class.

Also the last line must be: sprzedaz_inh()

I hope this can help you.

0
Avatar
Zrušiť
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
What would be the route to import an enterprise module? Solved
enterprise inherit class
Avatar
Avatar
Avatar
3
okt 24
1913
Inherit external_layout_header error Solved
xml inherit odoo10.0
Avatar
2
nov 17
7543
Adding a field to project.view_task_kanban
development xml inherit kanban
Avatar
Avatar
2
okt 25
955
Display location as hyperlink in common popover
xml inherit template space
Avatar
0
mar 25
1611
Error line3 product_id hr_expense inherit
xml inherit hr_expense v15
Avatar
1
aug 23
1943
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