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

How to add invoice payment date and tax number in invoice tree view?

Tilmeld

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

Dette spørgsmål er blevet anmeldt
invoices
5 Besvarelser
8126 Visninger
Avatar
Iñaki

I am trying to add the payment date to the invoice tree but nothing works.

I am using Odoo 14, I have seen the payment date is in model account.payment and the invoice tree view in model account.move, view account.invoice.tree. 

I tried to add  in the model account.move a new field "x_payment_id_date" and then a related field "payment_id.date" but I don't get it to work, I just get an empty field.

By adding in the tree view   I get all the informations from the widget. Is there any option to filter and show only the date? As a work around I can export and in Excel (edit data, divide in columns) delete all but the date.

I got to show the tax number by adding a new field in account.move "x_partner_id_vat" and in related field I add "partner_id.vat". But for the date, I don't get it.

Any help would be appreciated!

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

How would you display multiple dates in one field in case of multiple payments?

You should create a compute char field and fetch the payment date from the payment widget as follow:

import json

payment_date = fields.Char(compute='_compute_payment_date')

def _compute_payment_date(self):
for inv in self:
dates = []
for payment_info in json.loads(inv.invoice_payments_widget).get('content', []):
dates.append(payment_info.get('date', ''))
inv.payment_date = ', '.join(dates)

This way you can fetch the payment date from the widget and add it to your field. This will work even if there will be multiple payments and that is why I have used CHAR field.

1
Avatar
Kassér
Javier Calvet Sánchez

Hi, It works when the invoice is paid or in paid process, but wen there isn't any payment it shows this error:

File "/home/odoo/src/user/ymt_personalizaciones/models/account_move.py", line 18, in _compute_payment_date
for payment_info in json.loads(inv.invoice_payments_widget).get('content', []):
Exception

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/odoo/src/odoo/odoo/http.py", line 643, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/home/odoo/src/odoo/odoo/http.py", line 301, in _handle_exception
raise exception.with_traceback(None) from new_cause
AttributeError: 'bool' object has no attribute 'get'

Iñaki
Forfatter

I guess the problem Javier found could be solved adding the line "if inv.invoice_payments_widget:" :

payment_date = fields.Char(compute='_compute_payment_date')

def _compute_payment_date(self):
for inv in self:
dates = []
if inv.invoice_payments_widget:
for payment_info in json.loads(inv.invoice_payments_widget).get('content', []):
dates.append(payment_info.get('date', ''))
inv.payment_date = ', '.join(dates)

But still I did not get it to work. Which field(s) should I add in "Dependencies"?

Avatar
Cybrosys Techno Solutions Pvt.Ltd
Bedste svar

Hi,

You can try this code

payment_date = fields.Date(string='Payment Date',

                               compute='_compute_payment_date')


@api.depends('line_ids')

def _compute_payment_date(self):

    for rec in self:

        payment_dates = [inv.payment_id.payment_date for inv in rec.line_ids if inv.payment_id]

        rec.payment_date = payment_dates[0] if payment_dates else False

<record id="view_invoice_tree" model="ir.ui.view">
        <field name="name">
http://account.move.view.invoice.tree.inherit.module.name/" target="_blank" style="color: rgb(17, 85, 204);">account.move.view.invoice.tree.inherit.module.name
        </field>
<field name="model">account.move</field>
<field name="inherit_id" ref="account.view_invoice_tree"/>
        <field name="arch" type="xml">
<xpath expr="//field[@name='invoice_date_due']" position="before">
                <field name="payment_date"/>
            </xpath>
         </field>
</record>



Regards


0
Avatar
Kassér
Avatar
Naz
Bedste svar

Am working on odoo 15 web studio, I have created a field (date) and include that in my Tree view and i created one 'automated action' for 'model journal entry', i set trigger for 'on update' and triggers field is 'payment status' and action to do is 'execute python code' this is what i did, I will give that code here :

all_records = env['account.move'].search([])

#model name -> env['account.move']
#to get all the records ->  .search([])

for rec in all_records:    
if rec.payment_state == 'paid':        
​if rec.invoice_payments_widget:
​ ​try:                
​ ​ ​# Parse the JSON string into a dictionary                ​ ​ ​ ​ ​
​ ​ ​invoice_payments_widget_dict = json.loads(rec.invoice_payments_widget)                                
​ ​ ​# Access the required information                
​ ​ ​content_list = invoice_payments_widget_dict.get('content', [])                                
​ ​ ​if content_list:                    
​ ​ ​ ​content_data = content_list[0]                    
​ ​ ​ ​date_str = content_data.get('date', '')                                        
​ ​ ​ ​if date_str:                        
​ ​ ​ ​ ​rec['x_studio_date_field_a1MrW'] = date_str            
​ ​except Exception:                
​ ​ ​rec['x_studio_date_field_a1MrW'] = None

(Please check the indentation) 
 


0
Avatar
Kassér
Avatar
danylook
Bedste svar
from odoo import models, fields
import json


class AccountMove(models.Model):
_inherit = 'account.move'
_Inherit = 'account.payment'


def _compute_payment_date(self):
for inv in self:
dates = []
if isinstance(inv.invoice_payments_widget, bool):
inv.payment_date = ''
print('info 1', inv.payment_date)
else:
if inv.payment_state == 'paid' or inv.payment_state == 'partial':

for payment_info in json.loads(inv.invoice_payments_widget).get('content', []):
print('info 2 ', payment_info)
dates.append(payment_info.get('date', ''))
inv.payment_date = ', '.join(dates)
print(inv.payment_date)
else:
inv.payment_date = ''
payment_date = fields.Char(compute='_compute_payment_date')


0
Avatar
Kassér
Avatar
Muhammad Anees
Bedste svar

You can add following in the account.inovice search view




0
Avatar
Kassér
Iñaki
Forfatter

Sorry, I do not understand your answer. Throught payment_id I should get the payment date (field date in account.payment) but I just get an empty field.

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
Odoo-12 Invoices sequence skipped for no apparent reason
invoices
Avatar
Avatar
2
jun. 25
1681
Invoice Wishlist percentage
invoices
Avatar
0
feb. 24
1889
SII Chilean invoice
invoices
Avatar
0
okt. 23
2042
Repeated terms and conditions in invoice
invoices
Avatar
Avatar
1
maj 23
3468
Attachments Issue upon printing invoices Løst
invoices
Avatar
Avatar
1
nov. 22
2799
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