Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
986 Widoki

When we create an invoice in the accounting app, we select a contact as customer. But, when we go to Other Info, the salesperson is the user that create the invoice, not the one associated to the contact. Is there a way to configure it to take the salesperson associated to the contact as default value?

Awatar
Odrzuć
Najlepsza odpowiedź

Hi,

Please refer to the code:


from odoo import models, api

class AccountMove(models.Model):
_inherit = 'account.move'

@api.onchange('partner_id')
def _onchange_partner_id_set_salesperson(self):
if self.partner_id and self.partner_id.user_id:
self.user_id = self.partner_id.user_id


Hope it helps.

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
0
wrz 25
3
0
wrz 25
54
0
wrz 25
233
1
wrz 25
955
3
wrz 25
276