How to inherit correctly field in div - odoo

how to inherit correctly field
I inherited a field but did not appear as required, because it is inside a div
<group name="email_template_and_project" position="before">
<group name="sale_condition" string="Sale Conditions">
<label for="warranty" groups="stock.group_production_lot"/>
<div groups="stock.group_production_lot">
<field name="warranty" class="oe_inline"/> months
</div>
<label for="sale_delay"/>
<div>
<field name="sale_delay" attrs="{'readonly':[('sale_ok','=',False)]}" class="oe_inline" style="vertical-align:baseline"/> days
</div>
</group>
</group>
<record model="ir.ui.view" id="view_product_template_es_">
<field name="name">product.template.es.form</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_only_form_view"/>
<field name="arch" type="xml">
<xpath expr="//field[#name='sale_delay']" position="after">
<div>
<field name = 'time_pose' /> hours
</div>
</xpath>
</field>
</record>

<record model="ir.ui.view" id="view_product_template_es_">
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_only_form_view"/>
<field name="arch" type="xml">
<xpath expr="//field[#name='sale_delay']/parent::div" position="after">
<label for="time_pose"/>
<div>
<field name="time_pose" class="oe_inline"/> hours
</div>
</xpath>
</field>
</record>

Related

Facing a problem with Odoo 14 custom Module

