Skip to content
Extraits de code Groupes Projets
Valider cccaf424 rédigé par Juliana's avatar Juliana
Parcourir les fichiers

[ADD] Add button justif présence in expense views

parent 024150c4
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -9,6 +9,7 @@ class AdefpatHrExpense(models.Model): ...@@ -9,6 +9,7 @@ class AdefpatHrExpense(models.Model):
_inherit = 'hr.expense' _inherit = 'hr.expense'
proof_file = fields.Char("Justificatif") proof_file = fields.Char("Justificatif")
proof_file_timesheet = fields.Char("Justificatif", related='timesheet_id.proof_file')
# ------------------------------------------------------ # ------------------------------------------------------
# Override ORM # Override ORM
...@@ -38,6 +39,25 @@ class AdefpatHrExpense(models.Model): ...@@ -38,6 +39,25 @@ class AdefpatHrExpense(models.Model):
properties = backend.get_cmis_repository().getFolder( properties = backend.get_cmis_repository().getFolder(
expense.proof_file).getProperties() expense.proof_file).getProperties()
url = backend.get_content_details_url_from_props(properties) url = backend.get_content_details_url_from_props(properties)
return {
'type': 'ir.actions.act_url',
'url': url,
'target': 'new',
}\
@api.multi
def get_content_details_url_timesheet(self):
# TODO: Refaire la fonction sans le type CMIS Folder
"""
Ouvre une nouvelle fenêtre avec le fichier
:return: ir.actions.act_url
"""
backend = self.env['cmis.backend'].search([], limit=1)
for expense in self:
if expense.proof_file_timesheet:
properties = backend.get_cmis_repository().getFolder(
expense.proof_file_timesheet).getProperties()
url = backend.get_content_details_url_from_props(properties)
return { return {
'type': 'ir.actions.act_url', 'type': 'ir.actions.act_url',
'url': url, 'url': url,
......
...@@ -21,10 +21,15 @@ ...@@ -21,10 +21,15 @@
type="object" type="object"
attrs="{'invisible': [('proof_file', '=', False)]}"/> attrs="{'invisible': [('proof_file', '=', False)]}"/>
<field name="proof_file" invisible="1"/> <field name="proof_file" invisible="1"/>
<field name="proof_file_timesheet" invisible="1"/>
<button name="get_content_details_url" <button name="get_content_details_url"
string="Voir le justificatif" string="Voir le justif de dépense"
type="object" type="object"
attrs="{'invisible': [('proof_file', '=', False)]}"/> attrs="{'invisible': [('proof_file', '=', False)]}"/>
<button name="get_content_details_url_timesheet"
string="Voir le justif de présence"
type="object"
attrs="{'invisible': [('proof_file_timesheet', '=', False)]}"/>
</header> </header>
</field> </field>
</record> </record>
...@@ -48,6 +53,7 @@ ...@@ -48,6 +53,7 @@
<field name="arch" type="xml"> <field name="arch" type="xml">
<button name="action_get_attachment_view" position="replace"> <button name="action_get_attachment_view" position="replace">
<field name="proof_file" invisible="1"/> <field name="proof_file" invisible="1"/>
<field name="proof_file_timesheet" invisible="1"/>
<button name="%(adefpat_alfodoo.upload_file_wizard_action)d" <button name="%(adefpat_alfodoo.upload_file_wizard_action)d"
string="Justif de frais" string="Justif de frais"
type="action" type="action"
...@@ -63,10 +69,16 @@ ...@@ -63,10 +69,16 @@
/> />
<button icon="/adefpat_alfodoo/static/src/img/alfresco-logo-16.png" <button icon="/adefpat_alfodoo/static/src/img/alfresco-logo-16.png"
name="get_content_details_url" name="get_content_details_url"
string="Voir le fichier dans Alfresco" string="Voir le justif de dépense"
type="object" type="object"
attrs="{'invisible': [('proof_file', '=', False)]}" attrs="{'invisible': [('proof_file', '=', False)]}"
/> />
<button icon="/adefpat_alfodoo/static/src/img/alfresco-logo-16.png"
name="get_content_details_url_timesheet"
string="Voir le justif de présence"
type="object"
attrs="{'invisible': [('proof_file_timesheet', '=', False)]}"
/>
</button> </button>
</field> </field>
</record> </record>
...@@ -79,6 +91,7 @@ ...@@ -79,6 +91,7 @@
<xpath expr="//notebook//page//field[@name='expense_line_ids']//tree//field[@name='attachment_number']" position="replace"/> <xpath expr="//notebook//page//field[@name='expense_line_ids']//tree//field[@name='attachment_number']" position="replace"/>
<xpath expr="//notebook//page//field[@name='expense_line_ids']//tree//button[@name='action_get_attachment_view']" position="replace"> <xpath expr="//notebook//page//field[@name='expense_line_ids']//tree//button[@name='action_get_attachment_view']" position="replace">
<field name="proof_file" invisible="1"/> <field name="proof_file" invisible="1"/>
<field name="proof_file_timesheet" invisible="1"/>
<button name="%(adefpat_alfodoo.upload_file_wizard_action)d" <button name="%(adefpat_alfodoo.upload_file_wizard_action)d"
string="Justif de frais" string="Justif de frais"
type="action" type="action"
...@@ -94,10 +107,16 @@ ...@@ -94,10 +107,16 @@
/> />
<button icon="/adefpat_alfodoo/static/src/img/alfresco-logo-16.png" <button icon="/adefpat_alfodoo/static/src/img/alfresco-logo-16.png"
name="get_content_details_url" name="get_content_details_url"
string="Voir le fichier dans Alfresco" string="Voir le justif de dépense"
type="object" type="object"
attrs="{'invisible': [('proof_file', '=', False)]}" attrs="{'invisible': [('proof_file', '=', False)]}"
/> />
<button icon="/adefpat_alfodoo/static/src/img/alfresco-logo-16.png"
name="get_content_details_url_timesheet"
string="Voir le justif de présence"
type="object"
attrs="{'invisible': [('proof_file_timesheet', '=', False)]}"
/>
</xpath> </xpath>
</field> </field>
</record> </record>
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter