Hi,
Does anyone have an idea how to use an Odoo 8 method in Odoo 7 class / method ?
I have to use a specific method developed in Odoo 8 (New API) module in my traditional (Odoo 7) addon. How does it possible?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
Hi,
Does anyone have an idea how to use an Odoo 8 method in Odoo 7 class / method ?
I have to use a specific method developed in Odoo 8 (New API) module in my traditional (Odoo 7) addon. How does it possible?
We have a work around for this. Define v7 & v8 compatible modules as follows,
@api.v7
def _validate_values(self,cr,uid,values,context=None):
@api.v8
def _validate_values(self,values):
And call the method like as follows to get result from both v7 & v8 ..
v7result = self.pool.get('hr.employee.rejoin')._validate_values(cr,uid,vals,context)
v8result = self._validate_values(values)
Hi,
If you are working with Odoo 8 and old api addon. You can use the decorators @api.model and @api.multi to make the new api methods callable from old api.
@api.multi def _validate_values(self,values): ...... return values How do i call this method from a traditional create function ? def create(self, cr, uid, vals, context=None): e = self.pool.get('hr.employee.rejoin')._validate_values(vals) Will this work ?? Nop..
No you need to call like calling an old api function. Like, e = self.pool.get('hr.employee.rejoin')._validate_values(cr, uid, ids, vals, context=None)
No Akhil , It wont't work as expected.. It throws an error.. We have a work around for this. Define v7 & v8 compatible modules as follows, @api.v7 def _validate_values(self,cr,uid,values,context=None): @api.v8 def _validate_values(self,values): And call the method like as follows to get result from both v7 & v8 .. v7result = self.pool.get('hr.employee.rejoin')._validate_values(cr,uid,vals,context) v8result = self._validate_values(values)
สร้างบัญชีวันนี้เพื่อเพลิดเพลินไปกับฟีเจอร์พิเศษและมีส่วนร่วมกับคอมมูนิตี้ที่ยอดเยี่ยมของเรา!
ลงชื่อRelated Posts | ตอบกลับ | มุมมอง | กิจกรรม | |
---|---|---|---|---|
Selecting items for one2many relation
แก้ไขแล้ว
|
|
2
ธ.ค. 22
|
14889 | |
|
1
พ.ย. 21
|
5015 | ||
|
0
ม.ค. 21
|
2338 | ||
|
8
พ.ค. 20
|
7909 | ||
|
0
ธ.ค. 23
|
2973 |