Přejít na obsah
Odoo Menu
  • Přihlásit se
  • Vyzkoušejte zdarma
  • Aplikace
    Finance
    • Účetnictví
    • Fakturace
    • Výdaje
    • Spreadsheet (BI)
    • Dokumenty
    • Podpisy
    Prodej
    • CRM
    • Prodej
    • POS Obchod
    • POS Restaurace
    • Předplatné
    • Pronájem
    Webové stránky
    • Webové stránky
    • E-shop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Dodavatelský řetězec
    • Sklad
    • Výroba
    • PLM
    • Nákup
    • Údržba
    • Kvalita
    Lidské zdroje
    • Zaměstnanci
    • Nábor
    • Volno
    • Hodnocení zaměstnanců
    • Doporučení
    • Vozový park
    Marketing
    • Marketing sociálních sítí
    • Emailový marketing
    • SMS Marketing
    • Události
    • Marketingová automatizace
    • Dotazníky
    Služby
    • Projekt
    • Časové výkazy
    • Práce v terénu
    • Helpdesk
    • Plánování
    • Schůzky
    Produktivita
    • Diskuze
    • Schvalování
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Aplikace třetích stran Odoo Studio Odoo cloudová platforma
  • Branže
    Maloobchod
    • Knihkupectví
    • Obchod s oblečením
    • Obchod s nábytkem
    • Potraviny
    • Obchod s hardwarem
    • Hračkářství
    Jídlo a pohostinství
    • Bar a Pub
    • Restaurace
    • Fast Food
    • Penzion
    • Distributor nápojů
    • Hotel
    Nemovitost
    • Realitní kancelář
    • Architektonická firma
    • Stavba
    • Správa nemovitostí
    • Zahradnictví
    • Asociace vlastníků nemovitosti
    Poradenství
    • Účetní firma
    • Odoo Partner
    • Marketingová agentura
    • Právník
    • Akvizice talentů
    • Audit a certifikace
    Výroba
    • Textil
    • Kov
    • Nábytek
    • Jídlo
    • Pivovar
    • Korporátní dárky
    Zdraví a fitness
    • Sportovní klub
    • Prodejna brýli
    • Fitness Centrum
    • Wellness praktikové
    • Lékárna
    • Kadeřnictví
    Transakce
    • Údržbář
    • Podpora IT & hardware
    • Systémy solární energie
    • Výrobce obuvi
    • Úklidové služby
    • Služby HVAC
    Ostatní
    • Nezisková organizace
    • Agentura pro životní prostředí
    • Pronájem billboardů
    • Fotografování
    • Leasing jízdních kol
    • Prodejce softwaru
    Procházet všechna odvětví
  • Komunita
    Edukační program
    • Tutoriály
    • Dokumentace
    • Certifikace
    • Vzdělávání
    • Blog
    • Podcast
    Podpora vzdělávání
    • Vzdělávací program
    • Scale Up! Hra na firmu
    • Navštivte Odoo
    Získat software
    • Stáhnout
    • Porovnejte edice
    • Verze
    Spolupráce
    • Github
    • Fórum
    • Události
    • Překlady
    • Stát se partnerem
    • Služby pro partnery
    • Registrujte svou účetní firmu
    Získat služby
    • Najít partnera
    • Najít účetní
    • Setkejte se s poradcem
    • Implementační služby
    • Zákaznické reference
    • Podpora
    • Upgrady
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dohodnout demo
  • Ceník
  • Pomoc

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

  • CRM
  • e-Commerce
  • Účetnictví
  • Sklad
  • PoS
  • Projekty
  • MRP
All apps
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
Pomoc

Why my bidirectional many2many is not showing data?

Odebírat

Get notified when there's activity on this post

This question has been flagged
inheritancerelationshipmany2many
2 Odpovědi
12653 Zobrazení
Avatar
Stefan Reisich

I'm having a problem with many2many fields. Creating a dhl label with relation to stock_picking_out is no problem. Everything works. But when I go to delivery orders the "dhl_label" field shows me an empty list. Here the code:

