Skip to Content
Odoo Menu
  • Log ind
  • Prøv gratis
  • Apps
    Økonomi
    • Bogføring
    • Fakturering
    • Udgifter
    • Regneark (BI)
    • Dokumenter
    • e-Signatur
    Salg
    • CRM
    • Salg
    • POS Butik
    • POS Restaurant
    • Abonnementer
    • Udlejning
    Hjemmeside
    • Hjemmesidebygger
    • e-Handel
    • Blog
    • Forum
    • LiveChat
    • e-Læring
    Forsyningskæde
    • Lagerbeholdning
    • Produktion
    • PLM
    • Indkøb
    • Vedligeholdelse
    • Kvalitet
    HR
    • Medarbejdere
    • Rekruttering
    • Fravær
    • Medarbejdersamtaler
    • Anbefalinger
    • Flåde
    Marketing
    • Markedsføring på sociale medier
    • E-mailmarketing
    • SMS-marketing
    • Arrangementer
    • Automatiseret marketing
    • Spørgeundersøgelser
    Tjenester
    • Projekt
    • Timesedler
    • Udkørende Service
    • Kundeservice
    • Planlægning
    • Aftaler
    Produktivitet
    • Dialog
    • Godkendelser
    • IoT
    • VoIP
    • Vidensdeling
    • WhatsApp
    Tredjepartsapps Odoo Studio Odoo Cloud-platform
  • Brancher
    Detailhandel
    • Boghandel
    • Tøjforretning
    • Møbelforretning
    • Dagligvarebutik
    • Byggemarked
    • Legetøjsforretning
    Mad og værtsskab
    • Bar og pub
    • Restaurant
    • Fastfood
    • Gæstehus
    • Drikkevareforhandler
    • Hotel
    Ejendom
    • Ejendomsmægler
    • Arkitektfirma
    • Byggeri
    • Ejendomsadministration
    • Havearbejde
    • Boligejerforening
    Rådgivning
    • Regnskabsfirma
    • Odoo-partner
    • Marketingbureau
    • Advokatfirma
    • Rekruttering
    • Audit & certificering
    Produktion
    • Tekstil
    • Metal
    • Møbler
    • Fødevareproduktion
    • Bryggeri
    • Firmagave
    Heldbred & Fitness
    • Sportsklub
    • Optiker
    • Fitnesscenter
    • Kosmetolog
    • Apotek
    • Frisør
    Håndværk
    • Handyman
    • IT-hardware og support
    • Solenergisystemer
    • Skomager
    • Rengøringsservicer
    • VVS- og ventilationsservice
    Andet
    • Nonprofitorganisation
    • Miljøagentur
    • Udlejning af billboards
    • Fotografi
    • Cykeludlejning
    • Softwareforhandler
    Gennemse alle brancher
  • Community
    Få mere at vide
    • Tutorials
    • Dokumentation
    • Certificeringer
    • Oplæring
    • Blog
    • Podcast
    Bliv klogere
    • Udannelselsesprogram
    • Scale Up!-virksomhedsspillet
    • Besøg Odoo
    Få softwaren
    • Download
    • Sammenlign versioner
    • Udgaver
    Samarbejde
    • Github
    • Forum
    • Arrangementer
    • Oversættelser
    • Bliv partner
    • Tjenester til partnere
    • Registrér dit regnskabsfirma
    Modtag tjenester
    • Find en partner
    • Find en bogholder
    • Kontakt en rådgiver
    • Implementeringstjenester
    • Kundereferencer
    • Support
    • Opgraderinger
    Github Youtube Twitter LinkedIn Instagram Facebook Spotify
    +1 (650) 691-3277
    Få en demo
  • Prissætning
  • Hjælp

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

  • CRM
  • e-Commerce
  • Bogføring
  • Lager
  • PoS
  • Projekt
  • MRP
All apps
Du skal være registreret for at interagere med fællesskabet.
All Posts People Emblemer
Tags (View all)
odoo accounting v14 pos v15
Om dette forum
Du skal være registreret for at interagere med fællesskabet.
All Posts People Emblemer
Tags (View all)
odoo accounting v14 pos v15
Om dette forum
Hjælp

If Condition in excel report

Tilmeld

Få besked, når der er aktivitet på dette indlæg

Dette spørgsmål er blevet anmeldt
reportinginvoicingOdoo13.0
1 Svar
3155 Visninger
Avatar
Suhaib Ahmed Khateeb