It's an error that happen when I want to install the module, and after hours of search on the internet, hours of just reading Odoo's code... I was able to install and run the module but still getting this error
I get the following error when updating the Module I cant figure out how to add the config_ok, I tried the following but still didn't work
I added
but no luck
Field config_ok used in attrs.invisible ({'invisible': ['|', ('config_ok','=',True), ('product_variant_count', '<=', 1)]}) must be present in view but is missing.
View name: product.template.common.form
Error context:
view: ir.ui.view(2092,)
xmlid: product_template_form_view_inherit
view.model: product.template
view.parent: ir.ui.view(878,)
file: /home/odoo/src/user/product_configurator/views/product_view.xml
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="product_template_form_view_procurement_button" model="ir.ui.view">
<field name="name">product.template_procurement.form.inherit</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="stock.product_template_form_view_procurement_button"/>
<field name="arch" type="xml">
<xpath expr="//header/button[#name='action_update_quantity_on_hand']" position="attributes">
<attribute name="attrs">{'invisible': ['|', ('product_variant_count', '<', 1), ('type', '!=', 'product')]}</attribute>
</xpath>
</field>
</record>
<record id="product_template_form_view_inherite" model="ir.ui.view">
<field name="name">product.template.common.form</field>
<field name="model">product.template</field>
<field name="priority">16</field>
<field name="inherit_id" ref="product.product_template_form_view"/>
<field name="arch" type="xml">
<xpath expr="//header/button[#name='%(product.product_attribute_value_action)d']" position="attributes">
<attribute name="attrs">{'invisible': ['|', ('config_ok','=',True), ('product_variant_count', '<=', 1)]}</attribute>
</xpath>
<div name="button_box" position="inside">
<button class="oe_stat_button" name="toggle_config"
type="object" icon="fa-wrench" groups="product_configurator.group_product_configurator_manager">
<field name="config_ok" options='{"active": "Configurable", "inactive": "Standard"}' widget="boolean_button"/>
</button>
</div>
</field>
</record>
<record id="product_template_form_view" model="ir.ui.view">
<field name="name">product.configurator.product.template.form</field>
<field name="model">product.template</field>
<field name="priority">16</field>
<field name="inherit_id" ref="product.product_template_only_form_view"/>
<field name="arch" type="xml">
<xpath expr='//header' position="inside">
<button class="oe_stat_button" name="get_product_attribute_values_action"
attrs="{'invisible': ['|', ('attribute_line_ids', '=', []), ('config_ok', '=', False)]}"
groups="product_configurator.group_product_configurator_manager"
type="object"
string="Variant Prices">
</button>
<button name="configure_product"
class="oe_highlight"
type="object"
string="Configure Product"
groups="product_configurator.group_product_configurator"
attrs="{'invisible': [('config_ok', '=', False)]}"/>
</xpath>
<xpath expr="//label[#for='purchase_ok' or #for='sale_ok']" position="after">
<div class="oe_left" name="options" groups="base.group_user">
<field name="id" invisible="True"/>
</div>
</xpath>
<!-- Product attributes -->
<xpath expr="//field[#name='attribute_line_ids']" position="attributes">
<attribute name="context">{
'show_attribute': False,
'attribute_line_ids': attribute_line_ids,
}</attribute>
</xpath>
<!-- TODO: Implement a method to hide this field for non-configurable product templates -->
<xpath expr="//field[#name='attribute_line_ids']/tree/field[#name='value_ids']" position="after">
<field name="default_val"
domain="[('id', 'in', value_ids)]"
context="{'show_attribute': False}"
options="{'no_create': True, 'no_create_edit': True}"
invisible="not context.get('default_config_ok', False)"/>
<field name="required" invisible="not context.get('default_config_ok', False)"/>
<field name="multi" invisible="not context.get('default_config_ok', False)" attrs="{'readonly': [('custom','=',True)]}" force_save="1"/>
<field name="custom" invisible="not context.get('default_config_ok', False)" attrs="{'readonly': [('multi','=',True)]}" force_save="1"/>
</xpath>
<xpath expr="//field[#name='attribute_line_ids']/tree/field[#name='value_ids']" position="attributes">
<attribute name="attrs">{'required': [('custom','!=',True)]}</attribute>
</xpath>
<xpath expr="//field[#name='attribute_line_ids']/tree/field[#name='attribute_id']" position="attributes">
<attribute name="context">{'flag_config_ok': not parent and context.get('default_config_ok', False) or parent.config_ok}</attribute>
</xpath>
<xpath expr="//field[#name='attribute_line_ids']/tree/field[#name='attribute_id']" position="before">
<field name="sequence" widget="handle"/>
</xpath>
<!-- TODO: Apply domains so only values from template are available -->
<xpath expr="//notebook/page[#name='variants']" position="after">
<page string="Configurator" name="configurator" attrs="{'invisible': [('config_ok','=',False)]}" groups="product_configurator.group_product_configurator">
<separator colspan="4" string="Configuration Restrictions" name="configurator_restrictions"/>
<field name="config_line_ids"
attrs="{'readonly': [('attribute_line_ids','=',[])]}"
context="{'show_attribute': False}">
<tree string="Attribute Value Dependencies" editable="bottom">
<field name="sequence" widget="handle"/>
<field name="attribute_line_id"
domain="[('product_tmpl_id','=',parent.id)]"
options="{'no_create': True, 'no_create_edit': True}"/>
<!-- # TODO: Find a more elegant way to restrict the value_ids -->
<field name="attr_line_val_ids"
widget="many2many_tags"
invisible="True"/>
<field name="value_ids"
widget="many2many_tags"
attrs="{'readonly': [('attribute_line_id','=',False)]}"
domain="[('id','in',attr_line_val_ids)]"
options="{'no_create': True, 'no_create_edit': True}"
context="{'show_attribute': False}"/>
<field name="domain_id" context="{'product_tmpl_id': product_tmpl_id or active_id or parent.id, 'product_attribute_ids': template_attribute_ids}"/>
<field name="product_tmpl_id" invisible="1"/>
<field name="template_attribute_ids" invisible="1"/>
</tree>
</field>
<separator colspan="4" string="Configuration Steps" name="configurator_steps"/>
<field name="config_step_line_ids"
attrs="{'readonly': [('attribute_line_ids','=',[])]}">
<tree string="Configuration Steps" editable="bottom">
<field name="sequence" widget="handle"/>
<field name="config_step_id"/>
<field name="attribute_line_ids"
domain="[('product_tmpl_id', '=', parent.id)]"
options="{'no_create': True, 'no_create_edit': True}"
widget="many2many_tags"/>
</tree>
</field>
<separator colspan="4" string="Configuration Images" name="configurator_images"/>
<field name="config_image_ids">
<tree editable="bottom" string="Configuration Images">
<field name="sequence" widget="handle"/>
<field name="name"/>
<field name="value_ids" widget="many2many_tags" context="{'_cfg_product_tmpl_id': parent.id}"/>
<field name="image_1920" widget="image" height="30px"/>
</tree>
</field>
<field name="attribute_line_val_ids" invisible="1"/>
<field name="attribute_value_line_ids" invisible="1">
<tree string="Attribute value lines" editable="bottom" context="{'default_product_tmpl_id': self.id}">
<field name="product_tmpl_id" invisible="1"/>
<field name="attribute_id" invisible="1"/>
<field name="sequence" widget="handle"/>
<field name="value_id"
domain="[('id', 'in', parent.attribute_line_val_ids)]"/>
<field name="value_ids"
domain="[
('id', 'in', parent.attribute_line_val_ids),
('attribute_id', '!=', attribute_id)
]" widget="many2many_tags"/>
</tree>
</field>
<separator string="Variant Name" colspan="4" groups="product_configurator.group_product_configurator_manager"/>
<field name="mako_tmpl_name" groups="product_configurator.group_product_configurator_manager"/>
</page>
</xpath>
<xpath expr="//field[#name='default_code']" position="attributes">
<attribute name="attrs">{'invisible': [('config_ok','=',True)]}</attribute>
</xpath>
</field>
</record>
<record id="product_template_search_view" model="ir.ui.view">
<field name="name">product.configurator.product.template.search.view</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_search_view"/>
<field name="arch" type="xml">
<xpath expr="//filter[#name='filter_to_sell']" position="after">
<separator/>
<filter string="Standard Products" name="filter_standard_products" domain="[('config_ok','=',False)]"/>
<filter string="Configurable Products" name="filter_config_ok" domain="[('config_ok','=',True)]"/>
</xpath>
</field>
</record>
<record id="template_view_tree_configurable" model="ir.ui.view">
<field name="name">product.template.product.tree</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_tree_view"/>
<field name="arch" type="xml">
<xpath expr="//field[#name='default_code']" position="attributes">
<attribute name="invisible">context.get('default_config_ok', 0)</attribute>
</xpath>
</field>
</record>
<record id="product_template_kanban_view_inherited" model="ir.ui.view">
<field name="name">Product.template.product.kanban</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_kanban_view"/>
<field name="arch" type="xml">
<xpath expr="//kanban" position="inside">
<field name="config_ok"/>
</xpath>
<xpath expr="//div/div[2]" position="before">
<div class="pull-right" groups="product_configurator.group_product_configurator" attrs="{'invisible': [('config_ok', '=', False)]}">
<a name="configure_product" type="object">
<i class="fa fa-wrench fa-lg"></i>
</a>
</div>
</xpath>
</field>
</record>
<record id="product_form_view_custom_vals_inherit" model="ir.ui.view">
<field name="name">product.configurator.form.view.custom.vals</field>
<field name="model">product.product</field>
<field name="inherit_id" ref="product.product_normal_form_view"/>
<field name="arch" type="xml">
<xpath expr='//header' position="inside">
<button string="Variant Prices" type="object"
name="get_product_attribute_values_action"
attrs="{'invisible': ['|', ('product_template_attribute_value_ids', '=', False), ('config_ok', '=', False)]}"
groups="product_configurator.group_product_configurator_manager"/>
<button name="reconfigure_product" groups="product_configurator.group_product_configurator"
class="oe_highlight"
type="object"
string="Reconfigure Product"
attrs="{'invisible': [('config_ok','=',False)]}"/>
</xpath>
<xpath expr="//button[#name='toggle_config']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<xpath expr="//div[#name='options']" position="inside">
<field name="config_preset_ok" attrs="{'invisible': [('config_ok', '=', False)]}"/>
<label for="config_preset_ok" attrs="{'invisible': [('config_ok', '=', False)]}"/>
</xpath>
</field>
</record>
<record id="product_variant_easy_edit_view_inherit" model="ir.ui.view">
<field name="name">product.product.view.form.easy</field>
<field name="model">product.product</field>
<field name="inherit_id" ref="product.product_variant_easy_edit_view"/>
<field name="mode">primary</field>
<field name="arch" type="xml">
<xpath expr="//field[#name='active']" position="after">
<field name="config_ok" invisible="1"/>
<field name="config_preset_ok" attrs="{'invisible': [('config_ok', '=', False)]}"/>
</xpath>
<xpath expr="//field[#name='weight']" position="attributes">
<attribute name="attrs">{'readonly': [('config_ok', '=', True)]}</attribute>
</xpath>
</field>
</record>
<record id="product_kanban_view_inherited" model="ir.ui.view">
<field name="name">Product Kanban</field>
<field name="model">product.product</field>
<field name="inherit_id" ref="product.product_kanban_view"/>
<field name="arch" type="xml">
<xpath expr="//kanban" position="inside">
<field name="config_ok"/>
</xpath>
<xpath expr="//div/div[2]/strong[hasclass('o_kanban_record_title')]" position="after">
<div class="pull-right" groups="product_configurator.group_product_configurator" attrs="{'invisible': [('config_ok', '=', False)]}">
<a name="reconfigure_product" type="object" class="fa fa-repeat fa-lg">
</a>
</div>
</xpath>
</field>
</record>
</data>
</odoo>
Thank you in advance
There can be multiple reasons for this error:
If you haven't tried basic solution, first solution:
Activate developer mode
Open users and set filter to display
Inactive Set OdooBot as an internal user
Second solution: explicitly add xpath for missing field abov attribue xpath.
<xpath expr="//header/button[#name='action_update_quantity_on_hand']" position="before">
<field name="config_ok" />
</xpath>
Let me know, if any of above don't work.