class dhl_label(osv.osv):
    _name = 'dhl.label'

    _columns = {
        'stock_picking_out': fields.many2many('stock.picking.out', 'dhl_label_stock_picking_out_rel', 'dhl_label_id', 'stock_picking_out_id'),

class stock_picking_out(osv.osv):
    _inherit = 'stock.picking.out'

    _columns = {
        'dhl_label': fields.many2many('dhl.label', 'dhl_label_stock_picking_out_rel', 'stock_picking_out_id', 'dhl_label_id'),

<record id="view_dhl_label_form" model="ir.ui.view">
            <field name="name">dhl.label.form</field>
            <field name="model">dhl.label</field>
            <field name="arch" type="xml">
                <form string="DHL Label" version="7.0">
                    <sheet>
                        <group>
                            <group>
                                <field name="stock_picking_out" widget="many2many_tags"/>
                            </group>
                        </group>
                    </sheet>
                </form>
            </field>
        </record>

<record id="nfx_dhl_view_picking_out_form" model="ir.ui.view">
            <field name="name">nfx.dhl.stock.picking.out.form</field>
            <field name="model">stock.picking.out</field>
            <field name="inherit_id" ref="stock.view_picking_out_form"/>
            <field name="arch" type="xml">
                <data>

                    <notebook position="inside">
                        <page string="DHL Label">
                            <field name="dhl_label" select="1"/>
                        </page>
                    </notebook>

                </data>
            </field>
        </record>
0
Avatar
Zrušit
Avatar
Stefan Reisich
Autor Nejlepší odpověď

I got the answer from the openerp support. Because stock_picking_out is not physical we must do it this way:

class stock_picking_out(osv.osv):
    _name = 'stock.picking.out'
    _inherit = 'stock.picking'
    _table = 'stock.picking'

Then everythin works...

0
Avatar
Zrušit
Avatar
Soohoo
Nejlepší odpověď

Hi Stefan The working copy is below,, just copy and see if it works for let me know if you need any help it will create a menu like dev under that you add same dhl label and in warehouse delivery orders it is accessible while creating and editing .

Thanks

Py File

import logging
from osv import fields,osv
_logger = logging.getLogger(__name__)

class dhl_label(osv.osv):
    _name = 'dhl.label'

    _columns = {
        'name': fields.char('dhl Label', size=32),
        'stock_picking_out': fields.many2many('stock.picking.out', 'dhl_label_stock_picking_out_rel', 'dhl_label_id',
                                              'stock_picking_out_id','Stocking Picking Out'),

    }

#dev_person()

class stock_picking_out(osv.osv):
    _inherit = 'stock.picking.out'

    _columns = {
        'dhl_label': fields.many2many('dhl.label', 'dhl_label_stock_picking_out_rel', 'stock_picking_out_id',
                                      'dhl_label_id','SPO Dhl Label'),

    }

View File

<?xml version="1.0"?>
<openerp>
<data>
    <record id="view_dhl_label_form" model="ir.ui.view">
            <field name="name">dhl.label.form</field>
            <field name="model">dhl.label</field>
            <field name="arch" type="xml">
                <field name="name"/>
                <form string="DHL Label" version="7.0">
                    <sheet>
                        <group>
                            <group>
                                <field name="stock_picking_out" widget="many2many_tags"/>
                            </group>
                        </group>
                    </sheet>
                </form>
            </field>
        </record>

    <record model="ir.ui.view" id="view_person_tree">
        <field name="name">dhl.label.tree</field>
        <field name="model">dhl.label</field>
        <field name="type">tree</field>
        <field name="arch" type="xml">
            <tree string="dev.person">
                <field name="name"/>
                <field name="stock_picking_out"/>
            </tree>
        </field>
    </record>

    <record model="ir.actions.act_window" id="action_dhl_label">
        <field name="name">dhl.label</field>
        <field name="res_model">dhl.label</field>
        <field name="view_type">form</field>
        <field name="view_mode">tree,form</field>
    </record>


<!--<menuitem id="menu_item_abi_notes" parent="menu_section_ramport" name="Abi Results" action="action_abi_results" />-->
<menuitem id="dev_menu" name="dev" />
 <menuitem id="menu_section_test" parent="dev_menu" name="Test" />
<menuitem id="menu_person" parent="menu_section_test" name="DHL Label" action="action_dhl_label" />
<!--<menuitem id="menu_prop" parent="dev_menu" name="prop" action="action_property" />-->

    <record id="nfx_dhl_view_picking_out_form" model="ir.ui.view">
            <field name="name">nfx.dhl.stock.picking.out.form</field>
            <field name="model">stock.picking.out</field>
            <field name="inherit_id" ref="stock.view_picking_out_form"/>
            <field name="arch" type="xml">
                <data>

                    <notebook position="inside">
                        <page string="DHL Label">
                            <field name="dhl_label" select="1"/>
                            <field name="origin" select="1"/>
                        </page>
                    </notebook>

                </data>
            </field>
        </record>

    <record model="ir.ui.view" id="view_property_tree">
        <field name="name">stock.picking.out</field>
        <field name="model">stock.picking.out</field>
        <field name="inherit_id" ref="stock.view_picking_out_tree"/>
        <field name="type">tree</field>
        <field name="arch" type="xml">
            <field name="name" position="after">
                <field name="dhl_label"/>
            </field>
        </field>
    </record>

    <record model="ir.actions.act_window" id="action_stock_picking_out_1">
        <field name="name">stock.picking.out</field>
        <field name="res_model">stock.picking.out</field>
        <field name="view_type">form</field>
        <field name="view_mode">tree,form</field>
    </record>
<menuitem id="menu_prop" parent="menu_section_test" name="Stock picking out" action="action_stock_picking_out_1" />

</data>

</openerp>
2
Avatar
Zrušit
Stefan Reisich
Autor

i'm sorry but nothing have changed. when i go to the delivery order i cannot see the dhl label. the many2many list is empty.

Soohoo

have to created any dhl label

Stefan Reisich
Autor

yes, of course i have created one, but it doesn't appears in delivery orders.

Stefan Reisich
Autor

I got it. Thank you for your help!

Soohoo

Hi stefan ! can you give me a example of load/save my own config

http://help.openerp.com/question/30123/how-can-i-saveload-my-own-configurationsettings/

This one is not working

please please give one live example

Stefan Reisich
Autor

hi Soohoo, i decided to use the system parameters from openerp to save all my configurations. you need to activate the technical view for your user and then you can go to settings -> parameters -> system parameters. there i added new values like my_module.my_setting_key. you will get this value with self.pool.get('ir.config_parameter').get_param(cr, uid, 'my_module.my_setting_key'). don't forget to eval the values, they are always saved as string...

Soohoo

can't we do it from code ??

Stefan Reisich
Autor

I'm not doing this by code, but i think you can write to the ir.config_parameter model: self.pool.get('ir.config_parameter').create(cr, uid, {'key': 'your_key', 'value': 'your_value'})...

Soohoo

but i wanted to know how the other module like account and stock using it

Stefan Reisich
Autor

i'm sorry but i don't understand. as i wrote you can read the values with self.pool.get('ir.config_parameter').get_param(cr, uid, 'my_setting_key'). that's the way i'm saving/loading my configuration at the moment...

Soohoo

so from the front end how can we create a form so that it can be changed , for multiple values

Stefan Reisich
Autor

i don't know...

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

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

Přihlásit se
Related Posts Odpovědi Zobrazení Aktivita
Error with inheritance odoo v16
inheritance relationship
Avatar
1
led 23
2469
many2many relation with attributes Vyřešeno
relationship many2many attribute
Avatar
Avatar
Avatar
2
pro 23
25181
How to get Value for Relation table in odoo 10 Vyřešeno
relationship many2many odoo10
Avatar
Avatar
2
čvn 17
7131
Many2many relation on the same model does not work Vyřešeno
fields relationship many2many model
Avatar
Avatar
3
čvn 18
15810
Allowing groups to only edit relationship fields in a model
security relationship many2many groups
Avatar
0
říj 16
3364
Komunita
  • Tutoriály
  • Dokumentace
  • Fórum
Open Source
  • Stáhnout
  • Github
  • Runbot
  • Překlady
Služby
  • Odoo.sh hostování
  • Podpora
  • Upgrade
  • Nestandardní vývoj
  • Edukační program
  • Najít účetní
  • Najít partnera
  • Stát se partnerem
O nás
  • Naše společnost
  • Podklady značky
  • Kontakujte nás
  • Práce
  • Události
  • Podcast
  • Blog
  • Zákazníci
  • Právní dokumenty • Soukromí
  • Zabezpečení
الْعَرَبيّة 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 balíček open-source aplikací, které pokrývají všechny potřeby vaší společnosti: CRM, e-shop, účetnictví, sklady, kasy, projektové řízení a další.

Unikátní nabídka od Odoo poskytuje velmi jednoduché uživatelské rozhraní a vše je integrované na jednom místě.

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