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
Field name: x_testfield Field Label: Test Field Type: Float
Is that the way the name is spelled in the xml view? <field name="x_testField" />
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?
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.
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/
Yes, my problem is occurring when I am in developer mode and I go into Manage Views and attempt to add the field.
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
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?
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.
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