Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
2 Odpowiedzi
1743 Widoki

Hi all, 

this is my python code:

class project_Task(models.Model):
_inherit = 'project.task'

lead_id = fields.Many2one(comodel_name='crm.lead', string='Opportunity', track_visibility='onchange')

I want to show it in the form view of project tasks. Here is my xml:

xml version="1.0" encoding="utf-8"?>


id="view_project_task_form_inherit" model="ir.ui.view">
name="name">project.task.form.inherit
name="model">project.task
name="inherit_id" ref="project.view_task_form2" />
name="arch" type="xml">

name="lead_id" position="after">





somehow I get an error:

odoo.tools.convert.ParseError: while parsing task_from_lead/views/task_from_lead_task_view.xml:5, somewhere inside

project.task.form.inherit

...


What is the issue? 

(The file is named in the __manifest__ file.)



Thanks in advance!

Friedrich

Awatar
Odrzuć
Najlepsza odpowiedź

Hi Friedrich Sauer,

can you send perfect code of your form view so i identify issue. 

  • can you try this way after project id field add your lead_id field.
  • Also use XPath using specific field after or before add.
  • i try in my project its complete work 


Thank you.

Awatar
Odrzuć

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="view_project_task_form_inherit" model="ir.ui.view">
<field name="name">project.task.form.inherit</field>
<field name="model">project.task</field>
<field name="inherit_id" ref="project.view_task_form2" />
<field name="arch" type="xml">
<xpath expr="//form" position="inside">
<field name="lead_id" />
</xpath>
</field>
</record>
</data>
</odoo>

sorry, that did not work but here is the xml in a txt file https://drive.google.com/drive/folders/1vCBP-NQr-NC4mSiucrUINQgPaLnGCBB0?usp=drive_link

Thanks in advance!

Autor

Hi Nikhil, I switched accounts on accident 'Alberts' comments were mine too!
https://drive.google.com/drive/folders/1vCBP-NQr-NC4mSiucrUINQgPaLnGCBB0?usp=drive_link

hii can you check my latest answer.

Autor Najlepsza odpowiedź

Hi Nikhil, 

it works now, thank you! 

Can you tell when to use and when to use xpath?


Best 

Friedrich

Awatar
Odrzuć

Hi Friedrich Sauer,
Sure, let's say
1. when you define any position your field like in odoo form view so you need to define xpath expression so it locate specific locations,

you need more understand then check this
https://www.scientecheasy.com/2019/08/xpath-axes.html/

Thank you.

Autor

Thanks Nikhil!

Powiązane posty Odpowiedzi Widoki Czynność
2
sie 24
2806
2
sty 24
935
1
lis 23
1312
1
gru 24
3444
0
mar 24
904