Skip to Content
Odoo Meniu
  • Autentificare
  • Try it free
  • Aplicații
    Finanțe
    • Contabilitate
    • Facturare
    • Cheltuieli
    • Spreadsheet (BI)
    • Documente
    • Semn
    Vânzări
    • CRM
    • Vânzări
    • POS Shop
    • POS Restaurant
    • Abonamente
    • Închiriere
    Site-uri web
    • Constructor de site-uri
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Lanț Aprovizionare
    • Inventar
    • Producție
    • PLM
    • Achiziție
    • Maintenance
    • Calitate
    Resurse Umane
    • Angajați
    • Recrutare
    • Time Off
    • Evaluări
    • Referințe
    • Flotă
    Marketing
    • Social Marketing
    • Marketing prin email
    • SMS Marketing
    • Evenimente
    • Automatizare marketing
    • Sondaje
    Servicii
    • Proiect
    • Foi de pontaj
    • Servicii de teren
    • Centru de asistență
    • Planificare
    • Programări
    Productivitate
    • Discuss
    • Aprobări
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Aplicații Terțe Odoo Studio Platforma Odoo Cloud
  • Industrii
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Managament
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Producție
    • Textile
    • Metal
    • Furnitures
    • Food
    • 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
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Comunitate
    Învăță
    • Tutorials
    • Documentație
    • Certificări
    • Instruire
    • Blog
    • Podcast
    Empower Education
    • Program Educațional
    • Scale Up! Business Game
    • Visit Odoo
    Obține Software-ul
    • Descărcare
    • Compară Edițiile
    • Lansări
    Colaborați
    • Github
    • Forum
    • Evenimente
    • Translations
    • Devino Partener
    • Services for Partners
    • Înregistrează-ți Firma de Contabilitate
    Obține Servicii
    • Găsește un Partener
    • Găsiți un contabil
    • Meet an advisor
    • Servicii de Implementare
    • Referințe ale clienților
    • Suport
    • Actualizări
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obține un demo
  • Prețuri
  • Ajutor

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

  • CRM
  • e-Commerce
  • Contabilitate
  • Inventar
  • PoS
  • Proiect
  • MRP
All apps
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Suport

Link 2 fields together

Abonare

Primiți o notificare când există activitate la acestă postare

Această întrebare a fost marcată
one2manylink
2 Răspunsuri
6703 Vizualizări
Imagine profil
Selverine

Hi everybody,

I would like to know how is possible to get (or to link together) in a field another field save in other table?

To be more clear:

My first field (field1) is a one2many field. Table product.product. My second field (field2) is on the table sale.order.line.

The goal of this manipulation is to have the field1 for each product of the sale.order.line Need I to declare my field2 as a one2many too? or can in make the link to say: My field 2 is my field 1?

Thank you a lot,

Selverine

0
Imagine profil
Abandonează
Imagine profil
René Schuster
Cel mai bun răspuns

I would make field2 many2one.
And then use an on_change method on field2 or make field1 a function field to get the products of the sale.order.line

Or better: Make field1 a relational field!

0
Imagine profil
Abandonează
Imagine profil
Selverine
Autor Cel mai bun răspuns

Hi René Schuster,

Thank your for your help.

So, I try to use a relational field. In the developer guide I saw this :

:City -> State -> Country, and you need to refer to the Country from a City, you can define a field as below in the City object: 'country_id': fields.related( 'state_id', 'country_id', type="many2one", relation="res.country", string="Country", store=False)

So I try to adapt to my projet.

I have

Sale.order.line <-> product -> BAT

It is why I try to do that:

class product_bat(osv.osv):
_name = 'product.bat'
_description = 'Product BAT'

_columns = {
    'name': fields.char('Name', size=64, required=False, translate=True),
    'name_id': fields.many2one('product.bat', 'Template'),
    'product_link_BAT': fields.many2one('product.template', 'Template Id'),
    'product_BAT' : fields.related('product_link_BAT', 'product_link_sale', string=" Product BAT", relation='sale.order.line', type='char', size=128, store=True, select=True),

}

product_bat()

class product_template(osv.osv): _name = "product.template" _description = "Product Template"

_columns = {
    'name': fields.char('Name', size=128, required=True, translate=True, select=True),
    'product_BAT': fields.one2many('product.bat', 'product_link_BAT', 'product BAT'),
    'product_link_sale': fields.many2one('sale.order.line', 'Product link sale'),

class sale_order_line(osv.osv):

_name = 'sale.order.line'
_description = 'Sales Order Line'
_columns = {
    'order_id': fields.many2one('sale.order', 'Order Reference', required=True, ondelete='cascade', select=True, readonly=True, states={'draft':[('readonly',False)]}),
    'name': fields.text('Description', required=True, readonly=True, states={'draft': [('readonly', False)]}),
    'product_link' : fields.one2many('product.product', 'product_link_sale', 'test_aurel'),

But it don't works. Have you an idea please? Is it a problem of link object together?

My error:

AttributeError: 'NoneType' object has no attribute '_table'

Thanks

Aurelien

0
Imagine profil
Abandonează
Enjoying the discussion? Don't just read, join in!

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

Înscrie-te
Related Posts Răspunsuri Vizualizări Activitate
how pass value to on2many field from parent form via context
one2many
Imagine profil
Imagine profil
1
ian. 25
2671
Can I create new menu in the sales module and give alink to the odoo spreadsheet in V17 ent ?
link
Imagine profil
0
oct. 24
1963
Liens de texte dans une même page
link
Imagine profil
Imagine profil
1
nov. 23
3122
How to make tree view place last entered field on the top of tree view? What is the difference between editable="top" and editable="bottom"?
one2many
Imagine profil
Imagine profil
Imagine profil
2
sept. 22
10408
How to configure one2many field inside a form with domain or filter Rezolvat
one2many
Imagine profil
Imagine profil
2
apr. 22
5266
Comunitate
  • Tutorials
  • Documentație
  • Forum
Open Source
  • Descărcare
  • Github
  • Runbot
  • Translations
Servicii
  • Hosting Odoo.sh
  • Suport
  • Actualizare
  • Custom Developments
  • Educație
  • Găsiți un contabil
  • Găsește un Partener
  • Devino Partener
Despre Noi
  • Compania noastră
  • Active de marcă
  • Contactați-ne
  • Locuri de muncă
  • Evenimente
  • Podcast
  • Blog
  • Clienți
  • Aspecte juridice • Confidențialitate
  • Securitate
الْعَرَبيّة 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 este o suită de aplicații de afaceri open source care acoperă toate nevoile companiei dvs.: CRM, comerț electronic, contabilitate, inventar, punct de vânzare, management de proiect etc.

Propunerea de valoare unică a Odoo este să fie în același timp foarte ușor de utilizat și complet integrat.

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