Bỏ qua để đến Nội dung
Odoo Menu
  • Đăng nhập
  • Dùng thử miễn phí
  • Ứng dụng
    Tài chính
    • Kế toán
    • Hóa đơn
    • Chi phí
    • Bảng tính (BI)
    • Tài liệu
    • Ký tên
    Bán hàng
    • CRM
    • Bán hàng
    • POS Cửa hàng
    • POS Nhà hàng
    • Đăng ký
    • Cho thuê
    Trang web
    • Trình tạo trang web
    • Thương mại điện tử
    • Blog
    • Diễn đàn
    • Trò chuyện trực tiếp
    • Học trực tuyến
    Chuỗi cung ứng
    • Tồn kho
    • Sản xuất
    • PLM
    • Mua hàng
    • Bảo dưỡng
    • Chất lượng
    Nhân sự
    • Nhân viên
    • Tuyển dụng
    • Ngày nghỉ
    • Đánh giá
    • Giới thiệu
    • Đội xe
    Marketing
    • Marketing trên MXH
    • Marketing qua email
    • Marketing qua SMS
    • Sự kiện
    • Tự động hóa Marketing
    • Khảo sát
    Dịch vụ
    • Dự án
    • Bảng chấm công
    • Dịch vụ hiện trường
    • Hỗ trợ
    • Kế hoạch
    • Lịch hẹn
    Năng suất
    • Thảo luận
    • Phê duyệt
    • IoT
    • VoIP
    • Kiến thức
    • WhatsApp
    Ứng dụng của bên thứ ba Studio Odoo Nền tảng Đám mây Odoo
  • Ngành
    Bán lẻ
    • Nhà sách
    • Cửa hàng quần áo
    • Cửa hàng nội thất
    • Cửa hàng tạp hóa
    • Cửa hàng đồ kim khí
    • Cửa hàng đồ chơi
    Ẩm thực & Dịch vụ lưu trú
    • Bar và quán rượu
    • Nhà hàng
    • Đồ ăn nhanh
    • Guest house
    • Nhà phân phối đồ uống
    • Khách sạn
    Bất động sản
    • Công ty môi giới bất động sản
    • Công ty kiến trúc
    • Xây dựng
    • Quản lý bất động sản
    • Làm vườn
    • Hiệp hội chủ sở hữu bất động sản
    Tư vấn
    • Công ty kế toán
    • Đối tác Odoo
    • Công ty marketing
    • Công ty luật
    • Tuyển dụng
    • Thanh tra & chứng nhận
    Sản xuất
    • Dệt may
    • Kim loại
    • Nội thất
    • Ẩm thực
    • Nhà máy bia
    • Quà tặng doanh nghiệp
    Sức khoẻ & fitness
    • CLB thể thao
    • Cửa hàng kính mắt
    • Trung tâm fitness
    • Chuyên gia chăm sóc sức khỏe
    • Hiệu thuốc
    • Tiệm làm tóc
    Thương mại
    • Dịch vụ sửa chữa
    • Phần cứng CNTT & Hỗ trợ
    • Hệ thống năng lượng mặt trời
    • Công ty sản xuất giày
    • Dịch vụ vệ sinh
    • Dịch vụ HVAC
    Khác
    • Tổ chức phi lợi nhuận
    • Cơ quan môi trường
    • Cho thuê biển quảng cáo
    • Nhiếp ảnh
    • Cho thuê xe đạp
    • Đại lý phần mềm
    Xem tất cả ngành
  • Cộng đồng
    Học tập
    • Khóa học
    • Tài liệu
    • Chứng chỉ
    • Đào tạo
    • Blog
    • Podcast
    Thúc đẩy đào tạo
    • Chương trình đào tạo
    • Trò chơi kinh doanh Scale Up!
    • Tham quan Odoo
    Nhận phần mềm
    • Tải xuống
    • So sánh các phiên bản
    • Phiên bản
    Hợp tác
    • Github
    • Diễn đàn
    • Sự kiện
    • Dịch thuật
    • Trở thành đối tác
    • Dịch vụ dành cho Đối tác
    • Đăng ký công ty kế toán của bạn
    Nhận dịch vụ
    • Tìm đối tác
    • Tìm kế toán
    • Gặp chuyên gia hỗ trợ
    • Dịch vụ Triển khai
    • Khách hàng tham khảo
    • Hỗ trợ
    • Nâng cấp
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Nhận một buổi demo
  • Bảng giá
  • Trợ giúp

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

  • CRM
  • e-Commerce
  • Kế toán
  • Tồn kho
  • PoS
  • Dự án
  • MRP
