Merge lp:~camptocamp/stock-logistic-flows/add-variant-dispach-report-jge into lp:stock-logistic-flows

Proposed by Joël Grand-Guillaume @ camptocamp
Status: Superseded
Proposed branch: lp:~camptocamp/stock-logistic-flows/add-variant-dispach-report-jge
Merge into: lp:stock-logistic-flows
Diff against target: 122 lines (+49/-6)
3 files modified
picking_dispatch/picking_dispatch.py (+33/-0)
picking_dispatch/picking_dispatch_view.xml (+7/-5)
picking_dispatch/report/dispatch.html.mako (+9/-1)
To merge this branch: bzr merge lp:~camptocamp/stock-logistic-flows/add-variant-dispach-report-jge
Reviewer Review Type Date Requested Status
Yannick Vaucher @ Camptocamp Needs Resubmitting
Pedro Manuel Baeza Needs Information
Review via email: mp+207961@code.launchpad.net

This proposal has been superseded by a proposal from 2014-03-12.

Commit message

[IMP] Add the variant in the dispatch report

Description of the change

Hi,

This add the variant in the dispatch report.

To post a comment you must log in.
Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

Hi, Joël,

Why don't you just simply don't show column if there is no variant?

Regards.

review: Needs Information
49. By Joël Grand-Guillaume @ camptocamp

merge from last head lp:stock-logistic-flows

50. By Joël Grand-Guillaume @ camptocamp

merge from lp:~camptocamp/stock-logistic-flows/add-variant-dispach-report-jge

51. By Joël Grand-Guillaume @ camptocamp

[FIX] Fix the page break after each page

Revision history for this message
Joël Grand-Guillaume @ camptocamp (jgrandguillaume-c2c) wrote :

Hi Pedro,

You're right, but the thing is, you may have some product that have a variant and some no. So I though it would be more clear to always have the column.. No ?

Regards,

Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

Thanks for the clarification. Now, I understand. Let's continue then this way.

There have been other revisions that add some other code. Is that intended?

Regards.

review: Needs Information
Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote :

Something is wrong on the branch

review: Needs Resubmitting
Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'picking_dispatch/picking_dispatch.py'
2--- picking_dispatch/picking_dispatch.py 2014-02-18 09:07:52 +0000
3+++ picking_dispatch/picking_dispatch.py 2014-02-26 09:27:40 +0000
4@@ -169,6 +169,14 @@
5 help='who this move is dispatched to'),
6 }
7
8+ def copy_data(self, cr, uid, id, default=None, context=None):
9+ if default is None:
10+ default = {}
11+ default = default.copy()
12+ default['dispatch_id'] = False
13+ return super(StockMove, self).\
14+ copy_data(cr, uid, id, default=default, context=context)
15+
16 def do_partial(self, cr, uid, ids, partial_datas, context=None):
17 """
18 in addition to what the original method does, create backorder
19@@ -283,6 +291,31 @@
20 }
21
22
23+class StockPickingIn(Model):
24+ _inherit = "stock.picking.in"
25+
26+ def _get_related_dispatch(self, cr, uid, ids, field_names, arg=None, context=None):
27+ return super(StockPickingIn, self)._get_related_dispatch(cr, uid, ids, field_names, arg=arg, context=context)
28+
29+ _columns = {
30+ 'related_dispatch_ids': fields.function(_get_related_dispatch, method=True, type='one2many',
31+ relation='picking.dispatch', string='Related Dispatch Picking'),
32+ }
33+
34+
35+class StockPickingOut(Model):
36+ _inherit = "stock.picking.out"
37+
38+ def _get_related_dispatch(self, cr, uid, ids, field_names, arg=None, context=None):
39+ return super(StockPickingOut, self)._get_related_dispatch(cr, uid, ids, field_names, arg=arg, context=context)
40+
41+ _columns = {
42+ 'related_dispatch_ids': fields.function(_get_related_dispatch, method=True, type='one2many',
43+ relation='picking.dispatch', string='Related Dispatch Picking'),
44+ }
45+
46+
47+
48 class Product(Model):
49 _inherit = "product.product"
50
51
52=== modified file 'picking_dispatch/picking_dispatch_view.xml'
53--- picking_dispatch/picking_dispatch_view.xml 2013-04-16 14:29:17 +0000
54+++ picking_dispatch/picking_dispatch_view.xml 2014-02-26 09:27:40 +0000
55@@ -27,9 +27,11 @@
56 <field name="name"/>
57 </h1>
58 </div>
59- <field name="picker_id"/>
60- <field name="date"/>
61- <field name="backorder_id"/>
62+ <group>
63+ <field name="picker_id"/>
64+ <field name="date"/>
65+ <field name="backorder_id"/>
66+ </group>
67 <notebook colspan="4">
68 <page string="Stock Moves">
69 <field name="move_ids" nolabel="1" colspan='4' widget="many2many"
70@@ -119,7 +121,7 @@
71 <!-- Stock Out picking : add dispatch infos -->
72 <record id="view_picking_form" model="ir.ui.view">
73 <field name="name">stock.picking.form.dispatch.out</field>
74- <field name="model">stock.picking</field>
75+ <field name="model">stock.picking.out</field>
76 <field name="inherit_id" ref="stock.view_picking_out_form"/>
77 <field name="type">form</field>
78 <field name="arch" type="xml">
79@@ -149,7 +151,7 @@
80 <!-- Stock In picking : add dispatch infos -->
81 <record id="view_picking_form_in" model="ir.ui.view">
82 <field name="name">stock.picking.form.dispatch.in</field>
83- <field name="model">stock.picking</field>
84+ <field name="model">stock.picking.in</field>
85 <field name="inherit_id" ref="stock.view_picking_in_form"/>
86 <field name="type">form</field>
87 <field name="arch" type="xml">
88
89=== modified file 'picking_dispatch/report/dispatch.html.mako'
90--- picking_dispatch/report/dispatch.html.mako 2012-12-10 10:51:23 +0000
91+++ picking_dispatch/report/dispatch.html.mako 2014-02-26 09:27:40 +0000
92@@ -39,6 +39,7 @@
93 <tr align="left">
94 <th>${_('Product Code')}</th>
95 <th>${_('Product')}</th>
96+ <th>${_('Variant')}</th>
97 <th>${_('Carrier')}</th>
98 <th>${_('QTY')}</th>
99 <th>${_('Explanation')}</th>
100@@ -47,6 +48,13 @@
101 <tr align="left">
102 <td>${product.default_code}</td>
103 <td>${product.name}</td>
104+ <td>
105+ %if product.variants:
106+ ${product.variants}
107+ %else:
108+ ${'-'}
109+ %endif
110+ </td>
111 <td>${carrier}</td>
112 <td>${qty}</td>
113 <td>${_('stock error')}<br/>${_('breakage')}</td>
114@@ -57,7 +65,7 @@
115 %endfor
116 </table>
117 %endfor
118- <p style="page-break-after:always">&nbsp</>
119+<p style="page-break-after:always">&nbsp;</p>
120 %endfor
121 </body>
122 </html>

Subscribers

People subscribed via source and target branches