'How to fix field doesn't exist error on Odoo

I found a module in Odoo apps that would help a lot, but it was for version 6.1, so i decided to update it for V13.0, i went through all python's problems i think but now i get some XML related errors when i try to install the app....

Odoo Server Error
Traceback (most recent call last):
File "d:\Program Files\Odoo 13.0\server\odoo\addons\base\models\ir_ui_view.py", line 394, in _check_xml
self.postprocess_and_fields(view.model, view_doc, view.id)
File "d:\Program Files\Odoo 13.0\server\odoo\addons\base\models\ir_ui_view.py", line 994, 
in postprocess_and_fields
self.raise_view_error(message, view_id)
File "d:\Program Files\Odoo 13.0\server\odoo\addons\base\models\ir_ui_view.py", line 614, 
in raise_view_error
raise ValueError(message)
ValueError: Field `partner_id` does not exist

But it's created in the model :

class generate_purchase_order(models.TransientModel):
_name = 'sale_to_purchase_order.generate_purchase_order'
_description = 'Generate Purchase Order'

_columns = {
    'partner_id': fields.Many2one('res.partner', 'Supplier', required=True, domain="[('supplier','=',True)]"),
    'pricelist_id': fields.Many2one('product.pricelist', 'Purchase Pricelist', required=True, domain="[('type','=','purchase')]",
                    help="This pricelist will be used, instead of the default one, for purchases from the current partner",),
    'warehouse_id': fields.Many2one('stock.warehouse', 'Warehouse', required=True,),
}

Here's the view :

<?xml version="1.0" encoding="utf-8" ?>
<record id="view_generate_purchase_order_wizard" model="ir.ui.view">
        <field name="name">Generate Purchase Order</field>
        <field name="model">sale_to_purchase_order.generate_purchase_order</field>
        <field name="type">form</field>
        <field name="arch" type="xml">
            <form string="Generate Purchase Order">
                <group col="4" colspan="4">
                    <label colspan="4" width="500"
                           string="You are on about to generate a Purchase Order from this Sale Order. To do so please complete the following mandatory fields first."/>
                    <newline/>
                    
                    <field name="partner_id" colspan="4" on_change="onchange_partner_id(partner_id)"
                           context="{'search_default_supplier': True, 'default_supplier': True, 'default_customer': False}"/>
                    
                    <field name="pricelist_id" colspan="4"/>
                    
                    <field name="warehouse_id" colspan="4"/>
                    
                    <button string="Cancel" colspan="2" special="cancel" icon="gtk-cancel" />
                    <button name="generate_purchase_order" string="Generate Purchase Order"
                            icon="gtk-go-forward" type="object" colspan="2"/>
                </group>
            </form>
        </field>
</record>
    
    
        
        


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source