All apps
Bạn cần phải đăng ký để tương tác với cộng đồng.
Tất cả bài viết Người Huy hiệu
Thẻ (Xem tất cả)
odoo accounting v14 pos v15
Về diễn đàn này
Bạn cần phải đăng ký để tương tác với cộng đồng.
Tất cả bài viết Người Huy hiệu
Thẻ (Xem tất cả)
odoo accounting v14 pos v15
Về diễn đàn này
Hỗ trợ

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

Đăng ký nhận tin

Nhận thông báo khi có hoạt động trên bài viết này

Câu hỏi này đã bị gắn cờ
invoices
5 Trả lời
8131 Lượt xem
Ảnh đại diện
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
Ảnh đại diện
Huỷ bỏ
Ảnh đại diện
Sudhir Arya (ERP Harbor Consulting Services)
Câu trả lời hay nhất

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
Ảnh đại diện
Huỷ bỏ
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
Tác giả

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"?

Ảnh đại diện
Cybrosys Techno Solutions Pvt.Ltd
Câu trả lời hay nhất

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
Ảnh đại diện
Huỷ bỏ
Ảnh đại diện
Naz
Câu trả lời hay nhất

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
Ảnh đại diện
Huỷ bỏ
Ảnh đại diện
danylook
Câu trả lời hay nhất
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
Ảnh đại diện
Huỷ bỏ
Ảnh đại diện
Muhammad Anees
Câu trả lời hay nhất

You can add following in the account.inovice search view




0
Ảnh đại diện
Huỷ bỏ
Iñaki
Tác giả

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.

Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!

Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!

Đăng ký
Bài viết liên quan Trả lời Lượt xem Hoạt động
Odoo-12 Invoices sequence skipped for no apparent reason
invoices
Ảnh đại diện
Ảnh đại diện
2
thg 6 25
1696
Invoice Wishlist percentage
invoices
Ảnh đại diện
0
thg 2 24
1896
SII Chilean invoice
invoices
Ảnh đại diện
0
thg 10 23
2045
Repeated terms and conditions in invoice
invoices
Ảnh đại diện
Ảnh đại diện
1
thg 5 23
3471
Attachments Issue upon printing invoices Đã xử lý
invoices
Ảnh đại diện
Ảnh đại diện
1
thg 11 22
2802
Cộng đồng
  • Khóa học
  • Tài liệu
  • Diễn đàn
Open source
  • Tải xuống
  • Github
  • Runbot
  • Dịch thuật
Dịch vụ
  • Lưu trữ Odoo.sh
  • Hỗ trợ
  • Nâng cấp
  • Phát triển tùy chỉnh
  • Đào tạo
  • Tìm kế toán
  • Tìm đối tác
  • Trở thành đối tác
Giới thiệu công ty
  • Công ty của chúng tôi
  • Tài sản thương hiệu
  • Liên hệ
  • Việc làm
  • Sự kiện
  • Podcast
  • Blog
  • Khách hàng
  • Pháp lý • Riêng tư
  • Bảo mật
الْعَرَبيّة 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 là bộ ứng dụng kinh doanh có open source đáp ứng tất cả các nhu cầu của công ty bạn: CRM, thương mại điện tử, kế toán, tồn kho, POS, quản lý dự án, v.v.

Định hướng giá trị riêng biệt của Odoo là tích hợp hoàn toàn và dễ dàng sử dụng.

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