Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
1017 Lượt xem

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?

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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.

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 9 25
233
2
thg 9 25
406
0
thg 9 25
4
0
thg 9 25
343
1
thg 9 25
1034