Inherit view and adding fields

2024/10/15 5:17:22

enter image description hereI want to add my 2 fields boatlenght and fuelcapacity under price list in product form view but they are not showing up. What did i miss.

    <?xml version="1.0" encoding="utf-8"?><openerp><data><!-- Inherit Form View to Modify it --><record id="product_product_template_only_form_view" model="ir.ui.view"><field name="model">product.product</field><field name="inherit_id" ref="product.product_template_only_form_view"/><field name="arch" type="xml"><field name="list_price" position="after"><field name="boatlenght"/><field name="fuelcapacity"/></field></field></record></data></openerp>from openerp import models, fields, apiclass ProductProduct(models.Model):_inherit = 'product.product'boatlenght = fields.Char(string="Lenght of the Boat", required=False, )fuelcapacity = fields.Char(string="Fuel Capacity", required=False, )
Answer

Try

<record id="product_product_template_only_form_view" model="ir.ui.view"><field name="model">product.product</field><field name="inherit_id" ref="product.product_template_only_form_view"/><field name="arch" type="xml"><xpath expr="//field[@name='list_price']" position="after"><field name="boatlenght"/><field name="fuelcapacity"/></xpath></field></record>

In order to insert the field properly you use an xpath expression to insert it on the DOM.

Check the documentation.

https://en.xdnf.cn/q/117870.html

Related Q&A

Linux and python: Combining multiple wave files to one wave file

I am looking for a way that I can combine multiple wave files into one wave file using python and run it on linux. I dont want to use any add on other than the default shell command line and default py…

How does the in operator determine membership? [duplicate]

This question already has answers here:Set "in" operator: uses equality or identity?(5 answers)Closed 7 years ago.How does the in operator work for Python? In the example below I have two n…

Python Automatically ignore unicode string

Ive been searching to automatically import some files but since Im on Windows i got the unicode error (because of the "C:\Users\..."). Ive been looking to correct this error and found some h…

How to obtain currency rates from this website converter widget python

How can I implement the currency rates on this website and keep the currencies up to date so that i can access them in python from this website and input and output values and currencies types. I need …

Trying to add sums from a csv file in python

I need to add sums of a csv file. The program is a test for a travel reservation system and the file reads like this:availableSTART,reservations,cancellations,availableEND 20,1,0,18I need to subtract r…

Numerical patterns in Python3 [duplicate]

This question already has answers here:How to print without a newline or space(30 answers)Closed 7 years ago.Im fairly new to programming, i have to start learning it for Uni.I have to make a pattern a…

setsockopt before connect for reactor.connectTCP

I have a small python client which needs a setsockopt after create_socket, but before connect. The non-twisted python code is as follows. How can this be expressed in a twisted environment?create_sock…

Manage quotation marks in XPath (lxml)

I want to extract web elements from the table MANUFACTURING AT A GLANCE in the given website. But the name of the row has (single quote). This is interfering with my syntax. How do I overcome this iss…

exception capture in threads and parent

How do you nicely capture exceptions in Python threads?If you have a threaded python app sys.excepthook does not capture errors in children.When a child raises an exception the parent will continue to…

Writing a program that compares 2 numbers in Python [closed]

Its difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying thi…