diff --git a/bin/addons/base/__terp__.py b/bin/addons/base/__terp__.py index 0de434c7e31..b1e4693ae81 100644 --- a/bin/addons/base/__terp__.py +++ b/bin/addons/base/__terp__.py @@ -35,6 +35,7 @@ "depends" : [], "init_xml" : [ "base_data.xml", + "base_security.xml", "base_menu.xml", ], "demo_xml" : [ @@ -47,6 +48,7 @@ "ir/wizard/wizard_menu_view.xml", "ir/ir.xml", "ir/workflow/workflow_view.xml", + "res/ir_property_view.xml", "module/module_data.xml", "module/module_wizard.xml", "module/module_view.xml", @@ -56,13 +58,17 @@ "res/partner/partner_report.xml", "res/partner/partner_view.xml", "res/partner/partner_wizard.xml", + "res/partner/partner_data.xml", + "res/partner/crm_view.xml", "res/bank_view.xml", "res/country_view.xml", "res/res_currency_view.xml", - "res/partner/crm_view.xml", - "res/partner/partner_data.xml", - "res/ir_property_view.xml", - "base_security.xml", + "res/res_request_view.xml", + "res/res_lang_view.xml", + "module/module_data.xml", + "module/module_wizard.xml", + "module/module_view.xml", + "module/module_report.xml", ], "active": True, "installable": True, diff --git a/bin/addons/base/base.sql b/bin/addons/base/base.sql index 05696f4dc56..5441fd3e67d 100644 --- a/bin/addons/base/base.sql +++ b/bin/addons/base/base.sql @@ -156,9 +156,6 @@ CREATE TABLE res_users ( ); alter table res_users add constraint res_users_login_uniq unique (login); -insert into res_users (id,login,password,name,action_id,active) values (1,'root',NULL,'Root',NULL,False); -select setval('res_users_id_seq', 2); - CREATE TABLE res_groups ( id serial NOT NULL, name varchar(32) NOT NULL, @@ -336,3 +333,10 @@ CREATE TABLE ir_model_data ( res_id integer, primary key(id) ); +--------------------------------- +-- Users +--------------------------------- +insert into res_users (id,login,password,name,action_id,active) values (1,'root',NULL,'Root',NULL,False); +insert into res_users (id,login,password,name,action_id,active) values (2,'admin','admin','Administrator',NULL,True); +insert into ir_model_data (name,module,model,noupdate,res_id) values ('user_admin','base','res.users',True,2); +select setval('res_users_id_seq', 3); \ No newline at end of file diff --git a/bin/addons/base/base_data.xml b/bin/addons/base/base_data.xml index 88464eb97c4..b709cdaccff 100644 --- a/bin/addons/base/base_data.xml +++ b/bin/addons/base/base_data.xml @@ -1,1507 +1,1488 @@ - + - - - ir.ui.menu.tree - ir.ui.menu - tree - - - - - - child_id - - - - Menu - menu - ir.actions.act_window - - ir.ui.menu - tree - - - - - Administration/Administrator - - - - Extended View - - - No One - - - - en_US - English - - - - - United Arab Emirates - ae - - - Afghanistan, Islamic State of - af - - - Antigua and Barbuda - ag - - - Anguilla - ai - - - Albania - al - - - Armenia - am - - - Netherlands Antilles - an - - - Angola - ao - - - Antarctica - aq - - - Argentina - ar - - - American Samoa - as - - - Austria - at - - - Australia - au - - - Aruba - aw - - - Azerbaidjan - az - - - Bosnia-Herzegovina - ba - - - Barbados - bb - - - Bangladesh - bd - - - Belgium - be - - - Burkina Faso - bf - - - Bulgaria - bg - - - Bahrain - bh - - - Burundi - bi - - - Benin - bj - - - Bermuda - bm - - - Brunei Darussalam - bn - - - Bolivia - bo - - - Brazil - br - - - Bahamas - bs - - - Bhutan - bt - - - Bouvet Island - bv - - - Botswana - bw - - - Belarus - by - - - Belize - bz - - - Canada - ca - - - Cocos (Keeling) Islands - cc - - - Central African Republic - cf - - - Congo, The Democratic Republic of the - cd - - - Congo - cg - - - Suisse - ch - - - Ivory Coast (Cote D'Ivoire) - ci - - - Cook Islands - ck - - - Chile - cl - - - Cameroon - cm - - - China - cn - - - Colombia - co - - - Costa Rica - cr - - - Serbia and Montenegro - cs - - - Cuba - cu - - - Cape Verde - cv - - - Christmas Island - cx - - - Cyprus - cy - - - Czech Republic - cz - - - Germany - de - - - Djibouti - dj - - - Denmark - dk - - - Dominica - dm - - - Dominican Republic - do - - - Algeria - dz - - - Ecuador - ec - - - Estonia - ee - - - Egypt - eg - - - Western Sahara - eh - - - Eritrea - er - - - Spain - es - - - Ethiopia - et - - - Finland - fi - - - Fiji - fj - - - Falkland Islands - fk - - - Micronesia - fm - - - Faroe Islands - fo - - - France - fr - - - Gabon - ga - - - Grenada - gd - - - Georgia - ge - - - French Guyana - gf - - - Ghana - gh - - - Gibraltar - gi - - - Greenland - gl - - - Gambia - gm - - - Guinea - gn - - - Guadeloupe (French) - gp - - - Equatorial Guinea - gq - - - Greece - gr - - - S. Georgia & S. Sandwich Isls. - gs - - - Guatemala - gt - - - Guam (USA) - gu - - - Guinea Bissau - gw - - - Guyana - gy - - - Hong Kong - hk - - - Heard and McDonald Islands - hm - - - Honduras - hn - - - Croatia - hr - - - Haiti - ht - - - Hungary - hu - - - Indonesia - id - - - Ireland - ie - - - Israel - il - - - India - in - - - British Indian Ocean Territory - io - - - Iraq - iq - - - Iran - ir - - - Iceland - is - - - Italy - it - - - Jamaica - jm - - - Jordan - jo - - - Japan - jp - - - Kenya - ke - - - Kyrgyz Republic (Kyrgyzstan) - kg - - - Cambodia, Kingdom of - kh - - - Kiribati - ki - - - Comoros - km - - - Saint Kitts & Nevis Anguilla - kn - - - North Korea - kp - - - South Korea - kr - - - Kuwait - kw - - - Cayman Islands - ky - - - Kazakhstan - kz - - - Laos - la - - - Lebanon - lb - - - Saint Lucia - lc - - - Liechtenstein - li - - - Sri Lanka - lk - - - Liberia - lr - - - Lesotho - ls - - - Lithuania - lt - - - Luxembourg - lu - - - Latvia - lv - - - Libya - ly - - - Morocco - ma - - - Monaco - mc - - - Moldavia - md - - - Madagascar - mg - - - Marshall Islands - mh - - - Macedonia - mk - - - Mali - ml - - - Myanmar - mm - - - Mongolia - mn - - - Macau - mo - - - Northern Mariana Islands - mp - - - Martinique (French) - mq - - - Mauritania - mr - - - Montserrat - ms - - - Malta - mt - - - Mauritius - mu - - - Maldives - mv - - - Malawi - mw - - - Mexico - mx - - - Malaysia - my - - - Mozambique - mz - - - Namibia - na - - - New Caledonia (French) - nc - - - Niger - ne - - - Norfolk Island - nf - - - Nigeria - ng - - - Nicaragua - ni - - - Netherlands - nl - - - Norway - no - - - Nepal - np - - - Nauru - nr - - - Neutral Zone - nt - - - Niue - nu - - - New Zealand - nz - - - Oman - om - - - Panama - pa - - - Peru - pe - - - Polynesia (French) - pf - - - Papua New Guinea - pg - - - Philippines - ph - - - Pakistan - pk - - - Poland - pl - - - Saint Pierre and Miquelon - pm - - - Pitcairn Island - pn - - - Puerto Rico - pr - - - Portugal - pt - - - Palau - pw - - - Paraguay - py - - - Qatar - qa - - - Reunion (French) - re - - - Romania - ro - - - Russian Federation - ru - - - Rwanda - rw - - - Saudi Arabia - sa - - - Solomon Islands - sb - - - Seychelles - sc - - - Sudan - sd - - - Sweden - se - - - Singapore - sg - - - Saint Helena - sh - - - Slovenia - si - - - Svalbard and Jan Mayen Islands - sj - - - Slovak Republic - sk - - - Sierra Leone - sl - - - San Marino - sm - - - Senegal - sn - - - Somalia - so - - - Suriname - sr - - - Saint Tome (Sao Tome) and Principe - st - - - El Salvador - sv - - - Syria - sy - - - Swaziland - sz - - - Turks and Caicos Islands - tc - - - Chad - td - - - French Southern Territories - tf - - - Togo - tg - - - Thailand - th - - - Tadjikistan - tj - - - Tokelau - tk - - - Turkmenistan - tm - - - Tunisia - tn - - - Tonga - to - - - East Timor - tp - - - Turkey - tr - - - Trinidad and Tobago - tt - - - Tuvalu - tv - - - Taiwan - tw - - - Tanzania - tz - - - Ukraine - ua - - - Uganda - ug - - - United Kingdom - uk - - - USA Minor Outlying Islands - um - - - United States - us - - - Uruguay - uy - - - Uzbekistan - uz - - - Holy See (Vatican City State) - va - - - Saint Vincent & Grenadines - vc - - - Venezuela - ve - - - Virgin Islands (British) - vg - - - Virgin Islands (USA) - vi - - - Vietnam - vn - - - Vanuatu - vu - - - Wallis and Futuna Islands - wf - - - Samoa - ws - - - Yemen - ye - - - Mayotte - yt - - - Yugoslavia - yu - - - South Africa - za - - - Zambia - zm - - - - Zaire - zr - - - Zimbabwe - zw - - - - - Alabama - al - - - - Alaska - ak - - - - Arizona - az - - - - Arkansas - ar - - - - California - ca - - - - Colorado - co - - - - Connecticut - ct - - - - District of Columbia - dc - - - - Delaware - de - - - - Florida - fl - - - - Georgia - ga - - - - Hawaii - hi - - - - Idaho - id - - - - Illinois - il - - - - Indiana - in - - - - Iowa - ia - - - - Kansas - ks - - - - Kentucky - ky - - - - Louisiana - la - - - - Maine - me - - - - Maryland - md - - - - Massachusetts - ma - - - - Michigan - mi - - - - Minnesota - mn - - - - Mississippi - ms - - - - Missouri - mo - - - - Montana - mt - - - - Nebraska - ne - - - - Nevada - nv - - - - New Hampshire - nh - - - - New Jersey - nj - - - - New Mexico - nm - - - - New York - ny - - - - North Carolina - nc - - - - North Dakota - nd - - - - Ohio - oh - - - - Oklahoma - ok - - - - Oregon - or - - - - Pennsylvania - pa - - - - Rhode Island - ri - - - - South Carolina - sc - - - - South Dakota - sd - - - - Tennessee - tn - - - - Texas - tx - - - - Utah - ut - - - - Vermont - vt - - - - Virginia - va - - - - Washington - wa - - - - West Virginia - wv - - - - Wisconsin - wi - - - - Wyoming - wy - - - - - Tiny sprl - - - - Fabien Pinckaers - Chaussee de Namur 40 - 1367 - Gerompont - (+32).81.81.37.00 - default - - - - - - EUR - EUR - 0.01 - 4 - - - 1.0 - - - - - - USD - USD - 0.01 - 4 - - - 1.3785 - - - - - - Bs - VEB - 2.95 - 4 - - - 1.0 - - - - - - - CAD - CAD - 0.01 - 4 - - - 1.451 - - - - - - - CHF - CHF - 0.01 - 4 - - - 1.644 - - - - - - BRL - BRL - 0.01 - 4 - - - 2.588 - - - - - - CNY - CNY - 0.01 - 4 - - - 10.4311 - - - - - - - COP - COP - 0.01 - 4 - - - - - CZK - 0.01 - 4 - - - - kr - DKK - 0.01 - 4 - - - 7.4416 - - - - - - - Ft - HUF - 0.01 - 4 - - - - Rs - IDR - 0.01 - 4 - - - - Ls - LVL - 0.01 - 4 - - - 0.71 - - - - - - - kr - NOK - 0.01 - 4 - - - 7.93 - - - - - - - PAB - PAB - 0.01 - 4 - - - 1.3813 - - - - - - - - PLN - 0.01 - 4 - - - - kr - SEK - 0.01 - 4 - - - - GBP - GBP - 0.01 - 4 - - - 0.675 - - - - - - ARS - ARS - 0.01 - 4 - - - - - Tiny sprl - - Free Business Solutions - Web: http://tiny.be - Tel: (+32).81.81.37.00 - Bank: CPH 126-2013269-07 - IBAN: BE74 1262 0132 6907 - SWIFT: GKCCBEBB - VAT: BE0477.472.701 - - - - - - Tiny sprl - - - - admin - admin - Administrator - Administrator - - - - - - - + + + + ir.ui.menu.tree + ir.ui.menu + tree + + + + + + child_id + + + + Menu + menu + ir.actions.act_window + + ir.ui.menu + tree + + + + + en_US + English + + + + United Arab Emirates + ae + + + Afghanistan, Islamic State of + af + + + Antigua and Barbuda + ag + + + Anguilla + ai + + + Albania + al + + + Armenia + am + + + Netherlands Antilles + an + + + Angola + ao + + + Antarctica + aq + + + Argentina + ar + + + American Samoa + as + + + Austria + at + + + Australia + au + + + Aruba + aw + + + Azerbaidjan + az + + + Bosnia-Herzegovina + ba + + + Barbados + bb + + + Bangladesh + bd + + + Belgium + be + + + Burkina Faso + bf + + + Bulgaria + bg + + + Bahrain + bh + + + Burundi + bi + + + Benin + bj + + + Bermuda + bm + + + Brunei Darussalam + bn + + + Bolivia + bo + + + Brazil + br + + + Bahamas + bs + + + Bhutan + bt + + + Bouvet Island + bv + + + Botswana + bw + + + Belarus + by + + + Belize + bz + + + Canada + ca + + + Cocos (Keeling) Islands + cc + + + Central African Republic + cf + + + Congo, The Democratic Republic of the + cd + + + Congo + cg + + + Suisse + ch + + + Ivory Coast (Cote D'Ivoire) + ci + + + Cook Islands + ck + + + Chile + cl + + + Cameroon + cm + + + China + cn + + + Colombia + co + + + Costa Rica + cr + + + Serbia and Montenegro + cs + + + Cuba + cu + + + Cape Verde + cv + + + Christmas Island + cx + + + Cyprus + cy + + + Czech Republic + cz + + + Germany + de + + + Djibouti + dj + + + Denmark + dk + + + Dominica + dm + + + Dominican Republic + do + + + Algeria + dz + + + Ecuador + ec + + + Estonia + ee + + + Egypt + eg + + + Western Sahara + eh + + + Eritrea + er + + + Spain + es + + + Ethiopia + et + + + Finland + fi + + + Fiji + fj + + + Falkland Islands + fk + + + Micronesia + fm + + + Faroe Islands + fo + + + France + fr + + + Gabon + ga + + + Grenada + gd + + + Georgia + ge + + + French Guyana + gf + + + Ghana + gh + + + Gibraltar + gi + + + Greenland + gl + + + Gambia + gm + + + Guinea + gn + + + Guadeloupe (French) + gp + + + Equatorial Guinea + gq + + + Greece + gr + + + S. Georgia & S. Sandwich Isls. + gs + + + Guatemala + gt + + + Guam (USA) + gu + + + Guinea Bissau + gw + + + Guyana + gy + + + Hong Kong + hk + + + Heard and McDonald Islands + hm + + + Honduras + hn + + + Croatia + hr + + + Haiti + ht + + + Hungary + hu + + + Indonesia + id + + + Ireland + ie + + + Israel + il + + + India + in + + + British Indian Ocean Territory + io + + + Iraq + iq + + + Iran + ir + + + Iceland + is + + + Italy + it + + + Jamaica + jm + + + Jordan + jo + + + Japan + jp + + + Kenya + ke + + + Kyrgyz Republic (Kyrgyzstan) + kg + + + Cambodia, Kingdom of + kh + + + Kiribati + ki + + + Comoros + km + + + Saint Kitts & Nevis Anguilla + kn + + + North Korea + kp + + + South Korea + kr + + + Kuwait + kw + + + Cayman Islands + ky + + + Kazakhstan + kz + + + Laos + la + + + Lebanon + lb + + + Saint Lucia + lc + + + Liechtenstein + li + + + Sri Lanka + lk + + + Liberia + lr + + + Lesotho + ls + + + Lithuania + lt + + + Luxembourg + lu + + + Latvia + lv + + + Libya + ly + + + Morocco + ma + + + Monaco + mc + + + Moldavia + md + + + Madagascar + mg + + + Marshall Islands + mh + + + Macedonia + mk + + + Mali + ml + + + Myanmar + mm + + + Mongolia + mn + + + Macau + mo + + + Northern Mariana Islands + mp + + + Martinique (French) + mq + + + Mauritania + mr + + + Montserrat + ms + + + Malta + mt + + + Mauritius + mu + + + Maldives + mv + + + Malawi + mw + + + Mexico + mx + + + Malaysia + my + + + Mozambique + mz + + + Namibia + na + + + New Caledonia (French) + nc + + + Niger + ne + + + Norfolk Island + nf + + + Nigeria + ng + + + Nicaragua + ni + + + Netherlands + nl + + + Norway + no + + + Nepal + np + + + Nauru + nr + + + Neutral Zone + nt + + + Niue + nu + + + New Zealand + nz + + + Oman + om + + + Panama + pa + + + Peru + pe + + + Polynesia (French) + pf + + + Papua New Guinea + pg + + + Philippines + ph + + + Pakistan + pk + + + Poland + pl + + + Saint Pierre and Miquelon + pm + + + Pitcairn Island + pn + + + Puerto Rico + pr + + + Portugal + pt + + + Palau + pw + + + Paraguay + py + + + Qatar + qa + + + Reunion (French) + re + + + Romania + ro + + + Russian Federation + ru + + + Rwanda + rw + + + Saudi Arabia + sa + + + Solomon Islands + sb + + + Seychelles + sc + + + Sudan + sd + + + Sweden + se + + + Singapore + sg + + + Saint Helena + sh + + + Slovenia + si + + + Svalbard and Jan Mayen Islands + sj + + + Slovak Republic + sk + + + Sierra Leone + sl + + + San Marino + sm + + + Senegal + sn + + + Somalia + so + + + Suriname + sr + + + Saint Tome (Sao Tome) and Principe + st + + + El Salvador + sv + + + Syria + sy + + + Swaziland + sz + + + Turks and Caicos Islands + tc + + + Chad + td + + + French Southern Territories + tf + + + Togo + tg + + + Thailand + th + + + Tadjikistan + tj + + + Tokelau + tk + + + Turkmenistan + tm + + + Tunisia + tn + + + Tonga + to + + + East Timor + tp + + + Turkey + tr + + + Trinidad and Tobago + tt + + + Tuvalu + tv + + + Taiwan + tw + + + Tanzania + tz + + + Ukraine + ua + + + Uganda + ug + + + United Kingdom + uk + + + USA Minor Outlying Islands + um + + + United States + us + + + Uruguay + uy + + + Uzbekistan + uz + + + Holy See (Vatican City State) + va + + + Saint Vincent & Grenadines + vc + + + Venezuela + ve + + + Virgin Islands (British) + vg + + + Virgin Islands (USA) + vi + + + Vietnam + vn + + + Vanuatu + vu + + + Wallis and Futuna Islands + wf + + + Samoa + ws + + + Yemen + ye + + + Mayotte + yt + + + Yugoslavia + yu + + + South Africa + za + + + Zambia + zm + + + + Zaire + zr + + + Zimbabwe + zw + + + + + Alabama + al + + + + Alaska + ak + + + + Arizona + az + + + + Arkansas + ar + + + + California + ca + + + + Colorado + co + + + + Connecticut + ct + + + + District of Columbia + dc + + + + Delaware + de + + + + Florida + fl + + + + Georgia + ga + + + + Hawaii + hi + + + + Idaho + id + + + + Illinois + il + + + + Indiana + in + + + + Iowa + ia + + + + Kansas + ks + + + + Kentucky + ky + + + + Louisiana + la + + + + Maine + me + + + + Maryland + md + + + + Massachusetts + ma + + + + Michigan + mi + + + + Minnesota + mn + + + + Mississippi + ms + + + + Missouri + mo + + + + Montana + mt + + + + Nebraska + ne + + + + Nevada + nv + + + + New Hampshire + nh + + + + New Jersey + nj + + + + New Mexico + nm + + + + New York + ny + + + + North Carolina + nc + + + + North Dakota + nd + + + + Ohio + oh + + + + Oklahoma + ok + + + + Oregon + or + + + + Pennsylvania + pa + + + + Rhode Island + ri + + + + South Carolina + sc + + + + South Dakota + sd + + + + Tennessee + tn + + + + Texas + tx + + + + Utah + ut + + + + Vermont + vt + + + + Virginia + va + + + + Washington + wa + + + + West Virginia + wv + + + + Wisconsin + wi + + + + Wyoming + wy + + + + + Tiny sprl + + + + Fabien Pinckaers + Chaussee de Namur 40 + 1367 + Gerompont + (+32).81.81.37.00 + default + + + + # + # Currencies + # + + + EUR + EUR + 0.01 + 4 + + + 1.0 + + + + + + USD + USD + 0.01 + 4 + + + 1.3785 + + + + + + Bs + VEB + 2.95 + 4 + + + 3132.9 + + + + + + + CAD + CAD + 0.01 + 4 + + + 1.451 + + + + + + + CHF + CHF + 0.01 + 4 + + + 1.644 + + + + + + BRL + BRL + 0.01 + 4 + + + 2.588 + + + + + + CNY + CNY + 0.01 + 4 + + + 10.4311 + + + + + + + COP + COP + 0.01 + 4 + + + + + CZK + 0.01 + 4 + + + + kr + DKK + 0.01 + 4 + + + 7.4416 + + + + + + + Ft + HUF + 0.01 + 4 + + + + Rs + IDR + 0.01 + 4 + + + + Ls + LVL + 0.01 + 4 + + + 0.71 + + + + + + + kr + NOK + 0.01 + 4 + + + 7.93 + + + + + + + PAB + PAB + 0.01 + 4 + + + 1.3813 + + + + + + + + PLN + 0.01 + 4 + + + + kr + SEK + 0.01 + 4 + + + + GBP + GBP + 0.01 + 4 + + + 0.675 + + + + + + ARS + ARS + 0.01 + 4 + + + + + Tiny sprl + + Free Business Solutions + Web: http://tiny.be - Tel: (+32).81.81.37.00 - Bank: CPH 126-2013269-07 + IBAN: BE74 1262 0132 6907 - SWIFT: GKCCBEBB - VAT: BE0477.472.701 + + + + + + Tiny sprl + + + diff --git a/bin/addons/base/base_security.xml b/bin/addons/base/base_security.xml index ed4ede6649e..67652c98463 100644 --- a/bin/addons/base/base_security.xml +++ b/bin/addons/base/base_security.xml @@ -1,654 +1,701 @@ - + - - - UI menu - - - - - - - - - UI menu - - - - - - - - - - Act window - - - - - - - - Act window - - - - - - - - - - Actions - - - - - - - - Actions - - - - - - - - - - Actions Report Custom - - - - - - - - Actions Report Custom - - - - - - - - - - Actions Report XML - - - - - - - - Actions Report XML - - - - - - - - - - Actions Act Window view - - - - - - - - Actions Act Window view - - - - - - - - - - Actions Wizard - - - - - - - - Actions Wizard - - - - - - - - - - Actions URL - - - - - - - - Actions URL - - - - - - - - - - Groups - - - - - - - - Groups - - - - - - - - - - Roles - - - - - - - - Roles - - - - - - - - - - Lang - - - - - - - - Lang - - - - - - - - - - Country - - - - - - - - Country - - - - - - - - - - Country State - - - - - - - - Country State - - - - - - - - - - Currency - - - - - - - - Currency - - - - - - - - - - Currency Rate - - - - - - - - Currency Rate - - - - - - - - - - Company - - - - - - - - Company - - - - - - - - - - Users - - - - - - - - Users - - - - - - - - - - Cron - - - - - - - - Cron - - - - - - - - - - Model - - - - - - - - Model - - - - - - - - - - Model Fields - - - - - - - - Model Fields - - - - - - - - - - Model Access - - - - - - - - Model Access - - - - - - - - - - Model Data - - - - - - - - Model Data - - - - - - - - - - Report Custom - - - - - - - - Report Custom - - - - - - - - - - Report Custom Fields - - - - - - - - Report Custom Fields - - - - - - - - - - Rule group - - - - - - - - Rule group - - - - - - - - - - Rule - - - - - - - - Rule - - - - - - - - - - Sequence Type - - - - - - - - Sequence Type - - - - - - - - - - Sequence - - - - - - - - Sequence - - - - - - - - - - View - - - - - - - - View - - - - - - - - - - Workflow - - - - - - - - Workflow - - - - - - - - - - Workflow Activity - - - - - - - - Workflow Activity - - - - - - - - - - Workflow Transition - - - - - - - - Workflow Transition - - - - - - - - - - Module Repository - - - - - - - - Module Repository - - - - - - - - - - Module Category - - - - - - - - Module Category - - - - - - - - - - Module - - - - - - - - Module - - - - - - - - - - Module Dependency - - - - - - - - Module Dependency - - - - - - - - - - \ No newline at end of file + + + + + Administrator + + + + ERP Manager + + + + Employee + + + + Res Config View + + + + Extended View + + + + Partner Contact + + + + Partner Manager + + + + + Administrator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Ir Values + + + + + + + + + + Ir Values Admin + + + + + + + + + + View + + + + + + + + + + View Admin + + + + + + + + + + UI Shortcut + + + + + + + + + + UI Shortcut Admin + + + + + + + + + + IR UI Menu + + + + + + + + + + IR UI Menu Admin + + + + + + + + + + Module + + + + + + + + + + Module Admin + + + + + + + + + + Actions + + + + + + + + + + Actions Admin + + + + + + + + + + Groups + + + + + + + + + + Groups Admin + + + + + + + + + + Roles + + + + + + + + + + Roles Admin + + + + + + + + + + Lang + + + + + + + + + + Lang Admin + + + + + + + + + + Country + + + + + + + + + + Country Admin + + + + + + + + + + Currency + + + + + + + + + + Currency Admin + + + + + + + + + + Company + + + + + + + + + + Company Admin + + + + + + + + + + Users + + + + + + + + + + Users Admin + + + + + + + + + + Cron + + + + + + + + + + Cron Admin + + + + + + + + + + Model + + + + + + + + + + Model Admin + + + + + + + + + + Report Custom + + + + + + + + + + Report Custom Admin + + + + + + + + + + Rule + + + + + + + + + + Rule Admin + + + + + + + + + + Sequence + + + + + + + + + + Sequence Admin + + + + + + + + + + Workflow + + + + + + + + + + Workflow Admin + + + + + + + + + + Res Partner Employee + + + + + + + + + + Res Partner User + + + + + + + + + + Res Partner Admin + + + + + + + + + + Res Partner User + + + + + + + + + + Res Partner Admin + + + + + + + + + + Res Config View Admin + + + + + + + + + + Res Users + + + + + + + + + + Res Users Manager + + + + + + + + + + IR Property + + + + + + + + + + diff --git a/bin/addons/base/ir/ir.xml b/bin/addons/base/ir/ir.xml index 5471655652f..0847f974c7b 100644 --- a/bin/addons/base/ir/ir.xml +++ b/bin/addons/base/ir/ir.xml @@ -620,6 +620,7 @@ + @@ -672,6 +673,7 @@ + @@ -1021,6 +1023,7 @@ user.company_id.id + = @@ -1028,6 +1031,60 @@ + + + ir.model.form1 + ir.model + form + +
+ + + + + +
+ + + ir.model.tree1 + ir.model + tree + + + + + + + + + + + Objects + ir.model + form + form,tree + + + + + + tree + + + + + + + form + + + + + diff --git a/bin/addons/base/ir/ir_model.py b/bin/addons/base/ir/ir_model.py index 0c6bfc7edb1..741a56ca8f0 100644 --- a/bin/addons/base/ir/ir_model.py +++ b/bin/addons/base/ir/ir_model.py @@ -37,395 +37,418 @@ import tools import pooler def _get_fields_type(self, cr, uid, context=None): - cr.execute('select distinct ttype,ttype from ir_model_fields') - return cr.fetchall() + cr.execute('select distinct ttype,ttype from ir_model_fields') + return cr.fetchall() class ir_model(osv.osv): - _name = 'ir.model' - _description = "Objects" - _rec_name = 'name' - _columns = { - 'name': fields.char('Model Name', size=64, translate=True, required=True), - 'model': fields.char('Object Name', size=64, required=True, search=1), - 'info': fields.text('Information'), - 'field_id': fields.one2many('ir.model.fields', 'model_id', 'Fields', required=True), - 'state': fields.selection([('manual','Custom Object'),('base','Base Field')],'Manualy Created',readonly=1), - } - _defaults = { - 'model': lambda *a: 'x_', - 'state': lambda self,cr,uid,ctx={}: (ctx and ctx.get('manual',False)) and 'manual' or 'base', - } - - def _check_model_name(self, cr, uid, ids): - for model in self.browse(cr, uid, ids): - if model.state=='manual': - if not model.model.startswith('x_'): - return False - if not re.match('^[a-z_A-Z0-9]+$',model.model): - return False - return True + _name = 'ir.model' + _description = "Objects" + _rec_name = 'name' + _columns = { + 'name': fields.char('Model Name', size=64, translate=True, required=True), + 'model': fields.char('Object Name', size=64, required=True, search=1), + 'info': fields.text('Information'), + 'field_id': fields.one2many('ir.model.fields', 'model_id', 'Fields', required=True), + 'parent_id': fields.many2one('ir.model', 'Parent id'), + 'state': fields.selection([('manual','Custom Object'),('base','Base Field')],'Manualy Created',readonly=1), + } + _defaults = { + 'model': lambda *a: 'x_', + 'state': lambda self,cr,uid,ctx={}: (ctx and ctx.get('manual',False)) and 'manual' or 'base', + } + + def _check_model_name(self, cr, uid, ids): + for model in self.browse(cr, uid, ids): + if model.state=='manual': + if not model.model.startswith('x_'): + return False + if not re.match('^[a-z_A-Z0-9]+$',model.model): + return False + return True + + # FIXME: What it was for ? + #_constraints = [ + # (_check_model_name, 'The model name must start with x_ and not contain any special character !', ['model']), + #] + + def unlink(self, cr, user, ids, context=None): + for model in self.browse(cr, user, ids, context): + if model.state <> 'manual': + raise except_orm(_('Error'), _("You can not remove the model '%s' !") %(field.name,)) + res = super(ir_model, self).unlink(cr, user, ids, context) + pooler.restart_pool(cr.dbname) + return res - _constraints = [ - (_check_model_name, 'The model name must start with x_ and not contain any special character !', ['model']), - ] - def unlink(self, cr, user, ids, context=None): - for model in self.browse(cr, user, ids, context): - if model.state <> 'manual': - raise except_orm(_('Error'), _("You can not remove the model '%s' !") %(field.name,)) - res = super(ir_model, self).unlink(cr, user, ids, context) - pooler.restart_pool(cr.dbname) - return res + def create(self, cr, user, vals, context=None): + if context and context.get('manual',False): + vals['state']='manual' + res = super(ir_model,self).create(cr, user, vals, context) + if vals.get('state','base')=='manual': + pooler.restart_pool(cr.dbname) + return res - def create(self, cr, user, vals, context=None): - if context and context.get('manual',False): - vals['state']='manual' - res = super(ir_model,self).create(cr, user, vals, context) - if vals.get('state','base')=='manual': - pooler.restart_pool(cr.dbname) - return res - - def instanciate(self, cr, user, model, context={}): - class x_custom_model(osv.osv): - pass - x_custom_model._name = model - x_custom_model._module = False - x_custom_model.createInstance(self.pool, '', cr) - if 'x_name' in x_custom_model._columns: - x_custom_model._rec_name = 'x_name' - else: - x_custom_model._rec_name = x_custom_model._columns.keys()[0] + def instanciate(self, cr, user, model, context={}): + class x_custom_model(osv.osv): + pass + x_custom_model._name = model + x_custom_model._module = False + x_custom_model.createInstance(self.pool, '', cr) + if 'x_name' in x_custom_model._columns: + x_custom_model._rec_name = 'x_name' + else: + x_custom_model._rec_name = x_custom_model._columns.keys()[0] ir_model() +class ir_model_tree(osv.osv): + _name = 'ir.model.tree' + _description = "Objects Tree" + _columns = { + 'model_id': fields.many2one('ir.model', 'Model id', required=True), + 'parent_id': fields.many2one('ir.model', 'Parent id', required=True), + } +ir_model_tree() + class ir_model_fields(osv.osv): - _name = 'ir.model.fields' - _description = "Fields" - _columns = { - 'name': fields.char('Name', required=True, size=64, select=1), - 'model': fields.char('Object Name', size=64, required=True), - 'relation': fields.char('Model Relation', size=64), - 'model_id': fields.many2one('ir.model', 'Model id', required=True, select=True, ondelete='cascade'), - 'field_description': fields.char('Field Label', required=True, size=256), - 'relate': fields.boolean('Click and Relate'), + _name = 'ir.model.fields' + _description = "Fields" + _columns = { + 'name': fields.char('Name', required=True, size=64, select=1), + 'model': fields.char('Object Name', size=64, required=True), + 'relation': fields.char('Model Relation', size=64), + 'model_id': fields.many2one('ir.model', 'Model id', required=True, select=True, ondelete='cascade'), + 'field_description': fields.char('Field Label', required=True, size=256), + 'relate': fields.boolean('Click and Relate'), - 'ttype': fields.selection(_get_fields_type, 'Field Type',size=64, required=True), - 'selection': fields.char('Field Selection',size=128), - 'required': fields.boolean('Required'), - 'readonly': fields.boolean('Readonly'), - 'select_level': fields.selection([('0','Not Searchable'),('1','Always Searchable'),('2','Advanced Search')],'Searchable', required=True), - 'translate': fields.boolean('Translate'), - 'size': fields.integer('Size'), - 'state': fields.selection([('manual','Custom Field'),('base','Base Field')],'Manualy Created'), - 'on_delete': fields.selection([('cascade','Cascade'),('set null','Set NULL')], 'On delete', help='On delete property for many2one fields'), - 'domain': fields.char('Domain', size=256), + 'ttype': fields.selection(_get_fields_type, 'Field Type',size=64, required=True), + 'selection': fields.char('Field Selection',size=128), + 'required': fields.boolean('Required'), + 'readonly': fields.boolean('Readonly'), + 'select_level': fields.selection([('0','Not Searchable'),('1','Always Searchable'),('2','Advanced Search')],'Searchable', required=True), + 'translate': fields.boolean('Translate'), + 'size': fields.integer('Size'), + 'state': fields.selection([('manual','Custom Field'),('base','Base Field')],'Manualy Created'), + 'on_delete': fields.selection([('cascade','Cascade'),('set null','Set NULL')], 'On delete', help='On delete property for many2one fields'), + 'domain': fields.char('Domain', size=256), - 'groups': fields.many2many('res.groups', 'ir_model_fields_group_rel', 'field_id', 'group_id', 'Groups'), - 'group_name': fields.char('Group Name', size=128), - 'view_load': fields.boolean('View Auto-Load'), - } - _defaults = { - 'relate': lambda *a: 0, - 'view_load': lambda *a: 0, - 'selection': lambda *a: "[]", - 'domain': lambda *a: "[]", - 'name': lambda *a: 'x_', - 'state': lambda self,cr,uid,ctx={}: (ctx and ctx.get('manual',False)) and 'manual' or 'base', - 'on_delete': lambda *a: 'set null', - 'select_level': lambda *a: '0', - 'size': lambda *a: 64, - 'field_description': lambda *a: '', - } - _order = "id" - def unlink(self, cr, user, ids, context=None): - for field in self.browse(cr, user, ids, context): - if field.state <> 'manual': - raise except_orm(_('Error'), _("You can not remove the field '%s' !") %(field.name,)) - # - # MAY BE ADD A ALTER TABLE DROP ? - # - return super(ir_model_fields, self).unlink(cr, user, ids, context) + 'groups': fields.many2many('res.groups', 'ir_model_fields_group_rel', 'field_id', 'group_id', 'Groups'), + 'group_name': fields.char('Group Name', size=128), + 'view_load': fields.boolean('View Auto-Load'), + } + _defaults = { + 'relate': lambda *a: 0, + 'view_load': lambda *a: 0, + 'selection': lambda *a: "[]", + 'domain': lambda *a: "[]", + 'name': lambda *a: 'x_', + 'state': lambda self,cr,uid,ctx={}: (ctx and ctx.get('manual',False)) and 'manual' or 'base', + 'on_delete': lambda *a: 'set null', + 'select_level': lambda *a: '0', + 'size': lambda *a: 64, + 'field_description': lambda *a: '', + } + _order = "id" + def unlink(self, cr, user, ids, context=None): + for field in self.browse(cr, user, ids, context): + if field.state <> 'manual': + raise except_orm(_('Error'), _("You can not remove the field '%s' !") %(field.name,)) + return super(ir_model_fields, self).unlink(cr, user, ids, context) - def create(self, cr, user, vals, context=None): - if 'model_id' in vals: - model_data=self.pool.get('ir.model').read(cr,user,vals['model_id']) - vals['model']=model_data['model'] - if context and context.get('manual',False): - vals['state']='manual' - res = super(ir_model_fields,self).create(cr, user, vals, context) - if vals.get('state','base')=='manual': - if not vals['name'].startswith('x_'): - raise except_orm(_('Error'), _("Custom fields must have a name that starts with 'x_' !")) - if self.pool.get(vals['model']): - self.pool.get(vals['model']).__init__(self.pool, cr) - self.pool.get(vals['model'])._auto_init(cr,{}) - return res + def create(self, cr, user, vals, context=None): + if 'model_id' in vals: + model_data=self.pool.get('ir.model').read(cr,user,vals['model_id']) + vals['model']=model_data['model'] + if context and context.get('manual',False): + vals['state']='manual' + print vals['name'] + res = super(ir_model_fields,self).create(cr, user, vals, context) + if vals.get('state','base')=='manual': + if not vals['name'].startswith('x_'): + raise except_orm(_('Error'), _("Custom fields must have a name that starts with 'x_' !")) + if self.pool.get(vals['model']): + self.pool.get(vals['model']).__init__(self.pool, cr) + self.pool.get(vals['model'])._auto_init(cr,{}) + return res ir_model_fields() class ir_model_access(osv.osv): - _name = 'ir.model.access' - _columns = { - 'name': fields.char('Name', size=64, required=True), - 'model_id': fields.many2one('ir.model', 'Model', required=True), - 'group_id': fields.many2one('res.groups', 'Group'), - 'perm_read': fields.boolean('Read Access'), - 'perm_write': fields.boolean('Write Access'), - 'perm_create': fields.boolean('Create Access'), - 'perm_unlink': fields.boolean('Delete Permission'), - } - - def check_groups(self, cr, uid, group): - res = False - grouparr = group.split('.') - if grouparr: - cr.execute("select * from res_groups_users_rel where uid=" + str(uid) + " and gid in(select res_id from ir_model_data where module='%s' and name='%s')" % (grouparr[0], grouparr[1])) - r = cr.fetchall() - if not r: - res = False - else: - res = True - else: - res = False - return res - - def check(self, cr, uid, model_name, mode='read',raise_exception=True): - assert mode in ['read','write','create','unlink'], 'Invalid access mode for security' - if uid == 1: - return True # TODO: check security: don't allow xml-rpc request with uid == 1 + _name = 'ir.model.access' + _columns = { + 'name': fields.char('Name', size=64, required=True), + 'model_id': fields.many2one('ir.model', 'Model', required=True), + 'group_id': fields.many2one('res.groups', 'Group'), + 'perm_read': fields.boolean('Read Access'), + 'perm_write': fields.boolean('Write Access'), + 'perm_create': fields.boolean('Create Access'), + 'perm_unlink': fields.boolean('Delete Permission'), + } + + def check_groups(self, cr, uid, group): + res = False + grouparr = group.split('.') + if grouparr: + cr.execute("select * from res_groups_users_rel where uid=" + str(uid) + " and gid in(select res_id from ir_model_data where module='%s' and name='%s')" % (grouparr[0], grouparr[1])) + r = cr.fetchall() + if not r: + res = False + else: + res = True + else: + res = False + return res + + def check_tree(self, cr, uid, model_name, mode): + cr.execute('SELECT MAX(CASE WHEN perm_'+mode+' THEN 1 else 0 END) ' + 'from ir_model_access a join ir_model m on (m.id=a.model_id) ' + 'join res_groups_users_rel gu on (gu.gid = a.group_id) ' + 'where m.model = %s and gu.uid = %s', (model_name, uid,)) + res = cr.fetchall()[0][0] + if res==None: + cr.execute('select model from ir_model where id=(select parent_id from ir_model where model=%s)', (model_name,)) + parent_name = cr.fetchall() + if len(parent_name)>0: + res = self.check_tree(cr, uid, parent_name[0][0], mode) # Recursiv until there is no parent + print '\tcheck %s = %s' % (parent_name[0][0], str(res)) + return res + + def check(self, cr, uid, model_name, mode='read',raise_exception=True): + assert mode in ['read','write','create','unlink'], 'Invalid access mode for security' + + # We first check if a specific rule exists + cr.execute('SELECT MAX(CASE WHEN perm_'+mode+' THEN 1 else 0 END) ' + 'FROM ir_model_access a ' + 'JOIN ir_model m ON (a.model_id=m.id) ' + 'JOIN res_groups_users_rel gu ON (gu.gid = a.group_id) ' + 'WHERE m.model = %s AND gu.uid = %s', (model_name, uid,)) + r = cr.fetchall() + + print '%s in %s = %s by %i'%(mode, model_name, str(r[0][0]), uid) # FIXME: REMOVE PLEASE + + # Users root and admin have all access (Todo: exclude xml-rpc requests) + if uid==1 or uid==2: + return True + + # Recursivly check parent if present + if r[0][0] == None: + res = self.check_tree(cr, uid, model_name, mode) + else: + res = r[0][0] + + if not res: + if raise_exception: + msgs = { + 'read': _('You can not read this document! (%s)'), + 'write': _('You can not write in this document! (%s)'), + 'create': _('You can not create this kind of document! (%s)'), + 'unlink': _('You can not delete this document! (%s)'), + } + raise except_orm(_('AccessError'), msgs[mode] % model_name ) + return res - cr.execute('SELECT MAX(CASE WHEN perm_'+mode+' THEN 1 else 0 END) ' - 'FROM ir_model_access a ' - 'JOIN ir_model m ' - 'ON (a.model_id=m.id) ' - 'JOIN res_groups_users_rel gu ' - 'ON (gu.gid = a.group_id) ' - 'WHERE m.model = %s AND gu.uid = %s', (model_name, uid,)) - r = cr.fetchall() - if r[0][0] == None: - cr.execute('SELECT MAX(CASE WHEN perm_'+mode+' THEN 1 else 0 END) ' - 'FROM ir_model_access a ' - 'JOIN ir_model m ' - 'ON (a.model_id = m.id) ' - 'WHERE a.group_id IS NULL AND m.model = %s', (model_name,)) - r= cr.fetchall() - if r[0][0] == None: - return False # by default, the user had no access + check = tools.cache()(check) - if not r[0][0]: - if raise_exception: - msgs = { - 'read': _('You can not read this document! (%s)'), - 'write': _('You can not write in this document! (%s)'), - 'create': _('You can not create this kind of document! (%s)'), - 'unlink': _('You can not delete this document! (%s)'), - } - # due to the assert at the begin of the function, we will never have a KeyError - raise except_orm(_('AccessError'), msgs[mode] % model_name ) - return r[0][0] - - check = tools.cache()(check) - - # - # Methods to clean the cache on the Check Method. - # - def write(self, cr, uid, *args, **argv): - res = super(ir_model_access, self).write(cr, uid, *args, **argv) - self.check() - return res - def create(self, cr, uid, *args, **argv): - res = super(ir_model_access, self).create(cr, uid, *args, **argv) - self.check() - return res - def unlink(self, cr, uid, *args, **argv): - res = super(ir_model_access, self).unlink(cr, uid, *args, **argv) - self.check() - return res + # + # Check rights on actions + # + def write(self, cr, uid, *args, **argv): + res = super(ir_model_access, self).write(cr, uid, *args, **argv) + self.check() + return res + def create(self, cr, uid, *args, **argv): + res = super(ir_model_access, self).create(cr, uid, *args, **argv) + self.check() + return res + def unlink(self, cr, uid, *args, **argv): + res = super(ir_model_access, self).unlink(cr, uid, *args, **argv) + self.check() + return res ir_model_access() class ir_model_data(osv.osv): - _name = 'ir.model.data' - _columns = { - 'name': fields.char('XML Identifier', required=True, size=64), - 'model': fields.char('Model', required=True, size=64), - 'module': fields.char('Module', required=True, size=64), - 'res_id': fields.integer('Resource ID'), - 'noupdate': fields.boolean('Non Updatable'), - 'date_update': fields.datetime('Update Date'), - 'date_init': fields.datetime('Init Date') - } - _defaults = { - 'date_init': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'), - 'date_update': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'), - 'noupdate': lambda *a: False - } + _name = 'ir.model.data' + _columns = { + 'name': fields.char('XML Identifier', required=True, size=64), + 'model': fields.char('Model', required=True, size=64), + 'module': fields.char('Module', required=True, size=64), + 'res_id': fields.integer('Resource ID'), + 'noupdate': fields.boolean('Non Updatable'), + 'date_update': fields.datetime('Update Date'), + 'date_init': fields.datetime('Init Date') + } + _defaults = { + 'date_init': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'), + 'date_update': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'), + 'noupdate': lambda *a: False + } - def __init__(self, pool, cr): - osv.osv.__init__(self, pool, cr) - self.loads = {} - self.doinit = True - self.unlink_mark = {} + def __init__(self, pool, cr): + osv.osv.__init__(self, pool, cr) + self.loads = {} + self.doinit = True + self.unlink_mark = {} - def _get_id(self,cr, uid, module, xml_id): - ids = self.search(cr, uid, [('module','=',module),('name','=', xml_id)]) - assert len(ids)==1, '%d reference(s) to %s. You should have only one !' % (len(ids),xml_id) - return ids[0] - _get_id = tools.cache()(_get_id) + def _get_id(self,cr, uid, module, xml_id): + ids = self.search(cr, uid, [('module','=',module),('name','=', xml_id)]) + assert len(ids)==1, '%d reference(s) to %s. You should have only one !' % (len(ids),xml_id) + return ids[0] + _get_id = tools.cache()(_get_id) - def _update_dummy(self,cr, uid, model, module, xml_id=False, store=True): - if not xml_id: - return False - try: - id = self.read(cr, uid, [self._get_id(cr, uid, module, xml_id)], ['res_id'])[0]['res_id'] - self.loads[(module,xml_id)] = (model,id) - except: - id = False - return id + def _update_dummy(self,cr, uid, model, module, xml_id=False, store=True): + if not xml_id: + return False + try: + id = self.read(cr, uid, [self._get_id(cr, uid, module, xml_id)], ['res_id'])[0]['res_id'] + self.loads[(module,xml_id)] = (model,id) + except: + id = False + return id - def _update(self,cr, uid, model, module, values, xml_id=False, store=True, noupdate=False, mode='init', res_id=False): - warning = True - model_obj = self.pool.get(model) - context = {} - if xml_id and ('.' in xml_id): - assert len(xml_id.split('.'))==2, _('"%s" contains too many dots. XML ids should not contain dots ! These are used to refer to other modules data, as in module.reference_id') % (xml_id) - warning = False - module, xml_id = xml_id.split('.') - if (not xml_id) and (not self.doinit): - return False - action_id = False - if xml_id: - cr.execute('select id,res_id from ir_model_data where module=%s and name=%s', (module,xml_id)) - results = cr.fetchall() - for action_id2,res_id2 in results: - cr.execute('select id from '+self.pool.get(model)._table+' where id=%d', (res_id2,)) - result3 = cr.fetchone() - if not result3: - cr.execute('delete from ir_model_data where id=%d', (action_id2,)) - else: - res_id,action_id = res_id2,action_id2 + def _update(self,cr, uid, model, module, values, xml_id=False, store=True, noupdate=False, mode='init', res_id=False): + warning = True + model_obj = self.pool.get(model) + context = {} + if xml_id and ('.' in xml_id): + assert len(xml_id.split('.'))==2, _('"%s" contains too many dots. XML ids should not contain dots ! These are used to refer to other modules data, as in module.reference_id') % (xml_id) + warning = False + module, xml_id = xml_id.split('.') + if (not xml_id) and (not self.doinit): + return False + action_id = False + if xml_id: + cr.execute('select id,res_id from ir_model_data where module=%s and name=%s', (module,xml_id)) + results = cr.fetchall() + for action_id2,res_id2 in results: + cr.execute('select id from '+self.pool.get(model)._table+' where id=%d', (res_id2,)) + result3 = cr.fetchone() + if not result3: + cr.execute('delete from ir_model_data where id=%d', (action_id2,)) + else: + res_id,action_id = res_id2,action_id2 - if action_id and res_id: - model_obj.write(cr, uid, [res_id], values) - self.write(cr, uid, [action_id], { - 'date_update': time.strftime('%Y-%m-%d %H:%M:%S'), - }) - elif res_id: - model_obj.write(cr, uid, [res_id], values) - if xml_id: - self.create(cr, uid, { - 'name': xml_id, - 'model': model, - 'module':module, - 'res_id':res_id, - 'noupdate': noupdate, - }) - if model_obj._inherits: - for table in model_obj._inherits: - inherit_id = model_obj.browse(cr, uid, - res_id)[model_obj._inherits[table]] - self.create(cr, uid, { - 'name': xml_id + '_' + table.replace('.', '_'), - 'model': table, - 'module': module, - 'res_id': inherit_id, - 'noupdate': noupdate, - }) - else: - if mode=='init' or (mode=='update' and xml_id): - res_id = model_obj.create(cr, uid, values) - if xml_id: - self.create(cr, uid, { - 'name': xml_id, - 'model': model, - 'module': module, - 'res_id': res_id, - 'noupdate': noupdate - }) - if model_obj._inherits: - for table in model_obj._inherits: - inherit_id = model_obj.browse(cr, uid, - res_id)[model_obj._inherits[table]] - self.create(cr, uid, { - 'name': xml_id + '_' + table.replace('.', '_'), - 'model': table, - 'module': module, - 'res_id': inherit_id, - 'noupdate': noupdate, - }) - if xml_id: - if res_id: - self.loads[(module, xml_id)] = (model, res_id) - if model_obj._inherits: - for table in model_obj._inherits: - inherit_field = model_obj._inherits[table] - inherit_id = model_obj.read(cr, uid, res_id, - [inherit_field])[inherit_field] - self.loads[(module, xml_id + '_' + \ - table.replace('.', '_'))] = (table, inherit_id) - return res_id + if action_id and res_id: + model_obj.write(cr, uid, [res_id], values) + self.write(cr, uid, [action_id], { + 'date_update': time.strftime('%Y-%m-%d %H:%M:%S'), + }) + elif res_id: + model_obj.write(cr, uid, [res_id], values) + if xml_id: + self.create(cr, uid, { + 'name': xml_id, + 'model': model, + 'module':module, + 'res_id':res_id, + 'noupdate': noupdate, + }) + if model_obj._inherits: + for table in model_obj._inherits: + inherit_id = model_obj.browse(cr, uid, + res_id)[model_obj._inherits[table]] + self.create(cr, uid, { + 'name': xml_id + '_' + table.replace('.', '_'), + 'model': table, + 'module': module, + 'res_id': inherit_id, + 'noupdate': noupdate, + }) + else: + if mode=='init' or (mode=='update' and xml_id): + res_id = model_obj.create(cr, uid, values) + if xml_id: + self.create(cr, uid, { + 'name': xml_id, + 'model': model, + 'module': module, + 'res_id': res_id, + 'noupdate': noupdate + }) + if model_obj._inherits: + for table in model_obj._inherits: + inherit_id = model_obj.browse(cr, uid, + res_id)[model_obj._inherits[table]] + self.create(cr, uid, { + 'name': xml_id + '_' + table.replace('.', '_'), + 'model': table, + 'module': module, + 'res_id': inherit_id, + 'noupdate': noupdate, + }) + if xml_id: + if res_id: + self.loads[(module, xml_id)] = (model, res_id) + if model_obj._inherits: + for table in model_obj._inherits: + inherit_field = model_obj._inherits[table] + inherit_id = model_obj.read(cr, uid, res_id, + [inherit_field])[inherit_field] + self.loads[(module, xml_id + '_' + \ + table.replace('.', '_'))] = (table, inherit_id) + return res_id - def _unlink(self, cr, uid, model, ids, direct=False): - #self.pool.get(model).unlink(cr, uid, ids) - for id in ids: - self.unlink_mark[(model, id)]=False - cr.execute('delete from ir_model_data where res_id=%d and model=\'%s\'', (id,model)) - return True + def _unlink(self, cr, uid, model, ids, direct=False): + #self.pool.get(model).unlink(cr, uid, ids) + for id in ids: + self.unlink_mark[(model, id)]=False + cr.execute('delete from ir_model_data where res_id=%d and model=\'%s\'', (id,model)) + return True - def ir_set(self, cr, uid, key, key2, name, models, value, replace=True, isobject=False, meta=None, xml_id=False): - obj = self.pool.get('ir.values') - if type(models[0])==type([]) or type(models[0])==type(()): - model,res_id = models[0] - else: - res_id=None - model = models[0] + def ir_set(self, cr, uid, key, key2, name, models, value, replace=True, isobject=False, meta=None, xml_id=False): + obj = self.pool.get('ir.values') + if type(models[0])==type([]) or type(models[0])==type(()): + model,res_id = models[0] + else: + res_id=None + model = models[0] - if res_id: - where = ' and res_id=%d' % (res_id,) - else: - where = ' and (res_id is null)' + if res_id: + where = ' and res_id=%d' % (res_id,) + else: + where = ' and (res_id is null)' - if key2: - where += ' and key2=\'%s\'' % (key2,) - else: - where += ' and (key2 is null)' + if key2: + where += ' and key2=\'%s\'' % (key2,) + else: + where += ' and (key2 is null)' - cr.execute('select * from ir_values where model=%s and key=%s and name=%s'+where,(model, key, name)) - res = cr.fetchone() - if not res: - res = ir.ir_set(cr, uid, key, key2, name, models, value, replace, isobject, meta) - elif xml_id: - cr.execute('UPDATE ir_values set value=%s WHERE model=%s and key=%s and name=%s'+where,(value, model, key, name)) - return True + cr.execute('select * from ir_values where model=%s and key=%s and name=%s'+where,(model, key, name)) + res = cr.fetchone() + if not res: + res = ir.ir_set(cr, uid, key, key2, name, models, value, replace, isobject, meta) + elif xml_id: + cr.execute('UPDATE ir_values set value=%s WHERE model=%s and key=%s and name=%s'+where,(value, model, key, name)) + return True - def _process_end(self, cr, uid, modules): - if not modules: - return True - module_str = ["'%s'" % m for m in modules] - cr.execute('select id,name,model,res_id,module from ir_model_data where module in ('+','.join(module_str)+') and not noupdate') - wkf_todo = [] - for (id, name, model, res_id,module) in cr.fetchall(): - if (module,name) not in self.loads: - self.unlink_mark[(model,res_id)] = id - if model=='workflow.activity': - cr.execute('select res_type,res_id from wkf_instance where id in (select inst_id from wkf_workitem where act_id=%d)', (res_id,)) - wkf_todo.extend(cr.fetchall()) - cr.execute("update wkf_transition set condition='True', role_id=NULL, signal=NULL,act_to=act_from,act_from=%d where act_to=%d", (res_id,res_id)) - cr.execute("delete from wkf_transition where act_to=%d", (res_id,)) + def _process_end(self, cr, uid, modules): + if not modules: + return True + module_str = ["'%s'" % m for m in modules] + cr.execute('select id,name,model,res_id,module from ir_model_data where module in ('+','.join(module_str)+') and not noupdate') + wkf_todo = [] + for (id, name, model, res_id,module) in cr.fetchall(): + if (module,name) not in self.loads: + self.unlink_mark[(model,res_id)] = id + if model=='workflow.activity': + cr.execute('select res_type,res_id from wkf_instance where id in (select inst_id from wkf_workitem where act_id=%d)', (res_id,)) + wkf_todo.extend(cr.fetchall()) + cr.execute("update wkf_transition set condition='True', role_id=NULL, signal=NULL,act_to=act_from,act_from=%d where act_to=%d", (res_id,res_id)) + cr.execute("delete from wkf_transition where act_to=%d", (res_id,)) - for model,id in wkf_todo: - wf_service = netsvc.LocalService("workflow") - wf_service.trg_write(uid, model, id, cr) + for model,id in wkf_todo: + wf_service = netsvc.LocalService("workflow") + wf_service.trg_write(uid, model, id, cr) - cr.commit() - for (model,id) in self.unlink_mark.keys(): - if self.pool.get(model): - logger = netsvc.Logger() - logger.notifyChannel('init', netsvc.LOG_INFO, 'Deleting %s@%s' % (id, model)) - try: - self.pool.get(model).unlink(cr, uid, [id]) - if self.unlink_mark[(model,id)]: - self.unlink(cr, uid, [self.unlink_mark[(model,id)]]) - cr.execute('DELETE FROM ir_values WHERE value=%s', (model+','+str(id),)) - cr.commit() - except: - logger.notifyChannel('init', netsvc.LOG_ERROR, 'Could not delete id: %d of model %s\tThere should be some relation that points to this resource\tYou should manually fix this and restart --update=module' % (id, model)) - return True + cr.commit() + for (model,id) in self.unlink_mark.keys(): + if self.pool.get(model): + logger = netsvc.Logger() + logger.notifyChannel('init', netsvc.LOG_INFO, 'Deleting %s@%s' % (id, model)) + try: + self.pool.get(model).unlink(cr, uid, [id]) + if self.unlink_mark[(model,id)]: + self.unlink(cr, uid, [self.unlink_mark[(model,id)]]) + cr.execute('DELETE FROM ir_values WHERE value=%s', (model+','+str(id),)) + cr.commit() + except: + logger.notifyChannel('init', netsvc.LOG_ERROR, 'Could not delete id: %d of model %s\tThere should be some relation that points to this resource\tYou should manually fix this and restart --update=module' % (id, model)) + return True ir_model_data()