Merge pull request #3375 from expsa/dev_odex25_transactions

Dev odex25 transactions
This commit is contained in:
kchyounes19 2025-06-01 11:28:53 +01:00 committed by GitHub
commit 61d59e5bba
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 80 additions and 40 deletions

View File

@ -2122,6 +2122,7 @@ msgid "It has all the powers on internal transactions only"
msgstr "وله كافة الصلاحيات على المعاملات الداخلية فقط"
#. module: exp_transaction_documents
#: model:ir.model.fields,field_description:exp_transaction_documents.field_cm_entity__job_title
#: model:ir.model.fields,field_description:exp_transaction_documents.field_cm_entity__job_title_id
#: model:ir.model.fields,field_description:exp_transaction_documents.field_cm_job_title__name
msgid "Job Title"
@ -2436,7 +2437,12 @@ msgstr "صفحة: <span class=\"page\"/> / <span class=\"topage\"/>"
#: model:ir.model.fields,field_description:exp_transaction_documents.field_cm_entity__parent_id
#: model_terms:ir.ui.view,arch_db:exp_transaction_documents.cm_entity_search
msgid "Parent Entity"
msgstr "القسم الرئيسي"
msgstr "الإدارة الرئيسية"
#. module: exp_transaction_documents
#: model:ir.model.fields,field_description:exp_transaction_documents.field_cm_entity__is_employee
msgid "Is Employee"
msgstr "هل هو موظف؟"
#. module: exp_transaction_documents
#: model:ir.model.fields,field_description:exp_transaction_documents.field_cm_entity__partner_id
@ -3048,7 +3054,7 @@ msgstr "مدة المعاملة"
#. module: exp_transaction_documents
#: model:res.groups,name:exp_transaction_documents.group_transaction_manager
msgid "Transaction Manager"
msgstr "مدير المعاملة"
msgstr "مدير نظام المعاملات"
#. module: exp_transaction_documents
#: model:ir.model.fields,field_description:exp_transaction_documents.field_incoming_transaction__name

View File

