[IMP] Improve ospp_base and ospp_slide modules
							parent
							
								
									724d4a7754
								
							
						
					
					
						commit
						ab8c4ebce6
					
				|  | @ -34,6 +34,8 @@ class SlideChannel(models.Model): | ||||||
| 
 | 
 | ||||||
|             partner_ids = partner_obj.search([('channel_id', '=', rec.id)]) |             partner_ids = partner_obj.search([('channel_id', '=', rec.id)]) | ||||||
| 
 | 
 | ||||||
|  |             rec.message_unsubscribe(partner_ids=[x.partner_id.id for x in partner_ids]) | ||||||
|  | 
 | ||||||
|             if not rec.instance_ids: |             if not rec.instance_ids: | ||||||
|                 if rec.instance_arrangement in ['share', 'both']: |                 if rec.instance_arrangement in ['share', 'both']: | ||||||
|                     vals = [] |                     vals = [] | ||||||
|  | @ -160,6 +162,7 @@ class ChannelInstance(models.Model): | ||||||
|     is_notified = fields.Boolean('Is Notified', default=False) |     is_notified = fields.Boolean('Is Notified', default=False) | ||||||
| 
 | 
 | ||||||
|     def action_post_instance(self): |     def action_post_instance(self): | ||||||
|  |         partner_obj = self.env['slide.channel.partner'].sudo() | ||||||
|         for rec in self: |         for rec in self: | ||||||
|             subject = f"通知: 《{rec.channel_id.name}》实训环境已经生成" |             subject = f"通知: 《{rec.channel_id.name}》实训环境已经生成" | ||||||
|             html_body = f""" |             html_body = f""" | ||||||
|  | @ -171,6 +174,9 @@ class ChannelInstance(models.Model): | ||||||
|              |              | ||||||
|             <div>预祝学习愉快!</div> |             <div>预祝学习愉快!</div> | ||||||
|             """ |             """ | ||||||
|  |             partner_ids = partner_obj.search([('channel_id', '=', rec.channel_id.id)]) | ||||||
|  |             rec.message_unsubscribe(partner_ids=[x.partner_id.id for x in partner_ids]) | ||||||
|  | 
 | ||||||
|             partner_ids = [x.partner_id.id for x in rec.user_scope] |             partner_ids = [x.partner_id.id for x in rec.user_scope] | ||||||
|             kwargs = {} |             kwargs = {} | ||||||
|             rec.channel_id.with_context(mail_create_nosubscribe=True).message_post( |             rec.channel_id.with_context(mail_create_nosubscribe=True).message_post( | ||||||
|  | @ -185,7 +191,6 @@ class ChannelInstance(models.Model): | ||||||
|             rec.is_notified = True |             rec.is_notified = True | ||||||
|             return True |             return True | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
|     def action_generate_instance(self): |     def action_generate_instance(self): | ||||||
|         for rec in self: |         for rec in self: | ||||||
|             if rec.instance_created: |             if rec.instance_created: | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	 Oliver Yuan
						Oliver Yuan