I've got a big problem, I overridden the sale.report like any other model, but when I delete the module it deletes the sale.report! This has probably something to do that sale.report isn't a table but a database view.
How I overridden it
class SaleReportGDPR(models.Model): _inherit = 'sale.report' def _from(self): from_str = """ sale_order_line l join sale_order s on (l.order_id=s.id) join res_partner partner on (s.partner_id = partner.id and partner.personal_data=true) left join product_product p on (l.product_id=p.id) left join product_template t on (p.product_tmpl_id=t.id) left join product_uom u on (u.id=l.product_uom) left join product_uom u2 on (u2.id=t.uom_id) left join product_pricelist pp on (s.pricelist_id = pp.id) left join currency_rate cr on (cr.currency_id = pp.currency_id and cr.company_id = s.company_id and cr.date_start <= coalesce(s.date_order, now()) and (cr.date_end is null or cr.date_end > coalesce(s.date_order, now()))) """ return from_str
How is the right way to do this so I can upgrade my custom module so it won't delete the database view when I uninstall it? Now on uninstall it also breaks EVERY other database instance that uses the sale module so you can't see the product details when you select it. It just throws a ProgrammingError: relation "sale_report" does not exist!