Merge lp:~unifield-team/unifield-wm/us-829 into lp:unifield-wm

Proposed by jftempo
Status: Merged
Merged at revision: 2724
Proposed branch: lp:~unifield-team/unifield-wm/us-829
Merge into: lp:unifield-wm
Diff against target: 246 lines (+59/-35)
7 files modified
account_mcdb/wizard/output_currency_for_export.py (+1/-0)
msf_supply_doc_export/msf_supply_doc_export.py (+17/-6)
msf_supply_doc_export/wizard/po_follow_up.py (+1/-0)
sales_followup/report/sale_follow_up_multi_report.rml (+1/-1)
sales_followup/report/sale_follow_up_multi_report_xls.mako (+1/-1)
sales_followup/report/sale_follow_up_report_multi.py (+28/-21)
sales_followup/wizard/sale_followup_multi_wizard.py (+10/-6)
To merge this branch: bzr merge lp:~unifield-team/unifield-wm/us-829
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+283579@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 'account_mcdb/wizard/output_currency_for_export.py'
2--- account_mcdb/wizard/output_currency_for_export.py 2016-01-19 10:34:18 +0000
3+++ account_mcdb/wizard/output_currency_for_export.py 2016-01-22 08:55:06 +0000
4@@ -176,6 +176,7 @@
5 'report_name': fields.char('Report Name', size=256),
6 'report_id': fields.integer('Report id'),
7 'percent': fields.float('Percent'),
8+ 'finished': fields.boolean('Finished'),
9 }
10 def update_percent(self, cr, uid, ids, percent, context=None):
11 self.write(cr, uid, ids, {'percent': percent})
12
13=== modified file 'msf_supply_doc_export/msf_supply_doc_export.py'
14--- msf_supply_doc_export/msf_supply_doc_export.py 2015-07-23 13:47:45 +0000
15+++ msf_supply_doc_export/msf_supply_doc_export.py 2016-01-22 08:55:06 +0000
16@@ -408,6 +408,12 @@
17
18 return res
19
20+ def yieldPoLines(self, po_line_ids):
21+ for pol_id in po_line_ids:
22+ yield self.pool.get('purchase.order.line').browse(self.cr, self.uid, pol_id)
23+
24+ raise StopIteration
25+
26 def getPOLines(self, po_id):
27 ''' developer note: would be a lot easier to write this as a single sql and then use on-break '''
28 # TODO the multiplier is the value populated for no change in stock_move.price_unit
29@@ -418,17 +424,16 @@
30 prod_obj = self.pool.get('product.product')
31 uom_obj = self.pool.get('product.uom')
32 po_line_ids = pol_obj.search(self.cr, self.uid, [('order_id','=',po_id)], order='line_number')
33- po_lines = pol_obj.browse(self.cr, self.uid, po_line_ids)
34+# po_lines = pol_obj.browse(self.cr, self.uid, po_line_ids)
35 report_lines = []
36 order = po_obj.browse(self.cr, self.uid, po_id)
37- for line in po_lines:
38- in_lines = self.getAllLineIN(line.id)
39+ for line in self.yieldPoLines(po_line_ids):
40 analytic_lines = self.getAnalyticLines(line)
41 same_product_same_uom = []
42 same_product = []
43 other_product = []
44
45- for inl in in_lines:
46+ for inl in self.getAllLineIN(line.id):
47 if inl.get('product_id') and inl.get('product_id') == line.product_id.id:
48 if inl.get('product_uom') and inl.get('product_uom') == line.product_uom.id:
49 same_product_same_uom.append(inl)
50@@ -539,7 +544,10 @@
51 }
52 report_lines.append(report_line)
53
54- return report_lines
55+ for rl in report_lines:
56+ yield rl
57+
58+ raise StopIteration
59
60 def getAnalyticLines(self,po_line):
61 ccdl_obj = self.pool.get('cost.center.distribution.line')
62@@ -570,7 +578,10 @@
63 sm.picking_id = sp.id
64 ORDER BY
65 sp.name, sm.id asc''', tuple([po_line_id]))
66- return self.cr.dictfetchall()
67+ for res in self.cr.dictfetchall():
68+ yield res
69+
70+ raise StopIteration
71
72 def getReportHeaderLine1(self):
73 return self.datas.get('report_header')[0]
74
75=== modified file 'msf_supply_doc_export/wizard/po_follow_up.py'
76--- msf_supply_doc_export/wizard/po_follow_up.py 2014-11-07 15:09:38 +0000
77+++ msf_supply_doc_export/wizard/po_follow_up.py 2016-01-22 08:55:06 +0000
78@@ -159,6 +159,7 @@
79 'report_name': fields.char('Report Name', size=256),
80 'report_id': fields.integer('Report id'),
81 'percent': fields.float('Percent'),
82+ 'finished': fields.boolean('Finished'),
83 }
84 def update_percent(self, cr, uid, ids, percent, context=None):
85 self.write(cr, uid, ids, {'percent': percent})
86
87=== modified file 'sales_followup/report/sale_follow_up_multi_report.rml'
88--- sales_followup/report/sale_follow_up_multi_report.rml 2014-11-05 16:48:01 +0000
89+++ sales_followup/report/sale_follow_up_multi_report.rml 2016-01-22 08:55:06 +0000
90@@ -193,7 +193,7 @@
91 <para style="Lines"></para>
92 </td>
93 <td>
94- <para style="Lines"># Items: [[ len(getProducts(o)) ]]</para>
95+ <para style="Lines"># Items: [[ getCountProducts(o) ]]</para>
96 </td>
97 <td>
98 <para style="Lines">Estimated amount: [[ formatLang(o.amount_total or 0.00) ]] [[ o.pricelist_id.currency_id.name ]]</para>
99
100=== modified file 'sales_followup/report/sale_follow_up_multi_report_xls.mako'
101--- sales_followup/report/sale_follow_up_multi_report_xls.mako 2015-07-06 09:55:29 +0000
102+++ sales_followup/report/sale_follow_up_multi_report_xls.mako 2016-01-22 08:55:06 +0000
103@@ -263,7 +263,7 @@
104 <Cell ss:StyleID="order_header_first" ss:MergeAcross="2"><Data ss:Type="String">Order ref.: ${o.name|x} Status: ${getSel(o, 'state')|x}</Data></Cell>
105 <Cell ss:StyleID="order_header" ss:MergeAcross="2"><Data ss:Type="String">Received: ${saleUstr(formatLang(o.date_order, date=True))|x}</Data></Cell>
106 <Cell ss:StyleID="order_header" ss:MergeAcross="2"><Data ss:Type="String">Req. Delivery date: ${o.delivery_requested_date and saleUstr(formatLang(o.delivery_requested_date, date=True)) or ''|x}</Data></Cell>
107- <Cell ss:StyleID="order_header"><Data ss:Type="String"># Items: ${len(getProducts(o))|x}</Data></Cell>
108+ <Cell ss:StyleID="order_header"><Data ss:Type="String"># Items: ${getProducts(o)|x}</Data></Cell>
109 <Cell ss:StyleID="order_header_last" ss:MergeAcross="2"><Data ss:Type="String">Estimated amount: ${formatLang(o.amount_total or 0.00)|x} ${o.pricelist_id.currency_id.name|x}</Data></Cell>
110 </Row>
111
112
113=== modified file 'sales_followup/report/sale_follow_up_report_multi.py'
114--- sales_followup/report/sale_follow_up_report_multi.py 2015-06-16 08:08:25 +0000
115+++ sales_followup/report/sale_follow_up_report_multi.py 2016-01-22 08:55:06 +0000
116@@ -53,40 +53,43 @@
117
118 def _get_orders(self, report):
119 orders = []
120-
121- for order in report.order_ids:
122- if len(order.order_line):
123- orders.append(order)
124+ for order_id in report.order_ids:
125+ if self.pool.get('sale.order.line').search(self.cr, self.uid, [('order_id', '=', order_id)]):
126+ orders.append(order_id)
127
128 self._nb_orders = len(orders)
129
130- return orders
131+ for order in orders:
132+ yield self.pool.get('sale.order').browse(self.cr, self.uid, order)
133+
134+ raise StopIteration
135
136 def _get_products(self, order, count=False):
137 '''
138 Returns the list of products in the order
139 '''
140- prod_obj = self.pool.get('product.product')
141-
142- self.cr.execute('''SELECT distinct(product_id) FROM sale_order_line WHERE order_id = %(order_id)s''', {'order_id': order.id})
143- product_ids = [x[0] for x in self.cr.fetchall() if x[0] is not None]
144-
145- if count:
146- return len(product_ids)
147-
148- return prod_obj.browse(self.cr, self.uid, product_ids)
149+ self.cr.execute('''SELECT COUNT(DISTINCT(product_id)) FROM sale_order_line WHERE order_id = %(order_id)s''', {'order_id': order.id})
150+ return self.cr.fetchone()[0]
151+
152+ def _get_order_line(self, order_id):
153+ order_line_ids = self.pool.get('sale.order.line').search(self.cr, self.uid, [('order_id', '=', order_id)])
154+ for order_line_id in order_line_ids:
155+ yield self.pool.get('sale.order.line').browse(self.cr, self.uid, order_line_id)
156+
157+ raise StopIteration
158
159 def _get_lines(self, order, grouped=False):
160 '''
161 Get all lines with OUT/PICK for an order
162 '''
163- res = []
164 keys = []
165- for line in order.order_line:
166+ for line in self._get_order_line(order.id):
167 if not grouped:
168 keys = []
169 lines = []
170 first_line = True
171+ fl_index = 0
172+ m_index = 0
173 bo_qty = line.product_uom_qty
174 for move in line.move_ids:
175 m_type = move.product_qty != 0.00 and move.picking_id.type == 'out'
176@@ -154,6 +157,9 @@
177 else:
178 keys.append(key)
179 lines.append(data)
180+ if data.get('first_line'):
181+ fl_index= m_index
182+ m_index += 1
183
184 # No move found
185 if first_line:
186@@ -172,11 +178,12 @@
187 lines.append(data)
188
189 # Put the backorderd qty on the first line
190- for l in lines:
191- if l.get('first_line'):
192- l['backordered_qty'] = bo_qty
193+ if not lines:
194+ continue
195+ lines[fl_index]['backordered_qty'] = bo_qty
196
197- res.extend(lines)
198+ for line in lines:
199+ yield line
200
201 self._order_iterator += 1
202
203@@ -184,7 +191,7 @@
204 percent = float(self._order_iterator) / float(self._nb_orders)
205 self.pool.get('memory.background.report').update_percent(self.cr, self.uid, [self.back_browse.id], percent)
206
207- return res
208+ raise StopIteration
209
210 def _parse_date_xls(self, dt_str, is_datetime=True):
211 if not dt_str or dt_str == 'False':
212
213=== modified file 'sales_followup/wizard/sale_followup_multi_wizard.py'
214--- sales_followup/wizard/sale_followup_multi_wizard.py 2014-09-25 07:20:48 +0000
215+++ sales_followup/wizard/sale_followup_multi_wizard.py 2016-01-22 08:55:06 +0000
216@@ -61,13 +61,17 @@
217 string='Status',
218 readonly=True,
219 ),
220- 'order_ids': fields.many2many(
221- 'sale.order',
222- 'followup_per_client_rel',
223- 'report_id',
224- 'order_id',
225+ 'order_ids': fields.text(
226 string='Orders',
227+ readonly=True
228 ),
229+ #'order_ids': fields.many2many(
230+ # 'sale.order',
231+ # 'followup_per_client_rel',
232+ # 'report_id',
233+ # 'order_id',
234+ # string='Orders',
235+ #),
236 'order_id': fields.many2one(
237 'sale.order',
238 string='Order Ref.',
239@@ -173,7 +177,7 @@
240 _('No data found with these parameters'),
241 )
242
243- self.write(cr, uid, [wizard.id], {'order_ids': [(6,0,fo_ids)]}, context=context)
244+ self.write(cr, uid, [wizard.id], {'order_ids': fo_ids}, context=context)
245
246 return True
247

Subscribers

People subscribed via source and target branches