I'm using Odoo v10 and I'm trying to customize existing view (base.view_partner_form). Here are my model and view:
class add_supplier1099(models.Model):
# _name = 'add.supplier1099'
_inherit = ['res.partner']
_description = "Add Checkbox and TaxID Field if Supplier Requires 1099"
supp_test_field = fields.Char(string="test field")
<odoo>
<data>
<record id="add_supplier1099_view_inherit" model="ir.ui.view">
<field name="name">res.partner.form</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='phone']" position="after">
<field name="supp_test_field"/>
</xpath>
</field>
</record>
</data>
</odoo>
This code works and it adds "supp_test_field" to the form. But if you uncomment # _name = 'add.supplier1099' (I thinks it should add my new field to an existing table of "res.partner" model) it'll through an error:
ValueError: Can't validate view:
Field `supp_test_field` does not exist
I also tried to go with "_name = res.partner" (I thinks it should create a new table with my new field and fields from res.partner model), but I was getting the same error. Any ideas why i'm getting this error in the above cases and not getting an error when I comment out "_name" attribute?