コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
11328 ビュー

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
3528
0
3月 18
4814
2
4月 24
4039
1
11月 15
5742
0
3月 15
5797