Skip ke Konten
Odoo Menu
  • Login
  • Uji coba gratis
  • Aplikasi
    Keuangan
    • Akuntansi
    • Faktur
    • Pengeluaran
    • Spreadsheet (BI)
    • Dokumen
    • Tanda Tangan
    Sales
    • CRM
    • Sales
    • POS Toko
    • POS Restoran
    • Langganan
    • Rental
    Website
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Rantai Pasokan
    • Inventaris
    • Manufaktur
    • PLM
    • Purchase
    • Maintenance
    • Kualitas
    Sumber Daya Manusia
    • Karyawan
    • Rekrutmen
    • Cuti
    • Appraisal
    • Referensi
    • Armada
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Acara
    • Otomatisasi Marketing
    • Survei
    Layanan
    • Project
    • Timesheet
    • Layanan Lapangan
    • Meja Bantuan
    • Planning
    • Appointment
    Produktivitas
    • Diskusi
    • Approval
    • IoT
    • VoIP
    • Pengetahuan
    • WhatsApp
    Aplikasi pihak ketiga Odoo Studio Platform Odoo Cloud
  • Industri-Industri
    Retail
    • Toko Buku
    • Toko Baju
    • Toko Furnitur
    • Toko Kelontong
    • Toko Hardware
    • Toko Mainan
    Makanan & Hospitality
    • Bar dan Pub
    • Restoran
    • Fast Food
    • Rumah Tamu
    • Distributor Minuman
    • Hotel
    Real Estate
    • Agensi Real Estate
    • Firma Arsitektur
    • Konstruksi
    • Estate Management
    • Perkebunan
    • Asosiasi Pemilik Properti
    Konsultansi
    • Firma Akuntansi
    • Mitra Odoo
    • Agensi Marketing
    • Firma huku
    • Talent Acquisition
    • Audit & Sertifikasi
    Manufaktur
    • Tekstil
    • Logam
    • Perabotan
    • Makanan
    • Brewery
    • Corporate Gift
    Kesehatan & Fitness
    • Sports Club
    • Toko Kacamata
    • Fitness Center
    • Wellness Practitioners
    • Farmasi
    • Salon Rambut
    Perdagangan
    • Handyman
    • IT Hardware & Support
    • Sistem-Sistem Energi Surya
    • Pembuat Sepatu
    • Cleaning Service
    • Layanan HVAC
    Lainnya
    • Organisasi Nirlaba
    • Agen Lingkungan
    • Rental Billboard
    • Fotografi
    • Penyewaan Sepeda
    • Reseller Software
    Browse semua Industri
  • Komunitas
    Belajar
    • Tutorial-tutorial
    • Dokumentasi
    • Sertifikasi
    • Pelatihan
    • Blog
    • Podcast
    Empower Education
    • Program Edukasi
    • Game Bisnis 'Scale Up!'
    • Kunjungi Odoo
    Dapatkan Softwarenya
    • Download
    • Bandingkan Edisi
    • Daftar Rilis
    Kolaborasi
    • Github
    • Forum
    • Acara
    • Terjemahan
    • Menjadi Partner
    • Layanan untuk Partner
    • Daftarkan perusahaan Akuntansi Anda.
    Dapatkan Layanan
    • Temukan Mitra
    • Temukan Akuntan
    • Temui penasihat
    • Layanan Implementasi
    • Referensi Pelanggan
    • Bantuan
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dapatkan demo
  • Harga
  • Bantuan

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

  • CRM
  • e-Commerce
  • Akuntansi
  • Inventaris
  • PoS
  • Project
  • MRP
All apps
Anda harus terdaftar untuk dapat berinteraksi di komunitas.
Semua Post Orang Lencana-Lencana
Label (Lihat semua)
odoo accounting v14 pos v15
Mengenai forum ini
Anda harus terdaftar untuk dapat berinteraksi di komunitas.
Semua Post Orang Lencana-Lencana
Label (Lihat semua)
odoo accounting v14 pos v15
Mengenai forum ini
Help

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

Langganan

Dapatkan notifikasi saat terdapat aktivitas pada post ini

Pertanyaan ini telah diberikan tanda
invoices
5 Replies
8110 Tampilan
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
Buang
Avatar
Sudhir Arya (ERP Harbor Consulting Services)
Jawaban Terbai

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
Buang
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
Penulis

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
Jawaban Terbai

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
Buang
Avatar
Naz
Jawaban Terbai

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
Buang
Avatar
danylook
Jawaban Terbai
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
Buang
Avatar
Muhammad Anees
Jawaban Terbai

You can add following in the account.inovice search view




0
Avatar
Buang
Iñaki
Penulis

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.

Menikmati diskusi? Jangan hanya membaca, ikuti!

Buat akun sekarang untuk menikmati fitur eksklufi dan agar terlibat dengan komunitas kami!

Daftar
Post Terkait Replies Tampilan Aktivitas
Odoo-12 Invoices sequence skipped for no apparent reason
invoices
Avatar
Avatar
2
Jun 25
1655
Invoice Wishlist percentage
invoices
Avatar
0
Feb 24
1880
SII Chilean invoice
invoices
Avatar
0
Okt 23
2034
Repeated terms and conditions in invoice
invoices
Avatar
Avatar
1
Mei 23
3466
Attachments Issue upon printing invoices Diselesaikan
invoices
Avatar
Avatar
1
Nov 22
2788
Komunitas
  • Tutorial-tutorial
  • Dokumentasi
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Terjemahan
Layanan
  • Odoo.sh Hosting
  • Bantuan
  • Peningkatan
  • Custom Development
  • Pendidikan
  • Temukan Akuntan
  • Temukan Mitra
  • Menjadi Partner
Tentang Kami
  • Perusahaan kami
  • Aset Merek
  • Hubungi kami
  • Tugas
  • Acara
  • Podcast
  • Blog
  • Pelanggan
  • Hukum • Privasi
  • Keamanan
الْعَرَبيّة 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 adalah rangkaian aplikasi bisnis open source yang mencakup semua kebutuhan perusahaan Anda: CRM, eCommerce, akuntansi, inventaris, point of sale, manajemen project, dan seterusnya.

Mudah digunakan dan terintegrasi penuh pada saat yang sama adalah value proposition unik Odoo.

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