@ -71,9 +71,11 @@ class Entity(models.Model):
department_id = fields.Many2one('hr.department')
manager_id = fields.Many2one(comodel_name='cm.entity', string='Unit Manager')
secretary_id = fields.Many2one(comodel_name='cm.entity', string='Employee in charge of transactions')
user_id = fields.Many2one(comodel_name='res.users', string='Related User', related='employee_id.user_id', store=True)
# user_id = fields.Many2one(comodel_name='res.users', string='Related User', related='employee_id.user_id', store=True, readonly=False)
user_id = fields.Many2one('res.users', string='Related User', compute='_compute_user_id',store=True, readonly=False)
# job_title_id = fields.Many2one(comodel_name='cm.job.title', string='Job Title')
job_title_id = fields.Many2one(comodel_name='hr.job', string='Job Title')
job_title = fields.Char(string='Job Title')
need_approve = fields.Boolean(string='Need Aprove')
executive_direction = fields.Boolean(string='Executive direction')
is_secret = fields.Boolean(string='Is Secret')
@ -81,6 +83,7 @@ class Entity(models.Model):
person_id_issue_date = fields.Date(string='Person ID Issue Date')
employee_assignment_date = fields.Date(string='Employee Assignment Date')
employee_id = fields.Many2one('hr.employee')
is_employee = fields.Boolean(string="Is Employee")
phone = fields.Char()
email = fields.Char()
child_ids = fields.Many2many(comodel_name='cm.entity', relation='employee_entity_rel', column1='employee_id',
@ -98,6 +101,12 @@ class Entity(models.Model):
to_date = fields.Datetime(string='Delegation To Date')
to_delegate = fields.Boolean(string='To Delegate?', compute="_compute_to_delegate")
@api.depends('employee_id')
def _compute_user_id(self):
for rec in self:
if rec.is_employee:
rec.user_id = rec.employee_id.user_id if rec.employee_id else False
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
@ -121,15 +130,27 @@ class Entity(models.Model):
def onchange_department_id(self):
self.name = self.department_id.name
@api.onchange('employee_id')
@api.onchange('is_employee','employee_id')
def onchange_employee_id(self):
self.job_title_id = self.employee_id.job_id
self.name = self.employee_id.name
self.person_id = self.employee_id.iqama_number.iqama_id
self.email = self.employee_id.personal_email
self.phone = self.employee_id.mobile_phone
self.person_id_issue_date = self.employee_id.iqama_number.expiry_date
# self.employee_assignment_date = self.employee_id.job_id
if self.is_employee and self.employee_id:
self.job_title_id = self.employee_id.job_id
self.image = self.employee_id.image_1920
else:
self.job_title_id = False
used_user_ids = self.env['cm.entity'].search([('user_id', '!=', False),]).mapped('user_id.id')
return {
'domain': {
'user_id': [('id', 'not in', used_user_ids)]
}
}
@api.onchange('partner_id')
def onchange_partner_id(self):

View File

@ -75,7 +75,7 @@ cm_job_title_exective_man,excetive_cm_job_title,model_cm_job_title,group_cm_exec
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,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_manager,manager_cm_entity,model_cm_entity,group_transaction_manager,1,1,1,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

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
75 internal_transaction_exective_man excetive_internal_transaction model_internal_transaction group_cm_executive_manager 1 1 1 1
76 incoming_transaction employee_incoming_transaction model_incoming_transaction group_cm_employee_group 0 0 0 0
77 incoming_transaction_out employee_out_incoming_transaction model_incoming_transaction group_cm_user 1 1 1 1
78 incoming_transaction_reviwer reviwer_incoming_transaction model_incoming_transaction group_cm_reviewer 1 1 1 1
79 incoming_transaction_dep_man dep_incoming_transaction model_incoming_transaction group_cm_department_manager 0 0 0 0
80 incoming_transaction_exective_man excetive_incoming_transaction model_incoming_transaction group_cm_executive_manager 1 1 1 1
81 outgoing_transaction employee_outgoing_transaction model_outgoing_transaction group_cm_employee_group 1 1 1 1

View File

@ -24,11 +24,24 @@
<group>
<group>
<field name="type" required="True"/>
<field name="is_employee" attrs="{'invisible':[('type','not in',['employee'])]}"/>
<field name="to_delegate" attrs="{'invisible':[('type','not in',['employee'])]}"/>
<field name="employee_id" attrs="{'invisible':[('type','not in',['employee'])]}"/>
<field name="delegate_employee_id" attrs="{'invisible':['|',('type','not in',['employee']),('to_delegate','=',False)]}"/>
<field name="from_date" attrs="{'invisible':['|',('type','not in',['employee']),('to_delegate','=',False)]}" readonly="1" force_save="1"/>
<field name="to_date" attrs="{'invisible':['|',('type','not in',['employee']),('to_delegate','=',False)]}" readonly="1" force_save="1"/>
<field name="employee_id"
attrs="{'invisible':[('type','not in',['employee'])],'required':[('type','=','employee')]}"
options="{'no_create':True,'no_open':True,'no_create_edit': True,'no_quick_create': True}"/>
<field name="job_title_id" readonly="1" force_save="1"
attrs="{'invisible': ['|',('type','not in',['employee']),('is_employee', '=', False)]}"
widget="selection"/>
<field name="user_id" readonly="1" force_save="1"
attrs="{'required':[('type', 'in', ['employee'])],'invisible': ['|',('type','not in',['employee']),('is_employee', '=', False)]}"/>
<field name="delegate_employee_id"
attrs="{'invisible':['|',('type','not in',['employee']),('to_delegate','=',False)]}"/>
<field name="from_date"
attrs="{'invisible':['|',('type','not in',['employee']),('to_delegate','=',False)]}"
readonly="1" force_save="1"/>
<field name="to_date"
attrs="{'invisible':['|',('type','not in',['employee']),('to_delegate','=',False)]}"
readonly="1" force_save="1"/>
<field name="department_id" attrs="{'invisible': [('type','not in',['unit'])]}"/>
<field name="partner_id"
attrs="{'invisible': [('type','not in',['external'])]}"/>
@ -46,36 +59,36 @@
domain="[('type','in',['employee'])]"/>
<field name="child_ids" attrs="{'invisible': [('type', '!=', 'employee')]}"
widget="many2many_tags" domain="[('type', 'in', ['unit'])]"/>
<field name="image" attrs="{'invisible': [('type', '!=', 'employee')]}" widget="image" options="{'max_width': 200, 'max_height': 200}"/>
</group>
<group>
<field name="name" force_save ="1" attrs="{'readonly': [('type','=','employee')],'required':[('type','!=','employee')]}"/>
<field name="name" force_save="1"
attrs="{'invisible': [('type','=','employee'),('is_employee', '=', True)],'readonly': [('type','=','employee')],'required':[('type','!=','employee')]}"/>
<field name="job_title" attrs="{'invisible':['|',('type','not in',['employee']),('is_employee', '=', True)]}"/>
<field name="user_id"
attrs="{'required':[('type', 'in', ['employee'])],'invisible': ['|',('type','not in',['employee']),('is_employee', '=', True)]}"/>
<field name="establish_date" attrs="{'invisible': [('type', 'not in', ['unit'])]}"/>
<field name="unit_location" attrs="{'invisible': [('type', 'not in', ['unit'])]}"/>
<field name="email"
attrs="{'invisible': [('type','not in',['external'])]}"/>
<field name="sketch_attachment_id" widget="many2one_binary"
attrs="{'invisible': [('type', 'not in', ['unit'])]}"/>
<field name="person_id" attrs="{'invisible':[('type','not in',['employee'])]}"/>
<field name="email" attrs="{'invisible':[('type','not in',['employee'])]}"/>
<field name="phone" attrs="{'invisible':[('type','not in',['employee'])]}"/>
<field name="person_id"
attrs="{'invisible':['|',('type','not in',['employee']),('is_employee', '=', True)]}"/>
<field name="email"
attrs="{'invisible':['|',('type','not in',['employee']),('is_employee', '=', True)]}"/>
<field name="phone"
attrs="{'invisible':['|',('type','not in',['employee']),('is_employee', '=', True)]}"/>
<field name="person_id_issue_date"
attrs="{'invisible':[('type','not in',['employee'])]}"/>
attrs="{'invisible':['|',('type','not in',['employee']),('is_employee', '=', True)]}"/>
<field name="employee_assignment_date"
attrs="{'invisible':[('type','not in',['employee'])]}"/>
attrs="{'invisible':['|',('type','not in',['employee']),('is_employee', '=', True)]}"/>
<field name="is_secret" attrs="{'invisible': [('type', 'not in', ['unit'])]}"/>
<field name="dynamic_year" attrs="{'invisible': [('type', 'not in', ['unit'])]}"/>
<field name="year_increment" attrs="{'invisible': [('type', 'not in', ['unit'])]}"/>
<field name="job_title_id"
attrs="{'required':[('type', 'in', ['employee'])],'invisible': [('type','not in',['employee'])]}"
widget="selection"/>
<field name="user_id"
attrs="{'required':[('type', 'in', ['employee'])],'invisible': [('type','not in',['employee'])]}"/>
</group>
<group>
<field name="image" nolabel="1" attrs="{'invisible': [('type', '!=', 'employee')]}" widget="image"
class="oe_avatar" options="{'size': [250, 250]}"/>
</group>
</group>
</sheet>