跳至內容
選單
此問題已被標幟
1 回覆
981 瀏覽次數

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?

頭像
捨棄
最佳答案

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.

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
0
9月 25
229
1
9月 25
943
3
9月 25
270
1
9月 25
276
3
9月 25
1423