[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#82114 X-original-commit: 2f3ebe86b2d520dd9c7570f60056f200bb091aab Signed-off-by: Engels Robin (roen) <roen@odoo.com> Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import account_payment_register
|
||||
from . import mail_compose_message
|
||||
from . import payment_acquirer_onboarding_wizard
|
||||
from . import sale_make_invoice_advance
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
# -*- 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
|
||||
Reference in New Issue
Block a user