Merge lp:~unifield-team/unifield-server/us-3478-3479 into lp:unifield-server
- us-3478-3479
- Merge into trunk
Proposed by
jftempo
Status: | Merged |
---|---|
Merged at revision: | 4589 |
Proposed branch: | lp:~unifield-team/unifield-server/us-3478-3479 |
Merge into: | lp:unifield-server |
Diff against target: |
1859 lines (+1497/-40) 31 files modified
bin/addons/msf_profile/i18n/fr_MF.po (+214/-0) bin/addons/procurement_request/__openerp__.py (+1/-0) bin/addons/procurement_request/procurement_request.py (+34/-4) bin/addons/procurement_request/procurement_request_line_wizard.xml (+25/-0) bin/addons/procurement_request/procurement_request_view.xml (+7/-0) bin/addons/procurement_request/wizard/__init__.py (+1/-0) bin/addons/procurement_request/wizard/procurement_request_line_wizard.py (+44/-0) bin/addons/purchase/purchase_order_line.py (+8/-13) bin/addons/purchase/purchase_workflow.py (+4/-0) bin/addons/purchase_followup/__init__.py (+1/-0) bin/addons/purchase_followup/__openerp__.py (+3/-1) bin/addons/purchase_followup/report/__init__.py (+1/-0) bin/addons/purchase_followup/report/po_track_changes_report.py (+92/-0) bin/addons/purchase_followup/report/po_track_changes_report.xml (+18/-0) bin/addons/purchase_followup/report/po_track_changes_report_xls.mako (+299/-0) bin/addons/purchase_followup/wizard/__init__.py (+22/-0) bin/addons/purchase_followup/wizard/po_track_changes_wizard.py (+130/-0) bin/addons/purchase_followup/wizard/po_track_changes_wizard_view.xml (+39/-0) bin/addons/sale/sale_order.py (+1/-1) bin/addons/sale/sale_workflow.py (+1/-0) bin/addons/sales_followup/__openerp__.py (+2/-0) bin/addons/sales_followup/report/__init__.py (+1/-0) bin/addons/sales_followup/report/ir_track_changes_report.py (+73/-0) bin/addons/sales_followup/report/ir_track_changes_report.xml (+18/-0) bin/addons/sales_followup/report/ir_track_changes_report_xls.mako (+283/-0) bin/addons/sales_followup/wizard/__init__.py (+1/-0) bin/addons/sales_followup/wizard/ir_track_changes_wizard.py (+130/-0) bin/addons/sales_followup/wizard/ir_track_changes_wizard_view.xml (+39/-0) bin/addons/sourcing/procurement_order.py (+2/-0) bin/addons/sourcing/sale_order_line.py (+3/-0) bin/addons/sourcing/sourcing_view.xml (+0/-21) |
To merge this branch: | bzr merge lp:~unifield-team/unifield-server/us-3478-3479 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
UniField Reviewer Team | Pending | ||
Review via email: mp+332845@code.launchpad.net |
Commit message
Description of the change
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_profile/i18n/fr_MF.po' |
2 | --- bin/addons/msf_profile/i18n/fr_MF.po 2017-10-09 16:01:14 +0000 |
3 | +++ bin/addons/msf_profile/i18n/fr_MF.po 2017-10-26 10:06:24 +0000 |
4 | @@ -99629,3 +99629,217 @@ |
5 | #, python-format |
6 | msgid "You can't delete this FX rate as the period \"%s\" isn't in Draft state." |
7 | msgstr "Vous ne pouvez pas supprimer ce taux de change car la période \"%s\" n'est pas en statut Brouillon." |
8 | + |
9 | +#. modules: purchase, purchase_override, procurement_request |
10 | +#: field:sale.order.line,original_price:0 |
11 | +#: field:purchase.order.line,original_price:0 |
12 | +#: field:purchase.order.merged.line,original_price:0 |
13 | +msgid "Original Price" |
14 | +msgstr "Prix d'Origine" |
15 | + |
16 | +#. modules: purchase, purchase_override, procurement_request |
17 | +#: field:sale.order.line,original_product:0 |
18 | +#: field:purchase.order.line,original_product:0 |
19 | +#: field:purchase.order.merged.line,original_product:0 |
20 | +msgid "Original Product" |
21 | +msgstr "Produit d'Origine" |
22 | + |
23 | +#. modules: purchase, purchase_override, procurement_request |
24 | +#: field:sale.order.line,original_uom:0 |
25 | +#: field:purchase.order.line,original_uom:0 |
26 | +#: field:purchase.order.merged.line,original_uom:0 |
27 | +msgid "Original UoM" |
28 | +msgstr "UdM d'Origine" |
29 | + |
30 | +#. modules: purchase, purchase_followup, purchase_override |
31 | +#: field:purchase.order.line,original_currency_id:0 |
32 | +#: report:addons/purchase_followup/report/po_track_changes_report_xls.mako:244 |
33 | +#: field:purchase.order.merged.line,original_currency_id:0 |
34 | +msgid "Original Currency" |
35 | +msgstr "Devise d'Origine" |
36 | + |
37 | +#. modules: purchase, purchase_override, procurement_request |
38 | +#: field:sale.order.line,original_changed:0 |
39 | +#: field:purchase.order.line,original_changed:0 |
40 | +#: field:purchase.order.merged.line,original_changed:0 |
41 | +msgid "Changed" |
42 | +msgstr "Changé" |
43 | + |
44 | +#. modules: sales_followup, purchase, purchase_followup, purchase_override, procurement_request |
45 | +#: field:sale.order.line,original_qty:0 |
46 | +#: field:purchase.order.line,original_qty:0 |
47 | +#: report:addons/purchase_followup/report/po_track_changes_report_xls.mako:239 |
48 | +#: field:purchase.order.merged.line,original_qty:0 |
49 | +#: report:addons/sales_followup/report/ir_track_changes_report_xls.mako:231 |
50 | +msgid "Original Qty" |
51 | +msgstr "Qté d'Origine" |
52 | + |
53 | +#. module: sales_followup |
54 | +#: report:addons/sales_followup/report/ir_track_changes_report_xls.mako:236 |
55 | +msgid "Original Subtotal" |
56 | +msgstr "Sous-Total d'Origine" |
57 | + |
58 | +#. module: purchase_followup |
59 | +#: report:addons/purchase_followup/report/po_track_changes_report_xls.mako:246 |
60 | +msgid "Original Price in functional currency" |
61 | +msgstr "Prix d'Origine en devise fonctionnelle" |
62 | + |
63 | +#. modules: sales_followup, purchase_followup |
64 | +#: report:addons/purchase_followup/report/po_track_changes_report_xls.mako:240 |
65 | +#: report:addons/sales_followup/report/ir_track_changes_report_xls.mako:232 |
66 | +msgid "Original UoM" |
67 | +msgstr "UdM d'Origine" |
68 | + |
69 | +#. modules: sales_followup, purchase_followup |
70 | +#: report:addons/purchase_followup/report/po_track_changes_report_xls.mako:236 |
71 | +#: report:addons/sales_followup/report/ir_track_changes_report_xls.mako:228 |
72 | +msgid "Original Code" |
73 | +msgstr "Code d'Origine" |
74 | + |
75 | +#. modules: sales_followup, purchase_followup |
76 | +#: report:addons/purchase_followup/report/po_track_changes_report_xls.mako:243 |
77 | +#: report:addons/sales_followup/report/ir_track_changes_report_xls.mako:234 |
78 | +msgid "Original Unit Price" |
79 | +msgstr "Prix Unitaire d'Origine" |
80 | + |
81 | +#. module: purchase_followup |
82 | +#: report:addons/purchase_followup/report/po_track_changes_report_xls.mako:248 |
83 | +msgid "Original Subtotal (functional currency)" |
84 | +msgstr "Sous-Total d'Origine (devise fonctionnelle)" |
85 | + |
86 | +#. modules: sales_followup, purchase_followup |
87 | +#: report:addons/purchase_followup/report/po_track_changes_report_xls.mako:241 |
88 | +#: report:addons/sales_followup/report/ir_track_changes_report_xls.mako:233 |
89 | +msgid "Unit Price" |
90 | +msgstr "Prix Unitaire" |
91 | + |
92 | +#. modules: sales_followup, purchase_followup |
93 | +#: report:addons/purchase_followup/report/po_track_changes_report_xls.mako:231 |
94 | +#: report:addons/sales_followup/report/ir_track_changes_report_xls.mako:223 |
95 | +msgid "Order ref" |
96 | +msgstr "Ref commande" |
97 | + |
98 | +#. modules: sales_followup, purchase_followup |
99 | +#: report:addons/purchase_followup/report/po_track_changes_report_xls.mako:192 |
100 | +#: report:addons/sales_followup/report/ir_track_changes_report_xls.mako:184 |
101 | +msgid "Address:" |
102 | +msgstr "Adresse:" |
103 | + |
104 | +#. modules: sales_followup, purchase_followup |
105 | +#: report:addons/purchase_followup/report/po_track_changes_report_xls.mako:181 |
106 | +#: report:addons/sales_followup/report/ir_track_changes_report_xls.mako:173 |
107 | +msgid "Name:" |
108 | +msgstr "Nom:" |
109 | + |
110 | +#. modules: sales_followup, purchase_followup |
111 | +#: report:addons/purchase_followup/report/po_track_changes_report_xls.mako:249 |
112 | +#: report:addons/sales_followup/report/ir_track_changes_report_xls.mako:237 |
113 | +msgid "Modification comment" |
114 | +msgstr "Commentaire de modification" |
115 | + |
116 | +#. module: sales_followup |
117 | +#: model:ir.actions.report.xml,name:sales_followup.report_ir_track_changes_xls |
118 | +msgid "Internal Request Track Changes Excel Export" |
119 | +msgstr "Export Excel du Suivi des Changements des Demandes Internes" |
120 | + |
121 | +#. modules: sales_followup, purchase_followup |
122 | +#: report:addons/purchase_followup/report/po_track_changes_report_xls.mako:176 |
123 | +#: report:addons/sales_followup/report/ir_track_changes_report_xls.mako:168 |
124 | +msgid "Instance information" |
125 | +msgstr "Informations sur l'instance" |
126 | + |
127 | +#. modules: sales_followup, purchase_followup |
128 | +#: report:addons/purchase_followup/report/po_track_changes_report_xls.mako:206 |
129 | +#: report:addons/sales_followup/report/ir_track_changes_report_xls.mako:198 |
130 | +msgid "Order Ref:" |
131 | +msgstr "Ref Commande:" |
132 | + |
133 | +#. modules: sales_followup, purchase_followup |
134 | +#: report:addons/purchase_followup/report/po_track_changes_report_xls.mako:213 |
135 | +#: report:addons/sales_followup/report/ir_track_changes_report_xls.mako:205 |
136 | +msgid "Date of the request:" |
137 | +msgstr "Date de la requête:" |
138 | + |
139 | +#. modules: sales_followup, purchase_followup |
140 | +#: code:addons/purchase_followup/wizard/po_track_changes_wizard.py:94 |
141 | +#: code:addons/sales_followup/wizard/ir_track_changes_wizard.py:94 |
142 | +#, python-format |
143 | +msgid "No data found with these parameters" |
144 | +msgstr "Aucune donnée n'a été trouvée avec ces paramètres" |
145 | + |
146 | +#. module: sales_followup |
147 | +#: report:addons/sales_followup/report/ir_track_changes_report_xls.mako:235 |
148 | +msgid "Subtotal" |
149 | +msgstr "Sous-Total" |
150 | + |
151 | +#. modules: sales_followup, purchase_followup |
152 | +#: report:addons/purchase_followup/report/po_track_changes_report_xls.mako:195 |
153 | +#: report:addons/sales_followup/report/ir_track_changes_report_xls.mako:187 |
154 | +msgid "Date end:" |
155 | +msgstr "Date de fin:" |
156 | + |
157 | +#. modules: sales_followup |
158 | +#: report:addons/sales_followup/report/ir_track_changes_report_xls.mako:229 |
159 | +#, python-format |
160 | +msgid "Qty" |
161 | +msgstr "Qté" |
162 | + |
163 | +#. modules: sales_followup, purchase_followup |
164 | +#: report:addons/purchase_followup/report/po_track_changes_report_xls.mako:178 |
165 | +#: view:po.track.changes.wizard:0 |
166 | +#: report:addons/sales_followup/report/ir_track_changes_report_xls.mako:170 |
167 | +#: view:ir.track.changes.wizard:0 |
168 | +msgid "Request parameters" |
169 | +msgstr "Paramètres de la requête" |
170 | + |
171 | +#. modules: sales_followup, purchase_followup |
172 | +#: report:addons/purchase_followup/report/po_track_changes_report_xls.mako:184 |
173 | +#: report:addons/sales_followup/report/ir_track_changes_report_xls.mako:176 |
174 | +msgid "Date start:" |
175 | +msgstr "Date de départ:" |
176 | + |
177 | +#. module: sales_followup |
178 | +#: model:ir.actions.act_window,name:sales_followup.action_ir_track_changes_wizard |
179 | +#: model:ir.ui.menu,name:sales_followup.menu_ir_track_changes |
180 | +msgid "IR Track Changes" |
181 | +msgstr "Suivi Changements Demandes Internes" |
182 | + |
183 | +#. modules: sales_followup, purchase_followup |
184 | +#: report:addons/purchase_followup/report/po_track_changes_report_xls.mako:232 |
185 | +#: report:addons/sales_followup/report/ir_track_changes_report_xls.mako:224 |
186 | +#, python-format |
187 | +msgid "Status" |
188 | +msgstr "État" |
189 | + |
190 | +#. module: purchase_followup |
191 | +#: model:ir.actions.act_window,name:purchase_followup.action_po_track_changes_wizard |
192 | +#: model:ir.ui.menu,name:purchase_followup.menu_po_track_changes |
193 | +msgid "PO Track Changes" |
194 | +msgstr "Suivi Changements Bons de Commande" |
195 | + |
196 | +#. module: purchase_followup |
197 | +#: model:ir.actions.report.xml,name:purchase_followup.report_po_track_changes_xls |
198 | +msgid "Purchase Order Track Changes Excel Export" |
199 | +msgstr "Export Excel du Suivi des Changements des Bons de Commande" |
200 | + |
201 | +#. module: purchase_followup |
202 | +#: report:addons/purchase_followup/report/po_track_changes_report_xls.mako:245 |
203 | +msgid "Price in functional currency" |
204 | +msgstr "Prix dans la devise fonctionnelle" |
205 | + |
206 | +#. modules: purchase_followup |
207 | +#: report:addons/purchase_followup/report/po_track_changes_report_xls.mako:242 |
208 | +msgid "Currency" |
209 | +msgstr "Devise" |
210 | + |
211 | +#. module: purchase_followup |
212 | +#: report:addons/purchase_followup/report/po_track_changes_report_xls.mako:247 |
213 | +msgid "Subtotal (functional currency)" |
214 | +msgstr "Sous-Total (devise fonctionnelle)" |
215 | + |
216 | +#. modules: purchase, purchase_override, sale |
217 | +#: field:purchase.order.line,modification_comment:0 |
218 | +#: field:purchase.order.merged.line,modification_comment:0 |
219 | +#: field:sale.order.line,modification_comment:0 |
220 | +msgid "Modification Comment" |
221 | +msgstr "Commentaire de Modification" |
222 | |
223 | === modified file 'bin/addons/procurement_request/__openerp__.py' |
224 | --- bin/addons/procurement_request/__openerp__.py 2017-09-28 14:05:02 +0000 |
225 | +++ bin/addons/procurement_request/__openerp__.py 2017-10-26 10:06:24 +0000 |
226 | @@ -45,6 +45,7 @@ |
227 | 'procurement_request_sequence.xml', |
228 | 'procurement_request_wizard.xml', |
229 | 'procurement_request_report.xml', |
230 | + 'procurement_request_line_wizard.xml', |
231 | 'wizard/wizard_import_list_view.xml', |
232 | ], |
233 | 'demo_xml': [ |
234 | |
235 | === modified file 'bin/addons/procurement_request/procurement_request.py' |
236 | --- bin/addons/procurement_request/procurement_request.py 2017-10-03 16:01:45 +0000 |
237 | +++ bin/addons/procurement_request/procurement_request.py 2017-10-26 10:06:24 +0000 |
238 | @@ -694,15 +694,44 @@ |
239 | |
240 | for line in self.browse(cr, uid, ids, context=context): |
241 | changed = False |
242 | - if line.modification_comment or (line.original_qty and line.original_price and line.original_uom): |
243 | - if line.modification_comment or line.product_uom_qty != line.original_qty \ |
244 | - or line.price_unit != line.original_price or line.product_uom != line.original_uom: |
245 | - changed = True |
246 | + if line.modification_comment or (line.original_qty and line.product_uom_qty != line.original_qty): |
247 | + changed = True |
248 | |
249 | res[line.id] = changed |
250 | |
251 | return res |
252 | |
253 | + def button_view_changed(self, cr, uid, ids, context=None): |
254 | + """ |
255 | + Launch wizard to display line information |
256 | + """ |
257 | + if not context: |
258 | + context = {} |
259 | + if isinstance(ids, (int, long)): |
260 | + ids = [ids] |
261 | + |
262 | + wiz_obj = self.pool.get('procurement.request.line.wizard') |
263 | + cols = ['product_id', 'original_product', 'product_uom_qty', 'original_qty', 'price_unit', |
264 | + 'original_price', 'product_uom', 'original_uom', 'modification_comment'] |
265 | + sol = self.read(cr, uid, ids[0], cols, context=context) |
266 | + wiz_id = wiz_obj.create(cr, uid, sol, context=context) |
267 | + |
268 | + context.update({ |
269 | + 'active_id': ids[0], |
270 | + 'active_ids': ids, |
271 | + }) |
272 | + |
273 | + return { |
274 | + 'name': _('Original Data Internal Request Line'), |
275 | + 'type': 'ir.actions.act_window', |
276 | + 'res_model': 'procurement.request.line.wizard', |
277 | + 'view_type': 'form', |
278 | + 'view_mode': 'form', |
279 | + 'target': 'new', |
280 | + 'res_id': [wiz_id], |
281 | + 'context': context, |
282 | + } |
283 | + |
284 | _columns = { |
285 | 'cost_price': fields.float(string='Cost price', digits_compute=dp.get_precision('Sale Price Computation')), |
286 | 'procurement_request': fields.boolean(string='Internal Request', readonly=True), |
287 | @@ -715,6 +744,7 @@ |
288 | 'product_id_ok': fields.function(_get_product_id_ok, type="boolean", method=True, string='Product defined?', help='for if true the button "configurator" is hidden'), |
289 | 'product_ok': fields.boolean('Product selected'), |
290 | 'comment_ok': fields.boolean('Comment written'), |
291 | + 'original_product': fields.many2one('product.product', 'Original Product'), |
292 | 'original_qty': fields.float('Original Qty'), |
293 | 'original_price': fields.float('Original Price'), |
294 | 'original_uom': fields.many2one('product.uom', 'Original UOM'), |
295 | |
296 | === added file 'bin/addons/procurement_request/procurement_request_line_wizard.xml' |
297 | --- bin/addons/procurement_request/procurement_request_line_wizard.xml 1970-01-01 00:00:00 +0000 |
298 | +++ bin/addons/procurement_request/procurement_request_line_wizard.xml 2017-10-26 10:06:24 +0000 |
299 | @@ -0,0 +1,25 @@ |
300 | +<?xml version="1.0" encoding="utf-8"?> |
301 | +<openerp> |
302 | + <data> |
303 | + <record model="ir.ui.view" id="procurement_request_line_wizard_form"> |
304 | + <field name="name">procurement.request.line.wizard.form"</field> |
305 | + <field name="model">procurement.request.line.wizard</field> |
306 | + <field name="type">form</field> |
307 | + <field name="arch" type='xml'> |
308 | + <form string="Original Data Internal Request Line"> |
309 | + <field name="product_id" colspan="2"/> |
310 | + <field name="original_product" colspan="2"/> |
311 | + <field name="product_uom_qty" colspan="2"/> |
312 | + <field name="original_qty" colspan="2"/> |
313 | + <field name="price_unit" colspan="2"/> |
314 | + <field name="original_price" colspan="2"/> |
315 | + <field name="product_uom" colspan="2"/> |
316 | + <field name="original_uom" colspan="2"/> |
317 | + <field name="modification_comment" colspan="4"/> |
318 | + <newline/> |
319 | + <button icon="gtk-cancel" special="cancel" string="Close Wizard" colspan="4"/> |
320 | + </form> |
321 | + </field> |
322 | + </record> |
323 | + </data> |
324 | +</openerp> |
325 | \ No newline at end of file |
326 | |
327 | === modified file 'bin/addons/procurement_request/procurement_request_view.xml' |
328 | --- bin/addons/procurement_request/procurement_request_view.xml 2017-10-16 09:46:36 +0000 |
329 | +++ bin/addons/procurement_request/procurement_request_view.xml 2017-10-26 10:06:24 +0000 |
330 | @@ -9,6 +9,7 @@ |
331 | <field name="priority" eval="250" /> |
332 | <field name="arch" type="xml"> |
333 | <form string="Internal Request"> |
334 | + <field name="sourcing_trace_ok" invisible="1" /> |
335 | <group colspan="6" attrs="{'invisible': [('state', 'not in', ['validated', 'validated_p'])]}"> |
336 | <html> |
337 | <p style="text-align:center; color: red; font-weight: bold; font-size: 1.2em;"> |
338 | @@ -34,6 +35,7 @@ |
339 | <field name="fo_to_resource" invisible="1" /> |
340 | <field name="parent_order_name" attrs="{'invisible': [('fo_to_resource', '=', False)]}" /> |
341 | </group> |
342 | + |
343 | <notebook colspan="5"> |
344 | <page string="Products"> |
345 | <button colspan="4" string="Round Qty to SoQ" type="object" name="round_to_soq" icon="gtk-execute" attrs="{'invisible': [('state', '!=', 'draft')]}" /> |
346 | @@ -66,6 +68,8 @@ |
347 | icon="terp-go-week" /> |
348 | <field name="product_uom_qty" on_change="onchange_uom(product_id, product_uom, product_uom_qty)" /> |
349 | <field name="original_changed" readonly="1"/> |
350 | + <button name="button_view_changed" string="View Current/Original" type="object" icon="terp-stock_zoom" |
351 | + attrs="{'invisible': [('original_changed', '=', False)]}"/> |
352 | <field name="price_unit"/> |
353 | <field name="notes" /> |
354 | <field name="display_resourced_orig_line" /> |
355 | @@ -122,6 +126,9 @@ |
356 | <page string="Notes"> |
357 | <field name="notes" nolabel="1" /> |
358 | </page> |
359 | + <page string="Sourcing Logs" attrs="{'invisible': [('sourcing_trace_ok', '=', False)]}"> |
360 | + <field name="sourcing_trace" colspan="4" nolabel="1" /> |
361 | + </page> |
362 | </notebook> |
363 | </form> |
364 | </field> |
365 | |
366 | === modified file 'bin/addons/procurement_request/wizard/__init__.py' |
367 | --- bin/addons/procurement_request/wizard/__init__.py 2011-05-13 14:36:09 +0000 |
368 | +++ bin/addons/procurement_request/wizard/__init__.py 2017-10-26 10:06:24 +0000 |
369 | @@ -23,6 +23,7 @@ |
370 | import wizard_list_to_order |
371 | import wizard_list_to_rfq |
372 | import wizard_import_list |
373 | +import procurement_request_line_wizard |
374 | |
375 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
376 | |
377 | |
378 | === added file 'bin/addons/procurement_request/wizard/procurement_request_line_wizard.py' |
379 | --- bin/addons/procurement_request/wizard/procurement_request_line_wizard.py 1970-01-01 00:00:00 +0000 |
380 | +++ bin/addons/procurement_request/wizard/procurement_request_line_wizard.py 2017-10-26 10:06:24 +0000 |
381 | @@ -0,0 +1,44 @@ |
382 | +# -*- coding: utf-8 -*- |
383 | +############################################################################## |
384 | +# |
385 | +# OpenERP, Open Source Management Solution |
386 | +# Copyright (C) 2011 TeMPO Consulting, MSF |
387 | +# |
388 | +# This program is free software: you can redistribute it and/or modify |
389 | +# it under the terms of the GNU Affero General Public License as |
390 | +# published by the Free Software Foundation, either version 3 of the |
391 | +# License, or (at your option) any later version. |
392 | +# |
393 | +# This program is distributed in the hope that it will be useful, |
394 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
395 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
396 | +# GNU Affero General Public License for more details. |
397 | +# |
398 | +# You should have received a copy of the GNU Affero General Public License |
399 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
400 | +# |
401 | +############################################################################## |
402 | + |
403 | +from osv import osv |
404 | +from osv import fields |
405 | + |
406 | + |
407 | +class procurement_request_line_wizard(osv.osv_memory): |
408 | + _name = 'procurement.request.line.wizard' |
409 | + _description = 'Original Data Internal Request line' |
410 | + |
411 | + _columns = { |
412 | + 'id': fields.integer('id'), |
413 | + 'product_id': fields.many2one('product.product', 'Current Product', readonly=True), |
414 | + 'original_product': fields.many2one('product.product', 'Original Product', readonly=True), |
415 | + 'product_uom_qty': fields.float('Current Qty', readonly=True), |
416 | + 'original_qty': fields.float('Original Qty', readonly=True), |
417 | + 'price_unit': fields.float('Current Price', readonly=True), |
418 | + 'original_price': fields.float('Original Price', readonly=True), |
419 | + 'product_uom': fields.many2one('product.uom', 'Current UOM', readonly=True), |
420 | + 'original_uom': fields.many2one('product.uom', 'Original UOM', readonly=True), |
421 | + 'modification_comment': fields.char('Modification Comment', size=1024, readonly=True), |
422 | + } |
423 | + |
424 | + |
425 | +procurement_request_line_wizard() |
426 | |
427 | === modified file 'bin/addons/purchase/purchase_order_line.py' |
428 | --- bin/addons/purchase/purchase_order_line.py 2017-10-20 12:24:56 +0000 |
429 | +++ bin/addons/purchase/purchase_order_line.py 2017-10-26 10:06:24 +0000 |
430 | @@ -259,15 +259,8 @@ |
431 | |
432 | for line in self.browse(cr, uid, ids, context=context): |
433 | changed = False |
434 | - if line.modification_comment\ |
435 | - or (line.original_qty and line.original_price and line.original_uom and line.original_currency_id): |
436 | - if line.modification_comment or line.product_qty != line.original_qty \ |
437 | - or line.price_unit != line.original_price or line.product_uom != line.original_uom\ |
438 | - or line.currency_id != line.original_currency_id: |
439 | - changed = True |
440 | - elif line.original_qty and line.original_uom and not line.original_price: # From IR |
441 | - if line.original_qty != line.product_qty or line.original_uom.id != line.product_uom.id: |
442 | - changed = True |
443 | + if line.modification_comment or (line.original_qty and line.product_qty != line.original_qty): |
444 | + changed = True |
445 | |
446 | res[line.id] = changed |
447 | return res |
448 | @@ -488,10 +481,10 @@ |
449 | # not replacing the po_state from sale_followup - should ? |
450 | 'po_state_stored': fields.related('order_id', 'state', type='selection', selection=PURCHASE_ORDER_STATE_SELECTION, string='Po State', readonly=True,), |
451 | 'po_partner_type_stored': fields.related('order_id', 'partner_type', type='selection', selection=PARTNER_TYPE, string='Po Partner Type', readonly=True,), |
452 | - |
453 | + 'original_product': fields.many2one('product.product', 'Original Product'), |
454 | 'original_qty': fields.float('Original Qty'), |
455 | 'original_price': fields.float('Original Price'), |
456 | - 'original_uom': fields.many2one('product.uom', 'Original UOM'), |
457 | + 'original_uom': fields.many2one('product.uom', 'Original UoM'), |
458 | 'original_currency_id': fields.many2one('res.currency', 'Original Currency'), |
459 | 'modification_comment': fields.char('Modification Comment', size=1024), |
460 | 'original_changed': fields.function(_check_changed, method=True, string='Changed', type='boolean'), |
461 | @@ -1058,6 +1051,8 @@ |
462 | if vals.get('linked_sol_id'): |
463 | sol_comment = self.pool.get('sale.order.line').read(cr, uid, vals.get('linked_sol_id'), ['comment'], context=context)['comment'] |
464 | vals.update({'comment': sol_comment}) |
465 | + if not product_id and not vals.get('name'): # US-3530 |
466 | + vals.update({'name': 'None'}) |
467 | |
468 | # add the database Id to the sync_order_line_db_id |
469 | po_line_id = super(purchase_order_line, self).create(cr, uid, vals, context=context) |
470 | @@ -1127,9 +1122,9 @@ |
471 | |
472 | default.update({'state': 'draft', 'move_ids': [], 'invoiced': 0, 'invoice_lines': [], 'commitment_line_ids': []}) |
473 | |
474 | - for field in ['origin', 'move_dest_id', 'original_qty', 'original_price', 'original_uom', 'original_currency_id', 'modification_comment', 'sync_linked_sol']: |
475 | + for field in ['origin', 'move_dest_id', 'original_product', 'original_qty', 'original_price', 'original_uom', 'original_currency_id', 'modification_comment', 'sync_linked_sol']: |
476 | if field not in default: |
477 | - default[field]= False |
478 | + default[field] = False |
479 | |
480 | default.update({'sync_order_line_db_id': False, 'set_as_sourced_n': False, 'set_as_validated_n': False, 'linked_sol_id': False, 'link_so_id': False}) |
481 | |
482 | |
483 | === modified file 'bin/addons/purchase/purchase_workflow.py' |
484 | --- bin/addons/purchase/purchase_workflow.py 2017-10-18 07:20:45 +0000 |
485 | +++ bin/addons/purchase/purchase_workflow.py 2017-10-26 10:06:24 +0000 |
486 | @@ -333,6 +333,10 @@ |
487 | 'original_price': pol.price_unit, |
488 | 'original_currency_id': pol.currency_id.id |
489 | } |
490 | + |
491 | + if not pol.original_product: |
492 | + line_update['original_product'] = pol.product_id.id |
493 | + |
494 | if not pol.original_qty: |
495 | line_update['original_qty'] = pol.product_qty |
496 | |
497 | |
498 | === modified file 'bin/addons/purchase_followup/__init__.py' |
499 | --- bin/addons/purchase_followup/__init__.py 2017-09-28 12:19:50 +0000 |
500 | +++ bin/addons/purchase_followup/__init__.py 2017-10-26 10:06:24 +0000 |
501 | @@ -21,5 +21,6 @@ |
502 | |
503 | import purchase_followup |
504 | import report |
505 | +import wizard |
506 | |
507 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
508 | |
509 | === modified file 'bin/addons/purchase_followup/__openerp__.py' |
510 | --- bin/addons/purchase_followup/__openerp__.py 2017-10-09 21:06:10 +0000 |
511 | +++ bin/addons/purchase_followup/__openerp__.py 2017-10-26 10:06:24 +0000 |
512 | @@ -35,7 +35,9 @@ |
513 | 'init_xml' : [ ], |
514 | "update_xml": [ |
515 | "purchase_followup_view.xml", |
516 | - "report/purchase_follow_up_report.xml" |
517 | + "report/purchase_follow_up_report.xml", |
518 | + "report/po_track_changes_report.xml", |
519 | + "wizard/po_track_changes_wizard_view.xml", |
520 | ], |
521 | 'demo_xml' : [ ], |
522 | 'test': [ |
523 | |
524 | === modified file 'bin/addons/purchase_followup/report/__init__.py' |
525 | --- bin/addons/purchase_followup/report/__init__.py 2014-05-07 14:04:54 +0000 |
526 | +++ bin/addons/purchase_followup/report/__init__.py 2017-10-26 10:06:24 +0000 |
527 | @@ -1,1 +1,2 @@ |
528 | import purchase_follow_up_report |
529 | +import po_track_changes_report |
530 | |
531 | === added file 'bin/addons/purchase_followup/report/po_track_changes_report.py' |
532 | --- bin/addons/purchase_followup/report/po_track_changes_report.py 1970-01-01 00:00:00 +0000 |
533 | +++ bin/addons/purchase_followup/report/po_track_changes_report.py 2017-10-26 10:06:24 +0000 |
534 | @@ -0,0 +1,92 @@ |
535 | +# -*- coding: utf-8 -*- |
536 | +############################################################################## |
537 | +# |
538 | +# OpenERP, Open Source Management Solution |
539 | +# Copyright (C) 2011 TeMPO Consulting, MSF. All Rights Reserved |
540 | +# |
541 | +# This program is free software: you can redistribute it and/or modify |
542 | +# it under the terms of the GNU Affero General Public License as |
543 | +# published by the Free Software Foundation, either version 3 of the |
544 | +# License, or (at your option) any later version. |
545 | +# |
546 | +# This program is distributed in the hope that it will be useful, |
547 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
548 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
549 | +# GNU Affero General Public License for more details. |
550 | +# |
551 | +# You should have received a copy of the GNU Affero General Public License |
552 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
553 | +# |
554 | +############################################################################## |
555 | + |
556 | + |
557 | +import time |
558 | +from report import report_sxw |
559 | +from spreadsheet_xml.spreadsheet_xml_write import SpreadsheetReport |
560 | + |
561 | + |
562 | +class po_track_changes_report_parser(report_sxw.rml_parse): |
563 | + def __init__(self, cr, uid, name, context=None): |
564 | + super(po_track_changes_report_parser, self).__init__(cr, uid, name, context=context) |
565 | + self.cr = cr |
566 | + self.uid = uid |
567 | + self.user_company = self._get_user_company() |
568 | + self.localcontext.update({ |
569 | + 'time': time, |
570 | + 'getLines': self._get_po_lines, |
571 | + 'userCompany': self.user_company, |
572 | + 'computeCurrency': self._compute_currency |
573 | + }) |
574 | + |
575 | + def _get_po_lines(self, report): |
576 | + ''' |
577 | + Return the lines for the report |
578 | + ''' |
579 | + result = [] |
580 | + for line in report.po_line_ids: |
581 | + result.append(self.pool.get('purchase.order.line').browse(self.cr, self.uid, line)) |
582 | + |
583 | + return sorted(result, key=lambda r: (r['order_id']['name']), reverse=True) |
584 | + |
585 | + def _get_user_company(self): |
586 | + ''' |
587 | + Return user's current company |
588 | + ''' |
589 | + return self.pool.get('res.users').browse(self.cr, self.uid, self.uid).company_id |
590 | + |
591 | + def _compute_currency(self, pol, original=False): |
592 | + ''' |
593 | + Compute an amount of a given currency to the instance's currency |
594 | + ''' |
595 | + currency_obj = self.pool.get('res.currency') |
596 | + |
597 | + from_currency_id = pol.currency_id.id |
598 | + if original and pol.original_currency_id: |
599 | + from_currency_id = pol.original_currency_id.id |
600 | + |
601 | + context = {'date': pol.date_planned} |
602 | + to_currency_id = self.user_company['currency_id'].id |
603 | + |
604 | + if from_currency_id == to_currency_id: |
605 | + return round(pol.price_unit, 2) |
606 | + |
607 | + return round(currency_obj.compute(self.cr, self.uid, from_currency_id, to_currency_id, pol.price_unit, round=False, context=context), 2) |
608 | + |
609 | + |
610 | +class po_track_changes_report_xls(SpreadsheetReport): |
611 | + def __init__(self, name, table, rml=False, parser=report_sxw.rml_parse, |
612 | + header='external', store=False): |
613 | + super(po_track_changes_report_xls, self).__init__(name, table, |
614 | + rml=rml, parser=parser, header=header, store=store) |
615 | + |
616 | + def create(self, cr, uid, ids, data, context=None): |
617 | + a = super(po_track_changes_report_xls, self).create(cr, uid, ids, |
618 | + data, context) |
619 | + return (a[0], 'xls') |
620 | + |
621 | +po_track_changes_report_xls( |
622 | + 'report.po.track.changes.report_xls', |
623 | + 'po.track.changes.wizard', |
624 | + 'addons/purchase_followup/report/po_track_changes_report_xls.mako', |
625 | + parser=po_track_changes_report_parser, |
626 | + header=False) |
627 | |
628 | === added file 'bin/addons/purchase_followup/report/po_track_changes_report.xml' |
629 | --- bin/addons/purchase_followup/report/po_track_changes_report.xml 1970-01-01 00:00:00 +0000 |
630 | +++ bin/addons/purchase_followup/report/po_track_changes_report.xml 2017-10-26 10:06:24 +0000 |
631 | @@ -0,0 +1,18 @@ |
632 | +<?xml version="1.0" encoding="utf-8" ?> |
633 | +<openerp> |
634 | + <data> |
635 | + |
636 | + <report |
637 | + id="report_po_track_changes_xls" |
638 | + name="po.track.changes.report_xls" |
639 | + model="po.track.changes.wizard" |
640 | + string="Purchase Order Track Changes Excel Export" |
641 | + file="purchase_followup/report/po_track_changes_report_xls.mako" |
642 | + report_type="webkit" |
643 | + header="False" |
644 | + auto="False" |
645 | + menu="False" |
646 | + /> |
647 | + |
648 | + </data> |
649 | +</openerp> |
650 | |
651 | === added file 'bin/addons/purchase_followup/report/po_track_changes_report_xls.mako' |
652 | --- bin/addons/purchase_followup/report/po_track_changes_report_xls.mako 1970-01-01 00:00:00 +0000 |
653 | +++ bin/addons/purchase_followup/report/po_track_changes_report_xls.mako 2017-10-26 10:06:24 +0000 |
654 | @@ -0,0 +1,299 @@ |
655 | +<?xml version="1.0"?> |
656 | +<?mso-application progid="Excel.Sheet"?> |
657 | +<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" |
658 | + xmlns:o="urn:schemas-microsoft-com:office:office" |
659 | + xmlns:x="urn:schemas-microsoft-com:office:excel" |
660 | + xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" |
661 | + xmlns:html="http://www.w3.org/TR/REC-html40"> |
662 | + <DocumentProperties xmlns="urn:schemas-microsoft-com:office:office"> |
663 | + <Author>Unifield</Author> |
664 | + <LastAuthor>MSFUser</LastAuthor> |
665 | + <Created>2014-04-16T22:36:07Z</Created> |
666 | + <Company>Medecins Sans Frontieres</Company> |
667 | + <Version>11.9999</Version> |
668 | + </DocumentProperties> |
669 | + <ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel"> |
670 | + <WindowHeight>11640</WindowHeight> |
671 | + <WindowWidth>15480</WindowWidth> |
672 | + <WindowTopX>120</WindowTopX> |
673 | + <WindowTopY>75</WindowTopY> |
674 | + <ProtectStructure>False</ProtectStructure> |
675 | + <ProtectWindows>False</ProtectWindows> |
676 | + </ExcelWorkbook> |
677 | + <Styles> |
678 | + <Style ss:ID="ssCell"> |
679 | + <Alignment ss:Vertical="Top" ss:WrapText="1"/> |
680 | + <Font ss:Bold="1" /> |
681 | + </Style> |
682 | + <Style ss:ID="ssCellBlue"> |
683 | + <Alignment ss:Vertical="Top" ss:WrapText="1"/> |
684 | + <Font ss:Color="#0000FF" /> |
685 | + </Style> |
686 | + |
687 | + <!-- File header --> |
688 | + <Style ss:ID="big_header"> |
689 | + <Font x:Family="Swiss" ss:Size="14" ss:Bold="1"/> |
690 | + </Style> |
691 | + <Style ss:ID="file_header"> |
692 | + <Font ss:Size="9" /> |
693 | + <Interior ss:Color="#C0C0C0" ss:Pattern="Solid"/> |
694 | + </Style> |
695 | + |
696 | + <!-- Line header --> |
697 | + <Style ss:ID="line_header"> |
698 | + <Borders> |
699 | + <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1"/> |
700 | + <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1"/> |
701 | + <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1"/> |
702 | + <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1"/> |
703 | + </Borders> |
704 | + <Font x:Family="Swiss" ss:Size="8" ss:Bold="1"/> |
705 | + <Interior/> |
706 | + </Style> |
707 | + <Style ss:ID="line_header_orange"> |
708 | + <Borders> |
709 | + <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1"/> |
710 | + <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1"/> |
711 | + <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1"/> |
712 | + <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1"/> |
713 | + </Borders> |
714 | + <Font x:Family="Swiss" ss:Size="8" ss:Bold="1"/> |
715 | + <Interior ss:Color="#F79646" ss:Pattern="Solid"/> |
716 | + </Style> |
717 | + |
718 | + <!-- Lines --> |
719 | + <Style ss:ID="line_left"> |
720 | + <Alignment ss:Horizontal="Left" ss:Vertical="Bottom"/> |
721 | + <Borders> |
722 | + <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1"/> |
723 | + <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1"/> |
724 | + <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1"/> |
725 | + <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1"/> |
726 | + </Borders> |
727 | + <Font ss:Size="8" ss:Color="#0000FF"/> |
728 | + </Style> |
729 | + <Style ss:ID="line_right"> |
730 | + <Alignment ss:Horizontal="Right" ss:Vertical="Bottom"/> |
731 | + <Borders> |
732 | + <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1"/> |
733 | + <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1"/> |
734 | + <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1"/> |
735 | + <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1"/> |
736 | + </Borders> |
737 | + <Font ss:Size="8" ss:Color="#0000FF"/> |
738 | + <NumberFormat ss:Format="#,##0.00"/> |
739 | + </Style> |
740 | + <Style ss:ID="line_center"> |
741 | + <Alignment ss:Horizontal="Center" ss:Vertical="Bottom"/> |
742 | + <Borders> |
743 | + <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1"/> |
744 | + <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1"/> |
745 | + <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1"/> |
746 | + <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1"/> |
747 | + </Borders> |
748 | + <Font ss:Size="8" ss:Color="#0000FF"/> |
749 | + <NumberFormat ss:Format="#,##0.00"/> |
750 | + </Style> |
751 | + <Style ss:ID="line_center_no_digits"> |
752 | + <Alignment ss:Horizontal="Center" ss:Vertical="Bottom"/> |
753 | + <Borders> |
754 | + <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1"/> |
755 | + <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1"/> |
756 | + <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1"/> |
757 | + <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1"/> |
758 | + </Borders> |
759 | + <Font ss:Size="8" ss:Color="#0000FF"/> |
760 | + </Style> |
761 | + <Style ss:ID="line_left_date"> |
762 | + <Alignment ss:Horizontal="Right" ss:Vertical="Bottom"/> |
763 | + <NumberFormat ss:Format="Short Date" /> |
764 | + <Borders> |
765 | + <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1"/> |
766 | + <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1"/> |
767 | + <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1"/> |
768 | + <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1"/> |
769 | + </Borders> |
770 | + <Font ss:Size="8" ss:Color="#0000FF"/> |
771 | + </Style> |
772 | + <Style ss:ID="short_date"> |
773 | + <Alignment ss:Horizontal="Left" ss:Vertical="Center" ss:WrapText="1" /> |
774 | + <NumberFormat ss:Format="Short Date" /> |
775 | + <Font ss:Color="#0000FF" /> |
776 | + </Style> |
777 | +</Styles> |
778 | + |
779 | + |
780 | +% for r in objects: |
781 | +<ss:Worksheet ss:Name="IR Follow Up per Location"> |
782 | + <Table x:FullColumns="1" x:FullRows="1"> |
783 | + ## Order ref |
784 | + <Column ss:AutoFitWidth="1" ss:Width="145.75" /> |
785 | + ## Status |
786 | + <Column ss:AutoFitWidth="1" ss:Width="160.75" /> |
787 | + ## Item |
788 | + <Column ss:AutoFitWidth="1" ss:Width="30.0" /> |
789 | + ## Product code |
790 | + <Column ss:AutoFitWidth="1" ss:Width="70.25" /> |
791 | + ## Product description |
792 | + <Column ss:AutoFitWidth="1" ss:Width="250.25" /> |
793 | + ## Original Product code |
794 | + <Column ss:AutoFitWidth="1" ss:Width="70.25" /> |
795 | + ## Qty |
796 | + <Column ss:AutoFitWidth="1" ss:Width="58.75" /> |
797 | + ## UoM |
798 | + <Column ss:AutoFitWidth="1" ss:Width="58.75" /> |
799 | + ## Original Qty |
800 | + <Column ss:AutoFitWidth="1" ss:Width="63.75" /> |
801 | + ## Original UoM |
802 | + <Column ss:AutoFitWidth="1" ss:Width="63.75" /> |
803 | + ## Price |
804 | + <Column ss:AutoFitWidth="1" ss:Width="75.75" /> |
805 | + ## Currency |
806 | + <Column ss:AutoFitWidth="1" ss:Width="58.75" /> |
807 | + ## Original Price |
808 | + <Column ss:AutoFitWidth="1" ss:Width="85.75" /> |
809 | + ## Original Currency |
810 | + <Column ss:AutoFitWidth="1" ss:Width="90.75" /> |
811 | + ## Price in functional currency |
812 | + <Column ss:AutoFitWidth="1" ss:Width="130.75" /> |
813 | + ## Original Price in functional currency |
814 | + <Column ss:AutoFitWidth="1" ss:Width="160.75" /> |
815 | + ## Subtotal (functional currency) |
816 | + <Column ss:AutoFitWidth="1" ss:Width="140.25" /> |
817 | + ## Original Subtotal (functional currency) |
818 | + <Column ss:AutoFitWidth="1" ss:Width="170.25" /> |
819 | + ## Modification comment |
820 | + <Column ss:AutoFitWidth="1" ss:Width="209.25" /> |
821 | + |
822 | + <Row ss:Height="18"> |
823 | + <Cell ss:StyleID="big_header"><Data ss:Type="String">INTERNAL REQUEST Track Changes report</Data><NamedCell ss:Name="Print_Area"/></Cell> |
824 | + </Row> |
825 | + |
826 | + <Row ss:Height="10"></Row> |
827 | + |
828 | + ## WORKSHEET HEADER |
829 | + <Row> |
830 | + <Cell ss:StyleID="file_header" ss:MergeAcross="1"><Data ss:Type="String">${_('Instance information')|x}</Data></Cell> |
831 | + <Cell ss:StyleID="ssCell"><Data ss:Type="String"></Data></Cell> |
832 | + <Cell ss:StyleID="file_header" ss:MergeAcross="4"><Data ss:Type="String">${_('Request parameters')|x}</Data></Cell> |
833 | + </Row> |
834 | + <Row> |
835 | + <Cell ss:StyleID="ssCell"><Data ss:Type="String">${_('Name:')|x}</Data></Cell> |
836 | + <Cell ss:StyleID="ssCellBlue"><Data ss:Type="String">${r.company_id.instance_id.instance or '-'|x}</Data></Cell> |
837 | + <Cell ss:StyleID="ssCell"><Data ss:Type="String"></Data></Cell> |
838 | + <Cell ss:StyleID="ssCell" ss:MergeAcross="1"><Data ss:Type="String">${_('Date start:')|x}</Data></Cell> |
839 | + % if isDate(r.start_date): |
840 | + <Cell ss:StyleID="short_date" ss:MergeAcross="2"><Data ss:Type="DateTime">${r.start_date|n}T00:00:00.000</Data></Cell> |
841 | + % else: |
842 | + <Cell ss:StyleID="ssCell" ss:MergeAcross="2"><Data ss:Type="String"></Data></Cell> |
843 | + % endif |
844 | + </Row> |
845 | + <Row> |
846 | + <Cell ss:StyleID="ssCell"><Data ss:Type="String">${_('Address:')|x}</Data></Cell> |
847 | + <Cell ss:StyleID="ssCellBlue"><Data ss:Type="String">${r.company_id.partner_id.name or '-'|x}</Data></Cell> |
848 | + <Cell ss:StyleID="ssCell"><Data ss:Type="String"></Data></Cell> |
849 | + <Cell ss:StyleID="ssCell" ss:MergeAcross="1"><Data ss:Type="String">${_('Date end:')|x}</Data></Cell> |
850 | + % if isDate(r.end_date): |
851 | + <Cell ss:StyleID="short_date" ss:MergeAcross="2"><Data ss:Type="DateTime">${r.end_date|n}T00:00:00.000</Data></Cell> |
852 | + % else: |
853 | + <Cell ss:StyleID="ssCell" ss:MergeAcross="2"><Data ss:Type="String"></Data></Cell> |
854 | + % endif |
855 | + </Row> |
856 | + <Row> |
857 | + <Cell ss:StyleID="ssCell"><Data ss:Type="String"></Data></Cell> |
858 | + <Cell ss:StyleID="ssCellBlue"><Data ss:Type="String">${r.company_id.partner_id.address[0].street or ''|x}</Data></Cell> |
859 | + <Cell ss:StyleID="ssCell"><Data ss:Type="String"></Data></Cell> |
860 | + <Cell ss:StyleID="ssCell" ss:MergeAcross="1"><Data ss:Type="String">${_('Order Ref:')|x}</Data></Cell> |
861 | + <Cell ss:StyleID="ssCellBlue" ss:MergeAcross="2"><Data ss:Type="String">${r.po_id.id and r.po_id.name or '-'|x}</Data></Cell> |
862 | + </Row> |
863 | + <Row> |
864 | + <Cell ss:StyleID="ssCell"><Data ss:Type="String"></Data></Cell> |
865 | + <Cell ss:StyleID="ssCellBlue"><Data ss:Type="String">${r.company_id.partner_id.address[0].zip|x} ${r.company_id.partner_id.address[0].city|x}</Data></Cell> |
866 | + <Cell ss:StyleID="ssCell"><Data ss:Type="String"></Data></Cell> |
867 | + <Cell ss:StyleID="ssCell" ss:MergeAcross="1"><Data ss:Type="String">${_('Date of the request:')|x}</Data></Cell> |
868 | + % if r.report_date and isDateTime(r.report_date): |
869 | + <Cell ss:StyleID="short_date" ss:MergeAcross="2"><Data ss:Type="DateTime">${r.report_date[0:10]|n}T${r.report_date[11:19]|n}.000</Data></Cell> |
870 | + % else: |
871 | + <Cell ss:StyleID="ssCell" ss:MergeAcross="2"><Data ss:Type="String"></Data></Cell> |
872 | + % endif |
873 | + </Row> |
874 | + <Row> |
875 | + <Cell ss:StyleID="ssCell"><Data ss:Type="String"></Data></Cell> |
876 | + <Cell ss:StyleID="ssCellBlue"><Data ss:Type="String">${r.company_id.partner_id.address[0].country_id and r.company_id.partner_id.address[0].country_id.name or ''|x}</Data></Cell> |
877 | + <Cell ss:StyleID="ssCell"><Data ss:Type="String"></Data></Cell> |
878 | + <Cell ss:StyleID="ssCell" ss:MergeAcross="1"><Data ss:Type="String"></Data></Cell> |
879 | + <Cell ss:StyleID="ssCell" ss:MergeAcross="2"><Data ss:Type="String"></Data></Cell> |
880 | + </Row> |
881 | + |
882 | + <Row></Row> |
883 | + |
884 | + <Row> |
885 | + <Cell ss:StyleID="line_header"><Data ss:Type="String">${_('Order ref')|x}</Data></Cell> |
886 | + <Cell ss:StyleID="line_header"><Data ss:Type="String">${_('Status')|x}</Data></Cell> |
887 | + <Cell ss:StyleID="line_header"><Data ss:Type="String">${_('Item')|x}</Data></Cell> |
888 | + <Cell ss:StyleID="line_header"><Data ss:Type="String">${_('Code')|x}</Data></Cell> |
889 | + <Cell ss:StyleID="line_header"><Data ss:Type="String">${_('Description')|x}</Data></Cell> |
890 | + <Cell ss:StyleID="line_header"><Data ss:Type="String">${_('Original Code')|x}</Data></Cell> |
891 | + <Cell ss:StyleID="line_header_orange"><Data ss:Type="String">${_('Qty')|x}</Data></Cell> |
892 | + <Cell ss:StyleID="line_header"><Data ss:Type="String">${_('UoM')|x}</Data></Cell> |
893 | + <Cell ss:StyleID="line_header_orange"><Data ss:Type="String">${_('Original Qty')|x}</Data></Cell> |
894 | + <Cell ss:StyleID="line_header"><Data ss:Type="String">${_('Original UoM')|x}</Data></Cell> |
895 | + <Cell ss:StyleID="line_header_orange"><Data ss:Type="String">${_('Unit Price')|x}</Data></Cell> |
896 | + <Cell ss:StyleID="line_header_orange"><Data ss:Type="String">${_('Currency')|x}</Data></Cell> |
897 | + <Cell ss:StyleID="line_header_orange"><Data ss:Type="String">${_('Original Unit Price')|x}</Data></Cell> |
898 | + <Cell ss:StyleID="line_header_orange"><Data ss:Type="String">${_('Original Currency')|x}</Data></Cell> |
899 | + <Cell ss:StyleID="line_header_orange"><Data ss:Type="String">${_('Price in functional currency')|x}</Data></Cell> |
900 | + <Cell ss:StyleID="line_header_orange"><Data ss:Type="String">${_('Original Price in functional currency')|x}</Data></Cell> |
901 | + <Cell ss:StyleID="line_header_orange"><Data ss:Type="String">${_('Subtotal (functional currency)')|x}</Data></Cell> |
902 | + <Cell ss:StyleID="line_header_orange"><Data ss:Type="String">${_('Original Subtotal (functional currency)')|x}</Data></Cell> |
903 | + <Cell ss:StyleID="line_header"><Data ss:Type="String">${_('Modification comment')|x}</Data></Cell> |
904 | + </Row> |
905 | + |
906 | + % for line in getLines(r): |
907 | + <Row ss:Height="11.25"> |
908 | + <Cell ss:StyleID="line_left"><Data ss:Type="String">${line.order_id.name|x}</Data></Cell> |
909 | + <Cell ss:StyleID="line_left"><Data ss:Type="String">${line.state|x}</Data></Cell> |
910 | + <Cell ss:StyleID="line_center_no_digits"><Data ss:Type="Number">${line.line_number|x}</Data></Cell> |
911 | + <Cell ss:StyleID="line_left"><Data ss:Type="String">${line.product_id.default_code or ''|x}</Data></Cell> |
912 | + <Cell ss:StyleID="line_left"><Data ss:Type="String">${line.name|x}</Data></Cell> |
913 | + % if line.original_product and line.product_id.default_code != line.original_product.default_code: |
914 | + <Cell ss:StyleID="line_left"><Data ss:Type="String">${line.original_product.default_code or ''|x}</Data></Cell> |
915 | + % else: |
916 | + <Cell ss:StyleID="line_left"><Data ss:Type="String"></Data></Cell> |
917 | + % endif |
918 | + <Cell ss:StyleID="line_left"><Data ss:Type="Number">${line.product_qty|x}</Data></Cell> |
919 | + <Cell ss:StyleID="line_left"><Data ss:Type="String">${line.product_uom.name|x}</Data></Cell> |
920 | + <Cell ss:StyleID="line_left"><Data ss:Type="Number">${line.original_qty or 0|x}</Data></Cell> |
921 | + <Cell ss:StyleID="line_left"><Data ss:Type="String">${line.original_uom.name or ''|x}</Data></Cell> |
922 | + <Cell ss:StyleID="line_center"><Data ss:Type="Number">${line.price_unit|x}</Data></Cell> |
923 | + <Cell ss:StyleID="line_center"><Data ss:Type="String">${line.currency_id.name|x}</Data></Cell> |
924 | + <Cell ss:StyleID="line_center"><Data ss:Type="Number">${line.original_price or 0|x}</Data></Cell> |
925 | + <Cell ss:StyleID="line_center"><Data ss:Type="String">${line.original_currency_id and line.original_currency_id.name or ''|x}</Data></Cell> |
926 | + <Cell ss:StyleID="line_center"><Data ss:Type="Number">${computeCurrency(line, False)|x}</Data></Cell> |
927 | + <Cell ss:StyleID="line_center"><Data ss:Type="Number">${computeCurrency(line, True)|x}</Data></Cell> |
928 | + <Cell ss:StyleID="line_center"><Data ss:Type="Number">${computeCurrency(line, False) * line.product_qty|x}</Data></Cell> |
929 | + <Cell ss:StyleID="line_center"><Data ss:Type="Number">${computeCurrency(line, True) * line.original_qty|x}</Data></Cell> |
930 | + <Cell ss:StyleID="line_left"><Data ss:Type="String">${line.modification_comment or ''|x}</Data></Cell> |
931 | + </Row> |
932 | + % endfor |
933 | + |
934 | + </Table> |
935 | + |
936 | + <WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel"> |
937 | + <PageSetup> |
938 | + <Layout x:Orientation="Landscape"/> |
939 | + <Footer x:Data="Page &P of &N"/> |
940 | + </PageSetup> |
941 | + <Selected/> |
942 | + <Panes> |
943 | + <Pane> |
944 | + <Number>3</Number> |
945 | + <ActiveRow>21</ActiveRow> |
946 | + </Pane> |
947 | + </Panes> |
948 | + <ProtectObjects>False</ProtectObjects> |
949 | + <ProtectScenarios>False</ProtectScenarios> |
950 | + </WorksheetOptions> |
951 | +</ss:Worksheet> |
952 | +% endfor |
953 | +</Workbook> |
954 | |
955 | === added directory 'bin/addons/purchase_followup/wizard' |
956 | === added file 'bin/addons/purchase_followup/wizard/__init__.py' |
957 | --- bin/addons/purchase_followup/wizard/__init__.py 1970-01-01 00:00:00 +0000 |
958 | +++ bin/addons/purchase_followup/wizard/__init__.py 2017-10-26 10:06:24 +0000 |
959 | @@ -0,0 +1,22 @@ |
960 | +# -*- coding: utf-8 -*- |
961 | +############################################################################## |
962 | +# |
963 | +# OpenERP, Open Source Management Solution |
964 | +# Copyright (C) 2011 TeMPO Consulting, MSF |
965 | +# |
966 | +# This program is free software: you can redistribute it and/or modify |
967 | +# it under the terms of the GNU Affero General Public License as |
968 | +# published by the Free Software Foundation, either version 3 of the |
969 | +# License, or (at your option) any later version. |
970 | +# |
971 | +# This program is distributed in the hope that it will be useful, |
972 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
973 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
974 | +# GNU Affero General Public License for more details. |
975 | +# |
976 | +# You should have received a copy of the GNU Affero General Public License |
977 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
978 | +# |
979 | +############################################################################## |
980 | + |
981 | +import po_track_changes_wizard |
982 | |
983 | === added file 'bin/addons/purchase_followup/wizard/po_track_changes_wizard.py' |
984 | --- bin/addons/purchase_followup/wizard/po_track_changes_wizard.py 1970-01-01 00:00:00 +0000 |
985 | +++ bin/addons/purchase_followup/wizard/po_track_changes_wizard.py 2017-10-26 10:06:24 +0000 |
986 | @@ -0,0 +1,130 @@ |
987 | +# -*- coding: utf-8 -*- |
988 | +############################################################################## |
989 | +# |
990 | +# OpenERP, Open Source Management Solution |
991 | +# Copyright (C) 2011 TeMPO Consulting, MSF |
992 | +# |
993 | +# This program is free software: you can redistribute it and/or modify |
994 | +# it under the terms of the GNU Affero General Public License as |
995 | +# published by the Free Software Foundation, either version 3 of the |
996 | +# License, or (at your option) any later version. |
997 | +# |
998 | +# This program is distributed in the hope that it will be useful, |
999 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
1000 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1001 | +# GNU Affero General Public License for more details. |
1002 | +# |
1003 | +# You should have received a copy of the GNU Affero General Public License |
1004 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
1005 | +# |
1006 | +############################################################################## |
1007 | + |
1008 | +from osv import osv |
1009 | +from osv import fields |
1010 | +from tools.translate import _ |
1011 | + |
1012 | +import time |
1013 | + |
1014 | + |
1015 | +class po_track_changes_wizard(osv.osv_memory): |
1016 | + _name = 'po.track.changes.wizard' |
1017 | + _rec_name = 'report_date' |
1018 | + _order = 'report_date desc' |
1019 | + |
1020 | + _columns = { |
1021 | + 'report_date': fields.datetime( |
1022 | + string='Date of the demand', |
1023 | + readonly=True, |
1024 | + ), |
1025 | + 'company_id': fields.many2one( |
1026 | + 'res.company', |
1027 | + string='Company', |
1028 | + readonly=True, |
1029 | + ), |
1030 | + 'start_date': fields.date( |
1031 | + string='Start date', |
1032 | + ), |
1033 | + 'end_date': fields.date( |
1034 | + string='End date', |
1035 | + ), |
1036 | + 'po_line_ids': fields.text( |
1037 | + string='Purchase Orders Lines', |
1038 | + readonly=True |
1039 | + ), |
1040 | + 'po_id': fields.many2one( |
1041 | + 'purchase.order', |
1042 | + string='Purchase Order Ref.', |
1043 | + ), |
1044 | + } |
1045 | + |
1046 | + _defaults = { |
1047 | + 'report_date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'), |
1048 | + 'company_id': lambda self, cr, uid, ids, c={}: self.pool.get('res.users').browse(cr, uid, uid).company_id.id, |
1049 | + } |
1050 | + |
1051 | + def get_values(self, cr, uid, ids, context=None): |
1052 | + ''' |
1053 | + Retrieve the data according to values in wizard |
1054 | + ''' |
1055 | + po_line_obj = self.pool.get('purchase.order.line') |
1056 | + |
1057 | + if context is None: |
1058 | + context = {} |
1059 | + |
1060 | + if isinstance(ids, (int, long)): |
1061 | + ids = [ids] |
1062 | + |
1063 | + for wizard in self.browse(cr, uid, ids, context=context): |
1064 | + po_domain = [] |
1065 | + |
1066 | + if wizard.start_date: |
1067 | + po_domain.append(('create_date', '>=', wizard.start_date)) |
1068 | + |
1069 | + if wizard.end_date: |
1070 | + po_domain.append(('create_date', '<=', wizard.end_date)) |
1071 | + |
1072 | + if wizard.po_id: |
1073 | + po_domain.append(('order_id', '=', wizard.po_id.id)) |
1074 | + |
1075 | + po_line_ids = po_line_obj.search(cr, uid, po_domain, context=context) |
1076 | + |
1077 | + if not po_line_ids: |
1078 | + raise osv.except_osv( |
1079 | + _('Error'), |
1080 | + _('No data found with these parameters'), |
1081 | + ) |
1082 | + |
1083 | + self.write(cr, uid, [wizard.id], {'po_line_ids': po_line_ids}, context=context) |
1084 | + |
1085 | + return True |
1086 | + |
1087 | + def print_excel(self, cr, uid, ids, context=None): |
1088 | + ''' |
1089 | + Retrieve the data according to values in wizard |
1090 | + and print the report in Excel format. |
1091 | + ''' |
1092 | + if context is None: |
1093 | + context = {} |
1094 | + |
1095 | + if isinstance(ids, (int, long)): |
1096 | + ids = [ids] |
1097 | + |
1098 | + self.get_values(cr, uid, ids, context=context) |
1099 | + |
1100 | + background_id = self.pool.get('memory.background.report').create(cr, uid, { |
1101 | + 'file_name': 'PURCHASE ORDER Track Changes report', |
1102 | + 'report_name': 'po.track.changes.report_xls', |
1103 | + }, context=context) |
1104 | + context['background_id'] = background_id |
1105 | + context['background_time'] = 3 |
1106 | + |
1107 | + data = {'ids': ids, 'context': context} |
1108 | + return { |
1109 | + 'type': 'ir.actions.report.xml', |
1110 | + 'report_name': 'po.track.changes.report_xls', |
1111 | + 'datas': data, |
1112 | + 'context': context, |
1113 | + } |
1114 | + |
1115 | + |
1116 | +po_track_changes_wizard() |
1117 | |
1118 | === added file 'bin/addons/purchase_followup/wizard/po_track_changes_wizard_view.xml' |
1119 | --- bin/addons/purchase_followup/wizard/po_track_changes_wizard_view.xml 1970-01-01 00:00:00 +0000 |
1120 | +++ bin/addons/purchase_followup/wizard/po_track_changes_wizard_view.xml 2017-10-26 10:06:24 +0000 |
1121 | @@ -0,0 +1,39 @@ |
1122 | +<?xml version="1.0" encoding="utf-8"?> |
1123 | +<openerp> |
1124 | + |
1125 | + <data> |
1126 | + |
1127 | + <record id="po_track_changes_wizard_form_view" model="ir.ui.view"> |
1128 | + <field name="name">po.track.changes.wizard.form.view</field> |
1129 | + <field name="model">po.track.changes.wizard</field> |
1130 | + <field name="type">form</field> |
1131 | + <field name="arch" type="xml"> |
1132 | + <form string="PURCHASE ORDER Track Changes"> |
1133 | + <separator colspan="4" string="Request parameters" /> |
1134 | + <field name="start_date" /> |
1135 | + <field name="end_date" /> |
1136 | + <field name="po_id" /> |
1137 | + <separator colspan="4" string="Actions" /> |
1138 | + <button name="print_excel" string="Excel report" icon="gtk-print" type="object" colspan="4" /> |
1139 | + </form> |
1140 | + </field> |
1141 | + </record> |
1142 | + |
1143 | + <record id="action_po_track_changes_wizard" model="ir.actions.act_window"> |
1144 | + <field name="name">PO Track Changes</field> |
1145 | + <field name="res_model">po.track.changes.wizard</field> |
1146 | + <field name="view_type">form</field> |
1147 | + <field name="view_mode">form</field> |
1148 | + <field name="target">new</field> |
1149 | + </record> |
1150 | + |
1151 | + <menuitem |
1152 | + id="menu_po_track_changes" |
1153 | + action="action_po_track_changes_wizard" |
1154 | + parent="purchase.menu_procurement_management" |
1155 | + sequence="2" |
1156 | + /> |
1157 | + |
1158 | + </data> |
1159 | + |
1160 | +</openerp> |
1161 | |
1162 | === modified file 'bin/addons/sale/sale_order.py' |
1163 | --- bin/addons/sale/sale_order.py 2017-10-19 07:42:45 +0000 |
1164 | +++ bin/addons/sale/sale_order.py 2017-10-26 10:06:24 +0000 |
1165 | @@ -2104,7 +2104,7 @@ |
1166 | 'set_as_sourced_n': False, |
1167 | }) |
1168 | |
1169 | - for x in ['modification_comment', 'original_qty', 'original_price', 'original_uom', 'sync_linked_pol', 'resourced_original_line']: |
1170 | + for x in ['modification_comment', 'original_product', 'original_qty', 'original_price', 'original_uom', 'sync_linked_pol', 'resourced_original_line']: |
1171 | if x not in default: |
1172 | default[x] = False |
1173 | |
1174 | |
1175 | === modified file 'bin/addons/sale/sale_workflow.py' |
1176 | --- bin/addons/sale/sale_workflow.py 2017-10-13 14:36:52 +0000 |
1177 | +++ bin/addons/sale/sale_workflow.py 2017-10-26 10:06:24 +0000 |
1178 | @@ -345,6 +345,7 @@ |
1179 | to_write['type'] = 'make_to_stock' |
1180 | |
1181 | elif sol.procurement_request: # in case of IR |
1182 | + to_write['original_product'] = sol.product_id.id |
1183 | to_write['original_qty'] = sol.product_uom_qty |
1184 | to_write['original_price'] = sol.price_unit |
1185 | to_write['original_uom'] = sol.product_uom.id |
1186 | |
1187 | === modified file 'bin/addons/sales_followup/__openerp__.py' |
1188 | --- bin/addons/sales_followup/__openerp__.py 2017-09-28 14:05:02 +0000 |
1189 | +++ bin/addons/sales_followup/__openerp__.py 2017-10-26 10:06:24 +0000 |
1190 | @@ -44,8 +44,10 @@ |
1191 | "sale_followup_view.xml", |
1192 | "report/sale_follow_up_report.xml", |
1193 | "report/ir_follow_up_location_report.xml", |
1194 | + "report/ir_track_changes_report.xml", |
1195 | "wizard/sale_followup_multi_wizard_view.xml", |
1196 | "wizard/ir_followup_location_wizard_view.xml", |
1197 | + "wizard/ir_track_changes_wizard_view.xml", |
1198 | ], |
1199 | "demo_xml": [ |
1200 | ], |
1201 | |
1202 | === modified file 'bin/addons/sales_followup/report/__init__.py' |
1203 | --- bin/addons/sales_followup/report/__init__.py 2017-08-18 14:31:17 +0000 |
1204 | +++ bin/addons/sales_followup/report/__init__.py 2017-10-26 10:06:24 +0000 |
1205 | @@ -22,3 +22,4 @@ |
1206 | import sale_follow_up_report |
1207 | import sale_follow_up_report_multi |
1208 | import ir_follow_up_location_report |
1209 | +import ir_track_changes_report |
1210 | |
1211 | === added file 'bin/addons/sales_followup/report/ir_track_changes_report.py' |
1212 | --- bin/addons/sales_followup/report/ir_track_changes_report.py 1970-01-01 00:00:00 +0000 |
1213 | +++ bin/addons/sales_followup/report/ir_track_changes_report.py 2017-10-26 10:06:24 +0000 |
1214 | @@ -0,0 +1,73 @@ |
1215 | +# -*- coding: utf-8 -*- |
1216 | +############################################################################## |
1217 | +# |
1218 | +# OpenERP, Open Source Management Solution |
1219 | +# Copyright (C) 2011 TeMPO Consulting, MSF. All Rights Reserved |
1220 | +# |
1221 | +# This program is free software: you can redistribute it and/or modify |
1222 | +# it under the terms of the GNU Affero General Public License as |
1223 | +# published by the Free Software Foundation, either version 3 of the |
1224 | +# License, or (at your option) any later version. |
1225 | +# |
1226 | +# This program is distributed in the hope that it will be useful, |
1227 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
1228 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1229 | +# GNU Affero General Public License for more details. |
1230 | +# |
1231 | +# You should have received a copy of the GNU Affero General Public License |
1232 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
1233 | +# |
1234 | +############################################################################## |
1235 | + |
1236 | + |
1237 | +import time |
1238 | +from report import report_sxw |
1239 | +from spreadsheet_xml.spreadsheet_xml_write import SpreadsheetReport |
1240 | + |
1241 | + |
1242 | +class ir_track_changes_report_parser(report_sxw.rml_parse): |
1243 | + def __init__(self, cr, uid, name, context=None): |
1244 | + super(ir_track_changes_report_parser, self).__init__(cr, uid, name, context=context) |
1245 | + self.cr = cr |
1246 | + self.uid = uid |
1247 | + self.user_company = self._get_user_company() |
1248 | + self.localcontext.update({ |
1249 | + 'time': time, |
1250 | + 'getLines': self._get_ir_lines, |
1251 | + 'userCompany': self.user_company, |
1252 | + }) |
1253 | + |
1254 | + def _get_ir_lines(self, report): |
1255 | + ''' |
1256 | + Return the lines for the report |
1257 | + ''' |
1258 | + result = [] |
1259 | + for line in report.order_line_ids: |
1260 | + result.append(self.pool.get('sale.order.line').browse(self.cr, self.uid, line)) |
1261 | + |
1262 | + return sorted(result, key=lambda r: (r['order_id']['name']), reverse=True) |
1263 | + |
1264 | + def _get_user_company(self): |
1265 | + ''' |
1266 | + Return user's current company |
1267 | + ''' |
1268 | + return self.pool.get('res.users').browse(self.cr, self.uid, self.uid).company_id |
1269 | + |
1270 | + |
1271 | +class ir_track_changes_report_xls(SpreadsheetReport): |
1272 | + def __init__(self, name, table, rml=False, parser=report_sxw.rml_parse, |
1273 | + header='external', store=False): |
1274 | + super(ir_track_changes_report_xls, self).__init__(name, table, |
1275 | + rml=rml, parser=parser, header=header, store=store) |
1276 | + |
1277 | + def create(self, cr, uid, ids, data, context=None): |
1278 | + a = super(ir_track_changes_report_xls, self).create(cr, uid, ids, |
1279 | + data, context) |
1280 | + return (a[0], 'xls') |
1281 | + |
1282 | +ir_track_changes_report_xls( |
1283 | + 'report.ir.track.changes.report_xls', |
1284 | + 'ir.track.changes.wizard', |
1285 | + 'addons/sales_followup/report/ir_track_changes_report_xls.mako', |
1286 | + parser=ir_track_changes_report_parser, |
1287 | + header=False) |
1288 | |
1289 | === added file 'bin/addons/sales_followup/report/ir_track_changes_report.xml' |
1290 | --- bin/addons/sales_followup/report/ir_track_changes_report.xml 1970-01-01 00:00:00 +0000 |
1291 | +++ bin/addons/sales_followup/report/ir_track_changes_report.xml 2017-10-26 10:06:24 +0000 |
1292 | @@ -0,0 +1,18 @@ |
1293 | +<?xml version="1.0" encoding="utf-8" ?> |
1294 | +<openerp> |
1295 | + <data> |
1296 | + |
1297 | + <report |
1298 | + id="report_ir_track_changes_xls" |
1299 | + name="ir.track.changes.report_xls" |
1300 | + model="ir.track.changes.wizard" |
1301 | + string="Internal Request Track Changes Excel Export" |
1302 | + file="sales_followup/report/ir_track_changes_report_xls.mako" |
1303 | + report_type="webkit" |
1304 | + header="False" |
1305 | + auto="False" |
1306 | + menu="False" |
1307 | + /> |
1308 | + |
1309 | + </data> |
1310 | +</openerp> |
1311 | |
1312 | === added file 'bin/addons/sales_followup/report/ir_track_changes_report_xls.mako' |
1313 | --- bin/addons/sales_followup/report/ir_track_changes_report_xls.mako 1970-01-01 00:00:00 +0000 |
1314 | +++ bin/addons/sales_followup/report/ir_track_changes_report_xls.mako 2017-10-26 10:06:24 +0000 |
1315 | @@ -0,0 +1,283 @@ |
1316 | +<?xml version="1.0"?> |
1317 | +<?mso-application progid="Excel.Sheet"?> |
1318 | +<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" |
1319 | + xmlns:o="urn:schemas-microsoft-com:office:office" |
1320 | + xmlns:x="urn:schemas-microsoft-com:office:excel" |
1321 | + xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" |
1322 | + xmlns:html="http://www.w3.org/TR/REC-html40"> |
1323 | + <DocumentProperties xmlns="urn:schemas-microsoft-com:office:office"> |
1324 | + <Author>Unifield</Author> |
1325 | + <LastAuthor>MSFUser</LastAuthor> |
1326 | + <Created>2014-04-16T22:36:07Z</Created> |
1327 | + <Company>Medecins Sans Frontieres</Company> |
1328 | + <Version>11.9999</Version> |
1329 | + </DocumentProperties> |
1330 | + <ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel"> |
1331 | + <WindowHeight>11640</WindowHeight> |
1332 | + <WindowWidth>15480</WindowWidth> |
1333 | + <WindowTopX>120</WindowTopX> |
1334 | + <WindowTopY>75</WindowTopY> |
1335 | + <ProtectStructure>False</ProtectStructure> |
1336 | + <ProtectWindows>False</ProtectWindows> |
1337 | + </ExcelWorkbook> |
1338 | + <Styles> |
1339 | + <Style ss:ID="ssCell"> |
1340 | + <Alignment ss:Vertical="Top" ss:WrapText="1"/> |
1341 | + <Font ss:Bold="1" /> |
1342 | + </Style> |
1343 | + <Style ss:ID="ssCellBlue"> |
1344 | + <Alignment ss:Vertical="Top" ss:WrapText="1"/> |
1345 | + <Font ss:Color="#0000FF" /> |
1346 | + </Style> |
1347 | + |
1348 | + <!-- File header --> |
1349 | + <Style ss:ID="big_header"> |
1350 | + <Font x:Family="Swiss" ss:Size="14" ss:Bold="1"/> |
1351 | + </Style> |
1352 | + <Style ss:ID="file_header"> |
1353 | + <Font ss:Size="9" /> |
1354 | + <Interior ss:Color="#C0C0C0" ss:Pattern="Solid"/> |
1355 | + </Style> |
1356 | + |
1357 | + <!-- Line header --> |
1358 | + <Style ss:ID="line_header"> |
1359 | + <Borders> |
1360 | + <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1"/> |
1361 | + <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1"/> |
1362 | + <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1"/> |
1363 | + <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1"/> |
1364 | + </Borders> |
1365 | + <Font x:Family="Swiss" ss:Size="8" ss:Bold="1"/> |
1366 | + <Interior/> |
1367 | + </Style> |
1368 | + <Style ss:ID="line_header_orange"> |
1369 | + <Borders> |
1370 | + <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1"/> |
1371 | + <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1"/> |
1372 | + <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1"/> |
1373 | + <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1"/> |
1374 | + </Borders> |
1375 | + <Font x:Family="Swiss" ss:Size="8" ss:Bold="1"/> |
1376 | + <Interior ss:Color="#F79646" ss:Pattern="Solid"/> |
1377 | + </Style> |
1378 | + |
1379 | + <!-- Lines --> |
1380 | + <Style ss:ID="line_left"> |
1381 | + <Alignment ss:Horizontal="Left" ss:Vertical="Bottom"/> |
1382 | + <Borders> |
1383 | + <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1"/> |
1384 | + <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1"/> |
1385 | + <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1"/> |
1386 | + <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1"/> |
1387 | + </Borders> |
1388 | + <Font ss:Size="8" ss:Color="#0000FF"/> |
1389 | + </Style> |
1390 | + <Style ss:ID="line_right"> |
1391 | + <Alignment ss:Horizontal="Right" ss:Vertical="Bottom"/> |
1392 | + <Borders> |
1393 | + <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1"/> |
1394 | + <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1"/> |
1395 | + <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1"/> |
1396 | + <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1"/> |
1397 | + </Borders> |
1398 | + <Font ss:Size="8" ss:Color="#0000FF"/> |
1399 | + <NumberFormat ss:Format="#,##0.00"/> |
1400 | + </Style> |
1401 | + <Style ss:ID="line_center"> |
1402 | + <Alignment ss:Horizontal="Center" ss:Vertical="Bottom"/> |
1403 | + <Borders> |
1404 | + <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1"/> |
1405 | + <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1"/> |
1406 | + <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1"/> |
1407 | + <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1"/> |
1408 | + </Borders> |
1409 | + <Font ss:Size="8" ss:Color="#0000FF"/> |
1410 | + <NumberFormat ss:Format="#,##0.00"/> |
1411 | + </Style> |
1412 | + <Style ss:ID="line_center_no_digits"> |
1413 | + <Alignment ss:Horizontal="Center" ss:Vertical="Bottom"/> |
1414 | + <Borders> |
1415 | + <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1"/> |
1416 | + <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1"/> |
1417 | + <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1"/> |
1418 | + <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1"/> |
1419 | + </Borders> |
1420 | + <Font ss:Size="8" ss:Color="#0000FF"/> |
1421 | + </Style> |
1422 | + <Style ss:ID="line_left_date"> |
1423 | + <Alignment ss:Horizontal="Right" ss:Vertical="Bottom"/> |
1424 | + <NumberFormat ss:Format="Short Date" /> |
1425 | + <Borders> |
1426 | + <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1"/> |
1427 | + <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1"/> |
1428 | + <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1"/> |
1429 | + <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1"/> |
1430 | + </Borders> |
1431 | + <Font ss:Size="8" ss:Color="#0000FF"/> |
1432 | + </Style> |
1433 | + <Style ss:ID="short_date"> |
1434 | + <Alignment ss:Horizontal="Left" ss:Vertical="Center" ss:WrapText="1" /> |
1435 | + <NumberFormat ss:Format="Short Date" /> |
1436 | + <Font ss:Color="#0000FF" /> |
1437 | + </Style> |
1438 | +</Styles> |
1439 | + |
1440 | + |
1441 | +% for r in objects: |
1442 | +<ss:Worksheet ss:Name="IR Follow Up per Location"> |
1443 | + <Table x:FullColumns="1" x:FullRows="1"> |
1444 | + ## Order ref |
1445 | + <Column ss:AutoFitWidth="1" ss:Width="80.0" /> |
1446 | + ## Status |
1447 | + <Column ss:AutoFitWidth="1" ss:Width="160.75" /> |
1448 | + ## Item |
1449 | + <Column ss:AutoFitWidth="1" ss:Width="30.0" /> |
1450 | + ## Product code |
1451 | + <Column ss:AutoFitWidth="1" ss:Width="70.25" /> |
1452 | + ## Product description |
1453 | + <Column ss:AutoFitWidth="1" ss:Width="250.25" /> |
1454 | + ## Original Product code |
1455 | + <Column ss:AutoFitWidth="1" ss:Width="70.25" /> |
1456 | + ## Qty |
1457 | + <Column ss:AutoFitWidth="1" ss:Width="58.75" /> |
1458 | + ## UoM |
1459 | + <Column ss:AutoFitWidth="1" ss:Width="58.75" /> |
1460 | + ## Original Qty |
1461 | + <Column ss:AutoFitWidth="1" ss:Width="63.75" /> |
1462 | + ## Original UoM |
1463 | + <Column ss:AutoFitWidth="1" ss:Width="63.75" /> |
1464 | + ## Price |
1465 | + <Column ss:AutoFitWidth="1" ss:Width="75.75" /> |
1466 | + ## Original Price |
1467 | + <Column ss:AutoFitWidth="1" ss:Width="85.75" /> |
1468 | + ## Subtotal |
1469 | + <Column ss:AutoFitWidth="1" ss:Width="85.75" /> |
1470 | + ## Original Subtotal |
1471 | + <Column ss:AutoFitWidth="1" ss:Width="75.25" /> |
1472 | + ## Modification comment |
1473 | + <Column ss:AutoFitWidth="1" ss:Width="209.25" /> |
1474 | + |
1475 | + <Row ss:Height="18"> |
1476 | + <Cell ss:StyleID="big_header"><Data ss:Type="String">INTERNAL REQUEST Track Changes report</Data><NamedCell ss:Name="Print_Area"/></Cell> |
1477 | + </Row> |
1478 | + |
1479 | + <Row ss:Height="10"></Row> |
1480 | + |
1481 | + ## WORKSHEET HEADER |
1482 | + <Row> |
1483 | + <Cell ss:StyleID="file_header" ss:MergeAcross="1"><Data ss:Type="String">${_('Instance information')|x}</Data></Cell> |
1484 | + <Cell ss:StyleID="ssCell"><Data ss:Type="String"></Data></Cell> |
1485 | + <Cell ss:StyleID="file_header" ss:MergeAcross="4"><Data ss:Type="String">${_('Request parameters')|x}</Data></Cell> |
1486 | + </Row> |
1487 | + <Row> |
1488 | + <Cell ss:StyleID="ssCell"><Data ss:Type="String">${_('Name:')|x}</Data></Cell> |
1489 | + <Cell ss:StyleID="ssCellBlue"><Data ss:Type="String">${r.company_id.instance_id.instance or '-'|x}</Data></Cell> |
1490 | + <Cell ss:StyleID="ssCell"><Data ss:Type="String"></Data></Cell> |
1491 | + <Cell ss:StyleID="ssCell" ss:MergeAcross="1"><Data ss:Type="String">${_('Date start:')|x}</Data></Cell> |
1492 | + % if isDate(r.start_date): |
1493 | + <Cell ss:StyleID="short_date" ss:MergeAcross="2"><Data ss:Type="DateTime">${r.start_date|n}T00:00:00.000</Data></Cell> |
1494 | + % else: |
1495 | + <Cell ss:StyleID="ssCell" ss:MergeAcross="2"><Data ss:Type="String"></Data></Cell> |
1496 | + % endif |
1497 | + </Row> |
1498 | + <Row> |
1499 | + <Cell ss:StyleID="ssCell"><Data ss:Type="String">${_('Address:')|x}</Data></Cell> |
1500 | + <Cell ss:StyleID="ssCellBlue"><Data ss:Type="String">${r.company_id.partner_id.name or '-'|x}</Data></Cell> |
1501 | + <Cell ss:StyleID="ssCell"><Data ss:Type="String"></Data></Cell> |
1502 | + <Cell ss:StyleID="ssCell" ss:MergeAcross="1"><Data ss:Type="String">${_('Date end:')|x}</Data></Cell> |
1503 | + % if isDate(r.end_date): |
1504 | + <Cell ss:StyleID="short_date" ss:MergeAcross="2"><Data ss:Type="DateTime">${r.end_date|n}T00:00:00.000</Data></Cell> |
1505 | + % else: |
1506 | + <Cell ss:StyleID="ssCell" ss:MergeAcross="2"><Data ss:Type="String"></Data></Cell> |
1507 | + % endif |
1508 | + </Row> |
1509 | + <Row> |
1510 | + <Cell ss:StyleID="ssCell"><Data ss:Type="String"></Data></Cell> |
1511 | + <Cell ss:StyleID="ssCellBlue"><Data ss:Type="String">${r.company_id.partner_id.address[0].street or ''|x}</Data></Cell> |
1512 | + <Cell ss:StyleID="ssCell"><Data ss:Type="String"></Data></Cell> |
1513 | + <Cell ss:StyleID="ssCell" ss:MergeAcross="1"><Data ss:Type="String">${_('Order Ref:')|x}</Data></Cell> |
1514 | + <Cell ss:StyleID="ssCellBlue" ss:MergeAcross="2"><Data ss:Type="String">${r.order_id.id and r.order_id.name or '-'|x}</Data></Cell> |
1515 | + </Row> |
1516 | + <Row> |
1517 | + <Cell ss:StyleID="ssCell"><Data ss:Type="String"></Data></Cell> |
1518 | + <Cell ss:StyleID="ssCellBlue"><Data ss:Type="String">${r.company_id.partner_id.address[0].zip|x} ${r.company_id.partner_id.address[0].city|x}</Data></Cell> |
1519 | + <Cell ss:StyleID="ssCell"><Data ss:Type="String"></Data></Cell> |
1520 | + <Cell ss:StyleID="ssCell" ss:MergeAcross="1"><Data ss:Type="String">${_('Date of the request:')|x}</Data></Cell> |
1521 | + % if r.report_date and isDateTime(r.report_date): |
1522 | + <Cell ss:StyleID="short_date" ss:MergeAcross="2"><Data ss:Type="DateTime">${r.report_date[0:10]|n}T${r.report_date[11:19]|n}.000</Data></Cell> |
1523 | + % else: |
1524 | + <Cell ss:StyleID="ssCell" ss:MergeAcross="2"><Data ss:Type="String"></Data></Cell> |
1525 | + % endif |
1526 | + </Row> |
1527 | + <Row> |
1528 | + <Cell ss:StyleID="ssCell"><Data ss:Type="String"></Data></Cell> |
1529 | + <Cell ss:StyleID="ssCellBlue"><Data ss:Type="String">${r.company_id.partner_id.address[0].country_id and r.company_id.partner_id.address[0].country_id.name or ''|x}</Data></Cell> |
1530 | + <Cell ss:StyleID="ssCell"><Data ss:Type="String"></Data></Cell> |
1531 | + <Cell ss:StyleID="ssCell" ss:MergeAcross="1"><Data ss:Type="String"></Data></Cell> |
1532 | + <Cell ss:StyleID="ssCell" ss:MergeAcross="2"><Data ss:Type="String"></Data></Cell> |
1533 | + </Row> |
1534 | + |
1535 | + <Row></Row> |
1536 | + |
1537 | + <Row> |
1538 | + <Cell ss:StyleID="line_header"><Data ss:Type="String">${_('Order ref')|x}</Data></Cell> |
1539 | + <Cell ss:StyleID="line_header"><Data ss:Type="String">${_('Status')|x}</Data></Cell> |
1540 | + <Cell ss:StyleID="line_header"><Data ss:Type="String">${_('Item')|x}</Data></Cell> |
1541 | + <Cell ss:StyleID="line_header"><Data ss:Type="String">${_('Code')|x}</Data></Cell> |
1542 | + <Cell ss:StyleID="line_header"><Data ss:Type="String">${_('Description')|x}</Data></Cell> |
1543 | + <Cell ss:StyleID="line_header"><Data ss:Type="String">${_('Original Code')|x}</Data></Cell> |
1544 | + <Cell ss:StyleID="line_header_orange"><Data ss:Type="String">${_('Qty')|x}</Data></Cell> |
1545 | + <Cell ss:StyleID="line_header"><Data ss:Type="String">${_('UoM')|x}</Data></Cell> |
1546 | + <Cell ss:StyleID="line_header_orange"><Data ss:Type="String">${_('Original Qty')|x}</Data></Cell> |
1547 | + <Cell ss:StyleID="line_header"><Data ss:Type="String">${_('Original UoM')|x}</Data></Cell> |
1548 | + <Cell ss:StyleID="line_header_orange"><Data ss:Type="String">${_('Unit Price')|x}</Data></Cell> |
1549 | + <Cell ss:StyleID="line_header_orange"><Data ss:Type="String">${_('Original Unit Price')|x}</Data></Cell> |
1550 | + <Cell ss:StyleID="line_header_orange"><Data ss:Type="String">${_('Subtotal')|x}</Data></Cell> |
1551 | + <Cell ss:StyleID="line_header_orange"><Data ss:Type="String">${_('Original Subtotal')|x}</Data></Cell> |
1552 | + <Cell ss:StyleID="line_header"><Data ss:Type="String">${_('Modification comment')|x}</Data></Cell> |
1553 | + </Row> |
1554 | + |
1555 | + % for line in getLines(r): |
1556 | + <Row ss:Height="11.25"> |
1557 | + <Cell ss:StyleID="line_left"><Data ss:Type="String">${line.order_id.name|x}</Data></Cell> |
1558 | + <Cell ss:StyleID="line_left"><Data ss:Type="String">${line.state|x}</Data></Cell> |
1559 | + <Cell ss:StyleID="line_center_no_digits"><Data ss:Type="Number">${line.line_number|x}</Data></Cell> |
1560 | + <Cell ss:StyleID="line_left"><Data ss:Type="String">${line.product_id.default_code or ''|x}</Data></Cell> |
1561 | + <Cell ss:StyleID="line_left"><Data ss:Type="String">${line.name|x}</Data></Cell> |
1562 | + % if line.original_product and line.product_id.default_code != line.original_product.default_code: |
1563 | + <Cell ss:StyleID="line_left"><Data ss:Type="String">${line.original_product.default_code or ''|x}</Data></Cell> |
1564 | + % else: |
1565 | + <Cell ss:StyleID="line_left"><Data ss:Type="String"></Data></Cell> |
1566 | + % endif |
1567 | + <Cell ss:StyleID="line_left"><Data ss:Type="Number">${line.product_uom_qty|x}</Data></Cell> |
1568 | + <Cell ss:StyleID="line_left"><Data ss:Type="String">${line.product_uom.name|x}</Data></Cell> |
1569 | + <Cell ss:StyleID="line_left"><Data ss:Type="Number">${line.original_qty or 0|x}</Data></Cell> |
1570 | + <Cell ss:StyleID="line_left"><Data ss:Type="String">${line.original_uom.name or ''|x}</Data></Cell> |
1571 | + <Cell ss:StyleID="line_center"><Data ss:Type="Number">${line.price_unit|x}</Data></Cell> |
1572 | + <Cell ss:StyleID="line_center"><Data ss:Type="Number">${line.original_price or 0|x}</Data></Cell> |
1573 | + <Cell ss:StyleID="line_center"><Data ss:Type="Number">${line.price_unit * line.product_uom_qty|x}</Data></Cell> |
1574 | + <Cell ss:StyleID="line_center"><Data ss:Type="Number">${line.original_price * line.original_qty|x}</Data></Cell> |
1575 | + <Cell ss:StyleID="line_left"><Data ss:Type="String">${line.modification_comment or ''|x}</Data></Cell> |
1576 | + </Row> |
1577 | + % endfor |
1578 | + |
1579 | + </Table> |
1580 | + |
1581 | + <WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel"> |
1582 | + <PageSetup> |
1583 | + <Layout x:Orientation="Landscape"/> |
1584 | + <Footer x:Data="Page &P of &N"/> |
1585 | + </PageSetup> |
1586 | + <Selected/> |
1587 | + <Panes> |
1588 | + <Pane> |
1589 | + <Number>3</Number> |
1590 | + <ActiveRow>17</ActiveRow> |
1591 | + </Pane> |
1592 | + </Panes> |
1593 | + <ProtectObjects>False</ProtectObjects> |
1594 | + <ProtectScenarios>False</ProtectScenarios> |
1595 | + </WorksheetOptions> |
1596 | +</ss:Worksheet> |
1597 | +% endfor |
1598 | +</Workbook> |
1599 | |
1600 | === modified file 'bin/addons/sales_followup/wizard/__init__.py' |
1601 | --- bin/addons/sales_followup/wizard/__init__.py 2017-08-18 14:31:17 +0000 |
1602 | +++ bin/addons/sales_followup/wizard/__init__.py 2017-10-26 10:06:24 +0000 |
1603 | @@ -21,3 +21,4 @@ |
1604 | |
1605 | import sale_followup_multi_wizard |
1606 | import ir_followup_location_wizard |
1607 | +import ir_track_changes_wizard |
1608 | |
1609 | === added file 'bin/addons/sales_followup/wizard/ir_track_changes_wizard.py' |
1610 | --- bin/addons/sales_followup/wizard/ir_track_changes_wizard.py 1970-01-01 00:00:00 +0000 |
1611 | +++ bin/addons/sales_followup/wizard/ir_track_changes_wizard.py 2017-10-26 10:06:24 +0000 |
1612 | @@ -0,0 +1,130 @@ |
1613 | +# -*- coding: utf-8 -*- |
1614 | +############################################################################## |
1615 | +# |
1616 | +# OpenERP, Open Source Management Solution |
1617 | +# Copyright (C) 2011 TeMPO Consulting, MSF |
1618 | +# |
1619 | +# This program is free software: you can redistribute it and/or modify |
1620 | +# it under the terms of the GNU Affero General Public License as |
1621 | +# published by the Free Software Foundation, either version 3 of the |
1622 | +# License, or (at your option) any later version. |
1623 | +# |
1624 | +# This program is distributed in the hope that it will be useful, |
1625 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
1626 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1627 | +# GNU Affero General Public License for more details. |
1628 | +# |
1629 | +# You should have received a copy of the GNU Affero General Public License |
1630 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
1631 | +# |
1632 | +############################################################################## |
1633 | + |
1634 | +from osv import osv |
1635 | +from osv import fields |
1636 | +from tools.translate import _ |
1637 | + |
1638 | +import time |
1639 | + |
1640 | + |
1641 | +class ir_track_changes_wizard(osv.osv_memory): |
1642 | + _name = 'ir.track.changes.wizard' |
1643 | + _rec_name = 'report_date' |
1644 | + _order = 'report_date desc' |
1645 | + |
1646 | + _columns = { |
1647 | + 'report_date': fields.datetime( |
1648 | + string='Date of the demand', |
1649 | + readonly=True, |
1650 | + ), |
1651 | + 'company_id': fields.many2one( |
1652 | + 'res.company', |
1653 | + string='Company', |
1654 | + readonly=True, |
1655 | + ), |
1656 | + 'start_date': fields.date( |
1657 | + string='Start date', |
1658 | + ), |
1659 | + 'end_date': fields.date( |
1660 | + string='End date', |
1661 | + ), |
1662 | + 'order_line_ids': fields.text( |
1663 | + string='Orders Lines', |
1664 | + readonly=True |
1665 | + ), |
1666 | + 'order_id': fields.many2one( |
1667 | + 'sale.order', |
1668 | + string='Order Ref.', |
1669 | + ), |
1670 | + } |
1671 | + |
1672 | + _defaults = { |
1673 | + 'report_date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'), |
1674 | + 'company_id': lambda self, cr, uid, ids, c={}: self.pool.get('res.users').browse(cr, uid, uid).company_id.id, |
1675 | + } |
1676 | + |
1677 | + def get_values(self, cr, uid, ids, context=None): |
1678 | + ''' |
1679 | + Retrieve the data according to values in wizard |
1680 | + ''' |
1681 | + ir_line_obj = self.pool.get('sale.order.line') |
1682 | + |
1683 | + if context is None: |
1684 | + context = {} |
1685 | + |
1686 | + if isinstance(ids, (int, long)): |
1687 | + ids = [ids] |
1688 | + |
1689 | + for wizard in self.browse(cr, uid, ids, context=context): |
1690 | + ir_domain = [('procurement_request', '=', 't')] |
1691 | + |
1692 | + if wizard.start_date: |
1693 | + ir_domain.append(('create_date', '>=', wizard.start_date)) |
1694 | + |
1695 | + if wizard.end_date: |
1696 | + ir_domain.append(('create_date', '<=', wizard.end_date)) |
1697 | + |
1698 | + if wizard.order_id: |
1699 | + ir_domain.append(('order_id', '=', wizard.order_id.id)) |
1700 | + |
1701 | + ir_line_ids = ir_line_obj.search(cr, uid, ir_domain, context=context) |
1702 | + |
1703 | + if not ir_line_ids: |
1704 | + raise osv.except_osv( |
1705 | + _('Error'), |
1706 | + _('No data found with these parameters'), |
1707 | + ) |
1708 | + |
1709 | + self.write(cr, uid, [wizard.id], {'order_line_ids': ir_line_ids}, context=context) |
1710 | + |
1711 | + return True |
1712 | + |
1713 | + def print_excel(self, cr, uid, ids, context=None): |
1714 | + ''' |
1715 | + Retrieve the data according to values in wizard |
1716 | + and print the report in Excel format. |
1717 | + ''' |
1718 | + if context is None: |
1719 | + context = {} |
1720 | + |
1721 | + if isinstance(ids, (int, long)): |
1722 | + ids = [ids] |
1723 | + |
1724 | + self.get_values(cr, uid, ids, context=context) |
1725 | + |
1726 | + background_id = self.pool.get('memory.background.report').create(cr, uid, { |
1727 | + 'file_name': 'INTERNAL REQUEST Track Changes report', |
1728 | + 'report_name': 'ir.track.changes.report_xls', |
1729 | + }, context=context) |
1730 | + context['background_id'] = background_id |
1731 | + context['background_time'] = 3 |
1732 | + |
1733 | + data = {'ids': ids, 'context': context} |
1734 | + return { |
1735 | + 'type': 'ir.actions.report.xml', |
1736 | + 'report_name': 'ir.track.changes.report_xls', |
1737 | + 'datas': data, |
1738 | + 'context': context, |
1739 | + } |
1740 | + |
1741 | + |
1742 | +ir_track_changes_wizard() |
1743 | |
1744 | === added file 'bin/addons/sales_followup/wizard/ir_track_changes_wizard_view.xml' |
1745 | --- bin/addons/sales_followup/wizard/ir_track_changes_wizard_view.xml 1970-01-01 00:00:00 +0000 |
1746 | +++ bin/addons/sales_followup/wizard/ir_track_changes_wizard_view.xml 2017-10-26 10:06:24 +0000 |
1747 | @@ -0,0 +1,39 @@ |
1748 | +<?xml version="1.0" encoding="utf-8"?> |
1749 | +<openerp> |
1750 | + |
1751 | + <data> |
1752 | + |
1753 | + <record id="ir_track_changes_wizard_form_view" model="ir.ui.view"> |
1754 | + <field name="name">ir.track.changes.wizard.form.view</field> |
1755 | + <field name="model">ir.track.changes.wizard</field> |
1756 | + <field name="type">form</field> |
1757 | + <field name="arch" type="xml"> |
1758 | + <form string="INTERNAL REQUEST Track Changes"> |
1759 | + <separator colspan="4" string="Request parameters" /> |
1760 | + <field name="start_date" /> |
1761 | + <field name="end_date" /> |
1762 | + <field name="order_id" domain="[('procurement_request', '=', 't')]" /> |
1763 | + <separator colspan="4" string="Actions" /> |
1764 | + <button name="print_excel" string="Excel report" icon="gtk-print" type="object" colspan="4" /> |
1765 | + </form> |
1766 | + </field> |
1767 | + </record> |
1768 | + |
1769 | + <record id="action_ir_track_changes_wizard" model="ir.actions.act_window"> |
1770 | + <field name="name">IR Track Changes</field> |
1771 | + <field name="res_model">ir.track.changes.wizard</field> |
1772 | + <field name="view_type">form</field> |
1773 | + <field name="view_mode">form</field> |
1774 | + <field name="target">new</field> |
1775 | + </record> |
1776 | + |
1777 | + <menuitem |
1778 | + id="menu_ir_track_changes" |
1779 | + action="action_ir_track_changes_wizard" |
1780 | + parent="base.menu_sales" |
1781 | + sequence="3" |
1782 | + /> |
1783 | + |
1784 | + </data> |
1785 | + |
1786 | +</openerp> |
1787 | |
1788 | === modified file 'bin/addons/sourcing/procurement_order.py' |
1789 | --- bin/addons/sourcing/procurement_order.py 2017-10-02 14:14:09 +0000 |
1790 | +++ bin/addons/sourcing/procurement_order.py 2017-10-26 10:06:24 +0000 |
1791 | @@ -114,6 +114,8 @@ |
1792 | line.update({'origin': origin_line.order_id.name}) |
1793 | if origin_line.stock_take_date: |
1794 | line.update({'stock_take_date': origin_line.stock_take_date}) |
1795 | + if origin_line.original_product: |
1796 | + line.update({'original_product': origin_line.original_product.id}) |
1797 | if origin_line.original_qty: |
1798 | line.update({'original_qty': origin_line.original_qty}) |
1799 | if origin_line.original_uom: |
1800 | |
1801 | === modified file 'bin/addons/sourcing/sale_order_line.py' |
1802 | --- bin/addons/sourcing/sale_order_line.py 2017-10-19 14:06:34 +0000 |
1803 | +++ bin/addons/sourcing/sale_order_line.py 2017-10-26 10:06:24 +0000 |
1804 | @@ -1700,6 +1700,7 @@ |
1805 | pol_values['name'] = sourcing_line.comment |
1806 | if sourcing_line.procurement_request: |
1807 | pol_values.update({ |
1808 | + 'original_product': sourcing_line.original_product.id, |
1809 | 'original_qty': sourcing_line.original_qty, |
1810 | 'original_uom': sourcing_line.original_uom.id, |
1811 | }) |
1812 | @@ -1734,6 +1735,7 @@ |
1813 | } |
1814 | if sourcing_line.procurement_request: |
1815 | rfq_line_values.update({ |
1816 | + 'original_product': sourcing_line.original_product.id, |
1817 | 'original_qty': sourcing_line.original_qty, |
1818 | 'original_uom': sourcing_line.original_uom.id, |
1819 | }) |
1820 | @@ -1762,6 +1764,7 @@ |
1821 | } |
1822 | if sourcing_line.procurement_request: |
1823 | tender_values.update({ |
1824 | + 'original_product': sourcing_line.original_product.id, |
1825 | 'original_qty': sourcing_line.original_qty, |
1826 | 'original_uom': sourcing_line.original_uom.id, |
1827 | }) |
1828 | |
1829 | === modified file 'bin/addons/sourcing/sourcing_view.xml' |
1830 | --- bin/addons/sourcing/sourcing_view.xml 2017-10-04 06:36:54 +0000 |
1831 | +++ bin/addons/sourcing/sourcing_view.xml 2017-10-26 10:06:24 +0000 |
1832 | @@ -3,27 +3,6 @@ |
1833 | <data> |
1834 | |
1835 | |
1836 | - <record id="view_internal_request_form" model="ir.ui.view"> |
1837 | - <field name="name">view.internal.request.form</field> |
1838 | - <field name="model">sale.order</field> |
1839 | - <field name="type">form</field> |
1840 | - <field name="priority" eval="500" /> |
1841 | - <field name="inherit_id" ref="procurement_request.procurement_request_form_view" /> |
1842 | - <field name="arch" type="xml"> |
1843 | - <data> |
1844 | - <xpath expr="/form" position="inside"> |
1845 | - <field name="sourcing_trace_ok" invisible="1" /> |
1846 | - </xpath> |
1847 | - |
1848 | - <xpath expr="/form//notebook" position="inside"> |
1849 | - <page string="Sourcing Logs" attrs="{'invisible': [('sourcing_trace_ok', '=', False)]}"> |
1850 | - <field name="sourcing_trace" colspan="4" nolabel="1" /> |
1851 | - </page> |
1852 | - </xpath> |
1853 | - </data> |
1854 | - </field> |
1855 | - </record> |
1856 | - |
1857 | <record id="sourcing_line_normal_form_view" model="ir.ui.view"> |
1858 | <field name="name">sale.order.line.sourcing.form</field> |
1859 | <field name="model">sale.order.line</field> |