Community mailing list archives

community@mail.odoo.com

Avatar

Re: add a field in wizard.

by
Matt Taylor
- 12/01/17 08:43:48
Hi Assad,

You renamed the model with .inherit. You shouldn't do that. Remove the _name attribute from the py file and it should work.

Matt

On Nov 29, 2017 10:10 PM, "Assad Ali Sheikh" <aasheikh@comstarusa.com> wrote:


Hi,


I am new in odoo and currently using odoo11.

  1. __manifest__.py

{
'name': 'My Module',
'version': '1.1',
'category': 'My Module',
'author':'zuhair',
'summary': 'Sales internal machinery',
'description': """
This module contains all the common features of Sales Management and eCommerce.
""",
'depends': ['base','sale','account'],
'data': [
'views/demo.xml', 'views/partner.xml', 'views/sale_order_inherit.xml', 'views/invoice_inherit.xml',

],
'demo': [

],

} 2. .py file

class InvoiceInsert(models.Model):
_name = "sale.advance.payment.inv.inherit"
_inherit = "sale.advance.payment.inv"

# Add a new column to the res.partner model, by default partners are not
# instructors
# instructor = fields.Boolean(default=False)

# customInvoice = fields.Selection([
# ('gst', "Gst"),
# ('nongst', "Non-Gst")
# ], string="Type of invoice (Gst / Non-Gst)", default="gst", required=True)
customInvoice = fields.Char(string='testing')


InvoiceInsert()
3. invoice_inherit.xml
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<data>
<!-- Add instructor field to existing view -->
<record model="ir.ui.view" id="view_sale_advance_payment_inv">
<field name="name">sale.advance.payment.inv.form.inherit</field>
<field name="model">sale.advance.payment.inv</field>
<field name="inherit_id" ref="sale.view_sale_advance_payment_inv"/>
<field name="arch" type="xml">
<xpath expr="/form/group/field[@name='advance_payment_method']" position="after">
<field name="customInvoice" widget="radio"/>
</xpath>
</field>
</record>
</data>
</odoo> Error:
Field `customInvoice` does not exist

Error context:
View `sale.advance.payment.inv.form.inherit`
[view_id: 979, xml_id: n/a, model: sale.advance.payment.inv, parent_id: 625]


_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe

Reference