diff --git a/addons/account/security/account_security.xml b/addons/account/security/account_security.xml
index 24265065b25..347a82e33c2 100644
--- a/addons/account/security/account_security.xml
+++ b/addons/account/security/account_security.xml
@@ -100,14 +100,14 @@
Account fiscal Mapping company rule
- [('company_id','=',user.company_id.id)]
+ ['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]
Account model company rule
- [('company_id','=',user.company_id.id)]
+ ['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]
diff --git a/addons/account_budget/security/account_budget_security.xml b/addons/account_budget/security/account_budget_security.xml
index ec075205f68..1fbcd82e86c 100644
--- a/addons/account_budget/security/account_budget_security.xml
+++ b/addons/account_budget/security/account_budget_security.xml
@@ -1,27 +1,27 @@
-
+
-
- Budget post multi-company
-
-
- ['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]
-
+
+ Budget post multi-company
+
+
+ ['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]
+
-
- Budget multi-company
-
-
- ['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]
-
+
+ Budget multi-company
+
+
+ ['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]
+
-
- Budget lines multi-company
-
-
- ['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]
-
+
+ Budget lines multi-company
+
+
+ ['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]
+
-
+
diff --git a/addons/account_coda/security/account_security.xml b/addons/account_coda/security/account_security.xml
index f1a453da542..b8fdd32ebe6 100644
--- a/addons/account_coda/security/account_security.xml
+++ b/addons/account_coda/security/account_security.xml
@@ -5,7 +5,7 @@
Account Coda model company rule
- [('company_id','=',user.company_id.id)]
+ ['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]
diff --git a/addons/account_payment/security/account_payment_security.xml b/addons/account_payment/security/account_payment_security.xml
index 6561373bafb..5977ea36365 100644
--- a/addons/account_payment/security/account_payment_security.xml
+++ b/addons/account_payment/security/account_payment_security.xml
@@ -10,7 +10,7 @@
Payment Mode company rule
- [('company_id','=',user.company_id.id)]
+ ['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]
diff --git a/addons/analytic/security/analytic_security.xml b/addons/analytic/security/analytic_security.xml
index 2eeda3aa370..dfa8c840bb6 100644
--- a/addons/analytic/security/analytic_security.xml
+++ b/addons/analytic/security/analytic_security.xml
@@ -5,7 +5,7 @@
Analytic multi company rule
- [('company_id','=',user.company_id.id)]
+ ['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]
Useability / Analytic Accounting
diff --git a/addons/crm/crm_lead_menu.xml b/addons/crm/crm_lead_menu.xml
index a92a36aba33..6c74dccac15 100644
--- a/addons/crm/crm_lead_menu.xml
+++ b/addons/crm/crm_lead_menu.xml
@@ -31,7 +31,7 @@
parent="base.menu_base_partner" sequence="1" />
diff --git a/addons/crm/security/crm_security.xml b/addons/crm/security/crm_security.xml
index 78018a4031b..1e25ecb5bdd 100644
--- a/addons/crm/security/crm_security.xml
+++ b/addons/crm/security/crm_security.xml
@@ -34,6 +34,6 @@
-
+
diff --git a/addons/fetchmail/fetchmail_data.xml b/addons/fetchmail/fetchmail_data.xml
index 1b60f4ca0a8..ef40a76489f 100644
--- a/addons/fetchmail/fetchmail_data.xml
+++ b/addons/fetchmail/fetchmail_data.xml
@@ -12,15 +12,4 @@
-
-
-
-
- User wise Server
-
-
- [('user_id', '=', user.id)]
-
-
-
diff --git a/addons/hr_attendance/__openerp__.py b/addons/hr_attendance/__openerp__.py
index 8a52d0e2577..d38c0fcebf3 100644
--- a/addons/hr_attendance/__openerp__.py
+++ b/addons/hr_attendance/__openerp__.py
@@ -36,15 +36,16 @@
'hr_attendance_view.xml',
'hr_attendance_report.xml',
'security/ir.model.access.csv',
+ 'security/ir_rule.xml',
'wizard/hr_attendance_bymonth_view.xml',
'wizard/hr_attendance_byweek_view.xml',
'wizard/hr_attendance_error_view.xml',
'wizard/hr_attendance_sign_in_out_view.xml',
- ],
+ ],
'demo_xml': ['hr_attendance_demo.xml'],
'test': ['test/test_hr_attendance.yml',
'test/hr_attendance_report.yml'
- ],
+ ],
'installable': True,
'active': False,
'certificate': '0063495605613',
diff --git a/addons/hr_attendance/hr_attendance_demo.xml b/addons/hr_attendance/hr_attendance_demo.xml
index d2967167ec8..372e9112269 100644
--- a/addons/hr_attendance/hr_attendance_demo.xml
+++ b/addons/hr_attendance/hr_attendance_demo.xml
@@ -121,17 +121,6 @@
sign_out
-
- Employee Attendance
-
- [('employee_id.user_id','=',user.id)]
-
-
-
- Manager Attendance
-
- ['|',('employee_id.user_id','=',user.id),('employee_id.parent_id.user_id','=',user.id )]
-
-
+
diff --git a/addons/hr_attendance/security/ir_rule.xml b/addons/hr_attendance/security/ir_rule.xml
new file mode 100644
index 00000000000..914acbb1974
--- /dev/null
+++ b/addons/hr_attendance/security/ir_rule.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+ Employee Attendance
+
+ [('employee_id.user_id','=',user.id)]
+
+
+
+ Manager Attendance
+
+ [('1','=',1)]
+
+
+
+
+
+
+
diff --git a/addons/hr_evaluation/hr_evaluation_demo.xml b/addons/hr_evaluation/hr_evaluation_demo.xml
index f8513bf63ea..59396717d49 100644
--- a/addons/hr_evaluation/hr_evaluation_demo.xml
+++ b/addons/hr_evaluation/hr_evaluation_demo.xml
@@ -1599,31 +1599,31 @@ Once the form had been filled, the employee send it to his supervisor.
-
-
- Run Employee Evaluation
-
-
- 1
- minutes
- -1
-
-
-
-
+
+
+ Run Employee Evaluation
+
+
+ 1
+ minutes
+ -1
+
+
+
+
Employee Evaluation
[('employee_id.user_id','=',user.id)]
-
+
Manager Evaluation
['|',('employee_id.user_id','=',user.id),('employee_id.parent_id.user_id','=',user.id )]
-
+
-
+
diff --git a/addons/hr_expense/__openerp__.py b/addons/hr_expense/__openerp__.py
index c9df8587153..75d79d4bfc6 100644
--- a/addons/hr_expense/__openerp__.py
+++ b/addons/hr_expense/__openerp__.py
@@ -49,10 +49,11 @@
'hr_expense_view.xml',
'hr_expense_report.xml',
'process/hr_expense_process.xml',
+ 'security/ir_rule.xml',
'report/hr_expense_report_view.xml',
'board_hr_expense_view.xml',
'board_hr_expense_manager_view.xml'
- ],
+ ],
'demo_xml': [
'hr_expense_demo.xml',
],
diff --git a/addons/hr_expense/hr_expense_demo.xml b/addons/hr_expense/hr_expense_demo.xml
index cb9e28b5543..4c85bd8384e 100644
--- a/addons/hr_expense/hr_expense_demo.xml
+++ b/addons/hr_expense/hr_expense_demo.xml
@@ -1,8 +1,8 @@
-
+
-
+
1.0
1.0
@@ -38,61 +38,61 @@
-
-
-
-
- May Expenses
-
- 2010-05-03
- draft
-
+
+
+
+
+ May Expenses
+
+ 2010-05-03
+ draft
+
-
- Travel by Air
- 2010-05-03
-
-
-
-
-
-
-
+
+ Travel by Air
+ 2010-05-03
+
+
+
+
+
+
+
-
- Basic PC - Server for Seagate
- 2010-05-03
-
-
-
-
-
-
-
+
+ Basic PC - Server for Seagate
+ 2010-05-03
+
+
+
+
+
+
+
-
+
-
-
-
-
-
- Travel Expenses
-
- 2010-04-20
- draft
-
+
+
+
+
+
+ Travel Expenses
+
+ 2010-04-20
+ draft
+
-
- Hotel Expenses - Thymbra
- 2010-05-03
-
-
-
-
-
-
-
+
+ Hotel Expenses - Thymbra
+ 2010-05-03
+
+
+
+
+
+
+
Bruxelles - Paris
@@ -104,17 +104,5 @@
-
- Employee Expense
-
- [('employee_id.user_id','=',user.id)]
-
-
-
- Manager Expense
-
- ['|',('employee_id.user_id','=',user.id),('employee_id.parent_id.user_id','=',user.id )]
-
-
-
+
diff --git a/addons/hr_expense/security/ir_rule.xml b/addons/hr_expense/security/ir_rule.xml
new file mode 100644
index 00000000000..1a3ee41cdcb
--- /dev/null
+++ b/addons/hr_expense/security/ir_rule.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+ Employee Expense
+
+ [('employee_id.user_id','=',user.id)]
+
+
+
+ Manager Expense
+
+ [('1','=',1)]
+
+
+
+
+
diff --git a/addons/hr_holidays/__openerp__.py b/addons/hr_holidays/__openerp__.py
index 308f03ba293..09b312f0834 100644
--- a/addons/hr_holidays/__openerp__.py
+++ b/addons/hr_holidays/__openerp__.py
@@ -54,6 +54,7 @@
'init_xml': [],
'update_xml': [
'security/ir.model.access.csv',
+ 'security/ir_rule.xml',
'hr_holidays_workflow.xml',
'hr_holidays_view.xml',
'hr_holidays_data.xml',
diff --git a/addons/hr_holidays/hr_holidays_demo.xml b/addons/hr_holidays/hr_holidays_demo.xml
index e12d7de16b5..dca01d06b1a 100644
--- a/addons/hr_holidays/hr_holidays_demo.xml
+++ b/addons/hr_holidays/hr_holidays_demo.xml
@@ -33,19 +33,5 @@
-
-
- Employee Holidays
-
- [('employee_id.user_id','=',user.id)]
-
-
-
- Manager Holidays
-
- ['|',('employee_id.user_id','=',user.id),('employee_id.parent_id.user_id','=',user.id )]
-
-
-
diff --git a/addons/hr_holidays/security/ir_rule.xml b/addons/hr_holidays/security/ir_rule.xml
new file mode 100644
index 00000000000..12217aaddf2
--- /dev/null
+++ b/addons/hr_holidays/security/ir_rule.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+ Employee Holidays
+
+ [('employee_id.user_id','=',user.id)]
+
+
+
+ Manager Holidays
+
+ [('1','=',1)]
+
+
+
+
+
diff --git a/addons/hr_timesheet_sheet/security/hr_timesheet_sheet_security.xml b/addons/hr_timesheet_sheet/security/hr_timesheet_sheet_security.xml
index 2ff303cb48f..af6786a2a77 100644
--- a/addons/hr_timesheet_sheet/security/hr_timesheet_sheet_security.xml
+++ b/addons/hr_timesheet_sheet/security/hr_timesheet_sheet_security.xml
@@ -1,13 +1,13 @@
-
+
-
- Timesheet multi-company
-
-
- [('company_id','child_of',[user.company_id.id])]
-
+
+ Timesheet multi-company
+
+
+ [('company_id','child_of',[user.company_id.id])]
+
-
+
diff --git a/addons/mrp/security/mrp_security.xml b/addons/mrp/security/mrp_security.xml
index 406371a89dd..b105e1cbb8a 100644
--- a/addons/mrp/security/mrp_security.xml
+++ b/addons/mrp/security/mrp_security.xml
@@ -10,28 +10,28 @@
-
-
-
-
+
+
+
+
- mrp_production multi-company
+ mrp_production multi-company
['|',('company_id','child_of',[user.company_id.id]),('company_id','=',False)]
- mrp_workcenter multi-company
+ mrp_workcenter multi-company
['|',('company_id','child_of',[user.company_id.id]),('company_id','=',False)]
- mrp_bom multi-company
+ mrp_bom multi-company
['|',('company_id','child_of',[user.company_id.id]),('company_id','=',False)]
diff --git a/addons/point_of_sale/security/point_of_sale_security.xml b/addons/point_of_sale/security/point_of_sale_security.xml
index 6163d65a36f..d70fd1caa85 100644
--- a/addons/point_of_sale/security/point_of_sale_security.xml
+++ b/addons/point_of_sale/security/point_of_sale_security.xml
@@ -8,13 +8,6 @@
Point of Sale / User
-
-
- Registers
-
-
- [('user_id','!=',['base.user_root'])]
-
diff --git a/addons/procurement/security/procurement_security.xml b/addons/procurement/security/procurement_security.xml
index cf32286fd2f..b6b15d565c6 100644
--- a/addons/procurement/security/procurement_security.xml
+++ b/addons/procurement/security/procurement_security.xml
@@ -1,20 +1,20 @@
-
-
-
- procurement multi-company
-
-
- ['|',('company_id','child_of',[user.company_id.id]),('company_id','=',False)]
-
-
-
- stock_warehouse.orderpoint multi-company
-
-
- ['|',('company_id','child_of',[user.company_id.id]),('company_id','=',False)]
-
-
-
-
\ No newline at end of file
+
+
+
+ procurement multi-company
+
+
+ ['|',('company_id','child_of',[user.company_id.id]),('company_id','=',False)]
+
+
+
+ stock_warehouse.orderpoint multi-company
+
+
+ ['|',('company_id','child_of',[user.company_id.id]),('company_id','=',False)]
+
+
+
+
diff --git a/addons/product/pricelist.py b/addons/product/pricelist.py
index 90d55d47251..4831123e07c 100644
--- a/addons/product/pricelist.py
+++ b/addons/product/pricelist.py
@@ -126,161 +126,6 @@ class product_pricelist(osv.osv):
"currency_id": _get_currency
}
- def price_get_multi_old(self, cr, uid, product_map, context=None):
- """multi products 'price_get'
- @param context: {
- 'date': Date of the pricelist (%Y-%m-%d),
- @return: a dict with product_id as key and the product price as value
- }
- """
-
- def _create_parent_category_list(id, lst):
- if not id:
- return []
- parent = product_category_tree.get(id)
- if parent:
- lst.append(parent)
- return _create_parent_category_list(parent, lst)
- else:
- return lst
- # _create_parent_category_list
-
- context = context or {}
-
- # XXX
- date = time.strftime('%Y-%m-%d')
- if 'date' in context:
- date = context['date']
-
- currency_obj = self.pool.get('res.currency')
- product_obj = self.pool.get('product.product')
- product_category_obj = self.pool.get('product.category')
- product_uom_obj = self.pool.get('product.uom')
- supplierinfo_obj = self.pool.get('product.supplierinfo')
- price_type_obj = self.pool.get('product.price.type')
- product_pricelist_version_obj = self.pool.get('product.pricelist.version')
-
- # product.pricelist.version:
- pricelist_version_ids = list(set([k[1] for k in product_map.keys()]))
- plversions_search_args = [
- ('pricelist_id', 'in', pricelist_version_ids),
- '|',
- ('date_start', '=', False),
- ('date_start', '<=', date),
- '|',
- ('date_end', '=', False),
- ('date_end', '>=', date),
- ]
-
- plversion_ids = product_pricelist_version_obj.search(cr, uid, plversions_search_args)
- if len(pricelist_version_ids) != len(plversion_ids):
- msg = "At least one pricelist has no active version !\nPlease create or activate one."
- raise osv.except_osv(_('Warning !'), _(msg))
-
- # product.product:
- product_ids = list(set([k[0] for k in product_map.keys()]))
- products = dict([(item['id'], item) for item in product_obj.read(cr, uid, product_ids, ['categ_id', 'product_tmpl_id', 'uos_id', 'uom_id'])])
-
- # product.category:
- product_category_ids = product_category_obj.search(cr, uid, [])
- product_categories = product_category_obj.read(cr, uid, product_category_ids, ['parent_id'])
- product_category_tree = dict([(item['id'], item['parent_id'][0]) for item in product_categories if item['parent_id']])
-
- results = {}
- for (product_id, pricelist_id), line in product_map.items():
- price = False
-
- partner = line['partner_id']
- qty = line['qty']
- tmpl_id = products[product_id]['product_tmpl_id'] and products[product_id]['product_tmpl_id'][0] or False
-
- categ_id = products[product_id]['categ_id'] and products[product_id]['categ_id'][0] or False
- categ_ids = _create_parent_category_list(categ_id, [categ_id])
- if categ_ids:
- categ_where = '(categ_id IN (' + ','.join(map(str, categ_ids)) + '))'
- else:
- categ_where = '(categ_id IS NULL)'
-
- cr.execute(
- 'SELECT i.*, pl.currency_id '
- 'FROM product_pricelist_item AS i, '
- 'product_pricelist_version AS v, product_pricelist AS pl '
- 'WHERE (product_tmpl_id IS NULL OR product_tmpl_id = %s) '
- 'AND (product_id IS NULL OR product_id = %s) '
- 'AND (' + categ_where + ' OR (categ_id IS NULL)) '
- 'AND price_version_id = %s '
- 'AND (min_quantity IS NULL OR min_quantity <= %s) '
- 'AND i.price_version_id = v.id AND v.pricelist_id = pl.id '
- 'ORDER BY sequence',
- (tmpl_id, product_id, pricelist_id, qty))
- res1 = cr.dictfetchall()
-
- for res in res1:
- if res:
- if res['base'] == -1:
- if not res['base_pricelist_id']:
- price = 0.0
- else:
- price_tmp = self.price_get(cr, uid,
- [res['base_pricelist_id']], product_id,
- qty)[res['base_pricelist_id']]
- ptype_src = self.browse(cr, uid, res['base_pricelist_id']).currency_id.id
- price = currency_obj.compute(cr, uid, ptype_src, res['currency_id'], price_tmp, round=False)
- break
- elif res['base'] == -2:
- # this section could be improved by moving the queries outside the loop:
- where = []
- if partner:
- where = [('name', '=', partner) ]
- sinfo = supplierinfo_obj.search(cr, uid,
- [('product_id', '=', tmpl_id)] + where)
- price = 0.0
- if sinfo:
- cr.execute('SELECT * ' \
- 'FROM pricelist_partnerinfo ' \
- 'WHERE suppinfo_id IN %s' \
- 'AND min_quantity <= %s ' \
- 'ORDER BY min_quantity DESC LIMIT 1', (tuple(sinfo),qty,))
- res2 = cr.dictfetchone()
- if res2:
- price = res2['price']
- break
- else:
- price_type = price_type_obj.browse(cr, uid, int(res['base']))
- price = currency_obj.compute(cr, uid,
- price_type.currency_id.id, res['currency_id'],
- product_obj.price_get(cr, uid, [product_id],
- price_type.field)[product_id], round=False, context=context)
-
- if price:
- price_limit = price
-
- price = price * (1.0+(res['price_discount'] or 0.0))
- price = rounding(price, res['price_round'])
- price += (res['price_surcharge'] or 0.0)
- if res['price_min_margin']:
- price = max(price, price_limit+res['price_min_margin'])
- if res['price_max_margin']:
- price = min(price, price_limit+res['price_max_margin'])
- break
-
- else:
- # False means no valid line found ! But we may not raise an
- # exception here because it breaks the search
- price = False
-
- if price:
- p_uom_id = products[product_id]['uos_id'] and products[product_id]['uos_id'][0] or products[product_id]['uom_id'] and products[product_id]['uom_id'][0] or False
- if p_uom_id:
- price = product_uom_obj._compute_price(cr, uid, p_uom_id, price, context.get('uom', False))
-
- if results.get(product_id):
- results[product_id][pricelist_id] = price
- else:
- results[product_id] = {pricelist_id: price}
-
- return results
-
#def price_get_multi(self, cr, uid, product_ids, context=None):
def price_get_multi(self, cr, uid, pricelist_ids, products_by_qty_by_partner, context=None):
"""multi products 'price_get'.
@@ -392,7 +237,6 @@ class product_pricelist(osv.osv):
qty)[res['base_pricelist_id']]
ptype_src = self.browse(cr, uid, res['base_pricelist_id']).currency_id.id
price = currency_obj.compute(cr, uid, ptype_src, res['currency_id'], price_tmp, round=False)
- break
elif res['base'] == -2:
# this section could be improved by moving the queries outside the loop:
where = []
@@ -410,7 +254,6 @@ class product_pricelist(osv.osv):
res2 = cr.dictfetchone()
if res2:
price = res2['price']
- break
else:
price_type = price_type_obj.browse(cr, uid, int(res['base']))
price = currency_obj.compute(cr, uid,
diff --git a/addons/project/security/project_security.xml b/addons/project/security/project_security.xml
index e77b1f338d1..cf8a333a71d 100644
--- a/addons/project/security/project_security.xml
+++ b/addons/project/security/project_security.xml
@@ -37,13 +37,7 @@
['|','|','|',('user_id','=',False),('user_id','=',user.id),('project_id.members','in', [user.id]),('project_id.user_id','=',user.id)]
-
-
-
- Projects According to User
-
-
- [('user_id','=',user.id)]
+
diff --git a/addons/purchase_requisition/security/purchase_tender.xml b/addons/purchase_requisition/security/purchase_tender.xml
index ebee3d040c2..9ccab8fdbb9 100644
--- a/addons/purchase_requisition/security/purchase_tender.xml
+++ b/addons/purchase_requisition/security/purchase_tender.xml
@@ -10,7 +10,7 @@
- Purchase Requisition multi-company
+ Purchase Requisition multi-company
['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]