Přejít na obsah
Odoo Menu
  • Přihlásit se
  • Vyzkoušejte zdarma
  • Aplikace
    Finance
    • Účetnictví
    • Fakturace
    • Výdaje
    • Spreadsheet (BI)
    • Dokumenty
    • Podpisy
    Prodej
    • CRM
    • Prodej
    • POS Obchod
    • POS Restaurace
    • Předplatné
    • Pronájem
    Webové stránky
    • Webové stránky
    • E-shop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Dodavatelský řetězec
    • Sklad
    • Výroba
    • PLM
    • Nákup
    • Údržba
    • Kvalita
    Lidské zdroje
    • Zaměstnanci
    • Nábor
    • Volno
    • Hodnocení zaměstnanců
    • Doporučení
    • Vozový park
    Marketing
    • Marketing sociálních sítí
    • Emailový marketing
    • SMS Marketing
    • Události
    • Marketingová automatizace
    • Dotazníky
    Služby
    • Projekt
    • Časové výkazy
    • Práce v terénu
    • Helpdesk
    • Plánování
    • Schůzky
    Produktivita
    • Diskuze
    • Schvalování
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Aplikace třetích stran Odoo Studio Odoo cloudová platforma
  • Branže
    Maloobchod
    • Knihkupectví
    • Obchod s oblečením
    • Obchod s nábytkem
    • Potraviny
    • Obchod s hardwarem
    • Hračkářství
    Jídlo a pohostinství
    • Bar a Pub
    • Restaurace
    • Fast Food
    • Penzion
    • Distributor nápojů
    • Hotel
    Nemovitost
    • Realitní kancelář
    • Architektonická firma
    • Stavba
    • Správa nemovitostí
    • Zahradnictví
    • Asociace vlastníků nemovitosti
    Poradenství
    • Účetní firma
    • Odoo Partner
    • Marketingová agentura
    • Právník
    • Akvizice talentů
    • Audit a certifikace
    Výroba
    • Textil
    • Kov
    • Nábytek
    • Jídlo
    • Pivovar
    • Korporátní dárky
    Zdraví a fitness
    • Sportovní klub
    • Prodejna brýli
    • Fitness Centrum
    • Wellness praktikové
    • Lékárna
    • Kadeřnictví
    Transakce
    • Údržbář
    • Podpora IT & hardware
    • Systémy solární energie
    • Výrobce obuvi
    • Úklidové služby
    • Služby HVAC
    Ostatní
    • Nezisková organizace
    • Agentura pro životní prostředí
    • Pronájem billboardů
    • Fotografování
    • Leasing jízdních kol
    • Prodejce softwaru
    Procházet všechna odvětví
  • Komunita
    Edukační program
    • Tutoriály
    • Dokumentace
    • Certifikace
    • Vzdělávání
    • Blog
    • Podcast
    Podpora vzdělávání
    • Vzdělávací program
    • Scale Up! Hra na firmu
    • Navštivte Odoo
    Získat software
    • Stáhnout
    • Porovnejte edice
    • Verze
    Spolupráce
    • Github
    • Fórum
    • Události
    • Překlady
    • Stát se partnerem
    • Služby pro partnery
    • Registrujte svou účetní firmu
    Získat služby
    • Najít partnera
    • Najít účetní
    • Setkejte se s poradcem
    • Implementační služby
    • Zákaznické reference
    • Podpora
    • Upgrady
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dohodnout demo
  • Ceník
  • Pomoc

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

  • CRM
  • e-Commerce
  • Účetnictví
  • Sklad
  • PoS
  • Projekty
  • MRP
All apps
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
Pomoc

Change Odoo invoice payment core behaviour. How to achieve that?

Odebírat

Get notified when there's activity on this post

This question has been flagged
paymentsOdoo12.0
1 Odpovědět
4339 Zobrazení
Avatar
Paulo Matos

Hello everyone,

I am having a problem on solving a workflow on Odoo 12 for the invoicing module.

When we pay several invoices on Odoo 12, Odoo sets every selected invoice as paid which is the correct approach.
Problem is that the default order is not the one I need. That is, Odoo pays the invoices starting from the last one (which usually is the newest one) and the oldest one is left for the end.

