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
    • Magazin de îmbrăcăminte
    • Magazin de Mobilă
    • Magazin alimentar
    • Magazin de materiale de construcții
    • Magazin de jucării
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Distribuitor de băuturi
    • Hotel
    Proprietate imobiliara
    • Real Estate Agency
    • Firmă de Arhitectură
    • Construcție
    • Estate Managament
    • Grădinărit
    • Asociația Proprietarilor de Proprietăți
    Consultanta
    • Firma de Contabilitate
    • Partener Odoo
    • Agenție de marketing
    • Law firm
    • Atragere de talente
    • Audit & Certification
    Producție
    • Textil
    • Metal
    • Mobilier
    • Mâncare
    • Brewery
    • Cadouri corporate
    Health & Fitness
    • Club Sportiv
    • Magazin de ochelari
    • Centru de Fitness
    • Wellness Practitioners
    • Farmacie
    • Salon de coafură
    Trades
    • Handyman
    • IT Hardware and Support
    • Asigurare socială de stat
    • Cizmar
    • Servicii de curățenie
    • HVAC Services
    Altele
    • Organizație nonprofit
    • Agenție de Mediu
    • Închiriere panouri publicitare
    • Fotografie
    • Închiriere biciclete
    • Asigurare socială
    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

many2one value

Abonare

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

Această întrebare a fost marcată
inheritancemany2one
2 Răspunsuri
4800 Vizualizări
Imagine profil
Marychan

I'm still confuse, is many2one field always return a boolean value False


Like when u inherit a field from another model

field_id = fields.Many2one('model.name','Field String')

if I print field_id.field_name, it always return false even though the field_name type is integer.

0
Imagine profil
Abandonează
Avinash Nk

The field "field_name" have value?

Also, please ensure you restart your Odoo service and upgrade the module.

Marychan
Autor

Yes sir, there's a value 100 then I want to fetch it but it returns a false value.

I tried to restart it many times,still the same

Avinash Nk

You can provide me the entire code?

Marychan
Autor

Yes sir

from odoo import models,fields,api

from docutils.nodes import field

from datetime import datetime,date,time

from odoo.addons.base import res

class AccountInvoice(models.Model):

_inherit = 'account.invoice'

owner_id = fields.Many2one(

'res.partner', 'Owner')

partner_id = fields.Many2one(

'res.partner', 'Partner')

company_id = fields.Many2one(

'res.company', 'Company',

default=lambda self: self.env['res.company']._company_default_get('stock.picking'))

backorder_id = fields.Many2one('stock.picking','Back Order of')

date_invoice = fields.Date("Invoice: ")

@api.multi

def _write(self, vals):

res = super(AccountInvoice,self)._write(vals)

print("Owner ID: " + str(self.owner_id.min_date)) #false

print("Partner ID: " + str(self.partner_id.name))

print("Company ID: " + str(self.company_id.name))

print("Backorder ID: " + str(self.backorder_id.min_date)) #false

print('=============================')

print("Invoice: " + self.date_invoice)

return res

i tried every id that is m2o, to know which id have access of min_date

Avinash Nk

What is this? --> from odoo.addons.base import res?

why you need the following import?

from docutils.nodes import field

you are not using the following import. so avoid the imports that you are not using

from datetime import datetime, date, time

Avinash Nk

min_date field is a customized field in stock.picking?

Marychan
Autor

Some of my imports were automatically imported, my bad, I will remove it.

No, The min_field is declared inside the stock.picking class ,

I'm sorry, I'm still exploring the flow of odoo and I find it confusing on some part of it especially the relation model

Avinash Nk

I can't get your exact problem.

Anyway, try the write method instead of _write.

let me know the results.

Marychan
Autor

It still the same sir, the _write method is inherited from account.invoice ,

The goal of the code is to inherit also the min_date field value from stock.picking inside the inherited class account.invoice and initialize it on the date_invoice field.

How could I do it? They told me to get the id from the stock,picking but when i used the backorder_id.min_date, it returns false

Avinash Nk

Try related field concept

Marychan
Autor

Ok sir Avinash. Thank u for helping me :)

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
Many2one returns False
inheritance many2one
Imagine profil
Imagine profil
2
oct. 19
4228
Get custom field's value from BoM to production order
development inheritance many2one
Imagine profil
0
iun. 22
3005
value not pass from many2one field to form
many2one
Imagine profil
Imagine profil
Imagine profil
Imagine profil
3
sept. 25
2389
Can't inherit base.view_partner_form of res.partner
inheritance
Imagine profil
Imagine profil
Imagine profil
Imagine profil
Imagine profil
4
feb. 25
4274
Display values of dropdown in a many2one field Rezolvat
many2one
Imagine profil
Imagine profil
2
feb. 25
6974
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