Siirry sisältöön
Odoo Menu
  • Kirjaudu sisään
  • Kokeile ilmaiseksi
  • Sovellukset
    Talous
    • Kirjanpito
    • Laskutus
    • Kulut
    • Datataulukot (BI)
    • Asiakirjat
    • Allekirjoita
    Myynti
    • CRM
    • Myynti
    • Kassajärjestelmä myymälään
    • Kassajärjestelmä ravintolaan
    • Tilaukset
    • Vuokraus
    Verkkosivut
    • Verkkosivun Rakennustyökalu
    • Verkkokauppa
    • Blogi
    • Foorumi
    • Livechat
    • Verkko-oppiminen
    Toimitusketju
    • Varastointi
    • Tuotanto
    • Tuotteen elinkaaren hallinta (PLM)
    • Ostot
    • Huolto
    • Laatu
    Henkilöstöhallinto
    • Työntekijät
    • Rekrytointi
    • Vapaat
    • Arvioinnit
    • Suositukset
    • Kuljetuskalusto
    Markkinointi
    • Somemarkkinointi
    • Sähköpostimarkkinointi
    • Tekstiviestimarkkinointi
    • Tapahtumat
    • Markkinoinnin automaatio
    • Kyselyt
    Palvelut
    • Projekti
    • Työaikakirjaukset
    • Kenttähuolto
    • Asiakaspalvelu
    • Suunnittelu
    • Ajanvaraukset
    Tuottavuus
    • Viestintä
    • Hyväksynnät
    • IoT
    • IP-puhe
    • Tietokirjasto
    • WhatsApp
    Kolmannen osapuolen sovellukset Odoo-Studio Odoo-Pilvialusta
  • Toimialat
    Vähittäiskauppa
    • Kirjakauppa
    • Vaatekauppa
    • Huonekaluliike
    • Ruokakauppa
    • Laitteistokauppa
    • Lelukauppa
    Ruoka & Majoitus
    • Baari ja Pubi
    • Ravintola
    • Pikaruoka
    • Majatalo
    • Juomien jakelija
    • Hotelli
    Kiinteistöt
    • Kiinteistönvälitystoimisto
    • Arkkitehtitoimisto
    • Rakentaminen
    • Kiinteistönhallinta
    • Puutarhanhoito
    • Kiinteistön omistajien yhdistys
    Konsultointi
    • Tilitoimisto
    • Odoo-kumppani
    • Markkinointitoimisto
    • Lakitoimisto
    • Osaajahankinta
    • Tilintarkastus & sertifiointi
    Tuotanto
    • Tekstiili
    • Metalli
    • Huonekalut
    • Ruoka
    • Panimo
    • Yrityslahjat
    Terveys & Liikunta
    • Urheiluseura
    • Silmälasiliike
    • Kuntokeskus
    • Hyvinvointialan ammattilaiset
    • Apteekki
    • Kampaamo
    Kaupat
    • Yleismies
    • IT-laitteisto & Tuki
    • Aurinkoenergiajärjestelmät
    • Suutari
    • Siivoustarvikkeet
    • LVI-palvelut
    Muut
    • Voittoa tavoittelematon järjestö
    • Ympäristötoimisto
    • Mainostaulujen vuokraus  
    • Valokuvaus
    • Leasing-pyörät
    • Ohjelmistojen jälleenmyyjä
    Selaa kaikkia toimialoja
  • Yhteisö
    Opi
    • Tutoriaalit
    • Dokumentaatio
    • Todistukset
    • Koulutus
    • Blogi
    • Podcast
    Kannusta kouluttautumaan
    • Koulutusohjelmat
    • Scale Up! Liiketoimintapeli
    • Vieraile Odoolla
    Hanki ohjelmisto
    • Lataa
    • Vertaile versioita
    • Julkaisut
    Tee yhteistyötä
    • Github
    • Foorumi
    • Tapahtumat
    • Käännökset
    • Ryhdy kumppaniksi
    • Kumppanipalvelut
    • Rekisteröi tilitoimistosi
    Hanki palveluja
    • Löydä kumppani
    • Löydä kirjanpitäjä
    • Varaa asiantuntijatapaaminen
    • Implementaatiopalvelut
    • Asiakasreferenssit
    • Tuki
    • Versionkorotukset
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Varaa demo
  • Hinnoittelu
  • Asiakaspalvelu

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

  • CRM
  • e-Commerce
  • Kirjanpito
  • Varastointi
  • PoS
  • Projekti
  • MRP
All apps
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Kaikki kirjoitukset Ihmiset Merkit
Tunnisteet (Näytä kaikki)
odoo accounting v14 pos v15
Tietoa tästä foorumista
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Kaikki kirjoitukset Ihmiset Merkit
Tunnisteet (Näytä kaikki)
odoo accounting v14 pos v15
Tietoa tästä foorumista
Apua

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

Tilaa

Saat ilmoituksen, kun tähän viestiin ilmaantuu aktiviteettia

Tämä kysymys on merkitty
invoices
5 Vastaukset
8119 Näkymät
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
Hylkää
Avatar
Sudhir Arya (ERP Harbor Consulting Services)
Paras vastaus

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
Hylkää
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
Tekijä

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
Paras vastaus

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
Hylkää
Avatar
Naz
Paras vastaus

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
Hylkää
Avatar
danylook
Paras vastaus
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
Hylkää
Avatar
Muhammad Anees
Paras vastaus

You can add following in the account.inovice search view




0
Avatar
Hylkää
Iñaki
Tekijä

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.

Nautitko keskustelusta? Älä vain lue, vaan osallistu!

Luo tili jo tänään nauttiaksesi yksinoikeusominaisuuksista ja osallistuaksesi mahtavaan yhteisöömme!

Rekisteröidy
Aiheeseen liittyviä artikkeleita Vastaukset Näkymät Toimenpide
Odoo-12 Invoices sequence skipped for no apparent reason
invoices
Avatar
Avatar
2
kesäk. 25
1669
Invoice Wishlist percentage
invoices
Avatar
0
helmik. 24
1881
SII Chilean invoice
invoices
Avatar
0
lokak. 23
2036
Repeated terms and conditions in invoice
invoices
Avatar
Avatar
1
toukok. 23
3467
Attachments Issue upon printing invoices Ratkaistu
invoices
Avatar
Avatar
1
marrask. 22
2791
Yhteisö
  • Tutoriaalit
  • Dokumentaatio
  • Foorumi
Avoin lähdekoodi
  • Lataa
  • Github
  • Runbot
  • Käännökset
Palvelut
  • Odoo.sh hosting
  • Tuki
  • Versionkorotus
  • Räätälöidyt kehitykset
  • Koulutus
  • Löydä kirjanpitäjä
  • Löydä kumppani
  • Ryhdy kumppaniksi
Meistä
  • Yrityksemme
  • Tavaramerkki
  • Ota yhteyttä
  • Työpaikat
  • Tapahtumat
  • Podcast
  • Blogi
  • Asiakkaat
  • Oikeudellinen ilmoitus • Yksityisyys
  • Tietoturva
الْعَرَبيّة 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 on kokoelma avoimen lähdekoodin yrityssovelluksia, jotka kattavat kaikki yrityksesi tarpeet: asiakkuudenhallinta eli CRM, verkkokauppa, kirjanpito, varastointi, kassajärjestelmä, projektinhallinta, jne.

Odoon uniikki arvolupaus on olla samanaikaisesti erittäin helppokäyttöinen ja täysin integroitu.

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