Hi,
I have to assign schedule activity to multiple users. Do anyone have a better solution by adding a new field inside the schedule activity screen and so the rest work as like the default functioning of odoo.
Thank you.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
Hi,
I have to assign schedule activity to multiple users. Do anyone have a better solution by adding a new field inside the schedule activity screen and so the rest work as like the default functioning of odoo.
Thank you.
Hi,
We can add a many2many field inside mail.activity
class MailActivity(models.Model):
_inherit = 'mail.activity'
multiple_users = fields.Many2many('res.users', store=True)
#Add this function inside
@api.model
def create(self, vals):
assigned_user_id = vals['user_id']
assigned_user_name = self.env['res.users'].browse(vals['user_id']).name
vals['display_names'] = assigned_user_name
res = super(MailActivity, self).create(vals)
if 'multiple_users' in vals and vals['multiple_users']:
related_user_ids = self.env['res.users'].search([('id', 'in', vals['multiple_users'][0][2])], order='id')
for each in related_user_ids:
if each.name != assigned_user_name:
vals['user_id'] = each.id
vals['display_names'] = each.name
res = super(MailActivity, self).create(vals)
return res
And add that to the view.
<record id="mail_activity_view_form_popup_inherit" model="ir.ui.view">
<field name="name">mail.activity.form.inherit.calendar</field>
<field name="model">mail.activity</field>
<field name="inherit_id" ref="mail.mail_activity_view_form_popup"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='user_id']" position="after">
<field name="multiple_users" widget="many2many_tags" string="Additional Assignees"/>
</xpath>
</field>
</record>
So here we can add separate activity for each users we select in the multiple_users field.
Regards
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng kýBài viết liên quan | Trả lời | Lượt xem | Hoạt động | |
---|---|---|---|---|
|
0
thg 1 21
|
2286 | ||
|
2
thg 3 24
|
7491 | ||
|
0
thg 7 21
|
2169 | ||
|
3
thg 10 20
|
5232 | ||
|
3
thg 8 20
|
4675 |