Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
517 มุมมอง
I want to add a field that I added via the inherit account.analytic.line model in the page_timesheets notebook in the project.task module

here is my inherit view:

<record id="project_task_timesheet_ids_view_tree_inherit" model="ir.ui.view">

<field name="name">project.task.timesheet.ids.view</field>

<field name="model">account.analytic.line</field>

<field name="inherit_id" ref="hr_timesheet.view_task_form2_inherited"/>

<field name="arch" type="xml">

<xpath expr="//notebook/page[@name='page_timesheets']" position="inside">

<button name="start_timer" type="object" string="Start" class="btn btn-success" invisible="state_done == True" icon="fa-solid fa-play"/>

<button name="start_pouse" type="object" string="Pause" class="btn btn-info" invisible="state_done == True" icon="fa-solid fa-pause"/>

<button name="end_pouse" type="object" string="Resume" class="btn btn-info" invisible="state_done == True" icon="fa-solid fa-play"/>

<button name="stop_timer" type="object" string="Stop" class="btn btn-danger" invisible="state_done == True" icon="fa-solid fa-stop"/>

</xpath>

</field>

</record>

here is my model:

from odoo import models, fields, api


class AccountAnalyticLineInherit(models.Model):

_inherit = 'account.analytic.line'

_description = 'Account Analytic Line Inherit'


start_time = fields.Float(string="Start time")

pouse_time = fields.Float(string="Pause time")

stop_time = fields.Float(string="Stop time")

but i get an error:

raise ParseError(msg) from None  # Restart with "--log-handler odoo.tools.convert:DEBUG" for complete traceback
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
odoo.tools.convert.ParseError: while parsing /home/mangandaralam-sakti/odoo/odoo18c/custom_addons/timesheets_timer/views/account_analytic_line_inherit_view.xml:25
Error while validating view near:

<form string="Task" class="o_form_project_tasks" js_class="project_task_form">
                    <field name="recurrence_id" invisible="1"/>
                    <field name="allow_task_dependencies" invisible="1"/>

Field `recurrence_id` does not exist

how to fix it?


อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hello Mangandaralam Sakti,

​Can you please share screenshot of exactly in which place add fields or button of it

Thanks You.

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

are you sure the field "recurrence_id" available in the python code? 

the field used in xml file "custom_addons/timesheets_timer/views/account_analytic_line_inherit_view.xml"

อวตาร
ละทิ้ง