При нажатии меню для открытия сводного представления я продолжаю сталкиваться с ошибкой «ProgrammingError: column new_table_report.id не существует».
Файл моего кода .py:
@api.model_cr
def init(self):
tools.drop_view_if_exists(self._cr, 'new_table_report')
self._cr.execute("""
CREATE or REPLACE VIEW new_table_report AS (
SELECT sub.*,
(SELECT name FROM maintenance_rating_score_range WHERE
(sub.average_deviation >= from_score and
sub.average_deviation <= to_score)
) as rating
FROM(
SELECT
eq.id as equipment_id,
eq.name as name,
eq.category_id as category_id,
eq.partner_id as partner_id,
count(m.id) as number_service,
(sum(rs.score)/count(m.id)) as average_deviation
FROM maintenance_request m
INNER JOIN maintenance_equipment eq on (m.equipment_id = eq.id)
INNER JOIN maintenance_rating r on (r.request_id = m.id)
LEFT JOIN maintenance_rating_score rs on (r.rating_satisf_id = rs.id)
GROUP BY eq.id, eq.partner_id
)AS sub
)
""")
Файл моего кода .xml:
<record model="ir.ui.view" id="view_new_table_report_pivot">
<field name="name">new.table.report.pivot</field>
<field name="model">new.table.report</field>
<field name="arch" type="xml">
<pivot string="Report Analysis" disable_linking="False">
<field name="equipment_id" type="row"/>
<field name="number_service" type="measure"/>
<field name="average_deviation" type="measure"/>
</pivot>
</field>
</record>
<record model="ir.actions.act_window" id="action_new_tabke_report">
<field name="name">Report Analysis</field>
<field name="res_model">new.table.report</field>
<field name="view_type">form</field>
<field name="view_mode">pivot,graph</field>
<field name="context">{}</field>
</record>
Спасибо за продвижение.