I need to get current company in a xml syntax , module/data
using lambda self: self.env.company.id in xml , comme suit
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
I need to get current company in a xml syntax , module/data
using lambda self: self.env.company.id in xml , comme suit
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign upRelated Posts | Replies | Views | Activity | |
---|---|---|---|---|
|
1
Apr 22
|
18364 | ||
|
0
Jan 22
|
1561 | ||
|
3
Dec 23
|
3322 | ||
|
0
Dec 22
|
1345 | ||
|
0
Jul 20
|
2747 |
exemple : <field name='company_id' eval='lambda self:self.env.company.id' />
<record id="hr_payroll_rules_hs_40" model="hr.salary.rule">
<field name="category_id" ref="hs"/>
<field name="name">HS 40%</field>
<field name="code">HS40</field>
<field name='company_id' eval='lambda self:self.env.company.id' />
<field name="sequence">1022</field>
<field name="appears_on_payslip">True</field>
<field name="condition_select">python</field>
<field name="condition_python">if inputs.HS40.amount !=0:
result = True
</field>
<field name="amount_select">code</field>
<field name="amount_python_compute">result = inputs.HS40.amount*1.4*(categories.BASE + categories.INDM)/173.3333
</field>
but I have problem , how can i do
You can't do that from XML, You have to do it from python:
company_id = fields.Many2one('res.company', default=lambda self: self.env.company)
If the field already set then you can exclude it in XML and It will take the current company by default.
j'AI FAIT CELA mais y'a un souci en multi societé , le fichier data est chargé dans un autre societé different du societé en cours