Hello, i am trying to create a many2one field but am receiving an error. I'm creating a module for handling the growth of plants. One feature i require in the plant's module is a dropdown that contains the warehouses in a database. I have 2 problems. When i try to create my record, i get this error: [object with reference: code - code] and the other error is the "create" and "import" buttons in the warehouse section(inventory > config > warehouses) has disappeared.
Imgur displaying photos:
https://imgur.com/a/8mzjUi1
As you can tell from the code below, there is only 1 input field for this record. I received this error so i made seperate python and xml files just to test. Sure enough, it is this many2one field that is breaking. So how can i go about fixing these errors?
Side notes: Manifest does have a dependency on inventory (stock_account).
Here is my code:
Model:
from odoo import api, fields, modela
from odoo.exceptions import UserError
class Facilities(models.Model):
_name = 'nursery.facilities'
_inherit = 'stock.warehouse'
_description = "A list of facilities involved in doing stuff; \ info from inventory > warehouse"
facility_id = fields.Many2one(comodel_name = 'stock.warehouse', string = 'Facility ID', delegate = True)
XML
<?xml version="1.0" encoding="UTF-8"?> <odoo> <record model="ir.ui.view" id="nursery_facilities_form"> <field name="name">Facilities Form View</field> <field name="model">nursery.facilities</field> <field name="arch" type="xml"> <form string="Plant"> <sheet> <h1> <field name="facility_id" ref='view_warehouse_tree'/> </h1> </sheet> </form> </field> </record> </odoo>