The error indicates an issue with the security rule in rental_order_contract_security.xml . Specifically, the problem is with this line:
xml
Copy Edit
< field name = "domain_force" > [('company_id', 'in', company_ids)] </ field >
Possible Causes & Solutions:
1. company_ids is Undefined
Odoo does not recognize company_ids in the domain. Try replacing it with the correct Odoo environment variable:
Fix:
Replace:
xml
Copy Edit
< field name = "domain_force" > [('company_id', 'in', company_ids)] </ field >
With:
xml
Copy Edit
< field name = "domain_force" > [('company_id', '=', user.company_id.id)] </ field >
Or, if multi-company is needed:
xml
Copy Edit
< field name = "domain_force" > [('company_id', 'in', user.company_ids.ids)] </ field >
2. Incorrect Model Reference ( model_rental_order_contract )
Ensure that model_rental_order_contract is correctly defined in ir.model . To check this, go to Odoo shell:
python
Copy Edit
env[ 'ir.model' ].search([( 'model' , '=' , 'rental.order.contract' )])
If this returns an empty list, the model is missing or not properly defined.
3. Security Rule Placement Issue
Check if the security rule is loaded at the correct stage. If the model is defined in another module, ensure that the dependency is included in __manifest__.py :
python
Copy Edit
'depends' : [ 'base' , 'sale' , 'your_module_name' ],
4. Restart and Upgrade
After fixing the XML file, restart Odoo and update the module:
sh
Copy Edit
sudo service odoo restart
odoo -u odoo_rental_sales
I m running odoo on runtipi. the code seems different