How to use XPath in Odoo

I having some problem in Odoo
<record id="lunch_order_view_form" model="ir.ui.view">
<field name="name">lunch.order.form</field>
<field name="model">lunch.order</field>
<field name="arch" type="xml">
<form string='Orders Form' class="o_lunch">
<header>
<button name="%(action_lunch_order_line_lucky)d" type="action" string="Feeling Lucky" class="oe_highlight"/>
<!-- HERE THAT I WANT TO ADD -->
And then I use
<record id="lunch_order_view_form" model="ir.ui.view">
<xpath expr="/lunch/views/lunch_views/field[#name='arch']" position="after">
<button name="%(action_lunch_order_line_favorite)d" type="action" string="Favorite Menu" />
hello
</xpath>
</record>
but it now works how to define it?
If header is already define in your parent form view , you can inherit it as below:
<record id="lunch_order_view_form_inherit" model="ir.ui.view">
<field name="name">lunch.order.form.inherit</field>
<field name="model">lunch.order</field>
<field name="inherit_id" ref="parent_form_module_name.lunch_order_view_form"/>
<field name="arch" type="xml">
<xpath expr="//header" position="inside">
<button name="%(action_lunch_order_line_favorite)d" type="action" string="Favorite Menu" />
</xpath>
</field>
</record>
You can replace parent_form_module_name with actual module name where you have define parent form.

