@@ -1400,6 +1403,21 @@
+
+
+
+ tree
+
+
+
+
+
+
+ form
+
+
+
+
+
+ Portal Member
+ Portal members can access information through the portal menu. Also, they are chrooted in this specific menu.
+
+
Portal
diff --git a/addons/portal/portal_view.xml b/addons/portal/portal_view.xml
index fd15a842405..924f74565cd 100644
--- a/addons/portal/portal_view.xml
+++ b/addons/portal/portal_view.xml
@@ -84,7 +84,7 @@
-
+
diff --git a/addons/portal/security/ir.model.access.csv b/addons/portal/security/ir.model.access.csv
index 56b3ae5f269..29c43bb4815 100644
--- a/addons/portal/security/ir.model.access.csv
+++ b/addons/portal/security/ir.model.access.csv
@@ -1,8 +1,6 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_all,access.portal.all,model_res_portal,,1,0,0,0
access_widget_all,access.portal.widget.all,model_res_portal_widget,,1,0,0,0
-access_manager,access.portal.manager,model_res_portal,group_portal_manager,1,1,1,1
-access_widget_manager,access.portal.widget.manager,model_res_portal_widget,group_portal_manager,1,1,1,1
access_mail_message,mail.message,mail.model_mail_message,group_portal_member,1,0,1,1
access_mail_message_all,mail.message.all,mail.model_mail_message,group_portal_member,1,0,0,0
access_mail_thread,mail.thread,mail.model_mail_thread,group_portal_member,1,0,0,0
diff --git a/addons/portal/security/portal_security.xml b/addons/portal/security/portal_security.xml
deleted file mode 100644
index 4a493204d67..00000000000
--- a/addons/portal/security/portal_security.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
-
-
-
-
- Portal Member
- Portal members can access information through the portal menu. Also, they are chrooted in this specific menu.
-
-
-
- Portal
-
- 25
-
-
-
-
- Officer
- Portal officers can create new portal users with the portal wizard.
-
-
-
-
- Manager
- Portal managers have access to the portal definitions, and can easily configure the users, access rights and menus of portal users.
-
-
-
-
-
-
-
diff --git a/addons/portal/wizard/portal_wizard_view.xml b/addons/portal/wizard/portal_wizard_view.xml
index 0cf84646bab..7a81def67b0 100644
--- a/addons/portal/wizard/portal_wizard_view.xml
+++ b/addons/portal/wizard/portal_wizard_view.xml
@@ -8,7 +8,7 @@
res_model="res.portal.wizard"
view_type="form" view_mode="form"
key2="client_action_multi" target="new"
- groups="group_portal_officer"/>
+ groups="base.group_partner_manager"/>
diff --git a/addons/portal/wizard/share_wizard.py b/addons/portal/wizard/share_wizard.py
index ca950a61b08..e56e7517348 100644
--- a/addons/portal/wizard/share_wizard.py
+++ b/addons/portal/wizard/share_wizard.py
@@ -44,9 +44,6 @@ class share_wizard_portal(osv.TransientModel):
'group_ids': fields.many2many('res.groups', 'share_wizard_res_group_rel', 'share_id', 'group_id', 'Existing groups', domain=[('share', '=', False)]),
}
- def is_portal_manager(self, cr, uid, context=None):
- return self.has_group(cr, uid, module='portal', group_xml_id='group_portal_manager', context=context)
-
def _check_preconditions(self, cr, uid, wizard_data, context=None):
if wizard_data.user_type == 'existing':
self._assert(wizard_data.user_ids,
diff --git a/addons/portal/wizard/share_wizard_view.xml b/addons/portal/wizard/share_wizard_view.xml
index 72ae857eaaf..065a7aa317e 100644
--- a/addons/portal/wizard/share_wizard_view.xml
+++ b/addons/portal/wizard/share_wizard_view.xml
@@ -36,12 +36,12 @@
-
+
-
-
+
+
From be03938f47cd835674f3cecd23792d7934604278 Mon Sep 17 00:00:00 2001
From: Raphael Collet
Date: Fri, 14 Sep 2012 15:41:16 +0200
Subject: [PATCH 099/174] [FIX] portal: move group definition of portal back to
security/portal_security.xml
bzr revid: rco@openerp.com-20120914134116-sg2yqsro8c62bxg2
---
addons/portal/portal_data.xml | 6 ------
addons/portal/security/portal_security.xml | 13 +++++++++++++
2 files changed, 13 insertions(+), 6 deletions(-)
create mode 100644 addons/portal/security/portal_security.xml
diff --git a/addons/portal/portal_data.xml b/addons/portal/portal_data.xml
index 42447afdfd5..eb06ca656d6 100644
--- a/addons/portal/portal_data.xml
+++ b/addons/portal/portal_data.xml
@@ -2,12 +2,6 @@
-
-
- Portal Member
- Portal members can access information through the portal menu. Also, they are chrooted in this specific menu.
-
-
Portal
diff --git a/addons/portal/security/portal_security.xml b/addons/portal/security/portal_security.xml
new file mode 100644
index 00000000000..9a71b9b181f
--- /dev/null
+++ b/addons/portal/security/portal_security.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+ Portal
+ Portal members can access information through the portal menu. Also, they are chrooted in this specific menu.
+
+
+
+
+
From 5720ae3a90d11428c610c0c040f37315ce433488 Mon Sep 17 00:00:00 2001
From: Raphael Collet
Date: Fri, 14 Sep 2012 15:42:51 +0200
Subject: [PATCH 100/174] [IMP] portal: rename xml id
'portal.group_portal_member' to 'portal.group_portal'
bzr revid: rco@openerp.com-20120914134251-answ8jr65vfeeiz3
---
addons/portal/portal_data.xml | 2 +-
addons/portal/portal_view.xml | 2 +-
addons/portal/security/ir.model.access.csv | 14 ++--
addons/portal/security/portal_security.xml | 2 +-
.../portal_claim/security/ir.model.access.csv | 4 +-
.../portal_claim/security/portal_security.xml | 2 +-
.../portal_event/security/ir.model.access.csv | 4 +-
.../portal_event/security/portal_security.xml | 4 +-
.../security/ir.model.access.csv | 10 +--
.../security/ir.model.access.csv | 8 +--
.../security/portal_security.xml | 2 +-
.../security/ir.model.access.csv | 4 +-
.../security/portal_security.xml | 2 +-
.../portal_sale/security/ir.model.access.csv | 64 +++++++++----------
.../portal_sale/security/portal_security.xml | 12 ++--
15 files changed, 68 insertions(+), 68 deletions(-)
diff --git a/addons/portal/portal_data.xml b/addons/portal/portal_data.xml
index eb06ca656d6..5edb4bed8c7 100644
--- a/addons/portal/portal_data.xml
+++ b/addons/portal/portal_data.xml
@@ -4,7 +4,7 @@
Portal
-
+
diff --git a/addons/portal/portal_view.xml b/addons/portal/portal_view.xml
index 924f74565cd..5241d7cf54f 100644
--- a/addons/portal/portal_view.xml
+++ b/addons/portal/portal_view.xml
@@ -5,7 +5,7 @@
diff --git a/addons/portal/security/ir.model.access.csv b/addons/portal/security/ir.model.access.csv
index 29c43bb4815..60687e8a0cc 100644
--- a/addons/portal/security/ir.model.access.csv
+++ b/addons/portal/security/ir.model.access.csv
@@ -1,10 +1,10 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_all,access.portal.all,model_res_portal,,1,0,0,0
access_widget_all,access.portal.widget.all,model_res_portal_widget,,1,0,0,0
-access_mail_message,mail.message,mail.model_mail_message,group_portal_member,1,0,1,1
-access_mail_message_all,mail.message.all,mail.model_mail_message,group_portal_member,1,0,0,0
-access_mail_thread,mail.thread,mail.model_mail_thread,group_portal_member,1,0,0,0
-access_mail_followers,mail.followers,mail.model_mail_followers,group_portal_member,1,0,1,1
-access_mail_notification,mail.notification,mail.model_mail_notification,group_portal_member,1,0,1,0
-access_mail_group,mail.group,mail.model_mail_group,group_portal_member,1,0,0,0
-access_mail_alias,mail.alias,mail.model_mail_alias,group_portal_member,1,0,0,0
+access_mail_message,mail.message,mail.model_mail_message,group_portal,1,0,1,1
+access_mail_message_all,mail.message.all,mail.model_mail_message,group_portal,1,0,0,0
+access_mail_thread,mail.thread,mail.model_mail_thread,group_portal,1,0,0,0
+access_mail_followers,mail.followers,mail.model_mail_followers,group_portal,1,0,1,1
+access_mail_notification,mail.notification,mail.model_mail_notification,group_portal,1,0,1,0
+access_mail_group,mail.group,mail.model_mail_group,group_portal,1,0,0,0
+access_mail_alias,mail.alias,mail.model_mail_alias,group_portal,1,0,0,0
diff --git a/addons/portal/security/portal_security.xml b/addons/portal/security/portal_security.xml
index 9a71b9b181f..0bf4cb2dcfc 100644
--- a/addons/portal/security/portal_security.xml
+++ b/addons/portal/security/portal_security.xml
@@ -3,7 +3,7 @@
-
+
Portal
Portal members can access information through the portal menu. Also, they are chrooted in this specific menu.
diff --git a/addons/portal_claim/security/ir.model.access.csv b/addons/portal_claim/security/ir.model.access.csv
index 554c66cc998..ab2a2f66770 100644
--- a/addons/portal_claim/security/ir.model.access.csv
+++ b/addons/portal_claim/security/ir.model.access.csv
@@ -1,3 +1,3 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
-access_crm_claim,crm.claim,crm_claim.model_crm_claim,portal.group_portal_member,1,0,0,0
-access_crm_claim_stage,crm.claim.stage,crm_claim.model_crm_claim_stage,portal.group_portal_member,1,0,0,0
+access_crm_claim,crm.claim,crm_claim.model_crm_claim,portal.group_portal,1,0,0,0
+access_crm_claim_stage,crm.claim.stage,crm_claim.model_crm_claim_stage,portal.group_portal,1,0,0,0
diff --git a/addons/portal_claim/security/portal_security.xml b/addons/portal_claim/security/portal_security.xml
index e902bd043ad..9fc47c4cfb0 100644
--- a/addons/portal_claim/security/portal_security.xml
+++ b/addons/portal_claim/security/portal_security.xml
@@ -6,7 +6,7 @@
Portal Personal Claims
[('partner_id','child_of',user.partner_id.id)]
-
+
diff --git a/addons/portal_event/security/ir.model.access.csv b/addons/portal_event/security/ir.model.access.csv
index b418acbb9c4..7418b08bb4b 100644
--- a/addons/portal_event/security/ir.model.access.csv
+++ b/addons/portal_event/security/ir.model.access.csv
@@ -1,3 +1,3 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
-access_event,event,event.model_event_event,portal.group_portal_member,1,0,0,0
-access_registration,registration,event.model_event_registration,portal.group_portal_member,1,0,0,0
+access_event,event,event.model_event_event,portal.group_portal,1,0,0,0
+access_registration,registration,event.model_event_registration,portal.group_portal,1,0,0,0
diff --git a/addons/portal_event/security/portal_security.xml b/addons/portal_event/security/portal_security.xml
index 6a3ed0ac786..74b2372c147 100644
--- a/addons/portal_event/security/portal_security.xml
+++ b/addons/portal_event/security/portal_security.xml
@@ -6,14 +6,14 @@
Portal Visible Events
[('visibility', '=', 'public')]
-
+
Portal Personal Registrations
[('partner_id','child_of',user.partner_id.id)]
-
+
diff --git a/addons/portal_hr_employees/security/ir.model.access.csv b/addons/portal_hr_employees/security/ir.model.access.csv
index 6131f49d749..d18aeb90e1c 100644
--- a/addons/portal_hr_employees/security/ir.model.access.csv
+++ b/addons/portal_hr_employees/security/ir.model.access.csv
@@ -1,6 +1,6 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
-access_hr_employee_user,hr.employee user,hr.model_hr_employee,portal.group_portal_member,1,0,0,0
-access_res_partner,res.partner,base.model_res_partner,portal.group_portal_member,1,0,0,0
-access_res_partner_address,res.partner_address,base.model_res_partner_address,portal.group_portal_member,1,0,0,0
-access_res_partner_category,res.partner_category,base.model_res_partner_category,portal.group_portal_member,1,0,0,0
-access_res_partner_title,res.partner_title,base.model_res_partner_title,portal.group_portal_member,1,0,0,0
+access_hr_employee_user,hr.employee user,hr.model_hr_employee,portal.group_portal,1,0,0,0
+access_res_partner,res.partner,base.model_res_partner,portal.group_portal,1,0,0,0
+access_res_partner_address,res.partner_address,base.model_res_partner_address,portal.group_portal,1,0,0,0
+access_res_partner_category,res.partner_category,base.model_res_partner_category,portal.group_portal,1,0,0,0
+access_res_partner_title,res.partner_title,base.model_res_partner_title,portal.group_portal,1,0,0,0
diff --git a/addons/portal_project/security/ir.model.access.csv b/addons/portal_project/security/ir.model.access.csv
index dceca5ba8bb..85463868ee1 100644
--- a/addons/portal_project/security/ir.model.access.csv
+++ b/addons/portal_project/security/ir.model.access.csv
@@ -1,5 +1,5 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
-access_task,tasks,project.model_project_task,portal.group_portal_member,1,0,0,0
-access_task_type,task_type,project.model_project_task_type,portal.group_portal_member,1,0,0,0
-access_task_work,task_work,project.model_project_task_work,portal.group_portal_member,1,0,0,0
-access_project_category,project_category,project.model_project_category,portal.group_portal_member,1,0,0,0
+access_task,tasks,project.model_project_task,portal.group_portal,1,0,0,0
+access_task_type,task_type,project.model_project_task_type,portal.group_portal,1,0,0,0
+access_task_work,task_work,project.model_project_task_work,portal.group_portal,1,0,0,0
+access_project_category,project_category,project.model_project_category,portal.group_portal,1,0,0,0
diff --git a/addons/portal_project/security/portal_security.xml b/addons/portal_project/security/portal_security.xml
index b995c79bbbc..b9d37cec099 100644
--- a/addons/portal_project/security/portal_security.xml
+++ b/addons/portal_project/security/portal_security.xml
@@ -6,7 +6,7 @@
Portal Personal Task
[('partner_id','child_of',user.partner_id.id)]
-
+
diff --git a/addons/portal_project_issue/security/ir.model.access.csv b/addons/portal_project_issue/security/ir.model.access.csv
index 5257f9b6d02..80a38366b51 100644
--- a/addons/portal_project_issue/security/ir.model.access.csv
+++ b/addons/portal_project_issue/security/ir.model.access.csv
@@ -1,3 +1,3 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
-access_issues,project_issue,project_issue.model_project_issue,portal.group_portal_member,1,0,0,0
-access_case_section,crm_case_section,crm.model_crm_case_section,portal.group_portal_member,1,0,0,0
+access_issues,project_issue,project_issue.model_project_issue,portal.group_portal,1,0,0,0
+access_case_section,crm_case_section,crm.model_crm_case_section,portal.group_portal,1,0,0,0
diff --git a/addons/portal_project_issue/security/portal_security.xml b/addons/portal_project_issue/security/portal_security.xml
index 4ef8da5e4b6..358b5e6a0ad 100644
--- a/addons/portal_project_issue/security/portal_security.xml
+++ b/addons/portal_project_issue/security/portal_security.xml
@@ -6,7 +6,7 @@
Portal Personal Issues
[('partner_id','child_of',user.partner_id.id)]
-
+
diff --git a/addons/portal_sale/security/ir.model.access.csv b/addons/portal_sale/security/ir.model.access.csv
index 32266499af7..751c0b9baff 100644
--- a/addons/portal_sale/security/ir.model.access.csv
+++ b/addons/portal_sale/security/ir.model.access.csv
@@ -1,33 +1,33 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
-access_sale_order,sale.order,sale.model_sale_order,portal.group_portal_member,1,0,0,0
-access_sale_order_line,sale.order.line,sale.model_sale_order_line,portal.group_portal_member,1,0,0,0
-access_stock_picking,stock.picking,stock.model_stock_picking,portal.group_portal_member,1,0,0,0
-access_stock_picking.out,stock.picking.out,stock.model_stock_picking_out,portal.group_portal_member,1,0,0,0
-access_stock_move,stock.move,stock.model_stock_move,portal.group_portal_member,1,0,0,0
-access_stock_warehouse_orderpoint,stock.warehouse.orderpoint,procurement.model_stock_warehouse_orderpoint,portal.group_portal_member,1,0,0,0
-access_account_invoice,account.invoice,account.model_account_invoice,portal.group_portal_member,1,0,0,0
-access_account_invoice_tax,account.invoice.tax,account.model_account_invoice_tax,portal.group_portal_member,1,0,0,0
-access_account_invoice_line,account.invoice.line,account.model_account_invoice_line,portal.group_portal_member,1,0,0,0
-access_account_journal,account.journal,account.model_account_journal,portal.group_portal_member,1,0,0,0
-access_account_voucher,account.voucher,account_voucher.model_account_voucher,portal.group_portal_member,1,0,0,0
-access_account_voucher_line,account.voucher.line,account_voucher.model_account_voucher_line,portal.group_portal_member,1,0,0,0
-access_account_move,account.move,account.model_account_move,portal.group_portal_member,1,0,0,0
-access_account_move_line,account.move.line,account.model_account_move_line,portal.group_portal_member,1,0,0,0
-access_account_move_reconcile,account.move.reconcile,account.model_account_move_reconcile,portal.group_portal_member,1,0,0,0
-access_account_fiscalyear,account.sequence.fiscalyear,account.model_account_sequence_fiscalyear,portal.group_portal_member,1,0,0,0
-access_sale_shop,sale.shop,sale.model_sale_shop,portal.group_portal_member,1,0,0,0
-access_product_list,product.pricelist,product.model_product_pricelist,portal.group_portal_member,1,0,0,0
-access_product,product.product,product.model_product_product,portal.group_portal_member,1,0,0,0
-access_res_partner,res.partner,base.model_res_partner,portal.group_portal_member,1,0,0,0
-access_product_uom,product.uom,product.model_product_uom,portal.group_portal_member,1,0,0,0
-access_account_tax,account.tax,account.model_account_tax,portal.group_portal_member,1,0,0,0
-access_mrp_property,mrp.property,procurement.model_mrp_property,portal.group_portal_member,1,0,0,0
-access_product_template,product.template,product.model_product_template,portal.group_portal_member,1,0,0,0
-access_stock_warehouse,stock.warehouse,stock.model_stock_warehouse,portal.group_portal_member,1,0,0,0
-access_stock_location,stock.location,stock.model_stock_location,portal.group_portal_member,1,0,0,0
-access_account_fiscalyear,account.fiscalyear,account.model_account_fiscalyear,portal.group_portal_member,1,0,0,0
-access_res_partner_category,res.partner.category,base.model_res_partner_category,portal.group_portal_member,1,0,0,0
-access_product_supplierinfo,product.supplierinfo,product.model_product_supplierinfo,portal.group_portal_member,1,0,0,0
-access_product_packaging,product.packaging,product.model_product_packaging,portal.group_portal_member,1,0,0,0
-access_account_period,account.period,account.model_account_period,portal.group_portal_member,1,0,0,0
-access_account_account,account.account,account.model_account_account,portal.group_portal_member,1,0,0,0
+access_sale_order,sale.order,sale.model_sale_order,portal.group_portal,1,0,0,0
+access_sale_order_line,sale.order.line,sale.model_sale_order_line,portal.group_portal,1,0,0,0
+access_stock_picking,stock.picking,stock.model_stock_picking,portal.group_portal,1,0,0,0
+access_stock_picking.out,stock.picking.out,stock.model_stock_picking_out,portal.group_portal,1,0,0,0
+access_stock_move,stock.move,stock.model_stock_move,portal.group_portal,1,0,0,0
+access_stock_warehouse_orderpoint,stock.warehouse.orderpoint,procurement.model_stock_warehouse_orderpoint,portal.group_portal,1,0,0,0
+access_account_invoice,account.invoice,account.model_account_invoice,portal.group_portal,1,0,0,0
+access_account_invoice_tax,account.invoice.tax,account.model_account_invoice_tax,portal.group_portal,1,0,0,0
+access_account_invoice_line,account.invoice.line,account.model_account_invoice_line,portal.group_portal,1,0,0,0
+access_account_journal,account.journal,account.model_account_journal,portal.group_portal,1,0,0,0
+access_account_voucher,account.voucher,account_voucher.model_account_voucher,portal.group_portal,1,0,0,0
+access_account_voucher_line,account.voucher.line,account_voucher.model_account_voucher_line,portal.group_portal,1,0,0,0
+access_account_move,account.move,account.model_account_move,portal.group_portal,1,0,0,0
+access_account_move_line,account.move.line,account.model_account_move_line,portal.group_portal,1,0,0,0
+access_account_move_reconcile,account.move.reconcile,account.model_account_move_reconcile,portal.group_portal,1,0,0,0
+access_account_fiscalyear,account.sequence.fiscalyear,account.model_account_sequence_fiscalyear,portal.group_portal,1,0,0,0
+access_sale_shop,sale.shop,sale.model_sale_shop,portal.group_portal,1,0,0,0
+access_product_list,product.pricelist,product.model_product_pricelist,portal.group_portal,1,0,0,0
+access_product,product.product,product.model_product_product,portal.group_portal,1,0,0,0
+access_res_partner,res.partner,base.model_res_partner,portal.group_portal,1,0,0,0
+access_product_uom,product.uom,product.model_product_uom,portal.group_portal,1,0,0,0
+access_account_tax,account.tax,account.model_account_tax,portal.group_portal,1,0,0,0
+access_mrp_property,mrp.property,procurement.model_mrp_property,portal.group_portal,1,0,0,0
+access_product_template,product.template,product.model_product_template,portal.group_portal,1,0,0,0
+access_stock_warehouse,stock.warehouse,stock.model_stock_warehouse,portal.group_portal,1,0,0,0
+access_stock_location,stock.location,stock.model_stock_location,portal.group_portal,1,0,0,0
+access_account_fiscalyear,account.fiscalyear,account.model_account_fiscalyear,portal.group_portal,1,0,0,0
+access_res_partner_category,res.partner.category,base.model_res_partner_category,portal.group_portal,1,0,0,0
+access_product_supplierinfo,product.supplierinfo,product.model_product_supplierinfo,portal.group_portal,1,0,0,0
+access_product_packaging,product.packaging,product.model_product_packaging,portal.group_portal,1,0,0,0
+access_account_period,account.period,account.model_account_period,portal.group_portal,1,0,0,0
+access_account_account,account.account,account.model_account_account,portal.group_portal,1,0,0,0
diff --git a/addons/portal_sale/security/portal_security.xml b/addons/portal_sale/security/portal_security.xml
index f69fd283db6..8028d5360c4 100644
--- a/addons/portal_sale/security/portal_security.xml
+++ b/addons/portal_sale/security/portal_security.xml
@@ -7,42 +7,42 @@
Portal Personal Quotations/Sales Orders
[('partner_id','child_of',user.partner_id.id)]
-
+
Portal Personal Delivery Orders
[('partner_id','child_of',[user.partner_id.id])]
-
+
Portal Personal Delivery Orders Out
[('partner_id','child_of',[user.partner_id.id])]
-
+
Portal Personal Account Invoices
[('partner_id','child_of',user.partner_id.id)]
-
+
Portal Personal Payments
[('partner_id','child_of',user.partner_id.id)]
-
+
Portal Personal Contacts
[('id','child_of',user.partner_id.id)]
-
+
From 941cb76283aa05bc7e255c2af68251bd39b7ca78 Mon Sep 17 00:00:00 2001
From: Raphael Collet
Date: Fri, 14 Sep 2012 16:46:33 +0200
Subject: [PATCH 101/174] [IMP] portal: replace model 'res.portal' by
'res.groups' where field 'is_portal' is True
bzr revid: rco@openerp.com-20120914144633-z3xpe7392egz3640
---
addons/portal/mail_mail.py | 2 +-
addons/portal/portal.py | 190 +--------------------
addons/portal/portal_data.xml | 8 -
addons/portal/portal_demo.xml | 2 +-
addons/portal/portal_view.xml | 71 ++------
addons/portal/security/portal_security.xml | 4 +-
addons/portal/tests/test_portal.py | 2 +-
addons/portal/wizard/portal_wizard.py | 14 +-
addons/portal/wizard/share_wizard.py | 8 +-
9 files changed, 35 insertions(+), 266 deletions(-)
diff --git a/addons/portal/mail_mail.py b/addons/portal/mail_mail.py
index 72c8469c042..5b149c1146a 100644
--- a/addons/portal/mail_mail.py
+++ b/addons/portal/mail_mail.py
@@ -43,7 +43,7 @@ class mail_mail_portal(osv.Model):
:param partner: browse_record of the specific recipient partner
"""
if partner:
- portal_ref = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'portal', 'portal')
+ portal_ref = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'portal', 'portal_group')
portal_id = portal_ref and portal_ref[1] or False
url = self._generate_signin_url(cr, uid, partner.id, portal_id, 1234, context=context)
body = tools.append_content_to_html(mail.body_html, url)
diff --git a/addons/portal/portal.py b/addons/portal/portal.py
index 3672d87cf30..13cde80f849 100644
--- a/addons/portal/portal.py
+++ b/addons/portal/portal.py
@@ -20,196 +20,14 @@
##############################################################################
from osv import osv, fields
-from tools.translate import _
-
class portal(osv.osv):
+ """ A portal is simply a group of users with the flag 'is_portal' set to True.
+ The flag 'is_portal' makes a user group usable as a portal.
"""
- A portal is a group of users with specific menu, widgets, and typically
- restricted access rights.
- """
- _name = 'res.portal'
- _description = 'Portal'
- _inherits = {'res.groups': 'group_id'}
-
+ _inherit = 'res.groups'
_columns = {
- 'group_id': fields.many2one('res.groups', required=True, ondelete='cascade',
- string='Group',
- help='The group corresponding to this portal'),
- 'url': fields.char('URL',
- help="The url where portal users can connect to the server"),
- 'home_action_id': fields.many2one('ir.actions.actions',
- string='Home Action',
- help="if set, replaces the standard home action (first screen after loggin) for the portal's users"),
- 'menu_action_id': fields.many2one('ir.actions.act_window', readonly=True,
- # ISSUE: 'ondelete' constraints do not seem effective on this field...
- string='Menu Action',
- help="If set, replaces the standard menu for the portal's users"),
- 'parent_menu_id': fields.many2one('ir.ui.menu', ondelete='restrict',
- string='Parent Menu',
- help='The menu action opens the submenus of this menu item'),
- 'widget_ids': fields.one2many('res.portal.widget', 'portal_id',
- string='Widgets',
- help='Widgets assigned to portal users'),
+ 'is_portal': fields.boolean('Portal', help="If checked, this group is usable as a portal."),
}
- def copy(self, cr, uid, id, values, context=None):
- """ override copy(): menu_action_id must be different """
- values['menu_action_id'] = None
- return super(portal, self).copy(cr, uid, id, values, context)
-
- def create(self, cr, uid, values, context=None):
- """ extend create() to assign the portal menu to users """
- if context is None:
- context = {}
-
- # create portal (admin should not be included)
- context['noadmin'] = True
- portal_id = super(portal, self).create(cr, uid, values, context)
-
- # assign menu action and widgets to users
- if values.get('users') or values.get('menu_action_id'):
- self._assign_menu(cr, uid, [portal_id], context)
- if values.get('users') or values.get('widget_ids'):
- self._assign_widgets(cr, uid, [portal_id], context)
-
- return portal_id
-
- def write(self, cr, uid, ids, values, context=None):
- """ extend write() to reflect changes on users """
- # first apply portal changes
- super(portal, self).write(cr, uid, ids, values, context)
-
- # assign menu action and widgets to users
- if values.get('users') or values.get('menu_action_id'):
- self._assign_menu(cr, uid, ids, context)
- if values.get('users') or values.get('widget_ids'):
- self._assign_widgets(cr, uid, ids, context)
-
- # if parent_menu_id has changed, apply the change on menu_action_id
- if 'parent_menu_id' in values:
- act_window_obj = self.pool.get('ir.actions.act_window')
- portals = self.browse(cr, uid, ids, context)
- action_ids = [p.menu_action_id.id for p in portals if p.menu_action_id]
- if action_ids:
- action_values = {'domain': [('parent_id', '=', values['parent_menu_id'])]}
- act_window_obj.write(cr, uid, action_ids, action_values, context)
-
- return True
-
- def _assign_menu(self, cr, uid, ids, context=None):
- """ assign portal_menu_settings to users of portals (ids) """
- user_obj = self.pool.get('res.users')
- for p in self.browse(cr, uid, ids, context):
- # user menu action = portal menu action if set in portal
- if p.menu_action_id:
- user_ids = [u.id for u in p.users if u.id != 1]
- user_values = {'menu_id': p.menu_action_id.id}
- user_obj.write(cr, uid, user_ids, user_values, context)
-
- def _assign_widgets(self, cr, uid, ids, context=None):
- """ assign portal widgets to users of portals (ids) """
- widget_user_obj = self.pool.get('res.widget.user')
- for p in self.browse(cr, uid, ids, context):
- for w in p.widget_ids:
- values = {'sequence': w.sequence, 'widget_id': w.widget_id.id}
- for u in p.users:
- if u.id == 1: continue
- values['user_id'] = u.id
- widget_user_obj.create(cr, uid, values, context)
-
- def _res_xml_id(self, cr, uid, module, xml_id):
- """ return the resource id associated to the given xml_id """
- data_obj = self.pool.get('ir.model.data')
- data_id = data_obj._get_id(cr, uid, module, xml_id)
- return data_obj.browse(cr, uid, data_id).res_id
-
-portal()
-
-
-
-class portal_override_menu(osv.osv):
- """
- Extend res.portal with a boolean field 'Override Users Menu', that
- triggers the creation or removal of menu_action_id
- """
- _name = 'res.portal'
- _inherit = 'res.portal'
-
- def _get_override_menu(self, cr, uid, ids, field_name, arg, context=None):
- assert field_name == 'override_menu'
- result = {}
- for p in self.browse(cr, uid, ids, context):
- result[p.id] = bool(p.menu_action_id)
- return result
-
- def _set_override_menu(self, cr, uid, id, field_name, field_value, arg, context=None):
- assert field_name == 'override_menu'
- if field_value:
- self.create_menu_action(cr, uid, id, context)
- else:
- self.write(cr, uid, [id], {'menu_action_id': False}, context)
-
- def create_menu_action(self, cr, uid, id, context=None):
- """ create, if necessary, a menu action that opens the menu items below
- parent_menu_id """
- p = self.browse(cr, uid, id, context)
- if not p.menu_action_id:
- actions_obj = self.pool.get('ir.actions.act_window')
- parent_id = p.parent_menu_id.id if p.parent_menu_id else False
- action_values = {
- 'name': _('%s Menu') % p.name,
- 'type': 'ir.actions.act_window',
- 'usage': 'menu',
- 'res_model': 'ir.ui.menu',
- 'view_type': 'tree',
- 'view_id': self._res_xml_id(cr, uid, 'base', 'view_menu'),
- 'domain': [('parent_id', '=', parent_id)],
- }
- action_id = actions_obj.create(cr, uid, action_values, context)
- self.write(cr, uid, [id], {'menu_action_id': action_id}, context)
-
- _columns = {
- 'override_menu': fields.function(
- _get_override_menu, fnct_inv=_set_override_menu,
- type='boolean', string='Override Menu Action of Users',
- help='Enable this option to override the Menu Action of portal users'),
- }
-
-portal_override_menu()
-
-
-
-class portal_widget(osv.osv):
- """
- Similar to res.widget.user (res_widget.py), but with a portal instead.
- New users in a portal are assigned the portal's widgets.
- """
- _name='res.portal.widget'
- _description = 'Portal Widgets'
- _order = 'sequence'
- _columns = {
- 'sequence': fields.integer('Sequence'),
- 'portal_id': fields.many2one('res.portal', select=1, ondelete='cascade',
- string='Portal'),
- 'widget_id': fields.many2one('res.widget', required=True, ondelete='cascade',
- string='Widget'),
- }
-
- def create(self, cr, uid, values, context=None):
- domain = [('portal_id', '=', values.get('portal_id')),
- ('widget_id', '=', values.get('widget_id'))]
- existing = self.search(cr, uid, domain, context=context)
- if existing:
- res = existing[0]
- else:
- res = super(portal_widget, self).create(cr, uid, values, context=context)
- return res
-
-portal_widget()
-
-
-
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/portal/portal_data.xml b/addons/portal/portal_data.xml
index 5edb4bed8c7..a980552a854 100644
--- a/addons/portal/portal_data.xml
+++ b/addons/portal/portal_data.xml
@@ -2,14 +2,6 @@
-
- Portal
-
-
-
-
-
-
Company's news
diff --git a/addons/portal/portal_demo.xml b/addons/portal/portal_demo.xml
index 1ace02f3d7d..f4ba8fe2192 100644
--- a/addons/portal/portal_demo.xml
+++ b/addons/portal/portal_demo.xml
@@ -13,7 +13,7 @@
-
+
diff --git a/addons/portal/portal_view.xml b/addons/portal/portal_view.xml
index 5241d7cf54f..abd013d719c 100644
--- a/addons/portal/portal_view.xml
+++ b/addons/portal/portal_view.xml
@@ -21,71 +21,30 @@
-
-
- Portal List
- res.portal
+
+
+ Group Search
+ res.groups
+
-
-
-
+
+
+
-
-
+
+
Portal Form
- res.portal
+ res.groups
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
-
-
- Portals
- res.portal
- form
- tree,form
-
- {'form_view_ref': 'portal.portal_form_view'}
-
-
- Click to create a new portal.
-
- A portal helps defining specific views and rules for a group of
- users (the portal group). A portal menu, widgets and specific
- groups may be assigned to the portal's users.
-
-
-
-
-
-
-
-
diff --git a/addons/portal/security/portal_security.xml b/addons/portal/security/portal_security.xml
index 0bf4cb2dcfc..3d5cf47b0be 100644
--- a/addons/portal/security/portal_security.xml
+++ b/addons/portal/security/portal_security.xml
@@ -6,7 +6,9 @@
Portal
Portal members can access information through the portal menu. Also, they are chrooted in this specific menu.
-
+
+
+
diff --git a/addons/portal/tests/test_portal.py b/addons/portal/tests/test_portal.py
index 2c301228859..809bc131034 100644
--- a/addons/portal/tests/test_portal.py
+++ b/addons/portal/tests/test_portal.py
@@ -42,7 +42,7 @@ class test_portal(test_mail.TestMailMockups):
user_admin = self.res_users.browse(cr, uid, uid)
self.mail_invite = self.registry('mail.wizard.invite')
base_url = self.registry('ir.config_parameter').get_param(cr, uid, 'web.base.url', default='')
- portal_ref = self.registry('ir.model.data').get_object_reference(cr, uid, 'portal', 'portal')
+ portal_ref = self.registry('ir.model.data').get_object_reference(cr, uid, 'portal', 'portal_group')
portal_id = portal_ref and portal_ref[1] or False
# 0 - Admin
diff --git a/addons/portal/wizard/portal_wizard.py b/addons/portal/wizard/portal_wizard.py
index da9d9b4e18d..969f74b5bd8 100644
--- a/addons/portal/wizard/portal_wizard.py
+++ b/addons/portal/wizard/portal_wizard.py
@@ -78,7 +78,7 @@ class wizard(osv.osv_memory):
_columns = {
'partner_id': fields.many2one('res.partner', required=True, string="Partner"),
- 'portal_id': fields.many2one('res.portal', required=True,
+ 'portal_id': fields.many2one('res.groups', domain=[('is_portal', '=', True)], required=True,
string='Portal',
help="The portal in which new users must be added"),
'user_ids': fields.one2many('res.portal.wizard.user', 'wizard_id',
@@ -157,7 +157,7 @@ class wizard(osv.osv_memory):
for address in partner.child_ids:
_portal_user(address)
partner_user_ids = self._search_partner_user(cr, uid, partner.id, context=context)
- portal_users = [u.id for u in self.pool.get('res.portal').browse(cr, uid, portal_id, context=context).group_id.users]
+ portal_users = [u.id for u in self.pool.get('res.groups').browse(cr, uid, portal_id, context=context).users]
for user in res_user.browse(cr, uid, partner_user_ids, context=context):
email = user and user.email or False
has_portal_user = False
@@ -302,17 +302,17 @@ class wizard_user(osv.osv_memory):
return user_id
def link_portal_user(self, cr, uid, portal_id, user_id, context=None):
- res_portal = self.pool.get('res.portal')
- portal = res_portal.browse(cr, uid, portal_id, context=context)
- portal_user_ids = [u.id for u in portal.group_id.users]
+ res_groups = self.pool.get('res.groups')
+ portal = res_groups.browse(cr, uid, portal_id, context=context)
+ portal_user_ids = [u.id for u in portal.users]
if user_id not in portal_user_ids:
return portal.write({'users': [(4, user_id)]}, context=context)
if user_id in portal_user_ids:
return False
def unlink_portal_user(self, cr, uid, portal_id, user_id, context=None):
- res_portal = self.pool.get('res.portal')
- return res_portal.write(cr, uid, [portal_id], {'users': [(3, user_id)]}, context=context)
+ res_groups = self.pool.get('res.groups')
+ return res_groups.write(cr, uid, [portal_id], {'users': [(3, user_id)]}, context=context)
def unlink_user(self, cr, uid, user_id, context=None):
#TODO: search portal groups
diff --git a/addons/portal/wizard/share_wizard.py b/addons/portal/wizard/share_wizard.py
index e56e7517348..b1b6e980dec 100644
--- a/addons/portal/wizard/share_wizard.py
+++ b/addons/portal/wizard/share_wizard.py
@@ -119,16 +119,14 @@ class share_wizard_portal(osv.TransientModel):
# alter the rules of the groups so they can see the shared data
if wizard_data.group_ids:
# get the list of portals and the related groups to install their menus.
- Portals = self.pool.get('res.portal')
- all_portals = Portals.browse(cr, UID_ROOT, Portals.search(cr, UID_ROOT, [])) #no context!
- all_portal_group_ids = [p.group_id.id for p in all_portals]
+ res_groups = self.pool.get('res.groups')
+ all_portal_group_ids = res_groups.search(cr, UID_ROOT, [('is_portal', '=', True)])
# populate result lines with the users of each group and
# setup the menu for portal groups
for group in wizard_data.group_ids:
if group.id in all_portal_group_ids:
- portal = all_portals[all_portal_group_ids.index(group.id)]
- self._create_shared_data_menu(cr, uid, wizard_data, portal, context=context)
+ self._create_shared_data_menu(cr, uid, wizard_data, group.id, context=context)
for user in group.users:
new_line = {'user_id': user.id,
From 8cdd46aeec9ebbd23f82e946d7fe68ffa92a9847 Mon Sep 17 00:00:00 2001
From: Raphael Collet
Date: Mon, 17 Sep 2012 09:54:22 +0200
Subject: [PATCH 102/174] [FIX] portal: load missing file
security/portal_security.xml, and remove access rights about suppressed
models
bzr revid: rco@openerp.com-20120917075422-9ov3vd57phdes6yj
---
addons/portal/__openerp__.py | 1 +
addons/portal/security/ir.model.access.csv | 2 --
2 files changed, 1 insertion(+), 2 deletions(-)
diff --git a/addons/portal/__openerp__.py b/addons/portal/__openerp__.py
index f5e3c9ff452..d7356fc9ce5 100644
--- a/addons/portal/__openerp__.py
+++ b/addons/portal/__openerp__.py
@@ -44,6 +44,7 @@ very handy when used in combination with the module 'share'.
""",
'website': 'http://www.openerp.com',
'data': [
+ 'security/portal_security.xml',
'security/ir.model.access.csv',
'portal_data.xml',
'portal_view.xml',
diff --git a/addons/portal/security/ir.model.access.csv b/addons/portal/security/ir.model.access.csv
index 60687e8a0cc..2d7a17e0016 100644
--- a/addons/portal/security/ir.model.access.csv
+++ b/addons/portal/security/ir.model.access.csv
@@ -1,6 +1,4 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
-access_all,access.portal.all,model_res_portal,,1,0,0,0
-access_widget_all,access.portal.widget.all,model_res_portal_widget,,1,0,0,0
access_mail_message,mail.message,mail.model_mail_message,group_portal,1,0,1,1
access_mail_message_all,mail.message.all,mail.model_mail_message,group_portal,1,0,0,0
access_mail_thread,mail.thread,mail.model_mail_thread,group_portal,1,0,0,0
From a0f23eb60b5cbd352bc5dbecd81bc2e098607df3 Mon Sep 17 00:00:00 2001
From: "olt@tinyerp.com" <>
Date: Mon, 17 Sep 2012 10:10:17 +0200
Subject: [PATCH 103/174] [FIX] anonymization: raise a good descriptive error
when the state is 'unstable'
bzr revid: olt@tinyerp.com-20120917081017-s15mm36ppvs4lfxc
---
addons/anonymization/anonymization.py | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/addons/anonymization/anonymization.py b/addons/anonymization/anonymization.py
index 47e168a12b8..6b6db168a4f 100644
--- a/addons/anonymization/anonymization.py
+++ b/addons/anonymization/anonymization.py
@@ -64,11 +64,13 @@ class ir_model_fields_anonymization(osv.osv):
state = 'anonymized' # all fields are anonymized
else:
state = 'unstable' # fields are mixed: this should be fixed
+
return state
def _check_write(self, cr, uid, context=None):
# check that the field is created from the menu and not from an database update
# otherwise the database update can crash:
+
if context.get('manual'):
global_state = self._get_global_state(cr, uid, context=context)
if global_state == 'anonymized':
@@ -100,12 +102,16 @@ class ir_model_fields_anonymization(osv.osv):
# check field state: all should be clear before we can add a new field to anonymize:
self._check_write(cr, uid, context=context)
+ global_state = self._get_global_state(cr, uid, context=context)
+
if 'field_name' in vals and vals['field_name'] and 'model_name' in vals and vals['model_name']:
vals['model_id'], vals['field_id'] = self._get_model_and_field_ids(cr, uid, vals, context=context)
# check not existing fields:
if not vals.get('field_id'):
vals['state'] = 'not_existing'
+ else:
+ vals['state'] = global_state
res = super(ir_model_fields_anonymization, self).create(cr, uid, vals, context=context)
@@ -340,8 +346,9 @@ class ir_model_fields_anonymize_wizard(osv.osv_memory):
# remove the placeholer:
eview.remove(placeholder)
else:
- # unstable ?
- raise
+ msg = "The database anonymization is currently in an unstable state. Some fields are anonymized," + \
+ " while some fields are not anonymized. You should try to solve this problem before trying to do anything else."
+ raise osv.except_osv('Error !', msg)
res['arch'] = etree.tostring(eview)
From fabf4971aaaebb03d3bc7c582b5acb68082c0a2c Mon Sep 17 00:00:00 2001
From: Fabien Pinckaers
Date: Mon, 17 Sep 2012 10:14:51 +0200
Subject: [PATCH 104/174] [FIX] timesheet_sheet should not crash anymmore when
tests are performed at 23:59
bzr revid: fp@tinyerp.com-20120917081451-ugk1qi0le22kn44n
---
addons/hr_attendance/hr_attendance.py | 2 +-
.../test/test_hr_timesheet_sheet.yml | 26 +++++++++++--------
2 files changed, 16 insertions(+), 12 deletions(-)
diff --git a/addons/hr_attendance/hr_attendance.py b/addons/hr_attendance/hr_attendance.py
index d3bc79bda1a..8fdd2928fe6 100644
--- a/addons/hr_attendance/hr_attendance.py
+++ b/addons/hr_attendance/hr_attendance.py
@@ -55,7 +55,7 @@ class hr_attendance(osv.osv):
'name': fields.datetime('Date', required=True, select=1),
'action': fields.selection([('sign_in', 'Sign In'), ('sign_out', 'Sign Out'), ('action','Action')], 'Action', required=True),
'action_desc': fields.many2one("hr.action.reason", "Action Reason", domain="[('action_type', '=', action)]", help='Specifies the reason for Signing In/Signing Out in case of extra hours.'),
- 'employee_id': fields.many2one('hr.employee', "Employee's Name", required=True, select=True),
+ 'employee_id': fields.many2one('hr.employee', "Employee", required=True, select=True),
'day': fields.function(_day_compute, type='char', string='Day', store=True, select=1, size=32),
}
_defaults = {
diff --git a/addons/hr_timesheet_sheet/test/test_hr_timesheet_sheet.yml b/addons/hr_timesheet_sheet/test/test_hr_timesheet_sheet.yml
index 99705b07a39..070079a4b80 100644
--- a/addons/hr_timesheet_sheet/test/test_hr_timesheet_sheet.yml
+++ b/addons/hr_timesheet_sheet/test/test_hr_timesheet_sheet.yml
@@ -13,7 +13,7 @@
product_id: product.product_product_consultant
journal_id: hr_timesheet.analytic_journal
-
- I create my current timesheet for employee "Quentin Paolinon".
+ I create a timesheet for employee "Quentin Paolinon".
-
!record {model: hr_timesheet_sheet.sheet, id: hr_timesheet_sheet_sheet_deddk0}:
date_current: !eval time.strftime('%Y-%m-%d')
@@ -23,13 +23,17 @@
user_id: base.user_demo
employee_id: 'hr.employee_qdp'
-
- Now, at the time of login, I create Attendances and perform "Sign In" action.
+ Quentin "Sign In" at around 9am.
-
- !python {model: hr_timesheet_sheet.sheet}: |
- self.attendance_action_change(cr, uid, [ref('hr_timesheet_sheet_sheet_deddk0')], {})
- task_work = self.search(cr, uid, [("name","=","Quentin Paolinon")],context)[0]
- task_ids = self.browse(cr, uid, task_work, context)
- assert task_ids.state == "draft", "I State In Timesheet"
+ !record {model: hr.attendance, id: hr_attendance_1}:
+ action: sign_in
+ employee_id: 'hr.employee_qdp'
+ name: !eval datetime.now().strftime('%Y-%m-%d 09:%M:%S')
+-
+ I test that Quentin in signed in
+-
+ !assert {model: hr.employee, id: hr.employee_qdp}:
+ - state == 'present'
-
I want to check attendance and work of yesterday. I click on <- button.
-
@@ -57,10 +61,10 @@
-
At the time of logout, I create attendance and perform "Sign Out".
-
- !record {model: hr.attendance, id: hr_attendance_1}:
+ !record {model: hr.attendance, id: hr_attendance_2}:
action: sign_out
employee_id: 'hr.employee_qdp'
- name: !eval (datetime.now() + timedelta(minutes=1)).strftime('%Y-%m-%d %H:%M:%S')
+ name: !eval datetime.now().strftime('%Y-%m-%d 17:30:00')
-
I create Timesheet Entry for time spend on today work.
-
@@ -103,10 +107,10 @@
general_account_id: account.a_expense
journal_id: hr_timesheet.analytic_journal
-
- I set an allowed difference of 25 hours
+ I set an allowed difference of 1 hour
-
!record {model: res.company, id: base.main_company}:
- timesheet_max_difference: 25.00
+ timesheet_max_difference: 1.00
-
I tried again to confirm the timesheet after modification.
-
From 7d93e8077db3c978a6c7e92db08a3716ae9c85a3 Mon Sep 17 00:00:00 2001
From: Raphael Collet
Date: Mon, 17 Sep 2012 10:23:36 +0200
Subject: [PATCH 105/174] [FIX] share: add inheritance on groups search view
bzr revid: rco@openerp.com-20120917082336-87tau8ef2qiu5v3p
---
addons/share/res_users_view.xml | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/addons/share/res_users_view.xml b/addons/share/res_users_view.xml
index 9a657ffdbb6..608c2ac3b92 100644
--- a/addons/share/res_users_view.xml
+++ b/addons/share/res_users_view.xml
@@ -25,13 +25,11 @@
res.groups.search.share
res.groups
-
+
-
-
-
+
-
+
From 46f7aa283bcc4173718e0b1c518ef17ba4c5449a Mon Sep 17 00:00:00 2001
From: Antonin Bourguignon
Date: Mon, 17 Sep 2012 11:41:12 +0200
Subject: [PATCH 106/174] [IMP] code cleaning
bzr revid: abo@openerp.com-20120917094112-uahrew8q0jz6aqo3
---
addons/account/wizard/account_move_journal.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/addons/account/wizard/account_move_journal.py b/addons/account/wizard/account_move_journal.py
index d1353049b72..d87e4d04a0c 100644
--- a/addons/account/wizard/account_move_journal.py
+++ b/addons/account/wizard/account_move_journal.py
@@ -92,14 +92,14 @@ class account_move_journal(osv.osv_memory):
journal = False
if journal_id:
- journal = journal_pool.read(cr, uid, [journal_id], ['name'])[0]['name']
+ journal = journal_pool.read(cr, uid, journal_id, ['name'], context=context).name
journal_string = _("Journal: %s") % tools.ustr(journal)
else:
journal_string = _("Journal: All")
period = False
if period_id:
- period = period_pool.browse(cr, uid, [period_id], context=context)[0]['name']
+ period = period_pool.browse(cr, uid, period_id, context=context).name
period_string = _("Period: %s") % tools.ustr(period)
open_string = _("Open")
From 29ff1bf82aba1274641bf35d5f3cf53bb751ffa4 Mon Sep 17 00:00:00 2001
From: "Bhumi Thakkar (Open ERP)"
Date: Mon, 17 Sep 2012 16:33:46 +0530
Subject: [PATCH 107/174] [IMP] Improve code for return value of selection
field.
bzr revid: bth@tinyerp.com-20120917110346-0daw7ho3y31zbpu3
---
addons/web_graph/controllers/graph.py | 3 +++
1 file changed, 3 insertions(+)
diff --git a/addons/web_graph/controllers/graph.py b/addons/web_graph/controllers/graph.py
index f6c1343c042..1da5e3bc91f 100644
--- a/addons/web_graph/controllers/graph.py
+++ b/addons/web_graph/controllers/graph.py
@@ -53,6 +53,9 @@ class GraphView(View):
if fields[field]['type']=='many2one':
data = data and data[1]
if tick:
+ if fields[field]['type']=='selection':
+ d = dict(fields[field]['selection'])
+ data = d[data]
return ticks.setdefault(data, len(ticks))
return data or 0
From 88ce4c22d95d34cad5db2dd8374e19fc3368a8e0 Mon Sep 17 00:00:00 2001
From: "Harry (OpenERP)"
Date: Mon, 17 Sep 2012 16:56:42 +0530
Subject: [PATCH 108/174] [FIX] stock: pass picking type in context to set
default locations
bzr revid: hmo@tinyerp.com-20120917112642-k1wmdmy7b1jdcexs
---
addons/stock/stock_view.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/addons/stock/stock_view.xml b/addons/stock/stock_view.xml
index 142beae4128..37308dbdbf8 100644
--- a/addons/stock/stock_view.xml
+++ b/addons/stock/stock_view.xml
@@ -779,7 +779,7 @@
-
+
From 06852d994b287e3af74a629a8feb55ae6b797f79 Mon Sep 17 00:00:00 2001
From: Stephane Wirtel
Date: Mon, 17 Sep 2012 14:09:26 +0200
Subject: [PATCH 109/174] [FIX] point_of_sale: Take the 'cash' journals if
there is no specific cash journal for the Point Of Sale
bzr revid: stw@openerp.com-20120917120926-h3bzu2k9ds5lnjjr
---
addons/point_of_sale/point_of_sale.py | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/addons/point_of_sale/point_of_sale.py b/addons/point_of_sale/point_of_sale.py
index 95b54b6baed..590718b48f0 100644
--- a/addons/point_of_sale/point_of_sale.py
+++ b/addons/point_of_sale/point_of_sale.py
@@ -314,9 +314,13 @@ class pos_session(osv.osv):
# define some cash journal if no payment method exists
if not pos_config.journal_ids:
- cashids = self.pool.get('account.journal').search(cr, uid, [('journal_user', '=', True), ('type','=','cash')], context=context)
+ journal_proxy = self.pool.get('account.journal')
+ cashids = journal_proxy.search(cr, uid, [('journal_user', '=', True), ('type','=','cash')], context=context)
if not cashids:
- cashids = self.pool.get('account.journal').search(cr, uid, [('journal_user','=',True)], context=context)
+ cashids = journal_proxy.search(cr, uid, [('type', '=', 'cash')], context=context)
+ if not cashids:
+ cashids = journal_proxy.search(cr, uid, [('journal_user','=',True)], context=context)
+
jobj.write(cr, uid, [pos_config.id], {'journal_ids': [(6,0, cashids)]})
From 1d8007f03c5de0f3a660b4eb61542b1582f8eebd Mon Sep 17 00:00:00 2001
From: Antonin Bourguignon
Date: Mon, 17 Sep 2012 14:28:21 +0200
Subject: [PATCH 110/174] [FIX] an error from the last merge
bzr revid: abo@openerp.com-20120917122821-0kfcipo5nw5gps08
---
.../crm_fundraising_view.xml.THIS | 224 ------------------
.../project_timesheet_data.xml.THIS | 20 --
2 files changed, 244 deletions(-)
delete mode 100644 addons/crm_fundraising/crm_fundraising_view.xml.THIS
delete mode 100644 addons/project_timesheet/project_timesheet_data.xml.THIS
diff --git a/addons/crm_fundraising/crm_fundraising_view.xml.THIS b/addons/crm_fundraising/crm_fundraising_view.xml.THIS
deleted file mode 100644
index 961ba2d6d3e..00000000000
--- a/addons/crm_fundraising/crm_fundraising_view.xml.THIS
+++ /dev/null
@@ -1,224 +0,0 @@
-
-
-
-
-
-
-
-
-
- Fundraising Categories
- crm.case.categ
- form
-
- [('object_id.model', '=', 'crm.fundraising')]
-
- Manage and define the fund raising categories you want to be maintained in the system.
-
-
-
-
-
-
-
- Fundraising Stages
- crm.case.stage
- form
-
- {'search_default_fundraising':1}
- Create and manage fund raising activity categories you want to be maintained in the system.
-
-
-
-
-
- CRM - Funds Tree
- crm.fundraising
- tree
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- CRM - Funds Form
- crm.fundraising
- form
-
-
-
-
-
-
-
-
- CRM - Funds Calendar
- crm.fundraising
- calendar
-
-
-
-
-
-
-
-
-
-
-
-
- CRM - Funds Graph
- crm.fundraising
- graph
-
-
-
-
-
-
-
-
-
-
-
- CRM - Funds Search
- crm.fundraising
- search
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/addons/project_timesheet/project_timesheet_data.xml.THIS b/addons/project_timesheet/project_timesheet_data.xml.THIS
deleted file mode 100644
index fc6597595ae..00000000000
--- a/addons/project_timesheet/project_timesheet_data.xml.THIS
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
-
-
-
-
-
From 313c4ef511115dd598a23a3698dc8ad25fe21126 Mon Sep 17 00:00:00 2001
From: Christophe Matthieu
Date: Mon, 17 Sep 2012 14:30:54 +0200
Subject: [PATCH 111/174] [IMP] note: search, css
bzr revid: chm@openerp.com-20120917123054-futj80nzfo725kiv
---
addons/note/note.py | 17 ++++++++++++-----
addons/note/note_demo.xml | 9 ---------
addons/note/note_view.xml | 17 +++++++++--------
addons/note/security/ir.rule.xml | 9 +++++++++
4 files changed, 30 insertions(+), 22 deletions(-)
diff --git a/addons/note/note.py b/addons/note/note.py
index 429c16eed6d..33d138de641 100644
--- a/addons/note/note.py
+++ b/addons/note/note.py
@@ -22,6 +22,7 @@
from openerp.osv import osv, fields
from tools.translate import _
import re
+from openerp.tools.misc import html2plaintext
class note_stage(osv.osv):
""" Category of Note """
@@ -60,6 +61,10 @@ class note_note(osv.osv):
rec_id = self.create(cr, uid, {'memo': name}, context=context)
return self.name_get(cr, uid, [rec_id], context)[0]
+ def _from_xml(self, mappings):
+ return chr(int( mappings.group(1) ))
+
+
#read the first line (convert hml into text)
def _get_note_first_line(self, cr, uid, ids, name="", args={}, context=None):
res = {}
@@ -67,13 +72,14 @@ class note_note(osv.osv):
text_note = (note.memo or '').strip().split('\n')[0]
text_note = re.sub(r'(\S?)(
|<[/]?p>|<[/]?div>|)[\s\S]*',r'\1',text_note)
text_note = re.sub(r'<[^>]+>','',text_note)
+ text_note = html2plaintext(text_note)
res[note.id] = text_note
return res
#unactivate a sticky note and record the date
def onclick_note_is_done(self, cr, uid, ids, context=None):
- self.write(cr, uid, ids, { 'active' : False, 'date_done' : fields.date.today() })
+ self.write(cr, uid, ids, { 'open' : False, 'date_done' : fields.date.today() })
self.message_post(cr, uid, ids[0], body='This sticky note is active', subject=False,
type='notification', parent_id=False, attachments=None, context=context)
@@ -82,7 +88,7 @@ class note_note(osv.osv):
#activate a Sticky note
def onclick_note_not_done(self, cr, uid, ids, context=None):
- self.write(cr, uid, ids, { 'active' : True })
+ self.write(cr, uid, ids, { 'open' : True })
self.message_post(cr, uid, ids[0], body='This sticky note is close', subject=False,
type='notification', parent_id=False, attachments=None, context=context)
@@ -124,7 +130,8 @@ class note_note(osv.osv):
_columns = {
'name': fields.function(_get_note_first_line,
string='Sticky note Summary',
- type='text', store=True),
+ type='text',
+ store=True),
'memo': fields.html('Pad Content'),
'sequence': fields.integer('Sequence'),
@@ -140,7 +147,7 @@ class note_note(osv.osv):
# stage per user
'stage_ids': fields.many2many('note.stage','note_stage_rel','note_id','stage_id','Linked stages users'),
- 'active': fields.boolean('Active'),
+ 'open': fields.boolean('Active'),
# when the user unactivate the Sticky note, record de date for un display Sticky note after 1 days
'date_done': fields.date('Date done'),
'color': fields.integer('Color Index'),
@@ -151,7 +158,7 @@ class note_note(osv.osv):
}
_defaults = {
- 'active' : 1,
+ 'open' : 1,
'stage_id' : _get_default_stage_id,
'memo': " "
}
diff --git a/addons/note/note_demo.xml b/addons/note/note_demo.xml
index 88b21effb7e..8b76887e577 100644
--- a/addons/note/note_demo.xml
+++ b/addons/note/note_demo.xml
@@ -115,14 +115,5 @@
7
-
-
* Open ERP: a modern approach to integrated business management
-
* Open ERP for Retail and Industrial Management
- ]]>
-
-
-
-
diff --git a/addons/note/note_view.xml b/addons/note/note_view.xml
index 232b96f643a..5617fae4376 100644
--- a/addons/note/note_view.xml
+++ b/addons/note/note_view.xml
@@ -51,7 +51,7 @@
-
+
@@ -65,8 +65,8 @@
- W
- è
+ W
+ è
@@ -80,7 +80,7 @@
-
+
@@ -107,7 +107,7 @@
-
+
@@ -143,8 +143,9 @@
-
-
+
+
+
@@ -188,7 +189,7 @@
form
kanban,tree,form
- {'search_default_active_true':True}
+ {'search_default_open_true':True}
diff --git a/addons/note/security/ir.rule.xml b/addons/note/security/ir.rule.xml
index 82994b960c2..5f4882c3048 100644
--- a/addons/note/security/ir.rule.xml
+++ b/addons/note/security/ir.rule.xml
@@ -1,12 +1,21 @@
+
Only followers can access a sticky notes
['|',('message_follower_ids','=',False),('message_follower_ids','=',user.partner_id.id)]
+
+
+ Each user have his stage name
+
+ ['|',('user_id','=',False),('user_id','=',user.id)]
+
+
+
From 6dc01c405b63d8985f9cc90e8e09535c48be5a8c Mon Sep 17 00:00:00 2001
From: Raphael Collet
Date: Mon, 17 Sep 2012 15:22:12 +0200
Subject: [PATCH 112/174] [IMP] portal: simplify portal access management
wizard
bzr revid: rco@openerp.com-20120917132212-wo2wrjzja0xsuys8
---
addons/portal/wizard/portal_wizard.py | 369 +++++++-------------
addons/portal/wizard/portal_wizard_view.xml | 36 +-
2 files changed, 133 insertions(+), 272 deletions(-)
diff --git a/addons/portal/wizard/portal_wizard.py b/addons/portal/wizard/portal_wizard.py
index 969f74b5bd8..26fbb383e11 100644
--- a/addons/portal/wizard/portal_wizard.py
+++ b/addons/portal/wizard/portal_wizard.py
@@ -25,6 +25,7 @@ import random
from osv import osv, fields
from tools.translate import _
from tools.misc import email_re
+from openerp import SUPERUSER_ID
from base.res.res_partner import _lang_get
_logger = logging.getLogger(__name__)
@@ -48,8 +49,6 @@ OpenERP - Open Source Business Applications
http://www.openerp.com
""")
-ROOT_UID = 1
-
# character sets for passwords, excluding 0, O, o, 1, I, l
_PASSU = 'ABCDEFGHIJKLMNPQRSTUVWXYZ'
_PASSL = 'abcdefghijkmnpqrstuvwxyz'
@@ -70,277 +69,157 @@ def extract_email(email):
class wizard(osv.osv_memory):
"""
- A wizard to create portal users from instances of 'res.partner'. The purpose
- is to provide an OpenERP database access to customers or suppliers.
+ A wizard to manage the creation/removal of portal users.
"""
- _name = 'res.portal.wizard'
- _description = 'Portal Wizard'
+ _name = 'portal.wizard'
+ _description = 'Portal Access Management'
_columns = {
'partner_id': fields.many2one('res.partner', required=True, string="Partner"),
'portal_id': fields.many2one('res.groups', domain=[('is_portal', '=', True)], required=True,
- string='Portal',
- help="The portal in which new users must be added"),
- 'user_ids': fields.one2many('res.portal.wizard.user', 'wizard_id',
- string='Users'),
- 'message': fields.text(string='Invitation message',
- help="This text is included in the welcome email sent to the users"),
+ string='Portal', help="The portal that users can be added in or removed from."),
+ 'user_ids': fields.one2many('portal.wizard.user', 'wizard_id', string='Users'),
+ 'message': fields.text(string='Invitation Message',
+ help="This text is included in the welcome email sent to the users."),
}
- def default_get(self, cr, uid, fields, context=None):
- if context is None:
- context = {}
- partner_id = context.get('active_id', False)
- portal_id = context.get('portal_id', False)
- res = {}
- if not partner_id:
- return res
+ def _default_partner(self, cr, uid, context):
+ return context and context.get('active_id') or False
- if 'partner_id' in fields:
- res.update({'partner_id': partner_id})
-
- if 'user_ids' in fields and portal_id:
- user_ids = self.get_portal_users(cr, uid, [partner_id], portal_id, context=context)
- res.update({'user_ids': user_ids})
- return res
+ def _default_portal(self, cr, uid, context):
+ portal_ids = self.pool.get('res.groups').search(cr, uid, [('is_portal', '=', True)])
+ return portal_ids and portal_ids[0] or False
+ _defaults = {
+ 'partner_id': _default_partner,
+ 'portal_id': _default_portal,
+ }
def onchange_portal_id(self, cr, uid, ids, partner_id, portal_id, context=None):
- if not portal_id:
- return {'value': {}}
- user_list = self.get_portal_users(cr, uid, [partner_id], portal_id, context=context)
- return {'value': {'user_ids': user_list}}
-
-
- def _search_partner_user(self, cr, uid, partner_id, context=None):
- res_user = self.pool.get('res.users')
- partner = self.pool.get('res.partner').browse(cr, uid, partner_id, context=context)
- if partner.parent_id:
- user_ids = res_user.search(cr, uid, [('login','=',partner.email)])
- else:
- user_ids = res_user.search(cr, uid, [('partner_id','=', partner.id)])
- return user_ids
-
- def _search_portal_user(self, cr, uid, partner_id, context=None):
- res_user = self.pool.get('res.users')
+ assert partner_id
+ # for each partner, determine corresponding portal.wizard.user records
res_partner = self.pool.get('res.partner')
- partner = res_partner.browse(cr, uid, partner_id, context=context)
- user_ids = res_user.search(cr, uid, [('login','=',partner.email)])
- user_id = False
- if user_ids and len(user_ids):
- user_id = user_ids[0]
- return user_id
+ partner_ids = [partner_id]
+ user_changes = []
+ for partner in res_partner.browse(cr, SUPERUSER_ID, partner_ids, context):
+ for contact in (partner.child_ids or [partner]):
+ in_portal = False
+ if contact.user_ids:
+ in_portal = portal_id in [g.id for g in contact.user_ids[0].groups_id]
+ user_changes.append((0, 0, {
+ 'partner_id': contact.id,
+ 'email': contact.email,
+ 'in_portal': in_portal,
+ }))
+ return {'value': {'user_ids': user_changes}}
- def _portal_user_dict(self, cr, uid, partner, portal_id, context=None):
- res_user = self.pool.get('res.users')
- users = []
- if partner.parent_id:
- lang = partner.parent_id.lang or 'en_US'
- company_id = partner.parent_id.id
- else:
- lang = partner.lang or 'en_US'
- company_id = partner.id
-
- def _portal_user(address):
- if not self._search_portal_user(cr, uid, address.id, context=context):
- if address.email:
- users.append({
- 'name': address.name,
- 'email': extract_email(address.email),
- 'lang': lang or 'en_US',
- 'partner_id': company_id,
- 'has_portal_user': False,
- })
-
- if not partner.child_ids:
- _portal_user(partner)
- for address in partner.child_ids:
- _portal_user(address)
- partner_user_ids = self._search_partner_user(cr, uid, partner.id, context=context)
- portal_users = [u.id for u in self.pool.get('res.groups').browse(cr, uid, portal_id, context=context).users]
- for user in res_user.browse(cr, uid, partner_user_ids, context=context):
- email = user and user.email or False
- has_portal_user = False
- if user.id in portal_users:
- has_portal_user = True
-
- if email:
- users.append({
- 'name': user and user.name,
- 'email': email and extract_email(email) or False,
- 'lang': lang or 'en_US',
- 'partner_id': company_id,
- 'has_portal_user': has_portal_user,
- 'user_id': user.id,
- })
- return users
-
- def get_portal_users(self, cr, uid, partner_ids, portal_id, context=None):
- users = []
- res_partner = self.pool.get('res.partner')
- for partner in res_partner.browse(cr, uid, partner_ids, context=context):
- users.extend(self._portal_user_dict(cr, uid, partner, portal_id, context=context))
- return users
-
-
- def action_manage_portal_access(self, cr, uid, ids, context=None):
- if context is None:
- context = {}
- clone_context = context
- clone_context['noshortcut'] = True # prevent shortcut creation
- context = dict(clone_context)
- res_portal_user = self.pool.get('res.portal.wizard.user')
- for data in self.browse(cr, uid, ids, context=context):
- if not data.user_ids:
- raise osv.except_osv(_('User required'),
- _('Create atleast one user for portal.'))
- portal_user_ids = [user.id for user in data.user_ids]
- res_portal_user.manage_portal_access(cr, uid, portal_user_ids, context=context)
+ def action_apply(self, cr, uid, ids, context=None):
+ wizard = self.browse(cr, uid, ids[0], context)
+ portal_user_ids = [user.id for user in wizard.user_ids]
+ self.pool.get('portal.wizard.user').action_apply(cr, uid, portal_user_ids, context)
return {'type': 'ir.actions.act_window_close'}
-wizard()
class wizard_user(osv.osv_memory):
"""
A model to configure users in the portal wizard.
"""
- _name = 'res.portal.wizard.user'
+ _name = 'portal.wizard.user'
_description = 'Portal User Config'
_columns = {
- 'wizard_id': fields.many2one('res.portal.wizard', required=True,
- string='Wizard'),
- 'name': fields.char(size=64, required=True,
- string='User Name',
- help="The user's real name"),
- 'email': fields.char(size=64, required=True,
- string='Email',
- help="Will be used as user login. "
- "Also necessary to send the account information to new users"),
- 'lang': fields.selection(_lang_get, required=True,
- string='Language',
- help="The language for the user's user interface"),
- 'partner_id': fields.related('wizard_id','partner_id',type='many2one',relation='res.partner',string='Partner',readonly=True),
- 'has_portal_user':fields.boolean('Has portal access'),
- 'user_id': fields.many2one('res.users', string="Related User")
+ 'wizard_id': fields.many2one('portal.wizard', string='Wizard', required=True),
+ 'partner_id': fields.many2one('res.partner', string='Contact', required=True, readonly=True),
+ 'email': fields.related('partner_id', 'email', type='char', string='Email'),
+ 'in_portal': fields.boolean('In Portal'),
}
- def _check_email(self, cr, uid, ids):
- """ check syntax of email address """
- for wuser in self.browse(cr, uid, ids):
- if not email_re.match(wuser.email): return False
- return True
-
- _constraints = [
- (_check_email, 'Invalid email address', ['email']),
- ]
-
- _defaults = {
- 'lang': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).partner_id.lang or 'en_US',
- 'partner_id': lambda self, cr, uid, ctx: ctx.get('active_id', False),
- }
-
- def send_email(self, cr, uid, portal_user, new_user_id, context=None):
- #TODO: use email template
- if context is None:
- context = {}
- ctx = dict(context)
+ def action_apply(self, cr, uid, ids, context=None):
res_users = self.pool.get('res.users')
- mail_mail = self.pool.get('mail.mail')
- user = res_users.browse(cr, ROOT_UID, uid, context)
+ for wizard_user in self.browse(cr, SUPERUSER_ID, ids, context):
+ portal = wizard_user.wizard_id.portal_id
+ user = self._retrieve_user(cr, SUPERUSER_ID, wizard_user, context)
+ if wizard_user.in_portal:
+ # create a user if necessary, and make sure it is in the portal group
+ if not user:
+ user = self._create_user(cr, SUPERUSER_ID, wizard_user, context)
+ if (not user.active) or (portal not in user.groups_id):
+ user.write({'active': True, 'groups_id': [(4, portal.id)]})
+ wizard_user = self.browse(cr, SUPERUSER_ID, wizard_user.id, context)
+ self._send_email(cr, uid, wizard_user, context)
+ else:
+ # remove the user (if it exists) from the portal group
+ if user:
+ if portal in user.groups_id:
+ values = {'groups_id': [(3, portal.id)]}
+ if len(user.groups_id) == 1:
+ values['active'] = False # deactivate user
+ user.write(values)
+
+ def _retrieve_user(self, cr, uid, wizard_user, context=None):
+ """ retrieve the (possibly inactive) user corresponding to wizard_user.partner_id
+ @param wizard_user: browse record of model portal.wizard.user
+ @return: browse record of model res.users
+ """
+ if wizard_user.partner_id.user_ids:
+ return wizard_user.partner_id.user_ids[0]
+ # the user may be inactive, search for it
+ res_users = self.pool.get('res.users')
+ domain = [('partner_id', '=', wizard_user.partner_id.id), ('active', '=', False)]
+ user_ids = res_users.search(cr, uid, domain)
+ return user_ids and res_users.browse(cr, uid, user_ids[0], context) or False
+
+ def _create_user(self, cr, uid, wizard_user, context=None):
+ """ create a new user for wizard_user.partner_id
+ @param wizard_user: browse record of model portal.wizard.user
+ @return: browse record of model res.users
+ """
+ res_users = self.pool.get('res.users')
+ create_context = dict(context or {}, noshortcut=True) # to prevent shortcut creation
+ values = {
+ 'login': wizard_user.email,
+ 'password': random_password(),
+ 'partner_id': wizard_user.partner_id.id,
+ 'groups_id': [(6, 0, [])],
+ 'share': True,
+ }
+ user_id = res_users.create(cr, uid, values, context=create_context)
+ return res_users.browse(cr, uid, user_id, context)
+
+ def _send_email(self, cr, uid, wizard_user, context=None):
+ """ send invitation email to a new portal user
+ @param wizard_user: browse record of model portal.wizard.user
+ @return: the id of the created mail.mail record
+ """
+ user = self.pool.get('res.users').browse(cr, SUPERUSER_ID, uid, context)
if not user.email:
raise osv.except_osv(_('Email required'),
- _('You must have an email address in your User Preferences'
- ' to send emails.'))
-
- record = portal_user.wizard_id
- subject_data = {
- 'company': user.company_id.name,
+ _('You must have an email address in your User Preferences to send emails.'))
+
+ # determine subject and body in the portal user's language
+ portal_user = wizard_user.partner_id.user_ids[0]
+ main_context = context
+ context = dict(main_context or {}, lang=portal_user.lang)
+ data = {
+ 'company': user.company_id.name,
+ 'portal': wizard_user.wizard_id.portal_id.name,
+ 'message': wizard_user.wizard_id.message or "",
+ 'url': _("(missing url)"),
+ 'db': cr.dbname,
+ 'login': portal_user.login,
+ 'password': portal_user.password,
+ 'name': portal_user.name
}
- new_user = res_users.browse(cr, uid, new_user_id, context=context)
- ctx['lang'] = new_user.lang
- body_data = {
- 'portal': record.portal_id.name,
- 'message': record.message or "",
- 'url': record.portal_id.url or _("(missing url)"),
- 'db': cr.dbname,
- 'login': new_user.login,
- 'password': new_user.password,
- 'name': new_user.name
+ subject = _(WELCOME_EMAIL_SUBJECT) % data
+ body = _(WELCOME_EMAIL_BODY) % data
+
+ mail_mail = self.pool.get('mail.mail')
+ mail_values = {
+ 'email_from': user.email,
+ 'email_to': portal_user.email,
+ 'subject': subject,
+ 'body_html': '%s
' % body,
+ 'state': 'outgoing',
}
- body_data.update(subject_data)
- email_from = user.email
- email_to = portal_user.email
- subject = _(WELCOME_EMAIL_SUBJECT) % subject_data
- body = _(WELCOME_EMAIL_BODY) % body_data
- mail_id = mail_mail.create(cr, uid, {
- 'email_from': email_from ,
- 'email_to': email_to,
- 'subject': subject,
- 'state': 'outgoing',
- 'body_html': '%s
' % body}, context=ctx)
- return mail_id
-
- def create_new_user(self, cr, uid, portal_user, context=None):
- res_user = self.pool.get('res.users')
- portal = portal_user.wizard_id.portal_id
- partner = portal_user.partner_id
- action_id = portal.home_action_id and portal.home_action_id.id or False
- value = {
- 'name': portal_user.name,
- 'login': portal_user.email,
- 'password': random_password(),
- 'email': portal_user.email,
- 'lang': portal_user.lang,
- 'share': True,
- 'action_id': action_id,
- 'partner_id': partner.id,
- 'groups_id': [(6, 0, [])],
- }
- user_id = res_user.create(cr, ROOT_UID, value, context=context)
- portal_user.write({'user_id': user_id})
- self.send_email(cr, uid, portal_user, user_id, context=context)
- return user_id
-
- def link_portal_user(self, cr, uid, portal_id, user_id, context=None):
- res_groups = self.pool.get('res.groups')
- portal = res_groups.browse(cr, uid, portal_id, context=context)
- portal_user_ids = [u.id for u in portal.users]
- if user_id not in portal_user_ids:
- return portal.write({'users': [(4, user_id)]}, context=context)
- if user_id in portal_user_ids:
- return False
-
- def unlink_portal_user(self, cr, uid, portal_id, user_id, context=None):
- res_groups = self.pool.get('res.groups')
- return res_groups.write(cr, uid, [portal_id], {'users': [(3, user_id)]}, context=context)
-
- def unlink_user(self, cr, uid, user_id, context=None):
- #TODO: search portal groups
- res_user = self.pool.get('res.users')
- user = res_user.browse(cr, uid, user_id, context=context)
- if not user.groups_id:
- user.unlink(context=context)
- return True
-
-
- def manage_portal_access(self, cr, uid, ids, context=None):
- res_user = self.pool.get('res.users')
- for portal_user in self.browse(cr, uid, ids, context=context):
- portal = portal_user.wizard_id.portal_id
- user_id = portal_user.user_id and portal_user.user_id.id
- if not user_id:
- user_ids = res_user.search(cr, uid, [('login','=',portal_user.email)])
- user_id = user_ids and user_ids[0] or False
-
- if not user_id:
- user_id = self.create_new_user(cr, uid, portal_user, context=context)
- linked = self.link_portal_user(cr, uid, portal.id, user_id, context=context)
- #unlink existing user into portal
- if not linked and not portal_user.has_portal_user:
- self.unlink_portal_user(cr, uid, portal.id, user_id, context=context)
- #drop user if it does not has any access in any portal.
- self.unlink_user(cr, uid, user_id, context=context)
- return True
-wizard_user()
+ return mail_mail.create(cr, uid, mail_values, context=main_context)
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/portal/wizard/portal_wizard_view.xml b/addons/portal/wizard/portal_wizard_view.xml
index 7a81def67b0..e6d7901e2aa 100644
--- a/addons/portal/wizard/portal_wizard_view.xml
+++ b/addons/portal/wizard/portal_wizard_view.xml
@@ -5,7 +5,7 @@
@@ -13,18 +13,18 @@
Portal Access Management
- res.portal.wizard
+ portal.wizard
diff --git a/addons/note/note_view.xml b/addons/note/note_view.xml
index ca684b42522..b356efc9549 100644
--- a/addons/note/note_view.xml
+++ b/addons/note/note_view.xml
@@ -82,7 +82,9 @@
+
+
diff --git a/addons/portal_project_issue/portal_project_issue_view.xml b/addons/portal_project_issue/portal_project_issue_view.xml
index 5d0b4ce081e..1030dedbdf8 100644
--- a/addons/portal_project_issue/portal_project_issue_view.xml
+++ b/addons/portal_project_issue/portal_project_issue_view.xml
@@ -27,6 +27,7 @@
+
Creation:
diff --git a/addons/project_issue/project_issue_view.xml b/addons/project_issue/project_issue_view.xml
index fea22c519a8..be7427fe8f4 100644
--- a/addons/project_issue/project_issue_view.xml
+++ b/addons/project_issue/project_issue_view.xml
@@ -269,9 +269,7 @@