I am stuck in a simple if condition for the below code

 for invoice in invoice_objs:
invoice_date = invoice.invoice_date.strftime('%Y-%m-%d')
worksheet.write(row, 0, invoice_date)
worksheet.write(row, 1, invoice.name)
worksheet.write(row, 2, invoice.partner_id.name)
worksheet.write(row, 3, ', '.join(invoice.invoice_line_ids.mapped('product_id.name')))
--> worksheet.write(row, 4, ', '.join(invoice.invoice_line_ids.mapped('tax_ids.name')))
worksheet.write(row, 5, ', '.join(str(i) for i in invoice.invoice_line_ids.mapped('price_subtotal')))
--> if invoice.invoice_line_ids.mapped('tax_ids.name') == 'Sales VAT':
worksheet.write(row, 6, '15%')
else:
worksheet.write(row, 6, '0%')
row += 1
key = u'_'.join((invoice.partner_id.name, invoice.currency_id.name)).encode('utf-8')
key = str(key, 'utf-8')

I just want to fetch the value of one excel field and use in if condition

If tax_ids.name == 'Sales VAT'

it should print 15%

else 

0%

but for all the lines its taking only the else condition i.e 0%








Invoice Date Invoice Number Customer Invoice Description Tax Name Total before VAT VAT %
2022-01-17 INV/2022/0001 Administrator Betrillix Sales VAT 2173.91 0%
2022-01-05 INV/2022/0003 My Company Betrillix, Sample Sales VAT 60.0, 30.0 0%
2022-01-03 INV/2022/0004 My Company Betrillix Sales VAT 2500.0 0%
2022-01-03 INV/2022/0002 Administrator Betrillix Sales VAT 500.0 0%









0
Avatar
Kassér
Avatar
Sudhir Arya (ERP Harbor Consulting Services)
Bedste svar

There is an issue with your condition.

invoice.invoice_line_ids.mapped('tax_ids.name')
# This will give you the tax names in a list. Ex: ['15%', '25%', '18%']

So, you should use the condition as follow:

if 'Sales VAT' in invoice.invoice_line_ids.mapped('tax_ids.name'):
# This will be evaluated like this: 'Sales VAT' in ['15%', '25%', '18%']


2
Avatar
Kassér
Suhaib Ahmed Khateeb
Forfatter

I don't want tax names, as the tax names are different, I just want to show the tax percentages as label as there are only 1 tax percent in saudi arabia either 15% or 0%

Suhaib Ahmed Khateeb
Forfatter

By the way, thank you and let me check with this code

Sudhir Arya (ERP Harbor Consulting Services)

Just use the code I suggested and it will work.

Suhaib Ahmed Khateeb
Forfatter

its working thanks

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

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

Tilmeld dig
Related Posts Besvarelser Visninger Aktivitet
Compute field in excel report Løst
reporting invoicing Odoo13.0
Avatar
Avatar
Avatar
2
jan. 22
2987
Addition of two fields in excel report
reporting invoicing Odoo13.0
Avatar
0
jan. 22
18
Get the value of one2many field in excel report Løst
one2many reporting invoicing Odoo13.0
Avatar
Avatar
Avatar
2
jul. 22
5479
Payment Method in Invoice Summary Report
pdf reporting invoicing Odoo13.0
Avatar
0
feb. 22
3224
Expected Singleton Error for excel report
reporting invoicing excel Odoo13.0
Avatar
1
feb. 22
61
Community
  • Tutorials
  • Dokumentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Oversættelser
Tjenester
  • Odoo.sh-hosting
  • Support
  • Opgradere
  • Individuelt tilpasset udvikling
  • Uddannelse
  • Find en bogholder
  • Find en partner
  • Bliv partner
Om os
  • Vores virksomhed
  • Brandaktiver
  • Kontakt os
  • Stillinger
  • Arrangementer
  • Podcast
  • Blog
  • Kunder
  • Juridiske dokumenter • Privatlivspolitik
  • Sikkerhedspolitik
الْعَرَبيّة 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 er en samling open source-forretningsapps, der dækker alle dine virksomhedsbehov – lige fra CRM, e-handel og bogføring til lagerstyring, POS, projektledelse og meget mere.

Det unikke ved Odoo er, at systemet både er brugervenligt og fuldt integreret.

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