Condition to display a header button only after a customer have been saved

I have tried so many ways to display "Offer Letter" button only when a customer is saved. But it seems i am not getting the condition right here:
<xpath expr="//form/*" position="before">
<header>
<button name="offer_letter" string="Offer Letter" type="object" class="oe_highlight"
attrs="{'invisible':[('what condition?')]}"/>
</header>
</xpath>
Below is my code snippet:
The Model:
class res_partner(models.Model):
_inherit = 'res.partner'
baf = fields.Boolean("Application Form", help="Specify customer who bought application form")
#api.multi
def offer_letter_method(self):
return self.env['report'].get_action(self, 'sales_custom.offer_letter_view')
The View:
<record model="ir.ui.view" id="customer_custom_form_view">
<field name="name">customer.custom</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<xpath expr="//form/*" position="before">
<header>
<button name="offer_letter" string="Offer Letter" type="object" class="oe_highlight"
attrs="{'invisible':[('what condition?')]}"/>
</header>
</xpath>
<xpath expr="//field[#name='name']" position="after">
<field name="baf"/>
<label for="baf"/>
</xpath>
</field>
</record>
Kindly assist.
You should try as following :
<record model="ir.ui.view" id="customer_custom_form_view">
<field name="name">customer.custom</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<xpath expr="//form/*" position="before">
<header>
<button name="offer_letter" string="Offer Letter" type="object" class="oe_highlight"
attrs="{'invisible':[('id','=',False)]}"/>
<field name="id" invisible="1"/>
</header>
</xpath>
<xpath expr="//field[#name='name']" position="after">
<field name="baf"/>
<label for="baf"/>
</xpath>
</field>
</record>

OpenERP - Page referenced in xpath not found in parent view

I have the following code in my xml view file that inherits from another view:
<xpath expr="//notebook/page[#string='Accounting']/group" position="replace"></xpath>
but it gives me the error:
Element "'<xpath expr="//notebook/page[#string='Accounting']/group">'" cannot be located in parent view
although the 'Accounting' tab is in the parent view. What I am doing wrong? Thanks for your help.
Here is the view I inherited from:
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="product_template_form_view" model="ir.ui.view">
<field name="name">product.template.form.inherit</field>
<field name="model">product.template</field>
<field name="priority">5</field>
<field name="inherit_id" ref="product.product_template_form_view"/>
<field name="arch" type="xml">
<page string="Sales" position="after">
<page string="Accounting" groups="account.group_account_invoice">
<group>
<label for="categ_id" string="Internal Category"/>
<div><field name="categ_id" colspan="3" nolabel="1"/></div>
</group>
<group name="properties">
<group>
<field name="property_account_income" domain="[('type','=','other')]" groups="account.group_account_user"/>
<field name="taxes_id" colspan="2" widget="many2many_tags"/>
</group>
<group>
<field name="property_account_expense" domain="[('type','=','other')]" groups="account.group_account_user"/>
<field name="supplier_taxes_id" colspan="2" widget="many2many_tags"/>
</group>
</group>
</page>
</page>
</field>
</record>
<record id="product_template_search_view" model="ir.ui.view">
<field name="name">product.template.search</field>
<field name="model">product.template</field>
<field name="mode">primary</field>
<field name="inherit_id" ref="product.product_template_search_view"/>
<field name="arch" type="xml">
<field name="product_variant_ids" position="after">
<field name="categ_id"/>
</field>
<xpath expr="//group[#string='Group by...']" position="inside">
<filter string='Category' icon="terp-stock_symbol-selection" domain="[]" context="{'group_by' : 'categ_id'}"/>
</xpath>
</field>
</record>
<record id="view_category_property_form" model="ir.ui.view">
<field name="name">product.category.property.form.inherit</field>
<field name="model">product.category</field>
<field name="inherit_id" ref="product.product_category_form_view"/>
<field name="arch" type="xml">
<data>
<xpath expr="//group[#name='parent']" position="inside">
<group name="account_property" string="Account Properties" colspan="2">
<field name="property_account_income_categ" domain="[('type','<>','view'),('type','<>','consolidation')]"/>
<field name="property_account_expense_categ" domain="[('type','<>','view'),('type','<>','consolidation')]"/>
</group>
</xpath>
</data>
</field>
</record>
</data>
</openerp>
and here is the view that inherited previous view and gave me the error:
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="product_config_form_view" model="ir.ui.view">
<field name="name">product.config.form.view</field>
<field name="model">product.template</field>
<field name="type">form</field>
<field name="inherit_id" ref="product.product_template_only_form_view" />
<field name="arch" type="xml">
<label for="name" position="replace">
<label for="name" invisible="1"/>
</label>
<field name="name" position="replace">
<div style="font-size:10pt;">
<label for="class_id" string="Item Class" />
</div>
<div style="font-size:10pt;">
<field name="class_id" colspan="3" nolabel="1" on_change="onchange_class_id(class_id)"
/> </div>
<div style="font-size:10pt;">
<label for="name" string="Item Description"/>
</div>
<div style="font-size:10pt;" >
<field name="name" colspan="3" nolabel="1"/>
</div>
</field>
<field name="default_code" position="replace" >
<field name="default_code" string="Item Number" />
</field>
<xpath expr="//notebook/page[#string='Accounting']/group" position="replace">
</xpath>
</field>
</record>
<record id="product_config_tree_view" model="ir.ui.view">
<field name="name">product.config.tree.view</field>
<field name="model">product.class</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Product">
<field name="default_code" string="Class ID" colspan="3" nolabel="1" />
<field name="name" string="Class Description" colspan="3" nolabel="1"/>
</tree>
</field>
</record>
<record id="class_search_view" model="ir.ui.view">
<field name="name">class.search.view</field>
<field name="model">product.class</field>
<field name="arch" type="xml">
<search string="Class">
<field name="name" string="Class Description" filter_domain="['|',('default_code','ilike',self),
('name','ilike',self)]" />
</search>
</field>
</record>
</data>
</openerp>
You start your xpath expression with //notebook.
So your xpath selects all notebook elements, regardless of where they appear in the document.
But I don't see any xml tag that contains notebook.
This expression:
<xpath expr="//page[#string='Accounting']/group" position="replace"></xpath>
selects all the group elements under:
<page string="Accounting" groups="account.group_account_invoice">

