openerp-8

Odoo 8 - Compute Field with “store=True” can't store in database

喜欢而已 提交于 2019-12-02 05:17:43
I'm using Odoo 8 and I have a problem with compute field with type is Many2One . Here, I declared department_id : department_id = fields.Text( string="Department", store=True, comodel_name="hr.department", compute="_get_department_id" ) And fuction of this compute field: @api.depends('employee_id') def _get_department_id(self): if self.employee_id.department_id: self.department_id = self.employee_id.department_id.name It seems to work right now, but it's not. In view, I can see the value of department_id . But in the database, the table has no column department_id and has no value of this

What is Main difference between @api.onchange and @api.depends in Odoo(openerp)?

怎甘沉沦 提交于 2019-11-30 11:03:47
问题 In Odoo v8 there are many API decorators used. But i don't understand the main difference between @api.depends and @api.onchange . Can anyone help me out from this one? Thank You. 回答1: @api.depends This decorator is specifically used for "fields.function" in odoo. For a "field.function", you can calculate the value and store it in a field, where it may possible that the calculation depends on some other field(s) of same table or some other table, in that case you can use '@api.depends' to

How to make field readonly based on group and status?

∥☆過路亽.° 提交于 2019-11-28 21:31:36
I want to make field readony based on group, and status. Like i have two grops 1. Manager Group 2. User Group If I give User Group to any user then and Status Done then field will be readonly for this user. Hope I able to make it clear to understand Thank OmaL Create a functional field of type boolean. If the logged in user is under user group and state is done, then return true. Then in the view, specify attrs="{'readonly':[('boolean_field_name','=',True)]}" OR First create your form view. Then inherit the view also specify the groups. for example in sale order form view, i want to make the

How to make field readonly based on group and status?

纵饮孤独 提交于 2019-11-27 20:58:20
问题 I want to make field readony based on group, and status. Like i have two grops 1. Manager Group 2. User Group If I give User Group to any user then and Status Done then field will be readonly for this user. Hope I able to make it clear to understand Thank 回答1: Create a functional field of type boolean. If the logged in user is under user group and state is done, then return true. Then in the view, specify attrs="{'readonly':[('boolean_field_name','=',True)]}" OR First create your form view.