Merge lp:~openerp-dev/openobject-addons/trunk-wms-gdechanges2-jco into lp:openobject-addons

Proposed by Josse Colpaert (OpenERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-addons/trunk-wms-gdechanges2-jco
Merge into: lp:openobject-addons
Diff against target: 276 lines (+89/-13)
9 files modified
procurement/procurement.py (+3/-1)
stock/__openerp__.py (+1/-0)
stock/procurement.py (+2/-1)
stock/stock.py (+16/-5)
stock/stock_report.xml (+1/-1)
stock/stock_view.xml (+16/-1)
stock/views/report_lot_barcode.xml (+46/-0)
stock/views/report_package_barcode.xml (+1/-1)
stock/views/report_stockpicking.xml (+3/-3)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/trunk-wms-gdechanges2-jco
Reviewer Review Type Date Requested Status
qdp (OpenERP) Pending
Review via email: mp+218964@code.launchpad.net

Description of the change

Pack operations when picking is done and passing procurement priorities to stock moves, and priority of picking as calculated field of moves

To post a comment you must log in.
9715. By Josse Colpaert (OpenERP)

[MERGE] Merge from trunk

9716. By Josse Colpaert (OpenERP)

[IMP] Use changes of git to test on runbot

9717. By Josse Colpaert (OpenERP)

[IMP] Add lot barcode

Unmerged revisions

9717. By Josse Colpaert (OpenERP)

[IMP] Add lot barcode

9716. By Josse Colpaert (OpenERP)

[IMP] Use changes of git to test on runbot

9715. By Josse Colpaert (OpenERP)

[MERGE] Merge from trunk

9714. By Josse Colpaert (OpenERP)

[MERGE] Merge from trunk

9713. By Josse Colpaert (OpenERP)

[IMP] Remove picking priority and priority of picking as calculated field

9712. By Josse Colpaert (OpenERP)

[MERGE] Merge from trunk-wms

9711. By Josse Colpaert (OpenERP)

[IMP] Make sure priority propagates through move and procurement creations + extra tab in picking

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'procurement/procurement.py'
2--- procurement/procurement.py 2014-05-07 18:29:17 +0000
3+++ procurement/procurement.py 2014-05-23 08:13:43 +0000
4@@ -27,6 +27,8 @@
5 from openerp.tools.translate import _
6 import openerp
7
8+PROCUREMENT_PRIORITIES = [('0', 'Not urgent'), ('1', 'Normal'), ('2', 'Urgent'), ('3', 'Very Urgent')]
9+
10 class procurement_group(osv.osv):
11 '''
12 The procurement group class is used to group products together
13@@ -113,7 +115,7 @@
14 'company_id': fields.many2one('res.company', 'Company', required=True),
15
16 # These two fields are used for shceduling
17- 'priority': fields.selection([('0', 'Not urgent'), ('1', 'Normal'), ('2', 'Urgent'), ('3', 'Very Urgent')], 'Priority', required=True, select=True, track_visibility='onchange'),
18+ 'priority': fields.selection(PROCUREMENT_PRIORITIES, 'Priority', required=True, select=True, track_visibility='onchange'),
19 'date_planned': fields.datetime('Scheduled Date', required=True, select=True, track_visibility='onchange'),
20
21 'group_id': fields.many2one('procurement.group', 'Procurement Group'),
22
23=== modified file 'stock/__openerp__.py'
24--- stock/__openerp__.py 2014-05-07 09:18:18 +0000
25+++ stock/__openerp__.py 2014-05-23 08:13:43 +0000
26@@ -84,6 +84,7 @@
27 'report/report_stock_view.xml',
28 'res_config_view.xml',
29 'views/report_package_barcode.xml',
30+ 'views/report_lot_barcode.xml',
31 'views/report_stockpicking.xml',
32 'views/report_stockinventory.xml',
33 'views/stock.xml',
34
35=== modified file 'stock/procurement.py'
36--- stock/procurement.py 2014-05-08 11:03:57 +0000
37+++ stock/procurement.py 2014-05-23 08:13:43 +0000
38@@ -188,6 +188,7 @@
39 'date': newdate,
40 'date_expected': newdate,
41 'propagate': procurement.rule_id.propagate,
42+ 'priority': procurement.priority,
43 }
44 return vals
45
46@@ -288,7 +289,7 @@
47 self._procure_orderpoint_confirm(cr, SUPERUSER_ID, use_new_cursor=False, company_id=company.id, context=context)
48
49 #Search all confirmed stock_moves and try to assign them
50- confirmed_ids = move_obj.search(cr, uid, [('state', '=', 'confirmed')], limit=None, order='picking_priority desc, date_expected asc', context=context)
51+ confirmed_ids = move_obj.search(cr, uid, [('state', '=', 'confirmed')], limit=None, order='priority desc, date_expected asc', context=context)
52 for x in xrange(0, len(confirmed_ids), 100):
53 move_obj.action_assign(cr, uid, confirmed_ids[x:x + 100], context=context)
54 if use_new_cursor:
55
56=== modified file 'stock/stock.py'
57--- stock/stock.py 2014-05-08 10:41:22 +0000
58+++ stock/stock.py 2014-05-23 08:13:43 +0000
59@@ -29,6 +29,7 @@
60 from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT, DEFAULT_SERVER_DATE_FORMAT
61 from openerp import SUPERUSER_ID
62 import openerp.addons.decimal_precision as dp
63+from openerp.addons.procurement import procurement
64 import logging
65
66
67@@ -622,6 +623,12 @@
68 move_ids = [move.id for move in self.browse(cr, uid, id, context=context).move_lines]
69 move_obj.write(cr, uid, move_ids, {'date_expected': value}, context=context)
70
71+ def _set_priority(self, cr, uid, id, field, value, arg, context=None):
72+ move_obj = self.pool.get("stock.move")
73+ if value:
74+ move_ids = [move.id for move in self.browse(cr, uid, id, context=context).move_lines]
75+ move_obj.write(cr, uid, move_ids, {'priority': value}, context=context)
76+
77 def get_min_max_date(self, cr, uid, ids, field_name, arg, context=None):
78 """ Finds minimum and maximum dates for picking.
79 @return: Dictionary of values
80@@ -634,16 +641,18 @@
81 cr.execute("""select
82 picking_id,
83 min(date_expected),
84- max(date_expected)
85+ max(date_expected),
86+ max(priority)
87 from
88 stock_move
89 where
90 picking_id IN %s
91 group by
92 picking_id""", (tuple(ids),))
93- for pick, dt1, dt2 in cr.fetchall():
94+ for pick, dt1, dt2, prio in cr.fetchall():
95 res[pick]['min_date'] = dt1
96 res[pick]['max_date'] = dt2
97+ res[pick]['priority'] = prio
98 return res
99
100 def create(self, cr, user, vals, context=None):
101@@ -759,7 +768,9 @@
102 * Transferred: has been processed, can't be modified or cancelled anymore\n
103 * Cancelled: has been cancelled, can't be confirmed anymore"""
104 ),
105- 'priority': fields.selection([('0', 'Low'), ('1', 'Normal'), ('2', 'High')], states={'done': [('readonly', True)], 'cancel': [('readonly', True)]}, string='Priority', required=True),
106+ 'priority': fields.function(get_min_max_date, multi="min_max_date", fnct_inv=_set_priority, type='selection', selection=procurement.PROCUREMENT_PRIORITIES, string='Priority',
107+ store={'stock.move': (_get_pickings, ['priority'], 20)}, states={'done': [('readonly', True)], 'cancel': [('readonly', True)]}, select=1, help="Priority for this picking. Setting manually a value here would set it as priority for all the moves",
108+ track_visibility='onchange', required=True),
109 'min_date': fields.function(get_min_max_date, multi="min_max_date", fnct_inv=_set_min_date,
110 store={'stock.move': (_get_pickings, ['date_expected'], 20)}, type='datetime', states={'done': [('readonly', True)], 'cancel': [('readonly', True)]}, string='Scheduled Date', select=1, help="Scheduled time for the first part of the shipment to be processed. Setting manually a value here would set it as expected date for all the stock moves.", track_visibility='onchange'),
111 'max_date': fields.function(get_min_max_date, multi="min_max_date",
112@@ -1591,7 +1602,7 @@
113
114 _columns = {
115 'name': fields.char('Description', required=True, select=True),
116- 'priority': fields.selection([('0', 'Not urgent'), ('1', 'Urgent')], 'Priority'),
117+ 'priority': fields.selection(procurement.PROCUREMENT_PRIORITIES, 'Priority'),
118 'create_date': fields.datetime('Creation Date', readonly=True, select=True),
119 'date': fields.datetime('Date', required=True, select=True, help="Move date: scheduled date until move is done, then date of actual move processing", states={'done': [('readonly', True)]}),
120 'date_expected': fields.datetime('Expected Date', states={'done': [('readonly', True)]}, required=True, select=True, help="Scheduled date for the processing of this move"),
121@@ -1628,7 +1639,6 @@
122 'move_orig_ids': fields.one2many('stock.move', 'move_dest_id', 'Original Move', help="Optional: previous stock move when chaining them", select=True),
123
124 'picking_id': fields.many2one('stock.picking', 'Reference', select=True, states={'done': [('readonly', True)]}),
125- 'picking_priority': fields.related('picking_id', 'priority', type='selection', selection=[('0', 'Low'), ('1', 'Normal'), ('2', 'High')], string='Picking Priority', store={'stock.picking': (_get_move_ids, ['priority'], 10)}),
126 'note': fields.text('Notes'),
127 'state': fields.selection([('draft', 'New'),
128 ('cancel', 'Cancelled'),
129@@ -1774,6 +1784,7 @@
130 'group_id': group_id,
131 'route_ids': [(4, x.id) for x in move.route_ids],
132 'warehouse_id': move.warehouse_id and move.warehouse_id.id or False,
133+ 'priority': move.priority,
134 }
135
136 def _push_apply(self, cr, uid, moves, context=None):
137
138=== modified file 'stock/stock_report.xml'
139--- stock/stock_report.xml 2014-03-26 15:50:41 +0000
140+++ stock/stock_report.xml 2014-05-23 08:13:43 +0000
141@@ -20,6 +20,6 @@
142 />
143 <report auto="False" id="report_product_history" model="product.product" name="stock.product.history" string="Stock Level Forecast"/>
144 <report id="action_report_quant_package_barcode" model="stock.quant.package" report_type="qweb-pdf" name="stock.report_package_barcode" string="Package BarCode" file="stock.report_package_barcode"/>
145-
146+<report id="action_report_lot_barcode" model="stock.production.lot" report_type="qweb-pdf" name="stock.report_lot_barcode" string="Lot BarCode" file="stock.report_lot_barcode"/>
147 </data>
148 </openerp>
149
150=== modified file 'stock/stock_view.xml'
151--- stock/stock_view.xml 2014-05-08 10:29:57 +0000
152+++ stock/stock_view.xml 2014-05-23 08:13:43 +0000
153@@ -744,6 +744,21 @@
154 <field name="pack_operation_exist" invisible="1"/>
155 <field name="note" placeholder="Add an internal note..." class="oe_inline"/>
156 </page>
157+ <page string="Operations Done" attrs="{'invisible': ['|', ('state','!=','done'), ('pack_operation_ids','=',[])]}">
158+ <field name="pack_operation_ids">
159+ <tree editable="top">
160+ <field name="location_id"/>
161+ <field name="product_id"/>
162+ <field name="product_uom_id" groups="product.group_uom"/>
163+ <field name="lot_id" domain="[('product_id','=?', product_id)]" context="{'product_id': product_id}" groups="stock.group_production_lot"/>
164+ <field name="package_id" groups="stock.group_tracking_lot"/>
165+ <field name="owner_id" groups="stock.group_tracking_owner"/>
166+ <field name="product_qty" attrs="{'required': [('product_id', '!=', False)]}"/>
167+ <field name="location_dest_id"/>
168+ <field name="result_package_id" groups="stock.group_tracking_lot"/>
169+ </tree>
170+ </field>
171+ </page>
172 <page string="Additional Info">
173 <group string="General Informations">
174 <group>
175@@ -1058,7 +1073,7 @@
176 </group>
177 <group name="main_grp_col2">
178 <field name="picking_type_id"/>
179- <field name="picking_priority"/>
180+ <field name="priority"/>
181 <field name="company_id" groups="base.group_multi_company" widget="selection"/>
182 <field name="date_expected" on_change="onchange_date(date,date_expected)" attrs="{'invisible': [('state', '=', 'done')]}"/>
183 <field name="date" attrs="{'invisible': [('state', '!=', 'done')]}"/>
184
185=== added file 'stock/views/report_lot_barcode.xml'
186--- stock/views/report_lot_barcode.xml 1970-01-01 00:00:00 +0000
187+++ stock/views/report_lot_barcode.xml 2014-05-23 08:13:43 +0000
188@@ -0,0 +1,46 @@
189+<?xml version="1.0" encoding="utf-8"?>
190+<openerp>
191+<data>
192+<template id="report_lot_barcode">
193+ <t t-call="report.html_container">
194+ <t t-foreach="docs" t-as="o">
195+ <t>
196+ <div class="page">
197+ <div class="oe_structure"/>
198+ <div class="row">
199+ <div class="col-xs-8">
200+ <table class="table table-condensed" style="border-bottom: 0px solid white !important;">
201+ <thead>
202+ <tr>
203+ <th>Product</th>
204+ <th>Lot</th>
205+ </tr>
206+ </thead>
207+ <tbody>
208+ <td>
209+ <span t-field="o.product_id.name"/>
210+ </td>
211+ <td>
212+ <span t-field="o.name"/>
213+ </td>
214+ </tbody>
215+ </table>
216+ </div>
217+ <div class="col-xs-4">
218+ <img class="image" t-att-src="'data:image/png;base64,%s' % res_company.logo" style="border:auto;"/>
219+ </div>
220+ </div>
221+ <div class="row">
222+ <div class="col-xs-12 mt32">
223+ <table class="table table-condensed" style="border-bottom: 3px solid black !important;"><thead><th> </th></thead></table>
224+ <img t-att-src="'/report/barcode/?type=%s&amp;value=%s&amp;width=%s&amp;height=%s' % ('Code128', o.name, 600, 100)" style="width:300px;height:50px"/>
225+ <p class="text-center" t-field="o.name"></p>
226+ </div>
227+ </div>
228+ </div>
229+ </t>
230+ </t>
231+ </t>
232+</template>
233+</data>
234+</openerp>
235
236=== modified file 'stock/views/report_package_barcode.xml'
237--- stock/views/report_package_barcode.xml 2014-05-02 13:03:52 +0000
238+++ stock/views/report_package_barcode.xml 2014-05-23 08:13:43 +0000
239@@ -40,7 +40,7 @@
240 <div class="row">
241 <div class="col-xs-12 mt32">
242 <table class="table table-condensed" style="border-bottom: 3px solid black !important;"><thead><th> </th></thead></table>
243- <img t-att-src="'/report/barcode/?type=%s&amp;value=%s&amp;width=%s&amp;height=%s' % ('Standard39', o.name, 800, 40)" style="width:100%;"/>
244+ <img t-att-src="'/report/barcode/?type=%s&amp;value=%s&amp;width=%s&amp;height=%s' % ('Code128', o.name, 800, 40)" style="width:100%;"/>
245 <p class="text-center" t-field="o.name"></p>
246 </div>
247 </div>
248
249=== modified file 'stock/views/report_stockpicking.xml'
250--- stock/views/report_stockpicking.xml 2014-05-02 13:03:52 +0000
251+++ stock/views/report_stockpicking.xml 2014-05-23 08:13:43 +0000
252@@ -7,7 +7,7 @@
253 <t t-call="report.external_layout">
254 <div class="page">
255 <div class="row"><div class="col-xs-4 pull-right">
256- <img t-att-src="'/report/barcode/Standard39/%s' % o.name"/>
257+ <img t-att-src="'/report/barcode/Code128/%s' % o.name"/>
258 </div></div>
259 <div t-if="o.picking_type_id.code=='incoming'">
260 <span><strong>Supplier Address:</strong></span>
261@@ -104,13 +104,13 @@
262 </t>
263 <td>
264 <span t-if="pack_operation.lot_id">
265- <img t-att-src="'/report/barcode/Standard39/%s' % pack_operation.lot_id.name"/>
266+ <img t-att-src="'/report/barcode/Code128/%s' % pack_operation.lot_id.name"/>
267 </span>
268 <span t-if="pack_operation.product_id and not pack_operation.lot_id and pack_operation.product_id.ean13">
269 <img t-att-src="'/report/barcode/EAN13/%s' % pack_operation.product_id.ean13"/>
270 </span>
271 <span t-if="pack_operation.package_id and not pack_operation.product_id">
272- <img t-att-src="'/report/barcode/Standard39/%s' % pack_operation.package_id.name"/>
273+ <img t-att-src="'/report/barcode/Code128/%s' % pack_operation.package_id.name"/>
274 </span>
275 </td>
276 <t t-if="o.picking_type_id.code != 'outgoing'"><td><span t-field="pack_operation.location_dest_id"/>

Subscribers

People subscribed via source and target branches

to all changes: