Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

How to make a field from Sale Order form Line Item invisible by inheriting view_order_form in my custom module?

By
Francisco Luz
on 7/1/14, 10:09 AM 875 views

I am following the instructions at Inheritance in Views but am having trouble.

In my custom module I have created a xml file which its content can be seen here.

I am trying to make invisible the tax_id column in the line item at the sale order form.

The custom xml file is producing no changes on the targed form view whatsoever. I have taken the following precautions:

  • Restarted the server
  • Updated my custom module at Settings -> Installed Modules
  • Tested the xpath path parameter. It does point to the targeted field
  • Hacked into the core xml file at ../openerp/server/addons/sale/sale_view.xml beforehand to make sure I was trying to alter the right form view.

I keep getting the error "ValidateError: Error occurred while validating the field(s) arch: Invalid XML for View Architecture!"

0
Francisco Luz
On 7/1/14, 7:02 PM

The solution could not be more trivial. Apparently you must declare dependency of those modules, or the module, which originally created the xml view you are trying to alter.

In my particular case, I just added dependency of sale, stock and procurement into my module manifest ( __openerp__.py ) and BANG! It worked beautilly. A lesson learned in the hard way though.

0

Serpent Consulting Services Pvt. Ltd.

--Serpent Consulting Services Pvt. Ltd.--
4341
| 6 6 8
Gandhinagar, India
--Serpent Consulting Services Pvt. Ltd.--

Serpent Consulting Services Pvt. Ltd. Your Odoo/OpenERP Solution, just an email away!

Serpent Consulting Services Pvt. Ltd.
On 7/1/14, 10:55 AM

Francisco,

The line <field name="tax_id" position="replace"/> will not work because the order does not have tax_id field.

If it has, try to reach to the field by xpath.

In order to know the xact error, please check your server long and see what it contains.

Thanks.

The error message issue has being resolved but I am stuck still. The sale order object indeed does not have the tax_id but the form view does. Check out the file at ../openerp/server/addons/sale/sale_view.xml To further test what you said about why it should not work, I changed my targeted field to client_order_ref, which is a field that belongs to the sale order object. See my xml file content at https://gist.github.com/drupalista-br/4bf8facff175c1800908 The custom xml file is producing no changes on the targed form view whatsoever. I have taken the following precautions: * Restarted the server * Updated my custom module at Settings -> Installed Modules * Tested the xpath path parameter. It does point to the targeted field.

Francisco Luz
on 7/1/14, 5:14 PM

The view has the field tax_id, but it belongs to sale order line. You may take a route to that field using complete xpath(form/notebook/page/field/form/group) and I am sure it will work.

Serpent Consulting Services Pvt. Ltd.
on 7/2/14, 1:56 AM

My issue did not lie on the xml syntax but for not declaring a dependency to the sale and stock modules in the manifest file.

Francisco Luz
on 7/2/14, 7:31 PM

Alright, mentioning the dependency is first. Close the question if its resolved. Thanks.

Serpent Consulting Services Pvt. Ltd.
on 7/3/14, 1:41 AM

Why would I close the question? It might help someone else.

Francisco Luz
on 7/4/14, 12:12 PM

Meant, Close as solved by choosing an answer!

Serpent Consulting Services Pvt. Ltd.
on 7/4/14, 1:11 PM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 7/1/14, 10:09 AM
Seen: 875 times
Last updated: 3/16/15, 8:10 AM