Merge lp:~unifield-team/unifield-wm/bklg-16-17-18-31 into lp:unifield-wm

Proposed by jftempo
Status: Needs review
Proposed branch: lp:~unifield-team/unifield-wm/bklg-16-17-18-31
Merge into: lp:unifield-wm
Diff against target: 197 lines (+95/-20)
2 files modified
msf_outgoing/report/picking_ticket.py (+73/-0)
msf_outgoing/report/picking_ticket.rml (+22/-20)
To merge this branch: bzr merge lp:~unifield-team/unifield-wm/bklg-16-17-18-31
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+253940@code.launchpad.net
To post a comment you must log in.

Unmerged revisions

2421. By Quentin THEURET @Amaris

BKLG-18 [IMP] Fix displaying of number of items

2420. By Quentin THEURET @Amaris

BKLG-18 [IMP] Display the total quantity of a line in picking ticket PDF report in bold

2419. By Quentin THEURET @Amaris

BKLG-31 [IMP] Rewrite the sourcing document tab of Internal requests

2418. By Quentin THEURET @Amaris

BKLG-18 [FIX] Don't display product code and product description on picking ticket report in case of multiple batches

2417. By Quentin THEURET @Amaris

BKLG-18 [FIX] Don't display product code and product description on picking ticket report in case of multiple batches

2416. By Quentin THEURET @Amaris

BKLG-17 [FIX] Add a warning message when user changes the partner of an Outgoing delivery

2415. By Quentin THEURET @Amaris

BKLG-17 [FIX] Make the partner_id2 field of Outgoing delivery readonly because if not, you can choose the instance partner with an external location not consumption unit as destination

2414. By Quentin THEURET @Amaris

BKLG-31 [MERGE] Merge lp:~unifield-team/unifield-wm/bklg-31

2413. By Quentin THEURET @Amaris

BKLG-18 [MERGE] Merge lp:~unifield-team/unifield-wm/bklg-18

2412. By Quentin THEURET @Amaris

