Passa al contenuto
Odoo Menu
  • Accedi
  • Provalo gratis
  • App
    Finanze
    • Contabilità
    • Fatturazione
    • Note spese
    • Fogli di calcolo (BI)
    • Documenti
    • Firma
    Vendite
    • CRM
    • Vendite
    • Punto vendita Negozio
    • Punto vendita Ristorante
    • Abbonamenti
    • Noleggi
    Siti web
    • Configuratore sito web
    • E-commerce
    • Blog
    • Forum
    • Live chat
    • E-learning
    Supply chain
    • Magazzino
    • Produzione
    • PLM
    • Acquisti
    • Manutenzione
    • Qualità
    Risorse umane
    • Dipendenti
    • Assunzioni
    • Ferie
    • Valutazioni
    • Referral dipendenti
    • Parco veicoli
    Marketing
    • Social marketing
    • E-mail marketing
    • SMS marketing
    • Eventi
    • Marketing automation
    • Sondaggi
    Servizi
    • Progetti
    • Fogli ore
    • Assistenza sul campo
    • Helpdesk
    • Pianificazione
    • Appuntamenti
    Produttività
    • Comunicazioni
    • Approvazioni
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    App di terze parti Odoo Studio Piattaforma cloud Odoo
  • Settori
    Retail
    • Libreria
    • Negozio di abbigliamento
    • Negozio di arredamento
    • Alimentari
    • Ferramenta
    • Negozio di giocattoli
    Cibo e ospitalità
    • Bar e pub
    • Ristorante
    • Fast food
    • Pensione
    • Grossista di bevande
    • Hotel
    Agenzia immobiliare
    • Agenzia immobiliare
    • Studio di architettura
    • Edilizia
    • Gestione immobiliare
    • Impresa di giardinaggio
    • Associazione di proprietari immobiliari
    Consulenza
    • Società di contabilità
    • Partner Odoo
    • Agenzia di marketing
    • Studio legale
    • Selezione del personale
    • Audit e certificazione
    Produzione
    • Tessile
    • Metallo
    • Arredamenti
    • Alimentare
    • Birrificio
    • Ditta di regalistica aziendale
    Benessere e sport
    • Club sportivo
    • Negozio di ottica
    • Centro fitness
    • Centro benessere
    • Farmacia
    • Parrucchiere
    Commercio
    • Tuttofare
    • Hardware e assistenza IT
    • Ditta di installazione di pannelli solari
    • Calzolaio
    • Servizi di pulizia
    • Servizi di climatizzazione
    Altro
    • Organizzazione non profit
    • Ente per la tutela ambientale
    • Agenzia di cartellonistica pubblicitaria
    • Studio fotografico
    • Punto noleggio di biciclette
    • Rivenditore di software
    Carica tutti i settori
  • Community
    Apprendimento
    • Tutorial
    • Documentazione
    • Certificazioni 
    • Formazione
    • Blog
    • Podcast
    Potenzia la tua formazione
    • Programma educativo
    • Scale Up! Business Game
    • Visita Odoo
    Ottieni il software
    • Scarica
    • Versioni a confronto
    • Note di versione
    Collabora
    • Github
    • Forum
    • Eventi
    • Traduzioni
    • Diventa nostro partner
    • Servizi per partner
    • Registra la tua società di contabilità
    Ottieni servizi
    • Trova un partner
    • Trova un contabile
    • Incontra un esperto
    • Servizi di implementazione
    • Testimonianze dei clienti
    • Supporto
    • Aggiornamenti
    GitHub Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Richiedi una demo
  • Prezzi
  • Aiuto

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

  • CRM
  • e-Commerce
  • Contabilità
  • Magazzino
  • PoS
  • Progetti
  • MRP
All apps
È necessario essere registrati per interagire con la community.
Tutti gli articoli Persone Badge
Etichette (Mostra tutto)
odoo accounting v14 pos v15
Sul forum
È necessario essere registrati per interagire con la community.
Tutti gli articoli Persone Badge
Etichette (Mostra tutto)
odoo accounting v14 pos v15
Sul forum
Assistenza

[Solved] Inherit fields to existing tables

Iscriviti

Ricevi una notifica quando c'è un'attività per questo post

La domanda è stata contrassegnata
pythonpython2.7odooodoo10
4 Risposte
10440 Visualizzazioni
Avatar
Fazryan Fareka Riznendi

Hiiii,
How to inherit field to existing tables?