How do I make a new tree view for res.partner without inheriting the default tree?

I need to make an alternate tree view for res.partner.
This is my code
<record id="custom_res_partner_tree_view" model="ir.ui.view">
<field name="name">CUSTOM</field>
<field name="model">res.partner</field>
<field eval="1" name="priority"/>
<field name="arch" type="xml">
<tree string="Contacts">
<field string="1" name="custom_field1"/>
<field string="2" name="custom_field2"/>
<field string="3" name="name"/>
<field string="4" name="street"/>
<field string="5" name="phone"/>
<field string="6" name="email"/>
</tree>
</field>
</record>
.......
<record model="ir.actions.act_window.view" id="custom_res_partner_tree_view_action">
<field eval="2" name="sequence"/>
<field name="view_mode">tree</field>
<field name="view_id" ref="custom_res_partner_tree_view"/>
<field name="act_window_id" ref="custom_res_partner_action"/>
</record>
The code above works, but it behaves like it inherits the original tree view. It shows the columns which I don't specify. How do I make a completely new tree?
Additional details:
custom_res_partner.py
from osv import osv,fields
class custom_res_partner(osv.osv):
def _account_default(self, cr ,uid, context=None):
obj= self.pool.get('account.account')
ids = obj.search(cr, uid, [])
if(len(ids)>0):
return ids[0]
else:
return None
_name = "res.partner"
_inherit = "res.partner"
_columns = {
}
_defaults = {
'property_account_receivable' : _account_default,
'property_account_payable' : _account_default,
}
_sql_constraints = [
]
def init(self, cr):
pass
custom_res_partner()
custom_res_partner_view.xml
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<record id="custom_res_partner_tree_view" model="ir.ui.view">
<field name="name">Customer</field>
<field name="model">res.partner</field>
<field eval="10" name="priority"/>
<field name="arch" type="xml">
<tree string="Contacts">
<field string="KTP" name="ktp"/>
<field string="NPWP" name="npwp"/>
<field string="Name" name="name"/>
<field string="Address" name="street"/>
<field string="Telephone" name="phone"/>
<field string="Email" name="email"/>
</tree>
</field>
</record>
<record id="custom_res_partner_kanban_view" model="ir.ui.view">
<field name="name">res.partner.kanban.custom</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.res_partner_kanban_view" />
<field name="arch" type="xml">
<xpath expr="/kanban/field[#name='color']" position="after">
<field name="npwp" />
</xpath>
</field>
</record>
<record id="custom_res_partner_form_view" model="ir.ui.view">
<field name="name">res.partner.form</field>
<field name="model">res.partner</field>
<field eval="1" name="priority" />
<field name="arch" type="xml">
<form string="Customer" version="7.0">
<header></header>
<sheet>
<field name="image" widget='image' class="oe_left oe_avatar" options='{"preview_image": "image_medium", "size": [90, 90]}'/>
<div class="oe_title">
<div class="oe_edit_only">
<label for="name" string="Name"/>
</div>
<h1>
<field name="name" default_focus="1" placeholder="Nama" />
</h1>
<div class="oe_edit_only">
<label for="ktp" string="KTP"/>
</div>
<h1>
<field name="ktp" placeholder="KTP" />
</h1>
<div class="oe_edit_only">
<label for="npwp" string="NPWP"/>
</div>
<h1>
<field name="npwp" placeholder="NPWP" />
</h1>
</div>
<group>
<group>
<label for="street" string="Address"/>
<div>
<field name="street" placeholder="Address 1"/>
<field name="street2" placeholder="Address 2"/>
<div class="address_format">
<field name="city" placeholder="City" style="width: 40%%"/>
<field name="state_id" class="oe_no_button" placeholder="State" style="width: 37%%" options='{"no_open": True}' on_change="onchange_state(state_id)"/>
<field name="zip" placeholder="Zip" style="width: 20%%"/>
</div>
<field name="country_id" placeholder="Country" class="oe_no_button" options='{"no_open": True}'/>
</div>
</group>
<group>
<field name="phone" placeholder="misal +62224281110"/>
<field name="mobile"/>
<field name="fax"/>
<field name="email" widget="email"/>
</group>
</group>
</sheet>
<div class="oe_chatter"></div>
</form>
</field>
</record>
<record id="custom_res_partner_action" model="ir.actions.act_window">
<field name="name">Customer</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">res.partner</field>
<field name="view_type">form</field>
<field name="view_mode">kanban,tree,form</field>
<field name="context">{"search_default_customer":1}</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
bla bla bla
</p>
</field>
</record>
<record model="ir.actions.act_window.view" id="custom_res_partner_kanban_view_action">
<field eval="1" name="sequence"/>
<field name="view_mode">kanban</field>
<field name="view_id" ref="custom_res_partner_kanban_view"/>
<field name="act_window_id" ref="custom_res_partner_action"/>
</record>
<record model="ir.actions.act_window.view" id="custom_res_partner_tree_view_action">
<field eval="2" name="sequence"/>
<field name="view_mode">tree</field>
<field name="view_id" ref="custom_res_partner_tree_view"/>
<field name="act_window_id" ref="custom_res_partner_action"/>
</record>
<record model="ir.actions.act_window.view" id="custom_res_partner_form_view_action">
<field eval="3" name="sequence"/>
<field name="view_mode">form</field>
<field name="view_id" ref="custom_res_partner_form_view"/>
<field name="act_window_id" ref="custom_res_partner_action"/>
</record>
<menuitem id="menu_partner_form" parent="base.menu_sales" action="custom_res_partner_action" sequence="1"/>
</data>
</openerp>
Turns out the cause was because of this <field name="name">CUSTOM</field>. Coincidentally I changed content here to CUSTOM while in my original code it was still Customer. It somehow indicates that I inherited the original view. I don't know what's the purpose of the inherit_id then. But after I changed the name it works fine.