When the invoices are paid in full, there is no problem, but when the amount to be paid does is not equal to the total value of all selected invoices, the oldest one will be left open.

In my specific case, the order should be changed, that is, oldest invoices should be paid first.

I found that on Odoo core account model we have:
       class AccountInvoice(models.Model):
              _order = "date_invoice desc, number desc, id desc"

I have tested and manually changed this default order to:

      _order = "date_invoice asc, number asc, id asc"

This worked as expected and using this approach, invoices are paid on the desired order.

Since it is not advisable to make direct changes on core odoo modules, I have tried to inherit this class from my module using the following code:

      class AccountInvoice(models.Model):
              _inherit = "account.invoice"
              _order = "date_invoice asc, number asc, id asc"

This change is working because I can see on the invoices list view that the order is changed.

Problem is that even changing the default order, using a custom module, invoice payments are still on the "wrong" order.
So, I get lost here because I was expecting that inheriting the class and changing the order, this will be effective and change core Odoo behaviour.

Can anyone help me change this default order for my specific case?

Thank you all in advance

Best regards

Paulo


1
Avatar
Zrušit
Avatar
Paresh Wagh
Nejlepší odpověď

Hi Paulo: It looks like the _order is not driving the order in which the account move lines are getting selected. You may need to extend the following code to force the order in which the payments are reconciled. Hope this helps.

https://github.com/odoo/odoo/blob/12.0/addons/sale/models/account_invoice.py#L66

1
Avatar
Zrušit
Paulo Matos
Autor

Hello @Paresh,

I solved my problem.

In fact was not a problem at all. For some reason the changes I have made where not efective when I inherited the account.invoice model.

After checking everything, not it is woorking as expected.

On my new module I have:

class AccountInvoice(models.Model):

_inherit = "account.invoice"

#_order = "date_invoice desc, number desc, id desc" #This is the default order

_order = "date_invoice asc, number asc, id asc" #New order

On a xml file, in order to get the original Odoo view list:

<record id="sale_tree_view_account_invoice" model="ir.ui.view">

<field name="name">Account Invoice Tree View for Sales</field>

<field name="model">account.invoice</field>

<field name="inherit_id" ref="account.invoice_tree"/>

<field name="arch" type="xml">

<xpath expr="//tree" position="attributes">

<attribute name="default_order">date_invoice desc, number desc, id desc</attribute>

</xpath>

</field>

</record>

...and another record for supplier invoices.

It's working as expected now.

Thank you once again

Best regards

Paulo

Paresh Wagh

Great. So that means the _order is getting used by the move logic too ? Nice find.

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

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

Přihlásit se
Related Posts Odpovědi Zobrazení Aktivita
Custom Dashboard using js
Odoo12.0
Avatar
Avatar
1
dub 25
4855
When registering payment, i get "can't create a new payment without an outstanding payments/receipts account set"
payments
Avatar
Avatar
1
dub 25
3217
payments not sorted by date in invoicing
payments
Avatar
Avatar
1
říj 24
2562
Error reading the payment
payments
Avatar
1
zář 24
108
How to Limit Pos Category in Odoo 12 Shop?
Odoo12.0
Avatar
0
bře 24
2084
Komunita
  • Tutoriály
  • Dokumentace
  • Fórum
Open Source
  • Stáhnout
  • Github
  • Runbot
  • Překlady
Služby
  • Odoo.sh hostování
  • Podpora
  • Upgrade
  • Nestandardní vývoj
  • Edukační program
  • Najít účetní
  • Najít partnera
  • Stát se partnerem
O nás
  • Naše společnost
  • Podklady značky
  • Kontakujte nás
  • Práce
  • Události
  • Podcast
  • Blog
  • Zákazníci
  • Právní dokumenty • Soukromí
  • Zabezpečení
الْعَرَبيّة 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 je balíček open-source aplikací, které pokrývají všechny potřeby vaší společnosti: CRM, e-shop, účetnictví, sklady, kasy, projektové řízení a další.

Unikátní nabídka od Odoo poskytuje velmi jednoduché uživatelské rozhraní a vše je integrované na jednom místě.

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