I've tried various things, but it's hard to understand,

i want to inherit my field(on my addons) to model asset.

this my code ;

class Aset(models.Model): #addons field
    _inherit='asset.asset' 
    
    asset_number = fields.Char('Item Code/Reg', size=64)
    no_pol=fields.Char('Police Number')
    many_units=fields.Char('Number Of Units', default='1')
    item_type_id=fields.Many2one('item_type', string='Item Type')
    colour=fields.Char('Colour')
    machine_number=fields.Char('Number Machine')
    chassiss=fields.Char('Chassis Number')
    fill_in_the_slider=fields.Char('Slider')
    bpkb_no=fields.Char('BPKB No')
    year=fields.Char('Year')

xml ;

<record model="ir.ui.view" id="asset_asset_form_view">
    <field name="name">asset_asset_form</field>
    <field name="model">asset.asset</field>
    <field name="inherit_id" ref="asset.assets_form_view" />
    <field name="arch" type="xml">
        <page position='inside'>
            <group position="inside">
                <field name='serial'>
            <group>
                <field name='color'/>
            </group>
                </field>
       </group>
</page>

Thanks before...

0
Avatar
Abbandona
Avatar
La Jayuhni Yarsyah
Risposta migliore

Based on your code  on <page position='inside'> that  means "Put new tags Inside Element <Page> on referenced view (asset.assets_form_view)"

So the result as attached images. because odoo will render xml structure like this
<page string="Info">
    <group>
        <group>
            ******original fields on group top left
        </group>
    </group>
    <group string="Warranty">
        <group>
            *** Original fields on group bottom left
        </group>
        <group>
            *** Original fields on group bottom right
        </group>
    </group>


    <!-- THE APPENDED TAGS by <page position="inside">**TAGS**</page> -->
    <group>
        <field name='serial'>
    </group>
    <group>
        <field name='color'/>
    </group>
    <!-- END -->
</page>


So for you expected result like image that you attached, maybe you can try like this

<xpath expr="//form/sheet/notebook/page/group[1]" position="inside">
    **Appended tags
</xpath>
** Using group[1] or group (depends on referenced structure)

or

<xpath expr="//form/sheet/notebook/page/group[1]/group" position="after">
    **Appended tags
</xpath>

Note:
The expression depends by referenced views,,so you must modify it base on referenced xml view structure (asset.assets_form_view)

You can see the video that referenced by @Cybrosys before
And please learn about \XPATH\ expression\\ \/\ i\nheriting  View ON Odoo.

Regards

1
Avatar
Abbandona
Fazryan Fareka Riznendi
Autore

Thanks for response.

I do both examples,

still not as I expected sir.

the example above makes the field in an existing group, it is almost exactly what I want, but rather want to create a new group and be next to the existing group (as in the picture)

La Jayuhni Yarsyah

So for more please post the original view to inherit (asset.assets_form_view)

And your full xml view code , so me or anyone can help more detail,,

Regards..

Fazryan Fareka Riznendi
Autore

can it be like this? and which object should I edit?

https://drive.google.com/file/d/1375H_YpkqVBw7FSQb_-BmXCwku-b7NOx/view?usp=sharing

Fazryan Fareka Riznendi
Autore

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

<field name="name">asset_asset_form</field>

<field name="model">asset.asset</field>

<field name="inherit_id" ref="asset.assets_form_view" />

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

<xpath expr="//form/sheet/notebook/page/group" position="inside">

<group>

</group>

<group>

<field name='colour'/>

<field name='machine_number'/>

<field name='chassiss'/>

<field name='fill_in_the_slider'/>

<field name='bpkb_no'/>

<field name='year'/>

</group>

</xpath>

<field name='asset_number' position='replace'>

<field name='asset_number'/>

</field>

<field name='active' position='after'>

<field name='item_type_id' />

</field>

<field name='serial' position='after'>

<field name='many_units' />

</field>

</field>

</record>

La Jayuhni Yarsyah

Can you share screen shoot origin form (before inheriting) ?? i wanna see the structure ,, before it inherited

