2014-09-24 2 views
4

OpenERP 7.0과 협력하고 있습니다. 아래의 코드는 파일에서입니다 addons/project/security/project_security.xmlOpenERP/Odoo 모델 관계 XML 구문

숫자 4, 6 및 0의 출처는 어디에서 설명 해주시겠습니까? 문서의 어느 부분에서 이에 대해 문의 할 수 있습니까?

<record id="group_project_user" model="res.groups"> 
    <field name="name">User</field> 
    <field name="category_id" ref="base.module_category_project_management"/> 
</record> 

<record id="group_project_manager" model="res.groups"> 
    <field name="name">Manager</field> 
    <field name="category_id" ref="base.module_category_project_management"/> 
    <field name="implied_ids" eval="[(4, ref('group_project_user'))]"/> 
    <field name="users" eval="[(4, ref('base.user_root'))]"/> 
</record> 

<record model="ir.ui.menu" id="base.menu_definitions"> 
    <field name="groups_id" eval="[(6,0,[ref('group_project_manager')])]"/> 
</record> 

답변

11

many2many field의 경우 튜플 목록이 필요합니다. 여기 대응 의미론으로 허용되는 튜플의리스트는 다음과 one2many 필드의

(0, 0, { values }) link to a new record that needs to be created with the given values dictionary 
(1, ID, { values }) update the linked record with id = ID (write *values* on it) 
(2, ID)    remove and delete the linked record with id = ID (calls unlink on ID, that will delete the object completely, and the link to it as well) 
(3, ID)    cut the link to the linked record with id = ID (delete the relationship between the two objects but does not delete the target object itself) 
(4, ID)    link to existing record with id = ID (adds a relationship) 
(5)     unlink all (like using (3,ID) for all linked records) 
(6, 0, [IDs])   replace the list of linked IDs (like using (5) then (4,ID) for each ID in the list of IDs) 

Example: 
[(6, 0, [8, 5, 6, 4])] sets the many2many to ids [8, 5, 6, 4] 

튜플들의리스트가 예상된다.

(0, 0, { values }) link to a new record that needs to be created with the given values dictionary 
(1, ID, { values }) update the linked record with id = ID (write *values* on it) 
(2, ID)    remove and delete the linked record with id = ID (calls unlink on ID, that will delete the object completely, and the link to it as well) 

Example: 
[(0, 0, {'field_name':field_value_record1, ...}), (0, 0, {'field_name':field_value_record2, ...})] 

나는이 의심

감사 그리고 감사합니다

+0

가 대단히 야신 감사를 지 웁니다 희망 : 여기에 대응하는 의미로 받아 들여진다 튜플의 목록입니다. 귀하의 설명은 매우 분명합니다. 내가 어떻게 알 수 있는지 알려 주시면 고맙겠습니다. 나는 그 자체로 배울 수있는 공식 문서가 있기를 바랍니다. 어쨌든, 당신의 대답은 이미 저에게 많은 도움이됩니다. : D –

+2

ORM 모델 및 방법에 따라 Odoo.com의 설명서를 확인하십시오. 마술 숫자는 이상한 일이지만 코드를 저장합니다. –

+2

Adrian에게 안내해 주셔서 감사합니다. 나는 그것을 여기에서 발견했다. [https://doc.odoo.com/6.0/developer/2_5_Objects_Fields_Methods/methods/](https://doc.odoo.com/6.0/developer/2_5_Objects_Fields_Methods/methods/) –