Merge pull request #2002 from expsa/letters_29_12

UPDATE exp_transation_letters & exp_transaction_documents
This commit is contained in:
Manar416 2024-12-29 18:59:32 +02:00 committed by GitHub
commit 3d1a23c4e2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 66 additions and 9 deletions

View File

@ -89,6 +89,8 @@ class AttachmentRule(models.Model):
date = fields.Datetime(string='Date', default=fields.Datetime.now)
description = fields.Char(string='Description')
signed = fields.Boolean(string='Signed',readonly=True)
created_from_system = fields.Boolean(readonly=True)
def action_signature(self):
for rec in self:

View File

@ -129,10 +129,11 @@
type="object"
string="Sign"
class="btn-link"
icon="fa-signature" attrs="{'invisible':[('signed','=',True)]}"/>
icon="fa-signature" attrs="{'invisible':['|',('signed','=',True), ('created_from_system', '!=', True)]}"/>
<field name="signed"/>
<field name="external_drive_link" widget="url"/>
<field name="attachment_filename" invisible="True"/>
<field name="created_from_system" invisible="1"/>
</tree>
</field>
<field name="attachment_num"/>
@ -240,8 +241,15 @@
<field name="date" readonly="True"/>
<field name="description" required="False"/>
<field name="file_save" filename="attachment_filename" widget="many2many_attachment_preview"/>
<field name="external_drive_link" widget="url"/>
<button name="action_signature"
type="object"
string="Sign"
class="btn-link"
icon="fa-signature" attrs="{'invisible':['|',('signed','=',True), ('created_from_system', '!=', True)]}"/>
<field name="signed"/>
<field name="external_drive_link" widget="url"/>
<field name="attachment_filename" invisible="True"/>
<field name="created_from_system" invisible="1"/>
</tree>
</field>
<field name="attachment_num"/>
@ -353,8 +361,15 @@
<field name="date" readonly="True"/>
<field name="description" required="False"/>
<field name="file_save" filename="attachment_filename" widget="many2many_attachment_preview"/>
<field name="external_drive_link" widget="url"/>
<button name="action_signature"
type="object"
string="Sign"
class="btn-link"
icon="fa-signature" attrs="{'invisible':['|',('signed','=',True), ('created_from_system', '!=', True)]}"/>
<field name="signed"/>
<field name="external_drive_link" widget="url"/>
<field name="attachment_filename" invisible="True"/>
<field name="created_from_system" invisible="1"/>
</tree>
</field>
<field name="attachment_num"/>

View File

@ -22,6 +22,7 @@ class Letters(models.Model):
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')
attachment_generated = fields.Boolean()
@api.depends('transaction_type','name')
def compute_img(self):
@ -102,6 +103,7 @@ class Letters(models.Model):
'store_fname': ATTACHMENT_NAME,
'mimetype': 'application/pdf'
})
self.attachment_generated = True
return self.env['cm.attachment.rule'].sudo().create({
'employee_id': self.unite.id,
'entity_id': self.unite.id,
@ -110,6 +112,7 @@ class Letters(models.Model):
field_name: res_id,
'date': datetime.datetime.now(),
'description': self.name,
'created_from_system': True,
# 'signed' : True if self.is_sign else False
})

View File

@ -296,9 +296,25 @@
</div>
<br/>
<br/>
<div style="margin-top: 0px;" dir="ltr">
<img t-if="o.signature" t-attf-src="data:image/*;base64,{{o.signature}}"
style="margin-top:50px;height:100px;width:100px; border: 0px;margin-left:25px"/>
<div style="margin-top: 0px;" dir="ltr">
<div style="margin-bottom: 10px; text-align: left;">
<strong>اﻹسم:</strong>
<span t-esc="o.unite.user_id.name"/>
</div>
<div style="margin-bottom: 10px; text-align: left;">
<strong>الوظيفة:</strong>
<span t-esc="o.unite.employee_id.job_id.name"/>
</div>
<div style="margin-bottom: 10px; text-align: left;">
<strong>التوقيع:</strong>
</div>
<div style="margin-top: 10px; text-align: left;">
<img t-if="o.new_signature" t-attf-src="data:image/*;base64,{{o.new_signature}}"
style="height:200px;width:250px; border: 0px;margin-left:25px"/>
</div>
<!-- <img t-if="o.signature" t-attf-src="data:image/*;base64,{{o.signature}}"-->
<!-- style="margin-top:50px;height:100px;width:100px; border: 0px;margin-left:25px"/>-->
</div>
</div>

View File

@ -296,8 +296,27 @@
<br/>
<br/>
<div style="margin-top: 0px;" dir="ltr">
<img t-if="o.new_signature" t-attf-src="data:image/*;base64,{{o.new_signature}}"
style="margin-top:50px;height:100px;width:100px; border: 0px;margin-left:25px"/>
<div style="margin-bottom: 10px; text-align: left;">
<strong>اﻹسم:</strong>
<span t-esc="o.unite.user_id.name"/>
</div>
<div style="margin-bottom: 10px; text-align: left;">
<strong>الوظيفة:</strong>
<span t-esc="o.unite.employee_id.job_id.name"/>
</div>
<div style="margin-bottom: 10px; text-align: left;">
<strong>التوقيع:</strong>
</div>
<div style="margin-top: 10px; text-align: left;">
<img t-if="o.new_signature" t-attf-src="data:image/*;base64,{{o.new_signature}}"
style="height:200px;width:250px; border: 0px;margin-left:25px"/>
</div>
<!-- <div style="margin-top: 10px; text-align: left;">-->
<!-- <img t-if="o.new_signature" t-attf-src="data:image/*;base64,{{o.new_signature}}"-->
<!-- style="margin-top:50px;height:100px;width:100px; border: 0px;margin-left:25px"/>-->
<!-- </div>-->
</div>
</div>

View File

@ -19,7 +19,8 @@
<field name="arch" type="xml">
<form string="Letters">
<header>
<button name="action_generate_attachment" string="Add As Attachment to Transaction" class="oe_highlight" type="object"/>
<button name="action_generate_attachment" string="Add As Attachment to Transaction" class="oe_highlight" type="object"
attrs="{'invisible': [('attachment_generated','=', True)]}"/>
</header>
<sheet>
<group>
@ -27,6 +28,7 @@
<field name="name" required="1"/>
<field name="unite" required="1"/>
<field name="letter_template" options="{'no_create':True,'no_open':True}"/>
<field name="attachment_generated" invisible="1"/>
</group>
<group>
<field name="date" required="1"/>