I'm trying to create a transient model, to create a custom view, but I don't know why it gives me this error in the build.
Error:
ERROR server Model res.partner.billing.wizard has no table.
If it is a transient model it does not create a table, why does it give me that error, if I am not storing anything?
py:
from odoo import models, fields, api
from odoo.exceptions import UserError
class ResPartnerBillingWizard(models.TransientModel):
_name = 'res.partner.billing.wizard'
_description = 'Asistente para Facturación de Clientes'
min_billing = fields.Float(string="Facturación Mínima", required=True, default=0)
def action_filter_customers(self):
self.ensure_one()
partners = self.env['res.partner'].search([('is_customer', '=', True)])
partner_ids = [partner.id for partner in partners if partner.total_invoiced > self.min_billing]
if not partner_ids:
raise UserError("No se encontraron clientes que cumplan los criterios.")
return {
'type': 'ir.actions.act_window',
'name': 'Facturación clientes',
'view_mode': 'tree,form',
'res_model': 'res.partner',
'domain': [('id', 'in', partner_ids)],
'context': self.env.context,
}
xml:
<odoo>
<record id="view_res_partner_billing_wizard" model="ir.ui.view">
<field name="name">res.partner.billing.wizard.form</field>
<field name="model">res.partner.billing.wizard</field>
<field name="arch" type="xml">
<form string="Filtrar Clientes por Facturación">
<group>
<field name="min_billing"/>
</group>
<footer>
<button name="action_filter_customers" type="object" string="Filtrar" class="btn-primary"/>
<button string="Cancelar" class="btn-secondary" special="cancel"/>
</footer>
</form>
</field>
</record>
<record id="action_open_res_partner_billing_wizard" model="ir.actions.act_window">
<field name="name">Filtrar Clientes por Facturación</field>
<field name="res_model">res.partner.billing.wizard</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
<menuitem id="menu_res_partner_billing_wizard" name="Filtrar Facturación Clientes" action="action_open_res_partner_billing_wizard" parent=" crm.crm_menu_report"/>
</odoo>