And i see you wanna inherit form view from module wich named "asset" ,, i try to find the module at odoo source code on github (https://github.com/odoo/odoo/tree/10.0/addons) , but cant find "asset" module. It's your own custom module ??

If it right,, can you share the original form view xml structure...??

La Jayuhni Yarsyah

And What the result looks like , if your xpath like this:

<xpath expr="//form/sheet/notebook/page/group[1]/group[1]" position="after">

<group>

<field name='colour'/>

<field name='machine_number'/>

<field name='chassiss'/>

<field name='fill_in_the_slider'/>

<field name='bpkb_no'/>

<field name='year'/>

</group>

</xpath>

Fazryan Fareka Riznendi
Autore

now code like this,

<xpath expr="//form/sheet/notebook/page/group" position="inside">

<group>

</group>

<group>

<field name='colour'/>

<field name='machine_number'/>

<field name='chassiss'/>

<field name='fill_in_the_slider'/>

<field name='bpkb_no'/>

<field name='year'/>

</group>

</xpath>

and result like in image before...

Fazryan Fareka Riznendi
Autore

origin like this image https://drive.google.com/file/d/1mTJx570PVSSy8XnLmSwGaX38xmyzx3lS/view

and this for module,

https://apps.odoo.com/apps/modules/10.0/asset/

I just added a new field to the module, because when I tried to add a field directly to the module it couldn't, so I made simple addons for the inheritance

La Jayuhni Yarsyah

I see on that module repository on -> https://github.com/codup/odoo-eam/blob/10.0/asset/asset_view.xml#L72

There's Empty Group Already defined on origin form view, it post wil be rendered on top right of form

So in this case, can you try to put this code:

<xpath expr="//form/sheet/notebook/page/group[1]/group[2]" position="inside">

<field name='colour'/>

<field name='machine_number'/>

<field name='chassiss'/>

<field name='fill_in_the_slider'/>

<field name='bpkb_no'/>

<field name='year'/>

</xpath>

and see the result

Fazryan Fareka Riznendi
Autore

Hi La Jayuhni,

Big Thanks, now it's appropriate

Avatar
Cybrosys Techno Solutions Pvt.Ltd
Risposta migliore

Hi,

If you are looking to inherit and add new custom fields to the model asset.asset , what you have done seems to be fine, if there is an issue in the same, please post the issue or update the question with the error message.

Additional field to existing view

Thanks


1
Avatar
Abbandona
Fazryan Fareka Riznendi
Autore

Hello, Thanks for response

there was no error, but the addons field that I added was not in the 'Info' table and grouped there. but instead adds the fields below.

and essentially I want to add fields with new groups next to existing groups,

regards.

Fazryan Fareka Riznendi
Autore

if you are confused, you can see this picture for what I mean;

https://drive.google.com/file/d/1mTJx570PVSSy8XnLmSwGaX38xmyzx3lS/view?usp=sharing

Ti stai godendo la conversazione? Non leggere soltanto, partecipa anche tu!

Crea un account oggi per scoprire funzionalità esclusive ed entrare a far parte della nostra fantastica community!

Registrati
Post correlati Risposte Visualizzazioni Attività
[SOLVED] How to Hide or Delete Trash Icon in One2many field Risolto
python python2.7 odoo odoo10
Avatar
Avatar
2
ago 25
13060
Filter value 2 field of Many2one
python python2.7 odoo odoo10
Avatar
Avatar
Avatar
5
set 20
7082
Filter field domain one2many to many2one Risolto
python python2.7 odoo odoo10
Avatar
Avatar
1
dic 19
10430
How to calculate the value of results in one2many field
python python2.7 odoo odoo10
Avatar
Avatar
1
gen 19
7262
Generate XLSX(Excel) report in odoo 10 from custom module?
python python2.7 odoo odoo10
Avatar
Avatar
Avatar
2
lug 18
15455
Community
  • Tutorial
  • Documentazione
  • Forum
Open source
  • Scarica
  • Github
  • Runbot
  • Traduzioni
Servizi
  • Hosting Odoo.sh
  • Supporto
  • Aggiornamenti
  • Sviluppi personalizzati
  • Formazione
  • Trova un contabile
  • Trova un partner
  • Diventa nostro partner
Chi siamo
  • La nostra azienda
  • Branding
  • Contattaci
  • Lavora con noi
  • Eventi
  • Podcast
  • Blog
  • Clienti
  • Note legali • Privacy
  • Sicurezza
الْعَرَبيّة 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 è un gestionale di applicazioni aziendali open source pensato per coprire tutte le esigenze della tua azienda: CRM, Vendite, E-commerce, Magazzino, Produzione, Fatturazione elettronica, Project Management e molto altro.

Il punto di forza di Odoo è quello di offrire un ecosistema unico di app facili da usare, intuitive e completamente integrate tra loro.

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