Is it possible to create a field which become read only once it is created.I need to create a record in which one of the field should be read only but it should be editable at the time of creation so that the record can be created.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Financeiro
- Inventário
- PoS
- Project
- MRP
Esta pergunta foi sinalizada
Hello Abhijith soman,
May be you can achieve this from below code:
In PY :-
from openerp import models, fields, api
class ClassName(models.Model):
_name = 'class.name'
@api.model
def create(self, vals):
result = super(ClassName, self).create(vals)
self.is_create = True
return result
is_create = fields.Boolean('Is Create?')
readonly_field = fields.Char('Readonly Field')
In XML :-
<record id="class_name_form_view" model="ir.ui.view">
<field name="name">class.name.form.view</field>
<field name="model">class.name</field>
<field name="arch" type="xml">
<form string="Name">
<sheet>
<field name="is_create" invisible="1"/>
<field name="readonly_field" attrs="{'readonly' : [('is_create', '=', True)]}"/>
</sheet>
</form>
</field>
</record>
Hope it will works for you.
Thanks,
Thanks, jignesh mehta
Está gostando da discussão? Não fique apenas lendo, participe!
Crie uma conta hoje mesmo para aproveitar os recursos exclusivos e interagir com nossa incrível comunidade!
Inscreva-se