[IMP] project: update to new design

This commit is contained in:
Géry Debongnie
2015-06-15 16:30:36 +02:00
parent 05adb7f235
commit d6506b22e4
5 changed files with 78 additions and 70 deletions
+9 -1
View File
@@ -556,6 +556,12 @@ class task(osv.osv):
res[task.id] = False
return res
def _compute_displayed_image(self, cr, uid, ids, prop, arg, context=None):
res = {}
for line in self.browse(cr, uid, ids, context=context):
res[line.id] = line.attachment_ids and line.attachment_ids.filtered(lambda x: x.file_type_icon == 'webimage')[0] or None
return res
_columns = {
'active': fields.function(_is_template, store=True, string='Not a Template Task', type='boolean', help="This field is computed automatically and have the same behavior than the boolean 'active' field: if the task is linked to a template or unactivated project, it will be hidden unless specifically asked."),
'name': fields.char('Task Summary', track_visibility='onchange', size=128, required=True, select=True),
@@ -592,7 +598,9 @@ class task(osv.osv):
'id': fields.integer('ID', readonly=True),
'color': fields.integer('Color Index'),
'user_email': fields.related('user_id', 'email', type='char', string='User Email', readonly=True),
}
'attachment_ids': fields.one2many('ir.attachment', 'res_id', domain=lambda self: [('res_model', '=', self._name)], auto_join=True, string='Attachments'),
'displayed_image_id': fields.function(_compute_displayed_image, relation='ir.attachment', type="many2one", string='Attachment'),
}
_defaults = {
'stage_id': _get_default_stage_id,
'project_id': lambda self, cr, uid, ctx=None: ctx.get('default_project_id') if ctx is not None else False,
+4 -6
View File
@@ -27,7 +27,7 @@
<span><t t-esc="record.name.value"/></span>
</div>
<div t-if="record.alias_id.raw_value">
<span><i class="fa fa-envelope-o"></i> <t t-esc="record.alias_id.value"/></span>
<span><i class="fa fa-envelope"></i> <t t-esc="record.alias_id.value"/></span>
</div>
</div>
</div><div class="o_kanban_card_manage_pane o_invisible">
@@ -41,16 +41,14 @@
<div>
<a name="%(action_view_task_history_cumulative_filter)d" type="action">Cumulative Flow</a>
</div>
</div>
<div t-if="widget.editable" class="o_project_kanban_colorpicker">
<div class="col-xs-12">
<li><ul class="oe_kanban_colorpicker" data-field="color"/></li>
<div t-if="widget.editable" class="o_project_kanban_colorpicker">
<ul class="oe_kanban_colorpicker" data-field="color"/>
</div>
</div>
</div>
<div class="o_project_kanban_manage">
<div class="text-left">
<a class="o_kanban_manage_toggle_button">More <i class="fa fa-caret-down"/></a>
<a class="o_kanban_manage_toggle_button" href="#">More <i class="fa fa-caret-down"/></a>
</div>
</div>
</div>
+35 -29
View File
@@ -7,6 +7,7 @@
id="base.menu_main_pm"
groups="group_project_manager,group_project_user"
icon="fa-calendar"
web_icon="project,static/description/icon.png"
sequence="50"/>
<menuitem name="Search"
@@ -88,6 +89,15 @@
</header>
<sheet string="Project">
<field name="analytic_account_id" invisible="1" required="0"/>
<div class="oe_button_box" name="button_box" groups="base.group_user">
<button class="oe_stat_button" type="action" attrs="{'invisible':[('use_tasks','=', False)]}"
name="%(act_project_project_2_project_task_all)d" icon="fa-tasks">
<field string="Tasks" name="task_count" widget="statinfo" options="{'label_field': 'label_tasks'}"/>
</button>
<button class="oe_stat_button" name="attachment_tree_view" type="object" icon="fa-files-o">
<field string="Documents" name="doc_count" widget="statinfo"/>
</button>
</div>
<div class="oe_title">
<label for="name" class="oe_edit_only" string="Project Name"/>
<h1>
@@ -102,15 +112,6 @@
</div>
</div>
</div>
<div class="oe_right oe_button_box" name="buttons" groups="base.group_user">
<button class="oe_inline oe_stat_button" type="action" attrs="{'invisible':[('use_tasks','=', False)]}"
name="%(act_project_project_2_project_task_all)d" icon="fa-tasks">
<field string="Tasks" name="task_count" widget="statinfo" options="{'label_field': 'label_tasks'}"/>
</button>
<button class="oe_inline oe_stat_button" name="attachment_tree_view" type="object" icon="fa-files-o">
<field string="Documents" name="doc_count" widget="statinfo"/>
</button>
</div>
<notebook>
<page string="Emails" attrs="{'invisible': [('alias_domain', '=', False)]}">
<group name="group_alias">
@@ -254,7 +255,6 @@
</record>
<!-- Task -->
<record id="view_task_form2" model="ir.ui.view">
<field name="name">project.task.form</field>
<field name="model">project.task</field>
@@ -266,17 +266,15 @@
options="{'fold_field': 'fold'}"/>
</header>
<sheet string="Task">
<div class="row">
<h1 class="col-xs-11">
<field class="oe_inline oe_left" name="priority" widget="priority"/>
<field name="name" placeholder="Task summary..." class="oe_inline"/>
</h1>
<div class="col-xs-1 text-right">
<field name="kanban_state" class="oe_inline" widget="kanban_state_selection"
<div class="oe_title">
<h1 class="o_row">
<field name="priority" widget="priority"/>
<field name="name" placeholder="Task summary..."/>
<field name="kanban_state" widget="kanban_state_selection"
options='{
"states_legend_field": "stage_id",
"states_legend": {"normal": "legend_normal", "blocked": "legend_blocked", "done": "legend_done"}}'/>
</div>
</h1>
</div>
<group>
<group>
@@ -357,29 +355,35 @@
<field name="date_deadline"/>
<field name="message_summary"/>
<field name="tag_ids"/>
<field name="displayed_image_id"/>
<templates>
<t t-name="kanban-box">
<div t-attf-class="oe_kanban_color_#{kanban_getcolor(record.color.raw_value)} oe_kanban_card oe_kanban_global_click">
<div class="oe_dropdown_toggle oe_dropdown_kanban" groups="base.group_user">
<i class="fa fa-bars fa-lg"/>
<ul class="oe_dropdown_menu">
<div class="o_dropdown_kanban dropdown" groups="base.group_user">
<a class="dropdown-toggle btn" data-toggle="dropdown" href="#" >
<span class="fa fa-bars fa-lg"/>
</a>
<ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
<t t-if="widget.editable"><li><a type="edit">Edit Task</a></li></t>
<t t-if="widget.deletable"><li><a type="delete">Delete</a></li></t>
<li><ul class="oe_kanban_colorpicker" data-field="color"/></li>
</ul>
</div>
<div class="oe_kanban_content">
<div><b><field name="name"/></b></div>
<div>
<field name="tag_ids"/>
</div>
<div>
<strong><field name="name"/></strong>
</div>
<div class="text-muted">
<field name="project_id" invisible="context.get('default_project_id', False)"/><br/>
<t t-if="record.date_deadline.raw_value and record.date_deadline.raw_value lt (new Date())" t-set="red">oe_kanban_text_red</t>
<span t-attf-class="#{red || ''}"><i><field name="date_deadline"/></i></span>
</div>
<div class="oe_kanban_footer_left" style="margin-top:5px;">
<field name="tag_ids"/>
</div>
<div class="oe_kanban_bottom_left">
<field name="priority" widget="priority"/>
<t t-raw="record.message_summary.raw_value"/>
</div>
<div class="oe_kanban_bottom_right">
@@ -387,10 +391,12 @@
<div class="pull-left" groups="base.group_user">
<field name="kanban_state" widget="kanban_state_selection"
options='{"states_legend": {"normal": "legend_normal", "blocked": "legend_blocked", "done": "legend_done"}}'/>
<field name="priority" widget="priority"/>
</div>
</div>
</div>
<div t-if="record.displayed_image_id.value">
<field name="displayed_image_id" widget="attachment_image"/>
</div>
<div class="oe_clear"></div>
</div>
</t>
@@ -571,7 +577,7 @@
<p class="text-muted" colspan="2">
You can also give a tooltip about the use of the stars available in the kanban and form views.
</p>
<label for="legend_priority" string=" " class="fa fa-star fa-lg oe_star_on oe_project_kanban_legend"/>
<label for="legend_priority" string=" " class="fa fa-star fa-lg o_star_on oe_project_kanban_legend"/>
<field name="legend_priority" nolabel="1"/>
<p class="text-muted" colspan="2">
@@ -685,4 +691,4 @@
<menuitem action="project_tags_action" id="menu_project_tags_act" parent="base.menu_definitions" groups="base.group_no_one"/>
</data>
</openerp>
</openerp>
@@ -1,45 +1,37 @@
.oe_kanban_view.o_kanban_dashboard.o_project_kanban {
@odoo-brand-optional: #21b799;
.o_kanban_view.o_kanban_dashboard.o_project_kanban {
.o_kanban_flexbox {
display: flex;
.o-flex-display();
position: relative;
}
.oe_kanban_record {
.o_kanban_record {
min-width: 300px;
max-width: 350px;
}
/*
.oe_kanban_record:hover .o_project_kanban_manage {
visibility: visible;
}
*/
.o_project_kanban_main {
margin-bottom: 40px; // give space for manage section at the bottom
width: 75%;
// give space for manage section at the bottom
margin-bottom: 40px;
width: 70%;
.o_primary {
font-size: larger;
.o_kanban_card_content {
font-size: 12px;
.o_primary {
font-size: larger;
}
}
.o_project_kanban_manage {
visibility: visible;
position: absolute;
bottom: 0;
margin-left: 10px;
margin-left: 16px;
margin-bottom: 10px;
}
.o_project_kanban_colorpicker {
padding: 8px;
}
.o_kanban_card_manage_pane {
border-color: lightgrey;
border-bottom-style: solid;
border-bottom-width: 1px;
.o_kanban_card_manage_title {
margin: 0;
@@ -48,12 +40,16 @@
}
.o_project_kanban_boxes {
display: flex;
flex-direction: column;
justify-content: flex-end;
align-content: stretch;
.o-flex-display();
.o-flex-flow(column, nowrap);
.o-justify-content(flex-end);
.o-align-content(stretch);
width: 25%;
width: 30%;
> a:hover {
text-decoration: none;
}
.o_value {
font-size: x-large;
@@ -67,11 +63,11 @@
.o_project_kanban_box {
text-align: center;
padding: 15px 0 15px 0;
flex: 1 1 auto;
display: flex;
align-items: center;
flex-direction: column;
justify-content: center;
.o-flex(1, 1, auto);
.o-flex-display();
.o-align-items(center);
.o-flex-flow(column, nowrap);
.o-justify-content(center);
}
.o_project_kanban_box:nth-child(even) {
background-color: grey;
@@ -80,4 +76,4 @@
background-color: @odoo-brand-optional;
}
}
}
}
+3 -3
View File
@@ -8,7 +8,7 @@
<field name="inherit_id" ref="project.edit_project"/>
<field name="priority" eval="20"/>
<field name="arch" type="xml">
<xpath expr="//div[@name='buttons']" position="inside">
<div name="button_box" position="inside">
<button name="action_view_task_rating"
attrs="{'invisible': ['|', '|', ('is_visible_happy_customer', '=', False), ('use_tasks','=', False), ('percentage_satisfaction_task', '=', -1)]}"
class="oe_stat_button oe_percent"
@@ -16,7 +16,7 @@
icon="fa-smile-o">
<field string="On tasks" name="percentage_satisfaction_task" widget="statinfo"/>
</button>
</xpath>
</div>
<xpath expr="//field[@name='privacy_visibility']" position="after">
<field name="is_visible_happy_customer"/>
</xpath>
@@ -38,4 +38,4 @@
</record>
</data>
</openerp>
</openerp>