Merge lp:~dorian-kemps/unifield-server/US-4086 into lp:unifield-server

Proposed by jftempo
Status: Merged
Merged at revision: 4861
Proposed branch: lp:~dorian-kemps/unifield-server/US-4086
Merge into: lp:unifield-server
Diff against target: 161 lines (+63/-24)
6 files modified
bin/addons/msf_printed_documents/report/sale_order.rml (+1/-0)
bin/addons/procurement_request/report/procurement_request_report.rml (+1/-0)
bin/addons/purchase_override/report/merged_order.py (+36/-0)
bin/addons/purchase_override/report/merged_order.rml (+23/-24)
bin/addons/purchase_override/report/rfq.rml (+1/-0)
bin/addons/stock_override/report/internal_move.rml (+1/-0)
To merge this branch: bzr merge lp:~dorian-kemps/unifield-server/US-4086
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+342662@code.launchpad.net
To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/addons/msf_printed_documents/report/sale_order.rml'
2--- bin/addons/msf_printed_documents/report/sale_order.rml 2016-01-21 10:44:19 +0000
3+++ bin/addons/msf_printed_documents/report/sale_order.rml 2018-04-20 09:13:07 +0000
4@@ -524,6 +524,7 @@
5 <section>
6 <blockTable colWidths="25.0,105.0,305.5,115.0,55.5,60.0,51.0,55.0" style="LinesTable">
7 [[ repeatIn(objects[0].order_line, 'line') ]]
8+ [[ line.state not in ['cancel', 'cancel_r'] or removeParentNode('blockTable') ]]
9 <tr>
10 <td>
11 <para style="LinesBlue">[[ line.line_number ]]</para>
12
13=== modified file 'bin/addons/procurement_request/report/procurement_request_report.rml'
14--- bin/addons/procurement_request/report/procurement_request_report.rml 2017-09-25 08:31:13 +0000
15+++ bin/addons/procurement_request/report/procurement_request_report.rml 2018-04-20 09:13:07 +0000
16@@ -217,6 +217,7 @@
17 </tr>
18 <tr>
19 [[ repeatIn(req.order_line, 'line', 'tr') ]]
20+ [[ line.state not in ['cancel', 'cancel_r'] or removeParentNode('tr') ]]
21 <td>
22 <para style="Line">[[ line.line_number ]]</para>
23 </td>
24
25=== modified file 'bin/addons/purchase_override/report/merged_order.py'
26--- bin/addons/purchase_override/report/merged_order.py 2014-03-07 10:00:41 +0000
27+++ bin/addons/purchase_override/report/merged_order.py 2018-04-20 09:13:07 +0000
28@@ -30,6 +30,7 @@
29 'to_time': self.str_to_time,
30 'enumerate': enumerate,
31 'getOrigin': self._get_origin,
32+ 'get_merged_lines': self.get_merged_lines,
33 })
34
35 def _get_origin(self, origin, number=5):
36@@ -57,6 +58,41 @@
37
38 return res
39
40+ def get_merged_lines(self, order):
41+ all_prod = {}
42+ line_obj = self.pool.get('purchase.order.line')
43+ line_ids = line_obj.search(self.cr, self.uid, [('order_id', '=', order.id), ('state', 'not in', ['cancel', 'cancel_r'])])
44+
45+ for line in line_obj.browse(self.cr, self.uid, line_ids, context=self.localcontext):
46+ if not line.product_id:
47+ p_key = line.nomenclature_description
48+ p_name = line.nomenclature_description
49+ default_code = ''
50+ else:
51+ p_key = line.product_id.id
52+ p_name = line.product_id.name
53+ default_code = line.product_id.default_code
54+
55+ key = (p_key, line.product_uom.id)
56+ if key not in all_prod:
57+ all_prod[key] = {
58+ 'default_code': default_code,
59+ 'supplier_code': line.supplier_code,
60+ 'name': p_name,
61+ 'price_unit': line.price_unit,
62+ 'price_subtotal': line.price_subtotal,
63+ 'product_uom': line.product_uom.name,
64+ 'quantity': line.product_qty,
65+ 'comment': line.comment or '',
66+ }
67+ else:
68+ all_prod[key]['price_unit'] = ((all_prod[key]['price_unit'] * all_prod[key]['quantity']) + (line.product_qty*line.price_unit)) / (line.product_qty+all_prod[key]['quantity'])
69+ all_prod[key]['quantity'] += line.product_qty
70+ all_prod[key]['price_subtotal'] += line.price_subtotal
71+ if line.comment:
72+ all_prod[key]['comment'] += ' %s' % line.comment
73+
74+ return sorted(all_prod.values(), key=lambda x: x['default_code'] or x['name'])
75
76 def str_to_time(self, time):
77 if isinstance(time, str):
78
79=== modified file 'bin/addons/purchase_override/report/merged_order.rml'
80--- bin/addons/purchase_override/report/merged_order.rml 2017-09-22 15:31:55 +0000
81+++ bin/addons/purchase_override/report/merged_order.rml 2018-04-20 09:13:07 +0000
82@@ -593,32 +593,31 @@
83
84 <section>
85 <blockTable colWidths="65.0,95.0,295.5,95.0,55.5,60.0,51.0,55.0" style="LinesTable">
86- [[repeatIn(objects[0].merged_line_ids,'line')]]
87+ [[repeatIn(get_merged_lines(objects[0]),'line')]]
88 <tr>
89 <td>
90- <para style="LinesBlue">[[ line.supplier_code ]]</para>
91- </td>
92- <td>
93- <para style="LinesBlue">[[ line.product_id.default_code ]]</para>
94- </td>
95- <td>
96- <para style="LinesBlue">[[ line.product_id and line.product_id.name or removeParentNode('para') ]]</para>
97- <para style="LinesBlue">[[ not line.product_id and line.nomen_manda_0.name or removeParentNode('para') ]] [[ line.nomen_manda_1 and '/ %s' % line.nomen_manda_1.name or '' ]] [[ line.nomen_manda_2 and '/ %s' % line.nomen_manda_2.name or '' ]] [[ line.nomen_manda_3 and '/ %s' % line.nomen_manda_3.name or '' ]] [[ line.nomen_sub_0 and '/ %s' % line.nomen_sub_0.name or '' ]] [[ line.nomen_sub_1 and '/ %s' % line.nomen_sub_1.name or '' ]] [[ line.nomen_sub_2 and '/ %s' % line.nomen_sub_2.name or '' ]] [[ line.nomen_sub_3 and '/ %s' % line.nomen_sub_3.name or '' ]] [[ line.nomen_sub_4 and '/ %s' % line.nomen_sub_4.mane or '' ]] [[ line.nomen_sub_5 and '/ %s' % line.nomen_sub_5.name or '' ]]</para>
98- </td>
99- <td>
100- <para style="LinesBlue">[[ line.comment ]]</para>
101- </td>
102- <td>
103- <para style="LinesBlue" alignment="RIGHT">[[ line.product_qty or '0.00' ]]</para>
104- </td>
105- <td>
106- <para style="LinesBlue" alignment="CENTER">[[ line.product_uom.name ]]</para>
107- </td>
108- <td>
109- <para style="LinesBlue" alignment="RIGHT">[[ line.price_unit or '0.00' ]]</para>
110- </td>
111- <td>
112- <para style="LinesBlue" alignment="RIGHT">[[ line.price_subtotal or '0.00' ]]</para>
113+ <para style="LinesBlue">[[ line['supplier_code'] ]]</para>
114+ </td>
115+ <td>
116+ <para style="LinesBlue">[[ line['default_code'] ]]</para>
117+ </td>
118+ <td>
119+ <para style="LinesBlue">[[ line['name'] ]]</para>
120+ </td>
121+ <td>
122+ <para style="LinesBlue">[[ line['comment'] ]]</para>
123+ </td>
124+ <td>
125+ <para style="LinesBlue" alignment="RIGHT">[[ line['quantity'] or '0.00' ]]</para>
126+ </td>
127+ <td>
128+ <para style="LinesBlue" alignment="CENTER">[[ line['product_uom'] ]]</para>
129+ </td>
130+ <td>
131+ <para style="LinesBlue" alignment="RIGHT">[[ round(line['price_unit'], 4) or '0.00' ]]</para>
132+ </td>
133+ <td>
134+ <para style="LinesBlue" alignment="RIGHT">[[ line['price_subtotal'] or '0.00' ]]</para>
135 </td>
136 </tr>
137 </blockTable>
138
139=== modified file 'bin/addons/purchase_override/report/rfq.rml'
140--- bin/addons/purchase_override/report/rfq.rml 2017-09-22 15:31:55 +0000
141+++ bin/addons/purchase_override/report/rfq.rml 2018-04-20 09:13:07 +0000
142@@ -536,6 +536,7 @@
143 <section>
144 <blockTable colWidths="20.0,62.5,100,303.0,141.0,70.5,75.0" style="LinesTable">
145 [[ repeatIn(objects[0].order_line, 'line') ]]
146+ [[ (line.order_id.state != 'cancel' and line.state not in ['cancel', 'cancel_r']) or removeParentNode('blockTable') ]]
147 <tr>
148 <td>
149 <para style="LinesBlue">[[ line.line_number ]]</para>
150
151=== modified file 'bin/addons/stock_override/report/internal_move.rml'
152--- bin/addons/stock_override/report/internal_move.rml 2017-09-22 15:31:55 +0000
153+++ bin/addons/stock_override/report/internal_move.rml 2018-04-20 09:13:07 +0000
154@@ -230,6 +230,7 @@
155 </tr>
156 <tr>
157 [[ repeatIn(get_lines(picking), 'line', 'tr') ]]
158+ [[ line.state != 'cancel' or removeParentNode('tr') ]]
159 <td>
160 <para style="Line">[[ line.line_number ]]</para>
161 </td>

Subscribers

People subscribed via source and target branches