Skip to Content
Odoo Menu
  • Prisijungti
  • Išbandykite nemokamai
  • Programėlės
    Finansai
    • Apskaita
    • Pateikimas apmokėjimui
    • Sąnaudos
    • Skaičiuoklė (BI)
    • Dokumentai
    • Pasirašymas
    Pardavimai
    • CRM
    • Pardavimai
    • Kasų sistema - Parduotuvė
    • Kasų sistema - Restoranas
    • Prenumeratos
    • Nuoma
    Svetainės
    • Svetainių kūrėjimo įrankis
    • El. Prekyba
    • Internetinis Tinklaraštis
    • Forumas
    • Tiesioginis pokalbis
    • eMokymasis
    Tiekimo grandinė
    • Atsarga
    • Gamyba
    • PLM
    • Įsigijimai
    • Priežiūra
    • Kokybė
    Žmogaus ištekliai
    • Darbuotojai
    • Įdarbinimas
    • Atostogos
    • Įvertinimai
    • Rekomendacijos
    • Transporto priemonės
    Rinkodara
    • Socialinė rinkodara
    • Rinkodara el. paštu
    • SMS rinkodara
    • Renginiai
    • Rinkodaros automatizavimas
    • Apklausos
    Paslaugos
    • Projektas
    • Darbo laiko žiniaraščiai
    • Priežiūros tarnyba
    • Pagalbos tarnyba
    • Planavimas
    • Rezervacijos
    Produktyvumas
    • Diskucija
    • Patvirtinimai
    • IoT
    • VoIP
    • Žinių biblioteka
    • WhatsApp
    Trečiųjų šalių programos Odoo Studija Odoo debesijos platforma
  • Pramonės šakos
    Mažmeninė prekyba
    • Knygynas
    • Drabužių parduotuvė
    • Baldų parduotuvė
    • Maisto prekių parduotuvė
    • Techninės įrangos parduotuvė
    • Žaislų parduotuvė
    Food & Hospitality
    • Barai ir pub'ai
    • Restoranas
    • Greitasis maistas
    • Guest House
    • Gėrimų platintojas
    • Hotel
    Nekilnojamasis turtas
    • Real Estate Agency
    • Architektūros įmonė
    • Konstrukcija
    • Estate Managament
    • Sodininkauti
    • Turto savininkų asociacija
    Konsultavimas
    • Accounting Firm
    • Odoo Partneris
    • Marketing Agency
    • Teisinė firma
    • Talentų paieška
    • Auditai & sertifikavimas
    Gamyba
    • Textile
    • Metal
    • Furnitures
    • Maistas
    • Brewery
    • Įmonių dovanos
    Sveikata & Fitnesas
    • Sporto klubas
    • Akinių parduotuvė
    • Fitneso Centras
    • Sveikatos praktikai
    • Vaistinė
    • Kirpėjas
    Trades
    • Handyman
    • IT įranga ir palaikymas
    • Saulės energijos sistemos
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Kiti
    • Nonprofit Organization
    • Aplinkos agentūra
    • Reklaminių stendų nuoma
    • Fotografavimas
    • Dviračių nuoma
    • Programinės įrangos perpardavėjas
    Browse all Industries
  • Bendrija
    Mokykitės
    • Mokomosios medžiagos
    • Dokumentacija
    • Sertifikatai
    • Mokymai
    • Internetinis Tinklaraštis
    • Tinklalaidės
    Skatinkite švietinimą
    • Švietimo programa
    • Scale Up! Verslo žaidimas
    • Aplankykite Odoo
    Gaukite programinę įrangą
    • Atsisiųsti
    • Palyginkite versijas
    • Leidimai
    Bendradarbiauti
    • Github
    • Forumas
    • Renginiai
    • Vertimai
    • Tapkite partneriu
    • Services for Partners
    • Registruokite jūsų apskaitos įmonę
    Gaukite paslaugas
    • Susiraskite partnerį
    • Susirask buhalterį
    • Susitikti su konsultantu
    • Diegimo paslaugos
    • Klientų rekomendavimas
    • Palaikymas
    • Atnaujinimai
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Gaukite demo
  • Kainodara
  • Pagalba

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

  • CRM
  • e-Commerce
  • Apskaita
  • Atsarga
  • PoS
  • Projektas
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Žymos (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Žymos (View all)
odoo accounting v14 pos v15
About this forum
Pagalba

Print many2one field display "False" in odoo

Prenumeruoti

Get notified when there's activity on this post

This question has been flagged
odooV8
6 Replies
491 Rodiniai
Portretas
Abdelwahed

Hi everybody!!!

Please, i have a many2one field defined like this:

'project_service' : fields.many2one('project_service', string= 'service'),


The problem is that when when i want to make print on this field i get "false" despite it was defined very well.

Is it empty or what please who can help

Thanks a lot in advance

-1
Portretas
Atmesti
scot77844

For a many2one field, if no value is selected, it will return False. If there is any value for it, it displays the id of the selected record at the print statement.

Solanki Shamji

I think syntax like 'project_service' : fields.many2one('project.service', string= 'service'), Try this one.

Portretas
Serpent Consulting Services Pvt. Ltd.
Best Answer

Abdelwahed,

You should first understand the important basics/conventions on Odoo/OpenERP.

When you use a many2one field,try doing this:

'project_service_id': fields.many2one('project.service', 'Service')

With whatever object/handle you print, are you sure you are browsing through the righ model and reaching to this field?

If this field has a value, then you must do this:

<YourObject>.project_service_id and <YourObject>.project_service_id.name or '' .

Hope this helps.

SerpentCS

(contact@serpentcs.com)


0
Portretas
Atmesti
Abdelwahed
Autorius

Thanks a lot you ave answered me ;) Look i have changed the field: 'project_service_id': fields.many2one ('project.service', string= 'Services'), An dwhen i want to print it i have done this: service = vals.get('project_service_id') print service

