[MERGE]: Merged lp:~openerp-dev/openobject-addons/trunk-customer_portal-atp-portal-customer-enhancements-bde
bzr revid: atp@tinyerp.com-20120424102820-azpqlxn2i4fr9o3x
This commit is contained in:
commit
60645fd605
|
@ -91,12 +91,22 @@ class wizard(osv.osv_memory):
|
|||
def _default_user_ids(self, cr, uid, context):
|
||||
""" determine default user_ids from the active records """
|
||||
def create_user_from_address(address):
|
||||
return { # a user config based on a contact (address)
|
||||
'name': address.name,
|
||||
'user_email': extract_email(address.email),
|
||||
'lang': address.parent_id and address.parent_id.lang or 'en_US',
|
||||
'partner_id': address.parent_id and address.parent_id.id,
|
||||
}
|
||||
if isinstance(address, int):
|
||||
res_partner_obj = self.pool.get('res.partner')
|
||||
address = res_partner_obj.browse(cr, uid, address, context=context)
|
||||
lang = address.id and address.lang or 'en_US'
|
||||
partner_id = address.id
|
||||
|
||||
else:
|
||||
lang = address.parent_id and address.parent_id.lang or 'en_US'
|
||||
partner_id = address.parent_id and address.parent_id.id
|
||||
|
||||
return{
|
||||
'name': address.name,
|
||||
'user_email': extract_email(address.email),
|
||||
'lang': lang,
|
||||
'partner_id': partner_id,
|
||||
}
|
||||
|
||||
user_ids = []
|
||||
if context.get('active_model') == 'res.partner':
|
||||
|
@ -107,6 +117,8 @@ class wizard(osv.osv_memory):
|
|||
# add one user per contact, or one user if no contact
|
||||
if p.child_ids:
|
||||
user_ids.extend(map(create_user_from_address, p.child_ids))
|
||||
elif p.is_company == False and p.customer == True:
|
||||
user_ids.extend(map(create_user_from_address, [p.id]))
|
||||
else:
|
||||
user_ids.append({'lang': p.lang or 'en_US', 'parent_id': p.id})
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
<record id="portal_event_rule" model="ir.rule">
|
||||
<field name="name">Personal Events</field>
|
||||
<field ref="event.model_event_event" name="model_id"/>
|
||||
<field name="domain_force">[]</field>
|
||||
<field name="groups" eval="[(4, ref('portal_customer.group_sales_portal'))]"/>
|
||||
</record>
|
||||
|
||||
|
|
|
@ -8,3 +8,5 @@ access_survey_history,survey_history,survey.model_survey_history,portal_customer
|
|||
access_survey_question_column_heading,survey_question_column_heading,survey.model_survey_question_column_heading,portal_customer.group_sales_portal,1,0,0,0
|
||||
access_survey_response_line,survey_response_line,survey.model_survey_response_line,portal_customer.group_sales_portal,1,1,1,0
|
||||
access_survey_response_answer,survey_response_answer,survey.model_survey_response_answer,portal_customer.group_sales_portal,1,1,1,0
|
||||
access_ir_attachment,ir.attachment,base.model_ir_attachment,portal_customer.group_sales_portal,1,0,1,0
|
||||
access_mail_message,mail.message,mail.model_mail_message,portal_customer.group_sales_portal,1,1,1,0
|
||||
|
|
|
Loading…
Reference in New Issue