You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

159 lines
8.4 KiB

<?xml version = "1.0" encoding = "UTF-8" ?>
<odoo>
<!-- Inherit Ir Attachment form view to include extra fields-->
<record id="view_attachment_form" model="ir.ui.view">
<field name="name">
ir.attachment.view.form.inherit.project.task.attachments
</field>
<field name="model">ir.attachment</field>
<field name="inherit_id" ref="base.view_attachment_form"/>
<field name="arch" type="xml">
<xpath expr="//form" position="replace">
<form create="false" edit="false">
<sheet>
<h1>
<field name="name"/>
</h1>
<group>
<group>
<field name="attach_to" invisible="1"/>
<field name="project_id"
invisible="attach_to == 'task'"/>
<field name="task_id"
invisible="attach_to == 'project'"/>
<field name="type"/>
<field name="datas" filename="name"
string="File"
invisible="type == 'url'"/>
<field name="url" widget="url"
invisible="type == 'binary'"/>
</group>
<group name="description_group" string="Description"
groups="base.group_no_one" colspan="4">
<field name="description" nolabel="1"
colspan="2"/>
</group>
</group>
</sheet>
</form>
</xpath>
</field>
</record>
<!-- Inherit Ir Attachment list view to include extra fields-->
<record id="view_attachment_tree" model="ir.ui.view">
<field name="name">
ir.attachment.view.list.inherit.project.task.attachments
</field>
<field name="model">ir.attachment</field>
<field name="inherit_id" ref="base.view_attachment_tree"/>
<field name="arch" type="xml">
<xpath expr="//list" position="replace">
<list string="Attachments" create="false">
<field name="name"/>
<field name="type"/>
<field name="file_size"/>
<field name="company_id" groups="base.group_multi_company"/>
<field name="create_uid"/>
<field name="create_date"/>
</list>
</xpath>
</field>
</record>
<!-- Inherit Ir Attachment list view to include extra fields-->
<record id="view_document_file_kanban" model="ir.ui.view">
<field name="name">
ir.attachment.view.kanban.inherit.project.task.attachments
</field>
<field name="model">ir.attachment</field>
<field name="inherit_id" ref="mail.view_document_file_kanban"/>
<field name="arch" type="xml">
<xpath expr="//kanban" position="replace">
<kanban edit="false" import="false" create="false">
<field name="id"/>
<field name="mimetype"/>
<field name="type"/>
<field name="create_uid"/>
<field name="url"/>
<field name="create_date"/>
<field name="name"/>
<templates>
<t t-name="kanban-menu">
<a t-attf-href="/web/content/ir.attachment/#{record.id.raw_value}/datas?download=true" download="" class="dropdown-item">Download</a>
<a t-if="widget.deletable" role="menuitem" type="delete" class="dropdown-item">Delete</a>
</t>
<t t-name="kanban-box">
<div class="oe_kanban_global_area oe_kanban_global_click o_kanban_attachment">
<div class="o_kanban_image">
<div class="o_kanban_image_wrapper">
<t t-set="webimage" t-value="new RegExp('image.*(gif|jpeg|jpg|png|webp)').test(record.mimetype.value)"/>
<div t-if="record.type.raw_value == 'url'" class="o_url_image fa fa-link fa-3x text-muted" aria-label="Image is a link"/>
<img t-elif="webimage" t-attf-src="/web/image/#{record.id.raw_value}" width="100" height="100" alt="Document" class="o_attachment_image"/>
<div t-else="!webimage" class="o_image o_image_thumbnail" t-att-data-mimetype="record.mimetype.value"/>
</div>
</div>
<div class="o_kanban_details">
<div class="o_kanban_details_wrapper">
<div t-att-title="record.name.raw_value" class="o_kanban_record_title">
<field name="name" class="o_text_overflow"/>
</div>
<div class="o_kanban_record_body">
<t t-if="record.type.raw_value == 'url'">
<span class="o_document_url"><i class="fa fa-globe" aria-label="Document url"/> <field name="url" widget="url"/></span>
</t>
<samp t-else="" class="text-muted"> </samp>
</div>
<div class="o_kanban_record_bottom">
<time class="oe_kanban_bottom_left">
<field name="create_date" widget="date"/>
</time>
<div class="oe_kanban_bottom_right">
<field name="create_uid" widget="many2one_avatar_user"/>
</div>
</div>
</div>
</div>
</div>
</t>
</templates>
</kanban>
</xpath>
</field>
</record>
<!-- Project Documents menu action -->
<record id="ir_attachment_action_view_task_documents"
model="ir.actions.act_window">
<field name="type">ir.actions.act_window</field>
<field name="name">Task Documents</field>
<field name="res_model">ir.attachment</field>
<field name="view_mode">kanban,list,form</field>
<field name="context">{'default_attach_to': 'task','default_res_model':
'project.task'}
</field>
<field name="domain">[('res_model', '=', 'project.task')]</field>
</record>
<!-- Task Documents Menu Action -->
<record id="ir_attachment_action_view_project_documents"
model="ir.actions.act_window">
<field name="type">ir.actions.act_window</field>
<field name="name">Project Documents</field>
<field name="res_model">ir.attachment</field>
<field name="context">{'default_attach_to':
'project','default_res_model': 'project.project'}
</field>
<field name="view_mode">kanban,list,form</field>
<field name="domain">[('res_model', '=', 'project.project')]</field>
</record>
<!-- Documents Menu -->
<menuitem id="ir_attachment_menu" name="Documents"
parent="project.menu_main_pm"/>
<!-- Project Documents Menu -->
<menuitem id="ir_attachment_menu_view_project_documents"
name="Project Documents"
parent="ir_attachment_menu"
action="ir_attachment_action_view_project_documents"/>
<!-- Task Documents Menu -->
<menuitem id="ir_attachment_menu_view_task_documents"
name="Task Documents"
parent="ir_attachment_menu"
action="ir_attachment_action_view_task_documents"/>
</odoo>