OCA / bank-payment

Odoo Electronic Payment
https://odoo-community.org/psc-teams/banking-10
GNU Affero General Public License v3.0
198 stars 524 forks source link

Date on account_payment_line #1321

Closed rlemeur closed 2 months ago

rlemeur commented 2 months ago

Hi, I'm having a problem with the latest update to the account_payment_order module in the account_payment_line.py code.

New code def _prepare_account_payment_vals(self): """Prepare the dictionary to create an account payment record from a set of payment lines. """ journal = self.order_id.journal_id payment_mode = self.order_id.payment_mode_id vals = { "payment_type": self.order_id.payment_type, "partner_id": self.partner_id.id, "destination_account_id": self.move_line_id.account_id.id, "company_id": self.order_id.company_id.id, "amount": sum(self.mapped("amount_currency")), "date": fields.Date.today(),

ancien code

def _prepare_account_payment_vals(self): """Prepare the dictionary to create an account payment record from a set of payment lines. """ journal = self.order_id.journal_id

    vals = {
        "payment_type": self.order_id.payment_type,
        "partner_id": self.partner_id.id,
        "destination_account_id": self.move_line_id.account_id.id,
        "company_id": self.order_id.company_id.id,
        "amount": sum(self.mapped("amount_currency")),
        "date": self[:1].date,

This change poses a problem because the notion of due date is lost and customers are debited on the current date rather than the due date.

JuanuSt commented 2 months ago

We have the same problem.

pedrobaeza commented 2 months ago

The problem is that the previous code was not respecting the accrual principle, posting entries in the future or in the past incorrectly, as this entry represent the transfer of the debt to another account in the exact moment where the order is done. I know it's a bit shocking after a while working in the other way, but it has to be this way. The due date is filled with the payment date though.

MiquelRForgeFlow commented 2 months ago

This can be closed, due to https://github.com/OCA/bank-payment/pull/1315.

rlemeur commented 2 months ago

However, the due date is supplemented by the payment date. And that's the problem: it should be the other way round.