# -*- coding: utf-8 -*- from odoo import models, fields, api class ProjectTask(models.Model): _inherit = 'project.task' # Смета-анализ def action_estimate_analysis(self): context = dict(self.env.context or {}) domain = [('index_id', 'in', self.index_ids.ids)] return { 'name': 'Смета-Анализ', 'type': 'ir.actions.act_window', 'res_model': 'hg.value', 'view_mode': 'pivot', 'target': 'new', 'views': [(self.env.ref('mklab_base_indicators_extended.view_estimate_pivot').id, 'pivot')], 'domain': domain, 'context': context, } # Править смету def action_edit_estimate(self): if self.index_ids: context = dict(self.env.context or {}) domain = [('index_id', 'in', self.index_ids.ids)] return { 'name': 'Править смету', 'type': 'ir.actions.act_window', 'res_model': 'hg.value', 'view_mode': 'list', 'target': 'new', 'views': [(self.env.ref('mklab_base_indicators_extended.view_edit_estimate_list').id, 'list')], 'domain': domain, 'context': context, } else: return { 'name': 'Выбор шаблона сметы', 'type': 'ir.actions.act_window', 'res_model': 'estimate.wizard', 'view_mode': 'form', 'target': 'new', 'context': {'default_template_id': False, 'active_id': self.id}, }