Overslaan naar inhoud
Odoo Menu
  • Aanmelden
  • Probeer het gratis
  • Apps
    Financiën
    • Boekhouding
    • Facturatie
    • Onkosten
    • Spreadsheet (BI)
    • Documenten
    • Ondertekenen
    Verkoop
    • CRM
    • Verkoop
    • Kassasysteem winkel
    • Kassasysteem Restaurant
    • Abonnementen
    • Verhuur
    Websites
    • Websitebouwer
    • E-commerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Bevoorradingsketen
    • Voorraad
    • Productie
    • PLM
    • Inkoop
    • Onderhoud
    • Kwaliteit
    Personeelsbeheer
    • Werknemers
    • Werving & Selectie
    • Verlof
    • Evaluaties
    • Aanbevelingen
    • Wagenpark
    Marketing
    • Sociale media-marketing
    • E-mailmarketing
    • Sms-marketing
    • Evenementen
    • Marketingautomatisering
    • Enquêtes
    Diensten
    • Project
    • Urenstaten
    • Buitendienst
    • Helpdesk
    • Planning
    • Afspraken
    Productiviteit
    • Chat
    • Goedkeuringen
    • IoT
    • VoIP
    • Kennis
    • WhatsApp
    Apps van derden Odoo Studio Odoo Cloud Platform
  • Bedrijfstakken
    Detailhandel
    • Boekhandel
    • kledingwinkel
    • Meubelzaak
    • Supermarkt
    • Bouwmarkt
    • Speelgoedwinkel
    Food & Hospitality
    • Bar en Pub
    • Restaurant
    • Fastfood
    • Gastenverblijf
    • Drankenhandelaar
    • Hotel
    Vastgoed
    • Makelaarskantoor
    • Architectenbureau
    • Bouw
    • Vastgoedbeheer
    • Tuinieren
    • Vereniging van eigenaren
    Consulting
    • Accountantskantoor
    • Odoo Partner
    • Marketingbureau
    • Advocatenkantoor
    • Talentenwerving
    • Audit & Certificering
    Productie
    • Textiel
    • Metaal
    • Meubels
    • Eten
    • Brewery
    • Relatiegeschenken
    Gezondheid & Fitness
    • Sportclub
    • Opticien
    • Fitnesscentrum
    • Wellness-medewerkers
    • Apotheek
    • Kapper
    Trades
    • Klusjesman
    • IT-hardware & support
    • Zonne-energiesystemen
    • Schoenmaker
    • Schoonmaakdiensten
    • HVAC-diensten
    Andere
    • Non-profitorganisatie
    • Milieuagentschap
    • Verhuur van Billboards
    • Fotograaf
    • Fietsleasing
    • Softwareverkoper
    Browse all Industries
  • Community
    Leren
    • Tutorials
    • Documentatie
    • Certificeringen
    • Training
    • Blog
    • Podcast
    Versterk het onderwijs
    • Onderwijs- programma
    • Scale Up! Business Game
    • Bezoek Odoo
    Download de Software
    • Downloaden
    • Vergelijk edities
    • Releases
    Werk samen
    • Github
    • Forum
    • Evenementen
    • Vertalingen
    • Word een Partner
    • Services for Partners
    • Registreer je accountantskantoor
    Diensten
    • Vind een partner
    • Vind een boekhouder
    • Een adviseur ontmoeten
    • Implementatiediensten
    • Klantreferenties
    • Ondersteuning
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Vraag een demo aan
  • Prijzen
  • Help

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

  • CRM
  • e-Commerce
  • Boekhouding
  • Voorraad
  • PoS
  • Project
  • MRP
All apps
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Help

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

Inschrijven

Ontvang een bericht wanneer er activiteit is op deze post

Deze vraag is gerapporteerd
paymentsOdoo12.0
1 Beantwoorden
4347 Weergaven
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
Annuleer
Avatar
Paresh Wagh
Beste antwoord

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
Annuleer
Paulo Matos
Auteur

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.

Geniet je van het gesprek? Blijf niet alleen lezen, doe ook mee!

Maak vandaag nog een account aan om te profiteren van exclusieve functies en deel uit te maken van onze geweldige community!

Aanmelden
Gerelateerde posts Antwoorden Weergaven Activiteit
Custom Dashboard using js
Odoo12.0
Avatar
Avatar
1
apr. 25
4857
When registering payment, i get "can't create a new payment without an outstanding payments/receipts account set"
payments
Avatar
Avatar
1
apr. 25
3220
payments not sorted by date in invoicing
payments
Avatar
Avatar
1
okt. 24
2562
Error reading the payment
payments
Avatar
1
sep. 24
108
How to Limit Pos Category in Odoo 12 Shop?
Odoo12.0
Avatar
0
mrt. 24
2084
Community
  • Tutorials
  • Documentatie
  • Forum
Open Source
  • Downloaden
  • Github
  • Runbot
  • Vertalingen
Diensten
  • Odoo.sh Hosting
  • Ondersteuning
  • Upgrade
  • Gepersonaliseerde ontwikkelingen
  • Onderwijs
  • Vind een boekhouder
  • Vind een partner
  • Word een Partner
Over ons
  • Ons bedrijf
  • Merkelementen
  • Neem contact met ons op
  • Vacatures
  • Evenementen
  • Podcast
  • Blog
  • Klanten
  • Juridisch • Privacy
  • Beveiliging
الْعَرَبيّة 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 is een suite van open source zakelijke apps die aan al je bedrijfsbehoeften voldoet: CRM, E-commerce, boekhouding, inventaris, kassasysteem, projectbeheer, enz.

Odoo's unieke waardepropositie is om tegelijkertijd zeer gebruiksvriendelijk en volledig geïntegreerd te zijn.

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