[IMP] stock, usabiltiy: kanban view of operations
bzr revid: qdp-launchpad@openerp.com-20131224122748-lorgqfc4qyc3k58a
This commit is contained in:
parent
95b7e70a86
commit
efc19ae23a
|
@ -3481,31 +3481,31 @@ class stock_picking_type(osv.osv):
|
|||
"""
|
||||
month_begin = date.today().replace(day=1)
|
||||
section_result = [{
|
||||
'value': 0,
|
||||
'tooltip': (month_begin + relativedelta.relativedelta(months=-i)).strftime('%B'),
|
||||
} for i in range(10, -1, -1)]
|
||||
'value': 0,
|
||||
'tooltip': (month_begin + relativedelta.relativedelta(months=i)).strftime('%B'),
|
||||
} for i in range(-2, 2, 1)]
|
||||
group_obj = obj.read_group(cr, uid, domain, read_fields, groupby_field, context=context)
|
||||
for group in group_obj:
|
||||
group_begin_date = datetime.strptime(group['__domain'][0][2], DEFAULT_SERVER_DATE_FORMAT)
|
||||
month_delta = relativedelta.relativedelta(month_begin, group_begin_date)
|
||||
section_result[10 - (month_delta.months + 1)] = {'value': group.get(value_field, 0), 'tooltip': group_begin_date.strftime('%B')}
|
||||
section_result[-month_delta.months + 2] = {'value': group.get(value_field, 0), 'tooltip': group_begin_date.strftime('%B')}
|
||||
inner_groupby = (group.get('__context', {})).get('group_by',[])
|
||||
if inner_groupby:
|
||||
groupby_picking = obj.read_group(cr, uid, group.get('__domain'), read_fields, inner_groupby, context=context)
|
||||
for groupby in groupby_picking:
|
||||
section_result[10 - (month_delta.months + 1)]['value'] = groupby.get(value_field, 0)
|
||||
section_result[-month_delta.months + 2]['value'] = groupby.get(value_field, 0)
|
||||
return section_result
|
||||
|
||||
def _get_picking_data(self, cr, uid, ids, field_name, arg, context=None):
|
||||
obj = self.pool.get('stock.picking')
|
||||
res = dict.fromkeys(ids, False)
|
||||
month_begin = date.today().replace(day=1)
|
||||
groupby_begin = (month_begin + relativedelta.relativedelta(months=-4)).strftime(DEFAULT_SERVER_DATE_FORMAT)
|
||||
groupby_end = (month_begin + relativedelta.relativedelta(months=3)).strftime(DEFAULT_SERVER_DATE_FORMAT)
|
||||
groupby_begin = (month_begin + relativedelta.relativedelta(months=-2)).strftime(DEFAULT_SERVER_DATE_FORMAT)
|
||||
groupby_end = (month_begin + relativedelta.relativedelta(months=2)).strftime(DEFAULT_SERVER_DATE_FORMAT)
|
||||
for id in ids:
|
||||
created_domain = [
|
||||
('picking_type_id', '=', id),
|
||||
('state', 'not in', ['done', 'cancel']),
|
||||
('state', '=', 'assigned'),
|
||||
('date', '>=', groupby_begin),
|
||||
('date', '<', groupby_end),
|
||||
]
|
||||
|
|
|
@ -912,6 +912,23 @@
|
|||
<field name="search_view_id" ref="view_picking_internal_search"/>
|
||||
</record>
|
||||
|
||||
<record id="action_picking_tree_ready_grouped" model="ir.actions.act_window">
|
||||
<field name="name">Ready Transfers</field>
|
||||
<field name="res_model">stock.picking</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form,calendar</field>
|
||||
<field name="domain"></field>
|
||||
<field name="context">{
|
||||
'search_default_picking_type_id': [active_id],
|
||||
'default_picking_type_id': active_id,
|
||||
'contact_display': 'partner_address',
|
||||
'search_default_available': 1,
|
||||
'group_by': ['date'],
|
||||
}
|
||||
</field>
|
||||
<field name="search_view_id" ref="view_picking_internal_search"/>
|
||||
</record>
|
||||
|
||||
<record id="action_picking_tree_waiting" model="ir.actions.act_window">
|
||||
<field name="name">Waiting Transfers</field>
|
||||
|
@ -1456,8 +1473,8 @@
|
|||
<field name="count_picking_ready"/> Ready
|
||||
</a>
|
||||
<t t-if="record.count_picking_ready.raw_value > 0">
|
||||
<a name="%(action_picking_tree_ready)d" type="action">
|
||||
<field name="weekly_picking" widget="stock_sparkline">Weekly Moves</field>
|
||||
<a name="%(action_picking_tree_ready_grouped)d" type="action">
|
||||
<field name="weekly_picking" widget="stock_sparkline">Monthly Ready Operations</field>
|
||||
</a>
|
||||
</t>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue