Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
2562 Vistas
This is my xml file, focus on 






Ghi nhận sản xuất
production.record


































and this is my model:
class ProductionResult(models.Model):
_name = 'production.result'

production_record_id = fields.Many2one('production.record', string='Production Record')

planned_output_hour = fields.Float(string='Sản lượng kế hoạch/giờ')
so_volume = fields.Float(string='Khối lượng đơn hàng(thùng)')
mix_volume = fields.Float(string="Khối lượng trộn")
planned_output = fields.Float(string='Sản lượng kế hoạch (kg)')
actual_output_bin = fields.Float(string='Sản lượng thực tế (thùng)')
actual_output_kg = fields.Float(string ='Sản lượng thực tế(kg)')
completion_rate =fields.Float(string='Tỉ lệ hoàn thành(%)',compute='_compute_completion_rate',store=True)

is_operation_tron = fields.Boolean(string='Operation Tron',compute='_compute_is_operation_tron',default=False,store=True)
@api.depends('production_record_id.operation_id')
def _compute_is_operation_tron(self):
for rec in self:
if rec.production_record_id:
if rec.production_record_id.operation_id.name == 'Trộn':
rec.is_operation_tron = True
else:
rec.is_operation_tron = False

i can't invisible this column :

and i got this error:
Caused by: EvalError: Can not evaluate python expression: (bool(is_operation_tron != False)) Error: Name 'is_operation_tron' is not defined
but my default for is_operation_tron is False


Avatar
Descartar
Mejor respuesta

Hello in your tree view use invisible="is_operation_tron" dont use column_invisible with condition only use column_invisible = "1"

Avatar
Descartar
Autor

thanks for your knowledge, but when i using invisible ,it doesn't work
my column for field is_operation_tron still visible , do u have anotherway ?

Tree view not like form view either you hide that column completely or show it

Publicaciones relacionadas Respuestas Vistas Actividad
4
jul 25
4477
2
dic 24
5979
2
nov 24
1635
2
jun 24
11249
0
jun 25
311