تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
2 الردود
1860 أدوات العرض

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

الصورة الرمزية
إهمال
أفضل إجابة

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.

الصورة الرمزية
إهمال

<?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!

الكاتب

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.

الكاتب أفضل إجابة

Hi Nikhil, 

it works now, thank you! 

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


Best 

Friedrich

الصورة الرمزية
إهمال

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.

الكاتب

Thanks Nikhil!

المنشورات ذات الصلة الردود أدوات العرض النشاط
2
أغسطس 24
3032
2
يناير 24
1058
1
نوفمبر 23
1450
1
ديسمبر 24
3694
0
مارس 24
988