commit
fe83bd1345
|
|
@ -85,6 +85,7 @@ class Entity(models.Model):
|
|||
email = fields.Char()
|
||||
child_ids = fields.Many2many(comodel_name='cm.entity', relation='employee_entity_rel', column1='employee_id',
|
||||
column2='entity_id', string='Related Units')
|
||||
image = fields.Binary(string='Image')
|
||||
establish_date = fields.Date(string='Establish Date')
|
||||
unit_location = fields.Char(string='Unit Location')
|
||||
sketch_attachment_id = fields.Many2one(comodel_name='ir.attachment', string='Sketch Attachment')
|
||||
|
|
|
|||
|
|
@ -75,9 +75,17 @@ class Transaction(models.Model):
|
|||
('0', 'not'),
|
||||
('1', 'Favorite'),
|
||||
], size=1, string="Favorite")
|
||||
signature = fields.Binary("Signature image")
|
||||
signature = fields.Binary("Signature image",compute='compute_img',store=True)
|
||||
tran_tag = fields.Many2many(comodel_name='transaction.tag', string='Tags')
|
||||
add_rank = fields.Integer(string='Transaction Rank')
|
||||
|
||||
@api.depends('type','subject')
|
||||
def compute_img(self):
|
||||
employee_id = self.env['hr.employee'].search([('user_id', '=', self.env.uid)], limit=1)
|
||||
if employee_id:
|
||||
entity = self.env['cm.entity'].search([('type','=','employee'),('employee_id', '=',employee_id)], limit=1)
|
||||
for rec in self:
|
||||
rec.signature = entity.image
|
||||
|
||||
# @api.onchange('tran_tag')
|
||||
# def get_subject_type(self):
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@
|
|||
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')]}"/>
|
||||
|
|
|
|||
|
|
@ -14,13 +14,21 @@ class Letters(models.Model):
|
|||
date = fields.Date(string="Date")
|
||||
hijir_date = fields.Char(string="Hijir Date", compute='compute_hijri')
|
||||
content = fields.Html(string="Content")
|
||||
signature = fields.Binary("Signature image")
|
||||
signature = fields.Binary("Signature image",compute='compute_img',store=True)
|
||||
transaction_type = fields.Selection([('internal', 'Internal'), ('outgoing', 'Outgoing'),
|
||||
('incoming', 'Incoming')], default='internal', string='Transaction Type')
|
||||
incoming_transaction_id = fields.Many2one(comodel_name='incoming.transaction', string='Incoming Transaction')
|
||||
internal_transaction_id = fields.Many2one(comodel_name='internal.transaction', string='Internal Transaction')
|
||||
outgoing_transaction_id = fields.Many2one(comodel_name='outgoing.transaction', string='Outgoing Transaction')
|
||||
|
||||
@api.depends('transaction_type','name')
|
||||
def compute_img(self):
|
||||
employee_id = self.env['hr.employee'].search([('user_id', '=', self.env.uid)], limit=1)
|
||||
if employee_id:
|
||||
entity = self.env['cm.entity'].search([('type','=','employee'),('employee_id', '=',employee_id)], limit=1)
|
||||
for rec in self:
|
||||
rec.signature = entity.image
|
||||
|
||||
@api.onchange('transaction_type')
|
||||
def set_value_false(self):
|
||||
if self.transaction_type == 'internal':
|
||||
|
|
|
|||
Loading…
Reference in New Issue