Hi,
I have 2 models:
class ProjectTask (models.Model): # project_task.py
_inherit = "project.task"
task_line_ids = fields.One2many('project.task.line','task_id',string="Articles")
state = fields.Selection((('draft','Draft'),('open','In progress'),('done','Done'),('cancel','Cancelled')), default = 'draft', string='Status', required="True")
@api.multi
def action_draft(self):
return self.write({'state': 'draft'})
@api.multi
def action_open(self):
return self.write({'state': 'open'})
@api.multi
def action_done(self):
return self.write({'state': 'done'})
@api.multi
def action_cancel(self):
return self.write({'state': 'cancel'})
class ProjectTaskLine(models.Model):
_name = 'project.task.line'
quantity = fields.Float("Quantity")
price_unit = fields.Float("Unit Price")
product_id = fields.Many2one('product.product', string='Article')
task_id = fields.Many2one('project.task')
progress = fields.Float('Progress')
in the project_task.xml
<xpath expr="//form/sheet/notebook/page[@name='description_page']" position="before">
<page string="Articles">
<field name="task_line_ids">
<tree string="Batchs Order Lines" editable="bottom">
<field name="product_id" />
<field name="quantity"/>
<field name="price_unit"/>
<field name="progress" attrs="{'invisible': [('state','in','draft'])]}"/>
</tree>
</field>
</page>
</xpath>
I want to hide the column "progress" in the o2m field when the state = 'draft',but i get this message error : Uncaught Error: QWeb2 - template['ListView.row']: Runtime Error: Error: Unknown field state in domain [["state","in","draft"]]
How can i do to solve it please ?
Thanks