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

I am creating a custom field, but whenever I try to add it to my form, I get an error.

By
Amer Homaissi
on 3/11/14, 12:20 PM 1,183 views

I created a custom field named "Test Field" and while creating it I gave it a model of purchase.order

I am trying to create a custom field next to Subtotal in the Quotations and Purchase Order forms.

However, after creating the custom field in: Settings - Database Structures - Fields, while setting its Model to purchase.order, whenever I try adding it next to the Subtotal field on the Quotations form, I get an error that says the following:

"Error occurred while validating the field(s) arch: Invalid XML for View Architecture!"

I don't understand what the problem is and how to fix it.

Thank you for your help, in advance.

OQO

did you make sure the name of the field is spelled right? Custom fields require an "x_" before the name of the field. So the name should be x_test_field

Eric
on 3/11/14, 12:37 PM

Field name: x_testfield Field Label: Test Field Type: Float

Amer Homaissi
on 3/11/14, 2:07 PM

Is that the way the name is spelled in the xml view? <field name="x_testField" />

Eric
on 3/11/14, 2:10 PM

I couldn't find it in the xml view (purchase_view.xml), and I think it's because I haven't been able to create it into the form yet. Or is it supposed to be there?

Amer Homaissi
on 3/11/14, 2:13 PM

Yes, when you create a field in OpenERP, then you will need to add the field to the correct view. You can do that by adding the field tag like I have above, or you can also add it through the Developer Mode.

Eric
on 3/11/14, 2:21 PM

Here is a link that shows you how to add a field in Developer Mode http://openerpservice.in/how-to-add-new-field-in-open-erp-7-0/

Eric
on 3/11/14, 2:27 PM

Yes, my problem is occurring when I am in developer mode and I go into Manage Views and attempt to add the field.

Amer Homaissi
on 3/11/14, 2:30 PM

Ok. Make sure you are on the right form. Each form will belong to a model which will have its own fields you can use for it. So if you are modifying the Leads form, then you will need to make sure that the field you added belongs to the crm.leads model

Eric
on 3/11/14, 2:34 PM

Thank you for your help. I followed your steps and tried again and it gave me the same error. However, when I tried to do this elsewhere, it did not give me an error. I suspect that the problem might be because I am trying to add it to a tree. How can I add a custom field to a tree?

Amer Homaissi
on 3/11/14, 3:38 PM

If you are adding a field to a tree with the Developer Mode, it works the same as a form. When you click on Manage Views then see the list of forms to edit, select the one with the tree in it. Then you can add the field like you did in the form.

Eric
on 3/11/14, 4:02 PM

I would advise to create a custom module rather than adding fields through the Developer Mode though. If there ever is an upgrade, then all the fields that you added using the Developer Mode will get erased. When creating a new module that inherits an existing module, then the fields wont get erased if an upgrade is made. This is the preferred method

Eric
on 3/11/14, 4:05 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: 3/11/14, 12:20 PM
Seen: 1183 times
Last updated: 3/16/15, 8:10 AM