BKLG-17 [MERGE] Merge lp:~unifield-team/unifield-wm/bklg-17

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account_override/account.py'
2=== modified file 'analytic_distribution/wizard/analytic_distribution_wizard.py'
3=== modified file 'msf_outgoing/msf_outgoing.py'
4=== modified file 'msf_outgoing/report/picking_ticket.py'
5--- msf_outgoing/report/picking_ticket.py 2014-08-05 15:13:19 +0000
6+++ msf_outgoing/report/picking_ticket.py 2015-03-24 09:41:54 +0000
7@@ -20,11 +20,29 @@
8 ##############################################################################
9
10 import time
11+import pooler
12 from osv import osv
13 from tools.translate import _
14 from report import report_sxw
15
16
17+class BatchMoveLines(object):
18+
19+ def __init__(self, move):
20+ self.move = move
21+ self.location_id = move.location_id
22+ self.product_id = move.product_id
23+ self.line_number = move.line_number
24+ self.sale_line_id = move.sale_line_id
25+ self.product_uom = move.product_id.uom_id
26+ self.product_qty = 0.00
27+ self.prodlot_id = None
28+ self.kc_check = False
29+ self.dg_check = False
30+ self.np_check = False
31+ self.no_product = False
32+
33+
34 class picking_ticket(report_sxw.rml_parse):
35 """
36 Parser for the picking ticket report
37@@ -47,8 +65,62 @@
38 'uid': uid,
39 'getWarningMessage': self.get_warning,
40 'getStock': self.get_qty_available,
41+ 'getNbItems': self.get_nb_items,
42+ 'getLines': self.get_lines,
43 })
44
45+ def get_lines(self, picking):
46+ """
47+ Returns the move lines. For move lines with a batch number/expiry date
48+ create a first line with the whole quantity of product in stock, then
49+ one line for each batch with the quantity of batch in stock.
50+ """
51+ res = []
52+ dict_res = {}
53+ pool = pooler.get_pool(self.cr.dbname)
54+
55+ for m in picking.move_lines:
56+ dict_res.setdefault(m.line_number, [])
57+ if m.prodlot_id and not dict_res[m.line_number]:
58+ # First create a line without batch
59+ dict_res[m.line_number].append(BatchMoveLines(m))
60+ bm = BatchMoveLines(m)
61+ bm.product_uom = m.product_uom
62+ bm.product_qty = m.product_qty
63+ bm.prodlot_id = m.prodlot_id
64+ bm.kc_check = m.kc_check
65+ bm.dg_check = m.dg_check
66+ bm.np_check = m.np_check
67+ if m.prodlot_id and dict_res[m.line_number]:
68+ bm.no_product = True
69+ dict_res[m.line_number][0].product_qty += pool.get('product.uom')._compute_qty(
70+ self.cr, self.uid, bm.product_uom.id, bm.product_qty, bm.product_id.uom_id.id)
71+ dict_res[m.line_number].append(bm)
72+
73+ for key in dict_res:
74+ for m in dict_res[key]:
75+ res.append(m)
76+
77+ return res
78+
79+ def get_nb_items(self, picking):
80+ """
81+ Returns the number of different line number. If a line is split
82+ with a different product, this line count for +1
83+ """
84+ res = 0
85+ dict_res = {}
86+ for m in picking.move_lines:
87+ dict_res.setdefault(m.line_number, {})
88+ if m.product_id.id not in dict_res[m.line_number]:
89+ dict_res[m.line_number][m.product_id.id] = 1
90+
91+ for ln in dict_res.values():
92+ for p in ln.values():
93+ res += p
94+
95+ return res
96+
97 def get_warning(self, picking):
98 """
99 If the picking ticket contains heat sensitive, dangerous goods or both,
100@@ -100,6 +172,7 @@
101 context = {
102 'location': move.location_id.id,
103 'location_id': move.location_id.id,
104+ 'prodlot_id': move.prodlot_id and move.prodlot_id.id or False,
105 }
106
107 qty_available = product_obj.browse(
108
109=== modified file 'msf_outgoing/report/picking_ticket.rml'
110--- msf_outgoing/report/picking_ticket.rml 2014-10-23 15:26:10 +0000
111+++ msf_outgoing/report/picking_ticket.rml 2015-03-24 09:41:54 +0000
112@@ -11,7 +11,7 @@
113 <drawString x="20.0" y="555.0">PICKING TICKET ([[ getSel(objects[0], 'state') ]])</drawString>
114 <fill color="blue"/>
115 <drawString x="20.0" y="541.0">[[ objects[0].name ]]</drawString>
116- <image x="725.0" y="525.0" height="53.3" width="100">[[ company.logo or removeParentNode('image') ]]</image>
117+ <image x="705.0" y="525.0" height="53.3" width="100">[[ company.logo or removeParentNode('image') ]]</image>
118 <setFont name="Helvetica" size="8" />
119 <fill color="black" />
120 <drawString x="20.0" y="525.0">Page : <pageNumber /> / </drawString>
121@@ -101,6 +101,7 @@
122 <paraStyle name="LineHeaderLeft" fontName="Helvetica-Oblique" fontSize="6.0" alignment="LEFT" leading="5.0" />
123
124 <paraStyle name="LineValue" fontName="Helvetica" fontSize="6.0" alignment="CENTER" leading="5.0" textColor="blue" />
125+ <paraStyle name="LineValueBold" fontName="Helvetica-Bold" fontSize="8.0" alignment="CENTER" leading="5.0" textColor="blue" />
126 <paraStyle name="LineValueLeft" fontName="Helvetica" fontSize="6.0" alignment="LEFT" leading="5.0" textColor="blue" />
127
128
129@@ -132,7 +133,7 @@
130 <para style="HeaderInfosValue">[[ pt.sale_id and pt.sale_id.name or '-' ]]</para>
131 <para style="HeaderInfosValue">[[ pt.sale_id and pt.sale_id.client_order_ref and pt.sale_id.client_order_ref or '-' ]]</para>
132 <para style="HeaderInfosValue">[[ pt.sale_id and getSel(pt.sale_id, 'categ') or '-' ]]</para>
133- <para style="HeaderInfosValue">[[ len(pt.move_lines) or 0 ]]</para>
134+ <para style="HeaderInfosValue">[[ getNbItems(pt) ]]</para>
135 </td>
136 <td>
137 <para style="HeaderInfosTitle"></para>
138@@ -356,25 +357,26 @@
139
140 <!-- Lines -->
141 <blockTable colWidths="30.0,120.0,240.0,55.0,55.0,55.0,55.0,75.0,65.0,20.0,20.0,20.0" rowHeights="15.0" style="LinesValues">
142- [[ repeatIn(pt.move_lines, 'm', 'blockTable') ]]
143+ [[ repeatIn(getLines(pt), 'm', 'blockTable') ]]
144 <tr>
145 <td>
146- <para style="LineValue">[[ m.line_number ]]</para>
147- </td>
148- <td>
149- <para style="LineValueLeft">[[ m.sale_line_id and m.sale_line_id.product_id.default_code or m.product_id.default_code ]]</para>
150- </td>
151- <td>
152- <para style="LineValueLeft">[[ m.sale_line_id and m.sale_line_id.product_id.name or m.product_id.name ]]</para>
153- </td>
154- <td>
155- <para style="LineValue">[[ formatLang(getStock(m) or 0.00) ]]</para>
156- </td>
157- <td>
158- <para style="LineValue">[[ m.product_uom.name ]]</para>
159- </td>
160- <td>
161- <para style="LineValue">[[ m.product_qty and m.product_qty or 0.00 ]]</para>
162+ <para style="LineValue">[[ not m.no_product and m.line_number or '' ]]</para>
163+ </td>
164+ <td>
165+ <para style="LineValueLeft">[[ not m.no_product and (m.sale_line_id and m.sale_line_id.product_id.default_code or m.product_id.default_code) or '' ]]</para>
166+ </td>
167+ <td>
168+ <para style="LineValueLeft">[[ not m.no_product and (m.sale_line_id and m.sale_line_id.product_id.name or m.product_id.name) or '']]</para>
169+ </td>
170+ <td>
171+ <para style="LineValue">[[ formatLang(getStock(m) or 0.00, digits=get_digits(dp='Product UoM')) ]]</para>
172+ </td>
173+ <td>
174+ <para style="LineValue">[[ m.product_id.uom_id.name ]]</para>
175+ </td>
176+ <td>
177+ <para style="LineValue">[[ m.no_product and formatLang(m.product_qty, digits=get_digits(dp='Product UoM')) or removeParentNode('para') ]]</para>
178+ <para style="LineValueBold">[[ not m.no_product and formatLang(m.product_qty, digits=get_digits(dp='Product UoM')) or removeParentNode('para') ]]</para>
179 </td>
180 <td>
181 <para style="LineValue"> </para>
182@@ -400,7 +402,7 @@
183 <para style="LineValue"></para>
184 </td>
185 <td>
186- <para style="LineValueLeft">[[ m.sale_line_id and m.sale_line_id.note or '' ]]</para>
187+ <para style="LineValueLeft">[[ m.sale_line_id and m.sale_line_id.notes or '' ]]</para>
188 </td>
189 <td>
190 <para style="LineValueLeft">[[ m.sale_line_id and m.sale_line_id.product_id != m.product_id and '[%s] %s' % (m.product_id.default_code, m.product_id.name) or '' ]]</para>
191
192=== modified file 'msf_partner/partner.py'
193=== modified file 'sale_override/sale.py'
194=== modified file 'sourcing/procurement_order.py'
195=== modified file 'stock_override/stock.py'
196=== modified file 'stock_override/stock_view.xml'
197=== modified file 'tender_flow/tender_flow.py'

Subscribers

People subscribed via source and target branches