Skip to content
Snippets Groups Projects
Commit 26e035d4 authored by roen-odoo's avatar roen-odoo
Browse files

[FIX] sale: Payment had wrong sales team


Current behavior :
When creating payment from invoice, the payment had the wrong sales team id

Steps to reproduce :
- Create atleast 2 invoices with different sales team and same partner
- Register payments for every invoice
- Go in payments list view
- Filter on partner and group by sales team
- All the payments are grouped in the same sales team

opw-2681041

closes odoo/odoo#81593

Signed-off-by: default avatarEngels Robin (roen) <roen@odoo.com>
parent 96e4f84d
No related branches found
No related tags found
No related merge requests found
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import account_payment_register
from . import payment_acquirer_onboarding_wizard
from . import sale_make_invoice_advance
from . import sale_order_cancel
......
# -*- coding: utf-8 -*-
from odoo import models
class AccountPaymentRegister(models.TransientModel):
_inherit = 'account.payment.register'
def _create_payment_vals_from_wizard(self):
vals = super()._create_payment_vals_from_wizard()
# Make sure the account move linked to generated payment
# belongs to the expected sales team
# team_id field on account.payment comes from the `_inherits` on account.move model
vals.update({'team_id': self.line_ids.move_id[0].team_id.id})
return vals
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment