Browse Source

Jan 27: [FIX] Bug Fixed 'crm_check_approve_limiter'

pull/309/head
Cybrosys Technologies 3 months ago
parent
commit
662421c987
  1. 2
      crm_check_approve_limiter/__manifest__.py
  2. 5
      crm_check_approve_limiter/doc/RELEASE_NOTES.md
  3. 39
      crm_check_approve_limiter/models/crm_lead.py

2
crm_check_approve_limiter/__manifest__.py

@ -21,7 +21,7 @@
############################################################################# #############################################################################
{ {
'name': 'CheckList & Approval Process in CRM', 'name': 'CheckList & Approval Process in CRM',
'version': '17.0.1.0.0', 'version': '17.0.1.1.0',
'category': 'CRM', 'category': 'CRM',
'summary': 'Manage CRM based on CheckList and Team/Stage and' 'summary': 'Manage CRM based on CheckList and Team/Stage and'
'Approval Process to Make Sure Everything Completed In ' 'Approval Process to Make Sure Everything Completed In '

5
crm_check_approve_limiter/doc/RELEASE_NOTES.md

@ -4,3 +4,8 @@
#### Version 17.0.1.0.0 #### Version 17.0.1.0.0
#### ADD #### ADD
- Initial commit for CheckList & Approval Process in CRM - Initial commit for CheckList & Approval Process in CRM
#### 20.01.2025
#### Version 17.0.1.1.0
#### UPDT
- Fixed bugs in checklist history tracking functionality

39
crm_check_approve_limiter/models/crm_lead.py

@ -96,15 +96,18 @@ class CrmLead(models.Model):
and item not in self.check_list_ids: and item not in self.check_list_ids:
self.check_list_ids += item self.check_list_ids += item
if 'check_list_ids' in vals_set.keys(): if 'check_list_ids' in vals_set.keys():
group_check = self.env.user. \ group_check = self.env.user.has_group('crm_check_approve_limiter.crm_check_approve_manager')
has_group('crm_check_approve_limiter.'
'crm_check_approve_manager')
user_groups = self.env.user.groups_id user_groups = self.env.user.groups_id
new_ids = self.env['stage.check.list']. \ complete_operations = []
search([('id', 'in', vals_set['check_list_ids'][-1])]) notcomplete_operations = []
check_item_id = (self.check_list_ids - new_ids) for operation in vals_set['check_list_ids']:
check_item2 = (new_ids - self.check_list_ids) if operation[0] == 4: # Add operation
for ch_lst in check_item2: complete_operations.append(operation[1])
elif operation[0] == 3: # Remove operation
notcomplete_operations.append(operation[1])
new_complete_ids = self.env['stage.check.list'].search([('id', 'in', complete_operations)])
new_notcomplete_ids = self.env['stage.check.list'].search([('id', 'in', notcomplete_operations)])
for ch_lst in new_complete_ids:
if (ch_lst.approve_groups_ids and not ch_lst.approve_groups_ids if (ch_lst.approve_groups_ids and not ch_lst.approve_groups_ids
.filtered(lambda f: f in user_groups) and .filtered(lambda f: f in user_groups) and
not group_check): not group_check):
@ -114,33 +117,33 @@ class CrmLead(models.Model):
raise ValidationError(f'Only the below specified group' raise ValidationError(f'Only the below specified group'
f' members can complete this task' f' members can complete this task'
f' : {grp_string_t}') f' : {grp_string_t}')
for ch_lst in check_item_id: for ch_lst in new_notcomplete_ids:
if (ch_lst.approve_groups_ids and not ch_lst.approve_groups_ids if (ch_lst.approve_groups_ids and not ch_lst.approve_groups_ids
.filtered( .filtered(lambda f: f in user_groups) and
lambda f: f in user_groups) and not group_check): not group_check):
grp_string_t = '\n'.join( grp_string_t = '\n'.join(
map(str, ch_lst.approve_groups_ids. map(str, ch_lst.approve_groups_ids.
mapped('full_name'))) mapped('full_name')))
raise ValidationError(f'Only the below specified group' raise ValidationError(f'Only the below specified group'
f' members can undo this task' f' members can complete this task'
f' : {grp_string_t}') f' : {grp_string_t}')
if 'stage_id' not in vals_set.keys() and check_item_id: if 'stage_id' not in vals_set.keys() and new_complete_ids:
for c_item in check_item_id: for c_item in new_complete_ids:
vals = { vals = {
'lead_id': self.id, 'lead_id': self.id,
'check_item_id': c_item.id, 'check_item_id': c_item.id,
'list_action': 'not_complete', 'list_action': 'complete',
'change_date': datetime.now(), 'change_date': datetime.now(),
'user_id': self.env.user.id, 'user_id': self.env.user.id,
'stage_id': self.stage_id.id 'stage_id': self.stage_id.id
} }
self.env['crm.lead.check.history'].sudo().create(vals) self.env['crm.lead.check.history'].sudo().create(vals)
elif 'stage_id' not in vals_set.keys() and check_item2: if 'stage_id' not in vals_set.keys() and new_notcomplete_ids:
for c_item in check_item2: for c_item in new_notcomplete_ids:
vals = { vals = {
'lead_id': self.id, 'lead_id': self.id,
'check_item_id': c_item.id, 'check_item_id': c_item.id,
'list_action': 'complete', 'list_action': 'not_complete',
'change_date': datetime.now(), 'change_date': datetime.now(),
'user_id': self.env.user.id, 'user_id': self.env.user.id,
'stage_id': self.stage_id.id 'stage_id': self.stage_id.id

Loading…
Cancel
Save