Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
4996 Lượt xem

I'm working with models project.task that is related with account.analytic.line(task_id = fields.M2o('project.task')) and project.task.material(task_id = fields.M2o('project.task')) that is also related to project.task.

I now want to connect models account.analytic.line and project.task.material. So I added a field to account.analytic.line (material_id = fields.M2o('project.task.material'))

Now I extended the timesheets(account.analytic.line) view that is a tree view in a form view with the material_id.


<record id="account_analytic_line_task_extension_form_view" model="ir.ui.view">
    <field name="inherit_id" ref="hr_timesheet.view_task_form2_inherited" />
    <field name="model">project.task</field>
    <field name="arch" type="xml">
    <xpath expr="//field[@name='unit_amount']" position="after">
      <field name="material_id" domain="[('task_id', '=', id)]"/>
</xpath>
</field>
</record>

I want to show only the materials that are connected to the task, but none are shown?! How to create the filter so it will show the materials that are added to the task?

Modules user are project, hr_timesheet and custom app \https://www.odoo.com/apps/modules/10.0/project_task_material/

Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

I've figured it out. the domain filter has to be 

 domain="[('task_id', '=', parent.id)]"
Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 7 22
1545
0
thg 5 19
4110
2
thg 7 25
4531
2
thg 12 24
7699
2
thg 11 24
28443