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

Adding a field causing issues

By
Jamie Brunton
on 6/20/13, 9:06 AM 1,048 views

Hello,

I am trying to add a field to the leads form, that has been working fine "x_profit", when trying to have the profit field displayed in the reporting tree Lead/Opportunity analysis I am receiving an error when trying to save.

ValidateError

Error occurred while validating the field(s) arch: Invalid XML code in Arch fields of View!

If I then add a field inside the crm.lead.report, I then get a stack trace error saying "x_profit" cannot be found.

<?xml version="1.0"?>
<tree colors="blue:state == 'draft';black:state in ('open','pending','done');gray:state == 'cancel' " create="false" string="Opportunities Analysis">
        <field name="creation_year" invisible="1"/>
        <field name="creation_month" invisible="1"/>
        <field name="creation_day" invisible="1"/>
        <field name="deadline_month" invisible="1"/>
        <field name="section_id" invisible="1"/>
        <field name="user_id" invisible="1"/>
        <field name="partner_id" invisible="1"/>
        <field name="country_id" invisible="1"/>
        <field name="state" invisible="1"/>
        <field name="stage_id" invisible="1"/>
        <field name="priority" invisible="1"/>
        <field name="type_id" invisible="1"/>
        <field name="channel_id" invisible="1"/>
        <field name="type" invisible="1"/>
        <field name="company_id" invisible="1" groups="base.group_multi_company"/>
        <field name="nbr" string="#Opportunities" sum="#Opportunities"/>
        <field name="planned_revenue" sum="Planned Revenues"/>
        <field name="delay_open" sum="Delay to open"/>
        <field name="delay_close" sum="Delay to close"/>
        <field name="delay_expected"/>
        <field name="probability" widget="progressbar"/>
        <field name="probable_revenue"/>
        <field name="x_profit"/>
     </tree>
0
Tarun Behal
On 6/20/13, 1:35 PM

Hi Jamie,

The Lead Report and Lead Form are entirely different classes. You added a field on Lead Form but to see the x_profit view on Lead Report, you need to create a new field in Lead Report and in the Report Query add this field accordingly.

Can you link the fields easily?

Jamie Brunton
on 6/21/13, 11:00 AM

Yeah I've did that before.

Tarun Behal
on 6/21/13, 11:08 AM

Is it done via one to many or how would you link the values?

Jamie Brunton
on 6/21/13, 11:47 AM

Create a field x_profit (float) in crm.lead.report model. Then Goto openerp->addons->crm->crm_lead_report.py . There you will see what sql is getting executed when you are printing that report. After c.planned_revenue, add "c.x_profit". Modify the xml. This will get the job done. As a token of appreciation I would highly appreciate if you can just vote for my question regarding Sales Order Revision.

Tarun Behal
on 6/21/13, 12:19 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

0 follower(s)

Stats

Asked: 6/20/13, 9:06 AM
Seen: 1048 times
Last updated: 3/16/15, 8:10 AM