Serpent Consulting Services Pvt. Ltd.

Important thing is , where do you use it. You need a right container! If you use in create()/write() its vals! otherwise, its through object.

Portretas
Bole
Best Answer

first, i think that yur definition of a m2o field should be dot notated , not underscore... like:
'project_service': fields.many2one('project.service', string='service')

second... if that fields has no value (or it has Null value) it is interpreted as False. so in your report parser, you should check if the field value exists, and suggest some value for cases where it does not exist...

as noted in Tom's answer... in your report (rml or qweb) in part where you call a m2o field value 
(let's say it is o.project_service ) you should do something like:

if o.project_service != Null or o.project_service Is Not False:
    print o.project_service
else:
    print ''


to put it in short (pythonic form) jou can just write:

o.project_service and o.project_service or ''

(in human readable format it would read like: if there is a o.project_service value, write thta value othervise write '' or any other desired value/blank string...)

hope this will explain why and what you need to do in report:)

0
Portretas
Atmesti
Portretas
Tom
Best Answer

Hi,

I think you can ues the same example:

object.project_service and object.project_service.name or ''

0
Portretas
Atmesti
Abdelwahed
Autorius

thanks for the answer but i didnt understand you. in fact, why is my field.many2one is empty it returns False??

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

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

Registracija
Related Posts Replies Rodiniai Veikla
CONFIGURACION DE CORREO PROPIO POR PRUMERA VEZ
odooV8
Portretas
0
kov. 25
2070
How to remove model if not in the py files anymore
odooV8
Portretas
0
saus. 25
4399
Start odoo server automatically in Ubuntu 14.04 on reboot Solved
odooV8
Portretas
Portretas
1
rugp. 23
16020
change password Solved
odooV8
Portretas
Portretas
1
rugp. 23
14623
Creating tables with %for and %endfor in email templates - Odoo is putting my loop outside the table, not inside.
odooV8
Portretas
Portretas
1
liep. 23
11934
Bendrija
  • Mokomosios medžiagos
  • Dokumentacija
  • Forumas
Atvirasis kodas
  • Atsisiųsti
  • Github
  • Runbot
  • Vertimai
Paslaugos
  • Odoo.sh talpinimas
  • Palaikymas
  • Atnaujinti
  • Pritaikytas programavimo kūrimas
  • Švietimas
  • Susirask buhalterį
  • Susiraskite partnerį
  • Tapkite partneriu
Apie mus
  • Mūsų įmonė
  • Prekės ženklo turtas
  • Susisiekite su mumis
  • Darbo pasiūlymai
  • Renginiai
  • Tinklalaidės
  • Internetinis Tinklaraštis
  • Klientai
  • Teisinis • Privatumas
  • Saugumas
الْعَرَبيّة 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 yra atvirojo kodo verslo programų rinkinys, kuris apima visas įmonės poreikius: CRM, El. Prekybą, Apskaitą, Atsargų, Kasų sistemą, Projektų valdymą ir kt.

Unikali Odoo vertės pasiūla – būti tuo pačiu metu labai lengvai naudojama ir visiškai integruota sistema.

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