콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
11315 화면

In the sale.order model, the create() method contains this if-statement:

if 'company_id' in vals:
    vals['name'] = self.env['ir.sequence'].with_context(force_company=vals['company_id']).next_by_code('sale.order') or _('New')
else:
    vals['name'] = self.env['ir.sequence'].next_by_code('sale.order') or _('New')
I've figured out the sequences, but I am very confused as to what  with_context(force_company=vals['company_id']) does. 

Can you use it to define independent sequences within the same data.xml using different contexts? (In this case, using the vals['company_id'] value.) If so, what exactly is force_company? How can I add a custom context, without force_company?

Thanks in advance for your help!

아바타
취소
베스트 답변

hello

force_company means if the multi company feature is enable into the system at that time if the multiple sequence of sale's order exist so get the sequence of sale order based on the current company selected on the sales order.

아바타
취소
관련 게시물 답글 화면 활동
0
3월 15
3526
0
3월 18
4813
2
4월 24
4035
1
11월 15
5737
0
3월 15
5788