Merge pull request #3379 from expsa/younes_dev_odex25_transactions
fix signature
This commit is contained in:
commit
2d63e12cb2
|
|
@ -22,7 +22,7 @@ class SignLetterTransaction(models.TransientModel):
|
|||
})
|
||||
|
||||
# Generate a new attachment (you must have action_generate_attachment() in letters.letters)
|
||||
new_attachment = self.letter_id.action_generate_attachment()
|
||||
new_attachment = self.letter_id.with_context(is_sign=True).action_generate_attachment()
|
||||
if new_attachment:
|
||||
# Set the new attachment as signed
|
||||
attachment_record = self.env['cm.attachment.rule'].browse(new_attachment.id)
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ class Letters(models.Model):
|
|||
tracking=True
|
||||
)
|
||||
job_name = fields.Char(string="Job Name", store=True)
|
||||
|
||||
@api.depends('transaction_type', 'name')
|
||||
def compute_img(self):
|
||||
employee_id = self.env['hr.employee'].search([('user_id', '=', self.env.uid)], limit=1)
|
||||
|
|
@ -119,6 +120,13 @@ class Letters(models.Model):
|
|||
""" this method called from button action in view xml """
|
||||
# generate pdf from report, use report's id as reference
|
||||
for record in self:
|
||||
if self.env.context.get('is_sign'):
|
||||
employee = self.env['hr.employee'].search([('user_id', '=', self.env.user.id)], limit=1)
|
||||
record.job_name = employee.job_id.name if employee and employee.job_id else ' '
|
||||
record.signed_user_id = self.env.user
|
||||
else:
|
||||
record.job_name = False
|
||||
record.signed_user_id = False
|
||||
REPORT_ID = 'exp_transation_letters.report_letter_action_report'
|
||||
pdf = self.env.ref(REPORT_ID)._render_qweb_pdf(self.ids)
|
||||
# pdf result is a list
|
||||
|
|
@ -138,9 +146,6 @@ class Letters(models.Model):
|
|||
'mimetype': 'application/pdf'
|
||||
})
|
||||
# self.attachment_generated = True
|
||||
employee = self.env['hr.employee'].search([('user_id', '=', attach_id.create_uid.id)], limit=1)
|
||||
record.job_name = employee.job_id.name if employee and employee.job_id else ' '
|
||||
record.signed_user_id = attach_id.create_uid
|
||||
self.state = 'attached'
|
||||
return self.env['cm.attachment.rule'].sudo().create({
|
||||
'employee_id': self.unite.id,
|
||||
|
|
|
|||
Loading…
Reference in New Issue