Update transaction.py

This commit is contained in:
zainab2097 2024-08-01 12:39:24 +03:00 committed by GitHub
parent 0abf8901d0
commit 7ae1a1038a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 1 deletions

View File

@ -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):