问题标签 [one2many]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
mysql - 表连接问题 - 一对多关系问题
我有两个由唯一字段“drive_id”连接的表。每个 drive_id 可以有一个或多个 shift_ID,但班次只存储在一个表中。投影数据由表 1 中的“shift_id”存储,产品数据由表 2 中的“drive_id”存储。
我可以获得 drive_id 的详细信息以准确报告,但是当我尝试对所有 drive_id 进行总计时,由于表 1 中加入了两个班次,我得到了两倍的产品。
数据如下所示:
桌子 | drive_id | shift_id | 预计 | 实际的 | QNS | 延期 |
---|---|---|---|---|---|---|
drive_actuals | 47058 | 不存在 | 0 | 57 | 3 | 8 |
drive_actuals | 47532 | 不存在 | 0 | 23 | 1 | 2 |
drive_proj | 47058 | 43203 | 25 | 不存在 | 不存在 | 不存在 |
drive_actuals | 47058 | 29575 | 25 | 不存在 | 不存在 | 不存在 |
drive_actuals | 475352 | 39690 | 20 | 不存在 | 不存在 | 不存在 |
这是所需的输出:
Drive_id | 项目 | 实际的 | QNS | 延期 |
---|---|---|---|---|
47058 | 50 | 57 | 3 | 8 |
47532 | 20 | 23 | 1 | 2 |
全部的 | 70 | 80 | 4 | 10 |
这是我得到的:
Drive_id | 项目 | 实际的 | QNS | 延期 |
---|---|---|---|---|
47058 | 50 | 57 | 3 | 8 |
47532 | 20 | 23 | 1 | 2 |
全部的 | 70 | 137 | 7 | 18 |
由于两个班次,驱动器 47058 的实际、QNS 和延期的总数是两倍。
如何让实际值只返回详细行和总行中的一行?
python - Odoo - Iterate through field, take the values and put them in a new field
Hay I am new to Odoo Customizing and Python and wanted to know how I can iterate through a field and take the values out of the field and put them in a new one.
The field I want to iterate through contains multiple email adresses. I want to iterate through these email adress fields, collect the email adresses and store them together in a new field.
For that I need a function.
The field I want to iterate through: My One2many field contains multiple mail adresses which I want to iterate through and collect.
The field I want to store the collected email adresses in:
This is my class: I want to collect all the email adresses from the mail_contacts field.
My Try: This function collects only the last set record of the field_contacts_customer_info
field and puts this record in the selected_email field of every company.So it does not work right. It should collect all the mails of the field_contacts_customer_info
field for every company seperated and then put them in the selected_mail
field of the belonging company.
Thanks.
odoo - 在 One2many 字段 onchange 上添加值
我正在尝试在我的 one2many 字段 onchange 中添加值。我尝试使用[(0,0, {values})]
但没有任何反应。关于如何实施它的任何想法?
user-interface - Odoo13:在 UI 中嵌套 One2many 字段
各位同事,下午好
我正在尝试为包含深度 = 2 的嵌套 One2many 字段的模型创建适当的表单 UI。这是缩短的代码清单:
它们之间的关系:
ModelA --- v_set ---> ModelB --- 测量 ---> ModelC
这是当前的 UI XML 实现:
当我打开此表单时出现问题:它只显示嵌套字段的 ID,而不是“嵌套”字段('etalon_value'、'value'、'abs_error'、'max_error')。你可以在那里看到它:
这是点击“parent”-s ID 行后出现的表单:
我梦想让“嵌套”字段('etalon_value'、'value'、'abs_error'、'max_error')以 parent-s 形式出现,而不仅仅是 ID,如第一个链接所示。
你能否给我一些关于如何实现它的提示。