transaction delete restrict
This commit is contained in:
parent
09d4cbe7f6
commit
f2fe866fce
|
|
@ -3578,3 +3578,62 @@ msgstr "تاريخ نهاية التفويض"
|
|||
#: model_terms:ir.ui.view,arch_db:exp_transaction_documents.view_outgoing_transaction_filter
|
||||
msgid "Late Transactions"
|
||||
msgstr "المعاملات المتأخرة"
|
||||
|
||||
#. module: exp_transaction_documents
|
||||
#: model:res.groups,name:exp_transaction_documents.group_delete_transactions_configuration
|
||||
msgid "Delete Transactions Configuration"
|
||||
msgstr "حذف إعدادات المعاملات"
|
||||
|
||||
#. module: exp_transaction_documents
|
||||
#: code:addons/exp_transaction_documents/models/configuration.py:0
|
||||
#, python-format
|
||||
msgid ""
|
||||
"You Can Not Delete This Archive Type, Because There is a Related Transaction"
|
||||
" Trace Record."
|
||||
msgstr ".لا يمكنك حذف مبررات الحفظ و الارشفة، لأنه توجد معاملات ذات صلة"
|
||||
|
||||
#. module: exp_transaction_documents
|
||||
#: code:addons/exp_transaction_documents/models/configuration.py:0
|
||||
#, python-format
|
||||
msgid ""
|
||||
"You Can Not Delete This Attachment, Because There is a Related Transaction "
|
||||
"Attachments."
|
||||
msgstr ".لا يمكنك حذف انواع المشفوعات، لأنه توجد معاملات ذات صلة"
|
||||
|
||||
#. module: exp_transaction_documents
|
||||
#: code:addons/exp_transaction_documents/models/entity.py:0
|
||||
#, python-format
|
||||
msgid ""
|
||||
"You Can Not Delete This Entity, Because There is a Related Transaction."
|
||||
msgstr ".لا يمكنك حذف هذه الجهة، لأنه توجد معاملات ذات صلة"
|
||||
|
||||
#. module: exp_transaction_documents
|
||||
#: code:addons/exp_transaction_documents/models/configuration.py:0
|
||||
#, python-format
|
||||
msgid ""
|
||||
"You Can Not Delete This Procedure, Because There is a Related Transaction."
|
||||
msgstr ".لا يمكنك حذف هذا الإجراء، لأنه توجد معاملات ذات صلة"
|
||||
|
||||
#. module: exp_transaction_documents
|
||||
#: code:addons/exp_transaction_documents/models/configuration.py:0
|
||||
#, python-format
|
||||
msgid ""
|
||||
"You Can Not Delete This Transaction Category, Because There is a Related "
|
||||
"Transaction."
|
||||
msgstr ".لا يمكنك حذف هذا الوسم، لأنه توجد معاملات ذات صلة"
|
||||
|
||||
#. module: exp_transaction_documents
|
||||
#: code:addons/exp_transaction_documents/models/configuration.py:0
|
||||
#, python-format
|
||||
msgid ""
|
||||
"You Can Not Delete This Transaction Important, Because There is a Related "
|
||||
"Transaction."
|
||||
msgstr ".لا يمكنك حذف درجة الأهمية، لأنه توجد معاملات ذات صلة"
|
||||
|
||||
#. module: exp_transaction_documents
|
||||
#: code:addons/exp_transaction_documents/models/configuration.py:0
|
||||
#, python-format
|
||||
msgid ""
|
||||
"You Can Not This Delete Subject Type, Because There is a Related "
|
||||
"Transaction."
|
||||
msgstr ".لا يمكنك حذف نوع المعاملة، لأنه توجد معاملات ذات صلة"
|
||||
|
|
|
|||
|
|
@ -30,6 +30,16 @@ class SubjectType(models.Model):
|
|||
transaction_need_approve = fields.Boolean(string="Transaction need approve", tracking=True)
|
||||
tran_tag = fields.Many2many(comodel_name='transaction.tag', string='Tags', tracking=True)
|
||||
|
||||
def unlink(self):
|
||||
for rec in self:
|
||||
internal_transaction_id = self.env['internal.transaction'].search([('subject_type_id', '=', rec.id)]).ids
|
||||
outgoing_transaction_id = self.env['outgoing.transaction'].search([('subject_type_id', '=', rec.id)]).ids
|
||||
incoming_transaction_id = self.env['incoming.transaction'].search([('subject_type_id', '=', rec.id)]).ids
|
||||
|
||||
if internal_transaction_id or outgoing_transaction_id or incoming_transaction_id:
|
||||
raise ValidationError(_("You Can Not This Delete Subject Type, Because There is a Related Transaction."))
|
||||
return super(SubjectType, self).unlink()
|
||||
|
||||
|
||||
class ImportantDegree(models.Model):
|
||||
_name = 'cm.transaction.important'
|
||||
|
|
@ -37,12 +47,32 @@ class ImportantDegree(models.Model):
|
|||
name = fields.Char(string='Important Degree')
|
||||
rank = fields.Integer(string='Transaction Duration')
|
||||
|
||||
def unlink(self):
|
||||
for rec in self:
|
||||
internal_transaction_id = self.env['internal.transaction'].search([('important_id', '=', rec.id)]).ids
|
||||
outgoing_transaction_id = self.env['outgoing.transaction'].search([('important_id', '=', rec.id)]).ids
|
||||
incoming_transaction_id = self.env['incoming.transaction'].search([('important_id', '=', rec.id)]).ids
|
||||
|
||||
if internal_transaction_id or outgoing_transaction_id or incoming_transaction_id:
|
||||
raise ValidationError(_("You Can Not Delete This Transaction Important, Because There is a Related Transaction."))
|
||||
return super(ImportantDegree, self).unlink()
|
||||
|
||||
|
||||
class Procedure(models.Model):
|
||||
_name = 'cm.procedure'
|
||||
|
||||
name = fields.Char(string='Procedure Name')
|
||||
|
||||
def unlink(self):
|
||||
for rec in self:
|
||||
internal_transaction_id = self.env['internal.transaction'].search([('procedure_id', '=', rec.id)]).ids
|
||||
outgoing_transaction_id = self.env['outgoing.transaction'].search([('procedure_id', '=', rec.id)]).ids
|
||||
incoming_transaction_id = self.env['incoming.transaction'].search([('procedure_id', '=', rec.id)]).ids
|
||||
|
||||
if internal_transaction_id or outgoing_transaction_id or incoming_transaction_id:
|
||||
raise ValidationError(_("You Can Not Delete This Procedure, Because There is a Related Transaction."))
|
||||
return super(Procedure, self).unlink()
|
||||
|
||||
|
||||
class AttachmentType(models.Model):
|
||||
_name = 'cm.attachment.type'
|
||||
|
|
@ -50,6 +80,15 @@ class AttachmentType(models.Model):
|
|||
sequence = fields.Integer(string='Sequence', default=1)
|
||||
name = fields.Char(string='Name')
|
||||
|
||||
def unlink(self):
|
||||
for rec in self:
|
||||
transaction_trace_id = self.env['cm.attachment'].search([('type_id', '=', rec.id)]).ids
|
||||
|
||||
if transaction_trace_id:
|
||||
raise ValidationError(_("You Can Not Delete This Attachment, Because There is a Related Transaction Attachments."))
|
||||
return super(AttachmentType, self).unlink()
|
||||
|
||||
|
||||
|
||||
class Attachment(models.Model):
|
||||
_name = 'cm.attachment'
|
||||
|
|
@ -67,6 +106,14 @@ class ArchiveType(models.Model):
|
|||
|
||||
name = fields.Char(string='Archive Type')
|
||||
|
||||
def unlink(self):
|
||||
for rec in self:
|
||||
transaction_trace_id = self.env['cm.transaction.trace'].search([('archive_type_id', '=', rec.id)]).ids
|
||||
|
||||
if transaction_trace_id:
|
||||
raise ValidationError(_("You Can Not Delete This Archive Type, Because There is a Related Transaction Trace Record."))
|
||||
return super(ArchiveType, self).unlink()
|
||||
|
||||
|
||||
class AttachmentRule(models.Model):
|
||||
_name = 'cm.attachment.rule'
|
||||
|
|
@ -168,3 +215,13 @@ class TransactionCategory(models.Model):
|
|||
_name = 'transaction.tag'
|
||||
|
||||
name = fields.Char("Name")
|
||||
|
||||
def unlink(self):
|
||||
for rec in self:
|
||||
internal_transaction_id = self.env['internal.transaction'].search([('tran_tag', 'in', rec.id)]).ids
|
||||
outgoing_transaction_id = self.env['outgoing.transaction'].search(['|',('tran_tag', 'in', rec.id),('tran_tag_unit', 'in', rec.id)]).ids
|
||||
incoming_transaction_id = self.env['incoming.transaction'].search([('tran_tag', 'in', rec.id)]).ids
|
||||
|
||||
if internal_transaction_id or outgoing_transaction_id or incoming_transaction_id:
|
||||
raise ValidationError(_("You Can Not Delete This Transaction Category, Because There is a Related Transaction."))
|
||||
return super(TransactionCategory, self).unlink()
|
||||
|
|
|
|||
|
|
@ -98,6 +98,16 @@ class Entity(models.Model):
|
|||
to_date = fields.Datetime(string='Delegation To Date')
|
||||
to_delegate = fields.Boolean(string='To Delegate?', compute="_compute_to_delegate")
|
||||
|
||||
def unlink(self):
|
||||
for rec in self:
|
||||
internal_transaction_id = self.env['internal.transaction'].search(['|','|','|','|','|',('to_ids', '=', rec.id),('cc_ids', 'in', rec.id),('preparation_id', '=', rec.id),('employee_id', '=', rec.id),('entity_id', '=', rec.id),('archive_user_id', '=', rec.id)]).ids
|
||||
outgoing_transaction_id = self.env['outgoing.transaction'].search(['|','|','|','|','|',('to_ids', '=', rec.id),('cc_ids', 'in', rec.id),('preparation_id', '=', rec.id),('employee_id', '=', rec.id),('entity_id', '=', rec.id),('archive_user_id', '=', rec.id)]).ids
|
||||
incoming_transaction_id = self.env['incoming.transaction'].search(['|','|','|','|','|','|',('to_ids', '=', rec.id),('cc_ids', 'in', rec.id),('preparation_id', '=', rec.id),('employee_id', '=', rec.id),('entity_id', '=', rec.id),('from_id', '=', rec.id),('archive_user_id', '=', rec.id)]).ids
|
||||
|
||||
if internal_transaction_id or outgoing_transaction_id or incoming_transaction_id:
|
||||
raise ValidationError(_("You Can Not Delete This Entity, Because There is a Related Transaction."))
|
||||
return super(Entity, self).unlink()
|
||||
|
||||
def _compute_to_delegate(self):
|
||||
for rec in self:
|
||||
rec.to_delegate = False
|
||||
|
|
|
|||
|
|
@ -50,6 +50,11 @@
|
|||
<field name="category_id" ref="module_category_cm"/>
|
||||
</record>
|
||||
|
||||
<record id="group_delete_transactions_configuration" model="res.groups">
|
||||
<field name="name">Delete Transactions Configuration</field>
|
||||
<field name="category_id" ref="module_category_cm"/>
|
||||
</record>
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,33 +1,37 @@
|
|||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
||||
cm_subject_type_employee,employee subject type,model_cm_subject_type,group_cm_employee_group,1,1,0,0
|
||||
cm_subject_type_out,employee_out_subject_type,model_cm_subject_type,group_cm_user,1,1,1,1
|
||||
cm_subject_manager_type_out7,manager_out_subject_type7,model_cm_subject_type,group_transaction_manager,1,1,1,1
|
||||
|
||||
cm_subject_type_out,employee_out_subject_type,model_cm_subject_type,group_cm_user,1,1,1,0
|
||||
cm_subject_manager_type_out7,manager_out_subject_type7,model_cm_subject_type,group_transaction_manager,1,1,1,0
|
||||
cm_subject_type_reviwer,reviwer_subject_type,model_cm_subject_type,group_cm_reviewer,1,1,0,0
|
||||
cm_subject_type_dep_man,dep_subject_type,model_cm_subject_type,group_cm_department_manager,1,1,0,0
|
||||
cm_subject_type_exective_man,excetive_subject_type,model_cm_subject_type,group_cm_executive_manager,1,1,0,0
|
||||
cm_subject_type_delete,delete_subject_type,model_cm_subject_type,group_delete_transactions_configuration,1,1,1,1
|
||||
|
||||
cm_transaction_impo_employee,employee_transaction_impo,model_cm_transaction_important,group_cm_employee_group,1,0,0,0
|
||||
cm_transaction_impo_out,employee_out_transaction_impo,model_cm_transaction_important,group_cm_user,1,1,1,1
|
||||
cm_transaction_impo_out,employee_out_transaction_impo,model_cm_transaction_important,group_cm_user,1,1,1,0
|
||||
cm_transaction_impo_reviwer,reviwer_transaction_impo,model_cm_transaction_important,group_cm_reviewer,1,0,0,0
|
||||
cm_transaction_impo_dep_man,dep_transaction_impo,model_cm_transaction_important,group_cm_department_manager,1,0,0,0
|
||||
cm_transaction_impo_exective_man,cm_procedure,model_cm_transaction_important,group_cm_executive_manager,1,0,0,0
|
||||
cm_transaction_impo_transaction_man,cm_manager,model_cm_transaction_important,group_transaction_manager,1,0,0,0
|
||||
cm_transaction_impo_delete,delete_transaction_important,model_cm_transaction_important,group_delete_transactions_configuration,1,1,1,1
|
||||
|
||||
|
||||
cm_procedure_employee,employee_cm_procedure,model_cm_procedure,group_cm_employee_group,1,0,0,0
|
||||
cm_procedure_out,employee_out_cm_procedure,model_cm_procedure,group_cm_user,1,1,1,1
|
||||
cm_procedure_out_manager,employee_out_manager_cm_procedure,model_cm_procedure,group_transaction_manager,1,1,1,1
|
||||
|
||||
cm_procedure_out,employee_out_cm_procedure,model_cm_procedure,group_cm_user,1,1,1,0
|
||||
cm_procedure_out_manager,employee_out_manager_cm_procedure,model_cm_procedure,group_transaction_manager,1,1,1,0
|
||||
cm_procedure_reviwer,reviwer_cm_procedure,model_cm_procedure,group_cm_reviewer,1,0,0,0
|
||||
cm_procedure_dep_man,dep_cm_procedure,model_cm_procedure,group_cm_department_manager,1,0,0,0
|
||||
cm_procedure_exective_man,excetive_cm_procedure,model_cm_procedure,group_cm_executive_manager,1,0,0,0
|
||||
cm_attachmen_type_employee,employee_cm_attachmen_type,model_cm_attachment_type,group_cm_employee_group,1,1,1,1
|
||||
cm_attachmen_type_employee11_man,manager_cm_attachmen_type11,model_cm_attachment_type,group_transaction_manager,1,1,1,1
|
||||
cm_procedure_delete,delete_cm_procedure,model_cm_procedure,group_delete_transactions_configuration,1,1,1,1
|
||||
|
||||
cm_attachmen_type_employee,employee_cm_attachmen_type,model_cm_attachment_type,group_cm_employee_group,1,1,1,0
|
||||
cm_attachmen_type_employee11_man,manager_cm_attachmen_type11,model_cm_attachment_type,group_transaction_manager,1,1,1,0
|
||||
cm_attachmen_type_out,employee_out_cm_attachmen_type,model_cm_attachment_type,group_cm_user,1,1,1,0
|
||||
cm_attachmen_type_reviwer,reviwer_cm_attachmen_type,model_cm_attachment_type,group_cm_reviewer,1,1,1,0
|
||||
cm_attachmen_type_dep_man,dep_cm_attachmen_type,model_cm_attachment_type,group_cm_department_manager,1,1,1,0
|
||||
cm_attachmen_type_exective_man,excetive_cm_attachmen_type,model_cm_attachment_type,group_cm_executive_manager,1,1,1,0
|
||||
cm_attachmen_type_exective_delete,delete_excetive_cm_attachmen_type,model_cm_attachment_type,group_delete_transactions_configuration,1,1,1,1
|
||||
|
||||
cm_attachmen_type_out,employee_out_cm_attachmen_type,model_cm_attachment_type,group_cm_user,1,1,1,1
|
||||
cm_attachmen_type_reviwer,reviwer_cm_attachmen_type,model_cm_attachment_type,group_cm_reviewer,1,1,1,1
|
||||
cm_attachmen_type_dep_man,dep_cm_attachmen_type,model_cm_attachment_type,group_cm_department_manager,1,1,1,1
|
||||
cm_attachmen_type_exective_man,excetive_cm_attachmen_type,model_cm_attachment_type,group_cm_executive_manager,1,1,1,1
|
||||
cm_attachment,employee_cm_attachmen,model_cm_attachment,group_cm_employee_group,1,1,1,1
|
||||
cm_attachmen_out,employee_out_cm_attachmen,model_cm_attachment,group_cm_user,1,1,1,1
|
||||
cm_attachmen_reviwer,reviwer_cm_attachmen,model_cm_attachment,group_cm_reviewer,1,1,1,1
|
||||
|
|
@ -36,10 +40,13 @@ cm_attachmen_exective_man,excetive_cm_attachmen,model_cm_attachment,group_cm_exe
|
|||
cm_attachmen_exective_man2,excetive_manager_attachmen,model_cm_attachment,group_transaction_manager,1,1,1,1
|
||||
|
||||
cm_archive_type,employee_cm_archive_type,model_cm_archive_type,group_cm_employee_group,1,0,0,0
|
||||
cm_archive_type_out,employee_out_cm_archive_type,model_cm_archive_type,group_cm_user,1,1,1,1
|
||||
cm_archive_type_out,employee_out_cm_archive_type,model_cm_archive_type,group_cm_user,1,1,1,0
|
||||
cm_archive_type_reviwer,reviwer_cm_archive_type,model_cm_archive_type,group_cm_reviewer,1,0,0,0
|
||||
cm_archive_type_dep_man,dep_cm_archive_type,model_cm_archive_type,group_cm_department_manager,1,0,0,0
|
||||
cm_archive_type_exective_man,excetive_cm_archive_type,model_cm_archive_type,group_cm_executive_manager,1,0,0,0
|
||||
cm_archive_type_out_delete,delete_cm_archive_type,model_cm_archive_type,group_delete_transactions_configuration,1,1,1,1
|
||||
|
||||
|
||||
cm_attachment_rule,employee_cm_attachment_rule,model_cm_attachment_rule,group_cm_employee_group,1,1,1,1
|
||||
cm_attachment_rule_out,employee_out_cm_attachment_rule,model_cm_attachment_rule,group_cm_user,1,1,1,1
|
||||
cm_attachment_rule_reviwer,reviwer_cm_attachment_rule,model_cm_attachment_rule,group_cm_reviewer,1,1,1,1
|
||||
|
|
@ -64,13 +71,16 @@ cm_job_title_out,employee_out_cm_job_title,model_cm_job_title,group_cm_user,1,1,
|
|||
cm_job_title_reviwer,reviwer_cm_job_title,model_cm_job_title,group_cm_reviewer,1,0,0,0
|
||||
cm_job_title_dep_man,dep_cm_job_title,model_cm_job_title,group_cm_department_manager,1,0,0,0
|
||||
cm_job_title_exective_man,excetive_cm_job_title,model_cm_job_title,group_cm_executive_manager,1,0,0,0
|
||||
|
||||
cm_entity,employee_cm_entity,model_cm_entity,group_cm_employee_group,1,1,0,0
|
||||
cm_entity_out,employee_out_cm_entity,model_cm_entity,group_cm_user,1,1,1,1
|
||||
cm_entity_out,employee_out_cm_entity,model_cm_entity,group_cm_user,1,1,1,0
|
||||
cm_entity_reviwer,reviwer_cm_entity,model_cm_entity,group_cm_reviewer,1,1,0,0
|
||||
cm_entity_manager,manager_cm_entity,model_cm_entity,group_transaction_manager,1,1,0,0
|
||||
|
||||
cm_entity_dep_man,dep_cm_entity,model_cm_entity,group_cm_department_manager,1,1,0,0
|
||||
cm_entity_exective_man,excetive_cm_entity,model_cm_entity,group_cm_executive_manager,1,1,0,0
|
||||
cm_entity_delete,delete_cm_entity,model_cm_entity,group_delete_transactions_configuration,1,1,1,1
|
||||
|
||||
|
||||
internal_transaction,employee_internal_transaction,model_internal_transaction,group_cm_employee_group,1,1,1,1
|
||||
internal_transaction_out,employee_out_internal_transaction,model_internal_transaction,group_cm_user,1,1,1,1
|
||||
internal_transaction_reviwer,reviwer_internal_transaction,model_internal_transaction,group_cm_reviewer,1,1,1,1
|
||||
|
|
@ -96,11 +106,15 @@ cm_project_type_out,employee_out_project_type,model_project_type,group_cm_user,1
|
|||
cm_project_type_reviwer,reviwer_project_type,model_project_type,group_cm_reviewer,1,0,0,0
|
||||
cm_project_type_dep_man,dep_project_type,model_project_type,group_cm_department_manager,1,0,0,0
|
||||
cm_project_type_exective_man,excetive_project_type,model_project_type,group_cm_executive_manager,1,0,0,0
|
||||
|
||||
cm_transaction_category,employee_cm_transaction_category,model_transaction_tag,group_cm_employee_group,1,0,0,0
|
||||
cm_transaction_category_out,employee_out_transaction_category,model_transaction_tag,group_cm_user,1,1,1,1
|
||||
cm_transaction_category_out,employee_out_transaction_category,model_transaction_tag,group_cm_user,1,1,1,0
|
||||
cm_transaction_category_reviwer,reviwer_transaction_category,model_transaction_tag,group_cm_reviewer,1,0,0,0
|
||||
cm_transaction_category_dep_man,dep_transaction_category,model_transaction_tag,group_cm_department_manager,1,0,0,0
|
||||
cm_transaction_category_exective_man,excetive_transaction_category,model_transaction_tag,group_cm_executive_manager,1,0,0,0
|
||||
cm_transaction_category_delete,delete_transaction_category,model_transaction_tag,group_delete_transactions_configuration,1,1,1,1
|
||||
|
||||
|
||||
access_transaction_transaction,transaction_transaction,model_transaction_transaction,,1,1,1,1
|
||||
access_odex_barcode,odex_barcode,model_odex_barcode,,1,1,1,1
|
||||
access_reject_reason_wizard,access_reject_reason_wizard,model_reject_reason_wizard,base.group_user,1,1,1,1
|
||||
|
|
|
|||
|
Loading…
Reference in New Issue