Merge lp:~mallorymarcot/unifield-server/us-1671 into lp:unifield-server
- us-1671
- Merge into trunk
Proposed by
Quentin THEURET @Amaris
Status: | Merged |
---|---|
Merged at revision: | 4082 |
Proposed branch: | lp:~mallorymarcot/unifield-server/us-1671 |
Merge into: | lp:unifield-server |
Diff against target: |
841 lines (+640/-9) (has conflicts) 13 files modified
bin/addons/mission_stock/mission_stock.py (+4/-1) bin/addons/msf_profile/data/patches.xml (+7/-0) bin/addons/msf_profile/i18n/fr_MF.po (+39/-6) bin/addons/msf_profile/msf_profile.py (+18/-0) bin/addons/msf_sync_data_server/data/sync_server.sync_rule.csv (+2/-2) bin/addons/msf_tools/__init__.py (+1/-0) bin/addons/msf_tools/__openerp__.py (+2/-0) bin/addons/msf_tools/report/__init__.py (+22/-0) bin/addons/msf_tools/report/report_stopped_products.py (+279/-0) bin/addons/msf_tools/report/report_stopped_products_report.xml (+20/-0) bin/addons/msf_tools/report/report_stopped_products_view.xml (+92/-0) bin/addons/msf_tools/report/report_stopped_products_xls.mako (+140/-0) bin/addons/product_attributes/product_attributes.py (+14/-0) Text conflict in bin/addons/msf_profile/data/patches.xml Text conflict in bin/addons/msf_profile/i18n/fr_MF.po Text conflict in bin/addons/msf_profile/msf_profile.py |
To merge this branch: | bzr merge lp:~mallorymarcot/unifield-server/us-1671 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
UniField Reviewer Team | Pending | ||
Review via email: mp+309834@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/mission_stock/mission_stock.py' |
2 | --- bin/addons/mission_stock/mission_stock.py 2016-11-10 16:36:42 +0000 |
3 | +++ bin/addons/mission_stock/mission_stock.py 2016-11-21 09:48:09 +0000 |
4 | @@ -696,7 +696,8 @@ |
5 | 'cross_qty': line.cross_qty or 0.00, |
6 | 'secondary_qty': line.secondary_qty or 0.00, |
7 | 'cu_qty': line.cu_qty or 0.00, |
8 | - 'updated': True} |
9 | + 'updated': True, |
10 | + 'product_state': line.product_id.state and line.product_id.state.code,} |
11 | |
12 | if move[4] in internal_loc: |
13 | vals['internal_qty'] -= qty |
14 | @@ -916,6 +917,7 @@ |
15 | write_relate=False, |
16 | _fnct_migrate=is_migration, |
17 | ), |
18 | + 'product_state': fields.char(size=128, string='Unifield state'), |
19 | # mandatory nomenclature levels |
20 | 'nomen_manda_0': fields.related('product_id', 'nomen_manda_0', type='many2one', relation='product.nomenclature', string='Main Type'), |
21 | 'nomen_manda_1': fields.related('product_id', 'nomen_manda_1', type='many2one', relation='product.nomenclature', string='Group'), |
22 | @@ -1009,6 +1011,7 @@ |
23 | 'in_pipe_coor_qty': 0.00, |
24 | 'in_pipe_coor_val': 0.00, |
25 | 'instance_id': _get_default_destination_instance_id, |
26 | + 'product_state': '', |
27 | } |
28 | |
29 | def update_full_view_line(self, cr, uid, context=None): |
30 | |
31 | === modified file 'bin/addons/msf_profile/data/patches.xml' |
32 | --- bin/addons/msf_profile/data/patches.xml 2016-11-08 15:50:26 +0000 |
33 | +++ bin/addons/msf_profile/data/patches.xml 2016-11-21 09:48:09 +0000 |
34 | @@ -114,9 +114,16 @@ |
35 | <record id="us_1766_fix_fxa_aji_curr" model="patch.scripts"> |
36 | <field name="method">us_1766_fix_fxa_aji_curr</field> |
37 | </record> |
38 | +<<<<<<< TREE |
39 | |
40 | <record id="us_635_dest_partner_ids" model="patch.scripts"> |
41 | <field name="method">us_635_dest_partner_ids</field> |
42 | </record> |
43 | +======= |
44 | + |
45 | + <record id="us_1671_stopped_products" model="patch.scripts"> |
46 | + <field name="method">us_1671_stopped_products</field> |
47 | + </record> |
48 | +>>>>>>> MERGE-SOURCE |
49 | </data> |
50 | </openerp> |
51 | |
52 | === modified file 'bin/addons/msf_profile/i18n/fr_MF.po' |
53 | --- bin/addons/msf_profile/i18n/fr_MF.po 2016-11-09 15:21:10 +0000 |
54 | +++ bin/addons/msf_profile/i18n/fr_MF.po 2016-11-21 09:48:09 +0000 |
55 | @@ -6413,7 +6413,10 @@ |
56 | msgid "Either there are no moves linked to the picking or Accounting Journals are misconfigured!" |
57 | msgstr "Soit les Journaux Comptables sont mal configurés, soit il n'y a pas de mouvement connexe à ce prélèvement !" |
58 | |
59 | -#. modules: tender_flow, financing_contract, account_voucher, account_override, purchase_allocation_report, register_accounting, msf_accrual, account_msf, return_claim, res_currency_tables, procurement_request, stock_forecast, analytic, msf_doc_import, analytic_distribution, msf_order_date, account_payment, msf_homere_interface, msf_instance, purchase_override, specific_rules, kit, out_step, base, msf_budget, account_corrections, account, msf_outgoing, sale_override, sale, sales_followup, procurement, sourcing, purchase, msf_audittrail, stock |
60 | +#. modules: msf_tools, tender_flow, financing_contract, account_voucher, account_override, purchase_allocation_report, register_accounting, msf_accrual, account_msf, return_claim, res_currency_tables, procurement_request, stock_forecast, analytic, msf_doc_import, analytic_distribution, msf_order_date, account_payment, msf_homere_interface, msf_instance, purchase_override, specific_rules, kit, out_step, base, msf_budget, account_corrections, account, msf_outgoing, sale_override, sale, sales_followup, procurement, sourcing, purchase, msf_audittrail, stock |
61 | +#: view:automated.import.job:0 |
62 | +#: selection:automated.import.job,state:0 |
63 | +#: selection:export.report.stopped.products,state:0 |
64 | #: view:account.bank.statement:0 |
65 | #: selection:account.bank.statement,state:0 |
66 | #: view:account.invoice:0 |
67 | @@ -11615,7 +11618,8 @@ |
68 | msgid "Net weight" |
69 | msgstr "Net weight" |
70 | |
71 | -#. modules: stock_forecast, procurement, sync_client, stock_override, stock |
72 | +#. modules: stock_forecast, procurement, sync_client, stock_override, stock, msf_tools |
73 | +#: selection:export.report.stopped.products,state:0 |
74 | #: selection:procurement.order,state:0 |
75 | #: view:stock.move:0 |
76 | #: selection:stock.forecast.line,state:0 |
77 | @@ -31983,7 +31987,8 @@ |
78 | msgid "37 J(PM)" |
79 | msgstr "37 J(PM)" |
80 | |
81 | -#. modules: sales_followup, reason_types_moves, procurement_request, order_types, msf_doc_import, return_claim, sourcing, register_accounting |
82 | +#. modules: msf_tools, sales_followup, reason_types_moves, procurement_request, order_types, msf_doc_import, return_claim, sourcing, register_accounting |
83 | +#: selection:export.report.stopped.products,state:0 |
84 | #: selection:wizard.import.fo.line,state:0 |
85 | #: selection:wizard.import.ir.line,state:0 |
86 | #: selection:wizard.import.po.line,state:0 |
87 | @@ -43876,7 +43881,9 @@ |
88 | msgid "Average monthly consumption" |
89 | msgstr "consommation mensuelle réelle" |
90 | |
91 | -#. modules: account_override, msf_doc_import, account, consumption_calculation |
92 | +#. modules: account_override, msf_doc_import, account, consumption_calculation, msf_tools |
93 | +#: field:automated.import.job,state:0 |
94 | +#: field:export.report.stopped.products,state:0 |
95 | #: selection:account.journal.column,field:0 |
96 | #: report:addons/account_override/report/open_invoices_xls.mako:304 |
97 | #: field:real.average.consumption,state:0 |
98 | @@ -74707,9 +74714,10 @@ |
99 | msgid "Generate report (all locations)" |
100 | msgstr "Générer le rapport (toutes les zones)" |
101 | |
102 | -#. module: specific_rules |
103 | +#. modules: specific_rules, msf_tools |
104 | #: view:export.report.stock.inventory:0 |
105 | #: view:unconsistent.stock.report:0 |
106 | +#: view:export.report.stopped.products:0 |
107 | msgid "Generate report" |
108 | msgstr "Générer le rapport" |
109 | |
110 | @@ -74724,8 +74732,9 @@ |
111 | msgid "Product Code" |
112 | msgstr "Code Produit" |
113 | |
114 | -#. module: specific_rules |
115 | +#. modules: specific_rules, msf_tools |
116 | #: report:addons/specific_rules/report/report_stock_inventory_all_locations_xls.mako:129 |
117 | +#: field:export.report.stopped.products,name:0 |
118 | #: field:export.report.stock.inventory,name:0 |
119 | msgid "Generated on" |
120 | msgstr "Généré le" |
121 | @@ -74763,6 +74772,7 @@ |
122 | msgid "You can't search on this object without using at least one exact search term (precede your search with the character '=')." |
123 | msgstr "Vous ne pouvez pas exécuter de recherche sur cet objet sans utiliser au moins une recherche exacte (ajoutez le caractère = devant votre filtre)." |
124 | |
125 | +<<<<<<< TREE |
126 | #. module: procurement_request |
127 | #: code:addons/procurement_request/procurement_request.py:553 |
128 | #, python-format |
129 | @@ -75092,3 +75102,26 @@ |
130 | msgid "Attachment configuration" |
131 | msgstr "Configuration des pièces jointes" |
132 | |
133 | +======= |
134 | +#. module: msf_tools |
135 | +#: view:export.report.stopped.products:0 |
136 | +msgid "Request information" |
137 | +msgstr "Information" |
138 | + |
139 | +#. module: msf_tools |
140 | +#: view:export.report.stopped.products:0 |
141 | +#: model:ir.actions.act_window,name:msf_tools.export_report_stopped_products_action |
142 | +#: model:ir.ui.menu,name:msf_tools.export_report_stopped_products_menu |
143 | +msgid "Export Stopped Products" |
144 | +msgstr "Exporter produits stoppés" |
145 | + |
146 | +#. module: msf_tools |
147 | +#: view:export.report.stopped.products:0 |
148 | +msgid "Status of the report" |
149 | +msgstr "Status du rapport" |
150 | + |
151 | +#. module: msf_tools |
152 | +#: code:addons/msf_tools/report/report_stopped_products.py:64 |
153 | +#, python-format |
154 | +msgid "There is no stopped products to report" |
155 | +msgstr "Il n'y a aucun produit stoppé à afficher">>>>>>> MERGE-SOURCE |
156 | |
157 | === modified file 'bin/addons/msf_profile/msf_profile.py' |
158 | --- bin/addons/msf_profile/msf_profile.py 2016-11-09 13:21:34 +0000 |
159 | +++ bin/addons/msf_profile/msf_profile.py 2016-11-21 09:48:09 +0000 |
160 | @@ -909,6 +909,7 @@ |
161 | currency_id != %s""", (currency_id, tuple(journal_ids), currency_id)) |
162 | |
163 | |
164 | +<<<<<<< TREE |
165 | def us_635_dest_partner_ids(self, cr, uid, *a, **b): |
166 | """ |
167 | Fill many2many field dest_partner_ids |
168 | @@ -929,6 +930,23 @@ |
169 | return True |
170 | |
171 | |
172 | +======= |
173 | + def us_1671_stopped_products(self, cr, uid, *a, **b): |
174 | + ''' |
175 | + Fill field product_state of object stock.mission.report.line with the state of the products (product.product) |
176 | + ''' |
177 | + prod_obj = self.pool.get('product.product') |
178 | + smrl_obj = self.pool.get('stock.mission.report.line') |
179 | + context = {} |
180 | + |
181 | + prod_ids = prod_obj.search(cr, uid, [('state', '!=', False), ('active', 'in', ['t', 'f'])], context=context) |
182 | + smrl_to_modify = smrl_obj.search(cr, uid, [('product_id', 'in', prod_ids), ('mission_report_id.local_report', '=', True)], context=context) |
183 | + |
184 | + for smrl in smrl_obj.browse(cr, uid, smrl_to_modify, context=context): |
185 | + smrl_obj.write(cr, uid, smrl.id, {'product_state': smrl.product_id.state.code}, context=context) |
186 | + |
187 | + |
188 | +>>>>>>> MERGE-SOURCE |
189 | patch_scripts() |
190 | |
191 | |
192 | |
193 | === modified file 'bin/addons/msf_sync_data_server/data/sync_server.sync_rule.csv' |
194 | --- bin/addons/msf_sync_data_server/data/sync_server.sync_rule.csv 2016-11-03 15:58:00 +0000 |
195 | +++ bin/addons/msf_sync_data_server/data/sync_server.sync_rule.csv 2016-11-21 09:48:09 +0000 |
196 | @@ -84,8 +84,8 @@ |
197 | msf_sync_data_server.budget_line,TRUE,TRUE,FALSE,FALSE,bidirectional,Up,"[('budget_id','in',('msf.budget','id',[('type','=','normal'), ('state', '!=', 'draft')]))]","['account_id/id', 'budget_id/id', 'month1', 'month2', 'month3', 'month4', 'month5', 'month6', 'month7', 'month8', 'month9', 'month10', 'month11', 'month12', 'destination_id/id', 'line_type']",OC,msf.budget.line,,Budget line,Valid,,431 |
198 | msf_sync_data_server.budget_status,TRUE,TRUE,FALSE,FALSE,bidirectional,Up,"[('type','=','normal'), ('state', '!=', 'draft')]",['state'],OC,msf.budget,,Budget status,Valid,,432 |
199 | msf_sync_data_server.mission_stock_report,TRUE,TRUE,FALSE,FALSE,bidirectional,Up,"[('full_view', '=', False), ('local_report', '=', True)]","['full_view', 'instance_id/id', 'last_update', 'name']",OC,stock.mission.report,,Mission Stock Report,Valid,,440 |
200 | -msf_sync_data_server.mission_stock_report_line,TRUE,TRUE,FALSE,FALSE,bidirectional,Up,"[('mission_report_id.full_view', '=', False), ('mission_report_id.local_report', '=', True), ('international_status','in',['Local', 'Temporary'])]","['central_qty', 'central_val', 'cross_qty', 'cross_val', 'cu_qty', 'cu_val', 'in_pipe_coor_qty', 'in_pipe_coor_val', 'in_pipe_qty', 'in_pipe_val', 'internal_qty', 'internal_val', 'mission_report_id/id', 'product_id/id', 'secondary_qty', 'secondary_val', 'stock_qty', 'stock_val', 'xmlid_code']",MISSION,stock.mission.report.line,,Mission Stock Report Line,Valid,,441 |
201 | -msf_sync_data_server.mission_stock_report_line_OC,TRUE,TRUE,FALSE,FALSE,bidirectional,Up,"[('mission_report_id.full_view', '=', False), ('mission_report_id.local_report', '=', True), ('international_status','in',['ITC', 'UniData', 'ESC', 'HQ'])]","['central_qty', 'central_val', 'cross_qty', 'cross_val', 'cu_qty', 'cu_val', 'in_pipe_coor_qty', 'in_pipe_coor_val', 'in_pipe_qty', 'in_pipe_val', 'internal_qty', 'internal_val', 'mission_report_id/id', 'product_id/id', 'secondary_qty', 'secondary_val', 'stock_qty', 'stock_val', 'xmlid_code']",OC,stock.mission.report.line,,Mission Stock Report Line OC,Valid,,442 |
202 | +msf_sync_data_server.mission_stock_report_line,TRUE,TRUE,FALSE,FALSE,bidirectional,Up,"[('mission_report_id.full_view', '=', False), ('mission_report_id.local_report', '=', True), ('international_status','in',['Local', 'Temporary'])]","['central_qty', 'central_val', 'cross_qty', 'cross_val', 'cu_qty', 'cu_val', 'in_pipe_coor_qty', 'in_pipe_coor_val', 'in_pipe_qty', 'in_pipe_val', 'internal_qty', 'internal_val', 'mission_report_id/id', 'product_id/id', 'secondary_qty', 'secondary_val', 'stock_qty', 'stock_val', 'xmlid_code', 'product_state']",MISSION,stock.mission.report.line,,Mission Stock Report Line,Valid,,441 |
203 | +msf_sync_data_server.mission_stock_report_line_OC,TRUE,TRUE,FALSE,FALSE,bidirectional,Up,"[('mission_report_id.full_view', '=', False), ('mission_report_id.local_report', '=', True), ('international_status','in',['ITC', 'UniData', 'ESC', 'HQ'])]","['central_qty', 'central_val', 'cross_qty', 'cross_val', 'cu_qty', 'cu_val', 'in_pipe_coor_qty', 'in_pipe_coor_val', 'in_pipe_qty', 'in_pipe_val', 'internal_qty', 'internal_val', 'mission_report_id/id', 'product_id/id', 'secondary_qty', 'secondary_val', 'stock_qty', 'stock_val', 'xmlid_code', 'product_state']",OC,stock.mission.report.line,,Mission Stock Report Line OC,Valid,,442 |
204 | msf_sync_data_server.financing_contract_formats_fc,TRUE,TRUE,FALSE,TRUE,bidirectional,Bidirectional-Private,[],"['cost_center_ids/id', 'eligibility_from_date', 'eligibility_to_date', 'format_name', 'overhead_percentage', 'overhead_type', 'reporting_type', 'hidden_instance_id/id']",HQ + MISSION,financing.contract.format,hidden_instance_id,Financing Contract Formats FC,Valid,,450 |
205 | msf_sync_data_server.financing_contract_formats,TRUE,TRUE,TRUE,TRUE,bidirectional,Bidirectional,"[('hidden_instance_id','=',False)]","['hidden_instance_id/id','cost_center_ids/id', 'eligibility_from_date', 'eligibility_to_date', 'format_name', 'overhead_percentage', 'overhead_type', 'reporting_type']",HQ + MISSION,financing.contract.format,,Financing Contract Formats,Valid,,451 |
206 | msf_sync_data_server.financing_contract_format_lines,TRUE,TRUE,TRUE,TRUE,bidirectional,Bidirectional,"[('instance_id', '=', False)]","['account_destination_ids/id', 'instance_id/id','allocated_budget_value', 'allocated_real_value', 'code', 'format_id/id', 'line_type', 'name', 'overhead_percentage', 'overhead_type', 'project_budget_value', 'project_real_value', 'is_quadruplet','quadruplet_update']",HQ + MISSION,financing.contract.format.line,,Financing Contract Format Lines,Valid,,452 |
207 | |
208 | === modified file 'bin/addons/msf_tools/__init__.py' |
209 | --- bin/addons/msf_tools/__init__.py 2016-04-29 14:50:53 +0000 |
210 | +++ bin/addons/msf_tools/__init__.py 2016-11-21 09:48:09 +0000 |
211 | @@ -23,3 +23,4 @@ |
212 | import automated_import_function |
213 | import automated_import |
214 | import automated_import_job |
215 | +import report |
216 | |
217 | === modified file 'bin/addons/msf_tools/__openerp__.py' |
218 | --- bin/addons/msf_tools/__openerp__.py 2016-05-03 07:35:36 +0000 |
219 | +++ bin/addons/msf_tools/__openerp__.py 2016-11-21 09:48:09 +0000 |
220 | @@ -39,6 +39,8 @@ |
221 | 'views/automated_import_function_view.xml', |
222 | 'views/automated_import_job_view.xml', |
223 | 'security/ir.model.access.csv', |
224 | + 'report/report_stopped_products_view.xml', |
225 | + 'report/report_stopped_products_report.xml', |
226 | 'automated_import_data.xml', |
227 | ], |
228 | 'demo_xml': [ |
229 | |
230 | === added directory 'bin/addons/msf_tools/report' |
231 | === added file 'bin/addons/msf_tools/report/__init__.py' |
232 | --- bin/addons/msf_tools/report/__init__.py 1970-01-01 00:00:00 +0000 |
233 | +++ bin/addons/msf_tools/report/__init__.py 2016-11-21 09:48:09 +0000 |
234 | @@ -0,0 +1,22 @@ |
235 | +# -*- coding: utf-8 -*- |
236 | +############################################################################## |
237 | +# |
238 | +# OpenERP, Open Source Management Solution |
239 | +# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). |
240 | +# |
241 | +# This program is free software: you can redistribute it and/or modify |
242 | +# it under the terms of the GNU Affero General Public License as |
243 | +# published by the Free Software Foundation, either version 3 of the |
244 | +# License, or (at your option) any later version. |
245 | +# |
246 | +# This program is distributed in the hope that it will be useful, |
247 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
248 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
249 | +# GNU Affero General Public License for more details. |
250 | +# |
251 | +# You should have received a copy of the GNU Affero General Public License |
252 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
253 | +# |
254 | +############################################################################## |
255 | + |
256 | +import report_stopped_products |
257 | |
258 | === added file 'bin/addons/msf_tools/report/report_stopped_products.py' |
259 | --- bin/addons/msf_tools/report/report_stopped_products.py 1970-01-01 00:00:00 +0000 |
260 | +++ bin/addons/msf_tools/report/report_stopped_products.py 2016-11-21 09:48:09 +0000 |
261 | @@ -0,0 +1,279 @@ |
262 | +# -*- coding: utf-8 -*- |
263 | +############################################################################## |
264 | +# |
265 | +# OpenERP, Open Source Management Solution |
266 | +# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). |
267 | +# |
268 | +# This program is free software: you can redistribute it and/or modify |
269 | +# it under the terms of the GNU Affero General Public License as |
270 | +# published by the Free Software Foundation, either version 3 of the |
271 | +# License, or (at your option) any later version. |
272 | +# |
273 | +# This program is distributed in the hope that it will be useful, |
274 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
275 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
276 | +# GNU Affero General Public License for more details. |
277 | +# |
278 | +# You should have received a copy of the GNU Affero General Public License |
279 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
280 | +# |
281 | +############################################################################## |
282 | + |
283 | + |
284 | +import time |
285 | +import threading |
286 | +from osv import fields |
287 | +from osv import osv |
288 | +from report import report_sxw |
289 | +from spreadsheet_xml.spreadsheet_xml_write import SpreadsheetReport |
290 | +from service.web_services import report_spool |
291 | +from tools.translate import _ |
292 | + |
293 | + |
294 | + |
295 | +class export_report_stopped_products(osv.osv): |
296 | + |
297 | + _name = 'export.report.stopped.products' |
298 | + _order = 'name desc' |
299 | + |
300 | + _columns = { |
301 | + 'name': fields.datetime(string='Generated On', readonly=True), |
302 | + 'state': fields.selection( |
303 | + [('draft', 'Draft'), |
304 | + ('in_progress', 'In Progress'), |
305 | + ('ready', 'Ready')], |
306 | + string='State', |
307 | + readonly=True, |
308 | + ), |
309 | + } |
310 | + |
311 | + _defaults = { |
312 | + 'state': lambda *a: 'draft', |
313 | + } |
314 | + |
315 | + |
316 | + def generate_report(self, cr, uid, ids, context=None): |
317 | + ''' |
318 | + Generate a report of stopped products |
319 | + Method is called by button on XML view (form) |
320 | + ''' |
321 | + prod_obj = self.pool.get('product.product') |
322 | + data_obj = self.pool.get('ir.model.data') |
323 | + |
324 | + res = {} |
325 | + for report in self.browse(cr, uid, ids, context=context): |
326 | + # get ids of all non-local products : |
327 | + status_local_id = data_obj.get_object_reference(cr, uid, 'product_attributes', 'int_4')[1] |
328 | + product_ids = prod_obj.search(cr, uid, [('international_status', '!=', status_local_id)], context=context) |
329 | + if not product_ids: |
330 | + continue |
331 | + |
332 | + # state of report is in progress : |
333 | + self.write(cr, uid, [report.id], { |
334 | + 'name': time.strftime('%Y-%m-%d %H:%M:%S'), |
335 | + 'state': 'in_progress' |
336 | + }, context=context) |
337 | + |
338 | + datas = { |
339 | + 'ids': [report.id], |
340 | + 'lines': product_ids, |
341 | + } |
342 | + |
343 | + cr.commit() |
344 | + new_thread = threading.Thread(target=self.generate_report_bkg, args=(cr, uid, report.id, datas, context)) |
345 | + new_thread.start() |
346 | + new_thread.join(timeout=30.0) # join = wait until new_thread is finished but if it last more then timeout value, you can continue to work |
347 | + |
348 | + res = { |
349 | + 'type': 'ir.actions.act_window', |
350 | + 'res_model': self._name, |
351 | + 'view_type': 'form', |
352 | + 'view_mode': 'form,tree', |
353 | + 'res_id': report.id, |
354 | + 'context': context, |
355 | + 'target': 'same', |
356 | + } |
357 | + |
358 | + if new_thread.isAlive(): |
359 | + view_id = data_obj.get_object_reference( |
360 | + cr, uid, |
361 | + 'msf_tools', |
362 | + 'report_stopped_products_info_view')[1] |
363 | + res['view_id'] = [view_id] |
364 | + |
365 | + if not res: |
366 | + raise osv.except_osv( |
367 | + _('Error'), |
368 | + _("Nothing to generate") |
369 | + ) |
370 | + |
371 | + return res |
372 | + |
373 | + |
374 | + def generate_report_bkg(self, cr, uid, report_ids, datas, context=None): |
375 | + ''' |
376 | + Generate the report in background (thread) |
377 | + ''' |
378 | + attachment_obj = self.pool.get('ir.attachment') |
379 | + |
380 | + if context is None: |
381 | + context ={} |
382 | + |
383 | + if isinstance(report_ids, (int, long)): |
384 | + report_ids = [report_ids] |
385 | + |
386 | + import pooler |
387 | + new_cr = pooler.get_db(cr.dbname).cursor() |
388 | + |
389 | + # export datas : |
390 | + report_name = "stopped.products.xls" |
391 | + attachment_name = "stopped_products_report_%s.xls" % time.strftime('%d-%m-%Y_%Hh%M') |
392 | + rp_spool = report_spool() |
393 | + res_export = rp_spool.exp_report(cr.dbname, uid, report_name, report_ids, datas, context) |
394 | + file_res = {'state': False} |
395 | + while not file_res.get('state'): |
396 | + file_res = rp_spool.exp_report_get(new_cr.dbname, uid, res_export) |
397 | + time.sleep(0.5) |
398 | + |
399 | + # attach report to the right panel : |
400 | + attachment_obj.create(new_cr, uid, { |
401 | + 'name': attachment_name, |
402 | + 'datas_fname': attachment_name, |
403 | + 'description': "Stopped products", |
404 | + 'res_model': 'export.report.stopped.products', |
405 | + 'res_id': report_ids[0], |
406 | + 'datas': file_res.get('result'), |
407 | + }, context=context) |
408 | + |
409 | + # state is now 'ready' : |
410 | + self.write(new_cr, uid, report_ids, {'state': 'ready'}, context= context) |
411 | + |
412 | + new_cr.commit() |
413 | + new_cr.close(True) |
414 | + |
415 | + return True |
416 | + |
417 | + |
418 | +export_report_stopped_products() |
419 | + |
420 | + |
421 | + |
422 | + |
423 | +class parser_report_stopped_products_xls(report_sxw.rml_parse): |
424 | + ''' |
425 | + To parse our mako template for stopped products |
426 | + ''' |
427 | + def __init__(self, cr, uid, name, context=None): |
428 | + super(parser_report_stopped_products_xls, self).__init__(cr, uid, name, context=context) |
429 | + |
430 | + # localcontext allows you to call methods inside mako file : |
431 | + self.localcontext.update({ |
432 | + 'time': time, |
433 | + 'get_uf_stopped_products': self.get_uf_stopped_products, |
434 | + 'get_stock_mission_report_lines': self.get_stock_mission_report_lines, |
435 | + 'get_uf_status': self.get_uf_status, |
436 | + }) |
437 | + |
438 | + self.status_buffer = {} |
439 | + |
440 | + |
441 | + def get_uf_stopped_products(self): |
442 | + ''' |
443 | + Return browse record list that contains stopped products |
444 | + taking in account non-local/temp products stopped in the current instance, |
445 | + and products in stock mission if they have qty in stock or in pipe |
446 | + ''' |
447 | + prod_obj = self.pool.get('product.product') |
448 | + data_obj = self.pool.get('ir.model.data') |
449 | + smrl_obj = self.pool.get('stock.mission.report.line') |
450 | + |
451 | + stopped_state_id = data_obj.get_object_reference(self.cr, self.uid, 'product_attributes', 'status_3')[1] |
452 | + status_local_id = data_obj.get_object_reference(self.cr, self.uid, 'product_attributes', 'int_4')[1] |
453 | + temporary_status_id = data_obj.get_object_reference(self.cr, self.uid, 'product_attributes', 'int_5')[1] |
454 | + |
455 | + hq_stopped_ids = prod_obj.search(self.cr, self.uid, [ |
456 | + ('state', '=', stopped_state_id), |
457 | + ('international_status', '!=', status_local_id), |
458 | + ('international_status', '!=', temporary_status_id)], |
459 | + context=self.localcontext) |
460 | + |
461 | + smrl_ids = smrl_obj.search(self.cr, self.uid, [ |
462 | + ('full_view', '=', False), |
463 | + ('product_state', '=', 'stopped'), |
464 | + '|', ('internal_qty', '!=', 0), |
465 | + ('in_pipe_qty', '!=', 0) |
466 | + ], context=self.localcontext) |
467 | + |
468 | + sm_stopped_ids = smrl_obj.read(self.cr, self.uid, smrl_ids, ['product_id'], context=self.localcontext) |
469 | + sm_stopped_ids = [x.get('product_id')[0] for x in sm_stopped_ids] |
470 | + |
471 | + # build a list of stopped products with unique ids and sorted by default_code: |
472 | + stopped_ids = list(set(hq_stopped_ids + sm_stopped_ids)) |
473 | + ls = [] |
474 | + for prod in prod_obj.browse(self.cr, self.uid, stopped_ids, context=self.localcontext): |
475 | + ls.append( (prod.id, prod.default_code) ) |
476 | + sorted_stopped_ids = [x[0] for x in sorted(ls, key=lambda tup: tup[1])] |
477 | + |
478 | + return prod_obj.browse(self.cr, self.uid, sorted_stopped_ids, context=self.localcontext) |
479 | + |
480 | + |
481 | + def get_stock_mission_report_lines(self, product): |
482 | + ''' |
483 | + Return browse record list of stock_mission_report_line with given product_id |
484 | + ''' |
485 | + data_obj = self.pool.get('ir.model.data') |
486 | + smrl_obj = self.pool.get('stock.mission.report.line') |
487 | + smrl_ids = smrl_obj.search(self.cr, self.uid, [('product_id', '=', product.id)], context=self.localcontext) |
488 | + |
489 | + stopped_state_id = data_obj.get_object_reference(self.cr, self.uid, 'product_attributes', 'status_3')[1] |
490 | + |
491 | + res = [smrl for smrl in smrl_obj.browse(self.cr, self.uid, smrl_ids, context=self.localcontext) if \ |
492 | + not smrl.full_view and (smrl.product_state == 'stopped' or product.state.id == stopped_state_id) and (smrl.internal_qty != 0 or smrl.in_pipe_qty != 0)] |
493 | + |
494 | + return res |
495 | + |
496 | + |
497 | + def get_uf_status(self, code): |
498 | + ''' |
499 | + Return the name of the unifield status with the given code |
500 | + ''' |
501 | + if code in self.status_buffer: |
502 | + return self.status_buffer[code] |
503 | + |
504 | + status_obj = self.pool.get('product.status') |
505 | + code_ids = status_obj.search(self.cr, self.uid, [('code', '=', code)], context=self.localcontext) |
506 | + res = "" |
507 | + if code_ids: |
508 | + res = status_obj.read(self.cr, self.uid, code_ids, ['name'])[0]['name'] |
509 | + |
510 | + self.status_buffer[code] = res |
511 | + |
512 | + return res |
513 | + |
514 | + |
515 | + |
516 | +class report_stopped_products_xls(SpreadsheetReport): |
517 | + |
518 | + def __init(self, name, table, rml=False, parser=report_sxw.rml_parse, header='external', store=False): |
519 | + super(report_stopped_products_xls, self).__init__( |
520 | + name, |
521 | + table, |
522 | + rml=rml, |
523 | + parser=parser, |
524 | + header=header, |
525 | + store=store |
526 | + ) |
527 | + |
528 | + def create(self, cr, uid, ids, data, context=None): |
529 | + a = super(report_stopped_products_xls, self).create(cr, uid, ids, data, context=context) |
530 | + return (a[0], 'xls') |
531 | + |
532 | + |
533 | + |
534 | +report_stopped_products_xls( |
535 | + 'report.stopped.products.xls', |
536 | + 'export.report.stopped.products', |
537 | + 'addons/msf_tools/report/report_stopped_products_xls.mako', |
538 | + parser=parser_report_stopped_products_xls, |
539 | + header='internal', |
540 | +) |
541 | |
542 | === added file 'bin/addons/msf_tools/report/report_stopped_products_report.xml' |
543 | --- bin/addons/msf_tools/report/report_stopped_products_report.xml 1970-01-01 00:00:00 +0000 |
544 | +++ bin/addons/msf_tools/report/report_stopped_products_report.xml 2016-11-21 09:48:09 +0000 |
545 | @@ -0,0 +1,20 @@ |
546 | +<?xml version="1.0" encoding="utf-8"?> |
547 | +<openerp> |
548 | + <data> |
549 | + |
550 | + |
551 | + <report |
552 | + id="report_stopped_products_xls" |
553 | + string="Stopped products" |
554 | + model="export.report.stopped.products" |
555 | + name="stopped.products.xls" |
556 | + file="msf_tools/report/report_stopped_products_xls.mako" |
557 | + report_type="webkit" |
558 | + header="False" |
559 | + auto="False" |
560 | + menu="False" |
561 | + /> |
562 | + |
563 | + |
564 | + </data> |
565 | +</openerp> |
566 | \ No newline at end of file |
567 | |
568 | === added file 'bin/addons/msf_tools/report/report_stopped_products_view.xml' |
569 | --- bin/addons/msf_tools/report/report_stopped_products_view.xml 1970-01-01 00:00:00 +0000 |
570 | +++ bin/addons/msf_tools/report/report_stopped_products_view.xml 2016-11-21 09:48:09 +0000 |
571 | @@ -0,0 +1,92 @@ |
572 | +<?xml version="1.0" encoding="utf-8"?> |
573 | +<openerp> |
574 | + <data> |
575 | + |
576 | + |
577 | + <record id="export_report_stopped_products_form_view" model="ir.ui.view"> |
578 | + <field name="name">export.report.stopped.products.form.view</field> |
579 | + <field name="model">export.report.stopped.products</field> |
580 | + <field name="type">form</field> |
581 | + <field name="arch" type="xml"> |
582 | + <form string="Export Stopped Products"> |
583 | + <separator colspan="4" string="Request information" /> |
584 | + <field name="name" /> |
585 | + <field name="state" /> |
586 | + <button name="generate_report" type="object" string="Generate report" |
587 | + icon="gtk-execute" states='draft' /> |
588 | + </form> |
589 | + </field> |
590 | + </record> |
591 | + |
592 | + |
593 | + <record id="export_report_stopped_products_tree_view" model="ir.ui.view"> |
594 | + <field name="name">export.report.stopped.products.tree.view</field> |
595 | + <field name="model">export.report.stopped.products</field> |
596 | + <field name="type">tree</field> |
597 | + <field name="arch" type="xml"> |
598 | + <tree string="Export Stopped Products"> |
599 | + <field name="name" /> |
600 | + <field name="state" /> |
601 | + </tree> |
602 | + </field> |
603 | + </record> |
604 | + |
605 | + |
606 | + <record id="report_stopped_product_search_view" model="ir.ui.view"> |
607 | + <field name="name">export.report.stopped.products.search.view</field> |
608 | + <field name="model">export.report.stopped.products</field> <!-- _name of openERP object --> |
609 | + <field name="type">search</field> |
610 | + <field name="arch" type="xml"> |
611 | + <search string="Export Stopped Products"> |
612 | + <field name="name" /> |
613 | + <field name="state" /> |
614 | + </search> |
615 | + </field> |
616 | + </record> |
617 | + |
618 | + |
619 | + <record id="report_stopped_products_info_view" model="ir.ui.view"> |
620 | + <field name="name">export.report.stopped.products.info.view</field> |
621 | + <field name="model">export.report.stopped.products</field> |
622 | + <field name="type">form</field> |
623 | + <field name="priority" eval="99" /> |
624 | + <field name="arch" type="xml"> |
625 | + <form string="Status of the report" hide_new_button="1" hide_delete_button="1"> |
626 | + <label> </label> |
627 | + <group colspan="2" col="2"> |
628 | + <html> |
629 | + <div style="align: center"> |
630 | + <p style="font-size:14px;align:center"> |
631 | + Your export inventory level demand will be treated quickly.<br /> |
632 | + </p> |
633 | + <p style="font-size:14px;align:center"> |
634 | + Due to the volume of data, your report cannot be shown immediatly.<br /> |
635 | + </p> |
636 | + <p style="font-size:14px;align:center"> |
637 | + When the report will be ready, you can access to it by the menu Tools / Export Stopped Products.<br /> |
638 | + </p> |
639 | + </div> |
640 | + </html> |
641 | + </group> |
642 | + <label> </label> |
643 | + </form> |
644 | + </field> |
645 | + </record> |
646 | + |
647 | + |
648 | + <record id="export_report_stopped_products_action" model="ir.actions.act_window"> |
649 | + <field name="name">Export Stopped Products</field> |
650 | + <field name="res_model">export.report.stopped.products</field> |
651 | + <field name="view_type">form</field> |
652 | + <field name="view_mode">tree,form</field> |
653 | + </record> |
654 | + |
655 | + |
656 | + <menuitem |
657 | + id="export_report_stopped_products_menu" |
658 | + action="export_report_stopped_products_action" |
659 | + parent="object_query.menu_preferences" |
660 | + sequence="51" /> |
661 | + |
662 | + </data> |
663 | +</openerp> |
664 | \ No newline at end of file |
665 | |
666 | === added file 'bin/addons/msf_tools/report/report_stopped_products_xls.mako' |
667 | --- bin/addons/msf_tools/report/report_stopped_products_xls.mako 1970-01-01 00:00:00 +0000 |
668 | +++ bin/addons/msf_tools/report/report_stopped_products_xls.mako 2016-11-21 09:48:09 +0000 |
669 | @@ -0,0 +1,140 @@ |
670 | +<?xml version="1.0"?> |
671 | +<?mso-application progid="Excel.Sheet"?> |
672 | +<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" |
673 | + xmlns:o="urn:schemas-microsoft-com:office:office" |
674 | + xmlns:x="urn:schemas-microsoft-com:office:excel" |
675 | + xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" |
676 | + xmlns:html="http://www.w3.org/TR/REC-html40"> |
677 | + <DocumentProperties xmlns="urn:schemas-microsoft-com:office:office"> |
678 | + <Author>MSFUser</Author> |
679 | + <LastAuthor>MSFUser</LastAuthor> |
680 | + <Created>2012-06-18T15:46:09Z</Created> |
681 | + <Company>Medecins Sans Frontieres</Company> |
682 | + <Version>11.9999</Version> |
683 | +</DocumentProperties> |
684 | +<ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel"> |
685 | + <WindowHeight>13170</WindowHeight> |
686 | + <WindowWidth>19020</WindowWidth> |
687 | + <WindowTopX>120</WindowTopX> |
688 | + <WindowTopY>60</WindowTopY> |
689 | + <ProtectStructure>False</ProtectStructure> |
690 | + <ProtectWindows>False</ProtectWindows> |
691 | +</ExcelWorkbook> |
692 | + |
693 | +<Styles> |
694 | + <Style ss:ID="tab_header_orange"> |
695 | + <Alignment ss:Horizontal="Center" ss:Vertical="Center" ss:WrapText="1"/> |
696 | + <Interior ss:Color="#ffcc99" ss:Pattern="Solid"/> |
697 | + <Borders> |
698 | + <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1" /> |
699 | + <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1" /> |
700 | + <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1" /> |
701 | + <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1" /> |
702 | + </Borders> |
703 | + </Style> |
704 | + <Style ss:ID="tab_header_gray"> |
705 | + <Alignment ss:Horizontal="Center" ss:Vertical="Center" ss:WrapText="1"/> |
706 | + <Interior ss:Color="#dbdbdb" ss:Pattern="Solid"/> |
707 | + <Borders> |
708 | + <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1" /> |
709 | + <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1" /> |
710 | + <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1" /> |
711 | + <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1" /> |
712 | + </Borders> |
713 | + </Style> |
714 | + <Style ss:ID="tab_content"> |
715 | + <Alignment ss:Horizontal="Center" ss:Vertical="Center" ss:WrapText="1"/> |
716 | + <Borders> |
717 | + <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1" /> |
718 | + <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1" /> |
719 | + <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1" /> |
720 | + <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1" /> |
721 | + </Borders> |
722 | + </Style> |
723 | +</Styles> |
724 | + |
725 | + |
726 | +<ss:Worksheet ss:Name="Stopped products"> |
727 | + |
728 | + <Table x:FullColumns="1" x:FullRows="1"> |
729 | + |
730 | + <Columns ss:AutoFitWidth="1" ss:Width="90" /> # product code |
731 | + <Columns ss:AutoFitWidth="1" ss:Width="200" /> # product description |
732 | + <Columns ss:AutoFitWidth="1" ss:Width="90" /> # product creator |
733 | + <Columns ss:AutoFitWidth="1" ss:Width="90" /> # standardization level |
734 | + <Columns ss:AutoFitWidth="1" ss:Width="90" /> # unidata status |
735 | + |
736 | + ##### Table with all stopped products ##### |
737 | + |
738 | + <% stopped_products = get_uf_stopped_products() %> |
739 | + % if not stopped_products: |
740 | + <Row ss:AutoFitHeight="1"> |
741 | + <Cell ss:StyleID="tab_content"><Data ss:Type="String"></Data></Cell> |
742 | + <Cell ss:StyleID="tab_content"><Data ss:Type="String">There is no stopped products to report</Data></Cell> |
743 | + </Row> |
744 | + % endif |
745 | + |
746 | + % for line in stopped_products: |
747 | + <Row ss:AutoFitHeight="1"> |
748 | + <Cell ss:StyleID="tab_header_orange"><Data ss:Type="String">Code</Data></Cell> |
749 | + <Cell ss:StyleID="tab_header_orange"><Data ss:Type="String">Description</Data></Cell> |
750 | + <Cell ss:StyleID="tab_header_orange"><Data ss:Type="String">Product Creator</Data></Cell> |
751 | + <Cell ss:StyleID="tab_header_orange"><Data ss:Type="String">Standardization Level</Data></Cell> |
752 | + <Cell ss:StyleID="tab_header_orange"><Data ss:Type="String">Unidata Status</Data></Cell> |
753 | + </Row> |
754 | + |
755 | + <% standard_level = 'Standard' if line.standard_ok == 'True' else 'Non-standard' %> |
756 | + <Row ss:AutoFitHeight="1"> |
757 | + <Cell ss:StyleID="tab_content"><Data ss:Type="String">${(line.default_code)|x}</Data></Cell> |
758 | + <Cell ss:StyleID="tab_content"><Data ss:Type="String">${(line.name_template)|x}</Data></Cell> |
759 | + <Cell ss:StyleID="tab_content"><Data ss:Type="String">${(line.international_status and line.international_status.name or '')|x}</Data></Cell> |
760 | + <Cell ss:StyleID="tab_content"><Data ss:Type="String">${(standard_level)|x}</Data></Cell> |
761 | + <Cell ss:StyleID="tab_content"><Data ss:Type="String">${(line.state_ud and getSel(line, 'state_ud') or '')|x}</Data></Cell> |
762 | + </Row> |
763 | + |
764 | + <% smrl_list = get_stock_mission_report_lines(line) %> |
765 | + <Row ss:AutoFitHeight="1"> |
766 | + <Cell ss:StyleID="tab_header_gray"><Data ss:Type="String">Instance/Mission</Data></Cell> |
767 | + <Cell ss:StyleID="tab_header_gray"><Data ss:Type="String">Unifield Status</Data></Cell> |
768 | + <Cell ss:StyleID="tab_header_gray"><Data ss:Type="String">Instance stock</Data></Cell> |
769 | + <Cell ss:StyleID="tab_header_gray"><Data ss:Type="String">Pipeline Qty</Data></Cell> |
770 | + </Row> |
771 | + % for smrl in smrl_list: |
772 | + <Row ss:AutoFitHeight="1"> |
773 | + <Cell ss:StyleID="tab_content"><Data ss:Type="String">${(smrl.mission_report_id.name)|x}</Data></Cell> |
774 | + <Cell ss:StyleID="tab_content"><Data ss:Type="String">${(get_uf_status(smrl.product_state))|x}</Data></Cell> |
775 | + <Cell ss:StyleID="tab_content"><Data ss:Type="Number">${(smrl.internal_qty)|x}</Data></Cell> |
776 | + <Cell ss:StyleID="tab_content"><Data ss:Type="Number">${(smrl.in_pipe_qty)|x}</Data></Cell> |
777 | + </Row> |
778 | + % endfor |
779 | + <Row></Row> |
780 | + <Row></Row> |
781 | + % endfor |
782 | + |
783 | + </Table> |
784 | + |
785 | + <WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel"> |
786 | + <PageSetup> |
787 | + <Layout x:Orientation="Landscape"/> |
788 | + <Header x:Data="&C&"Arial,Bold"&14"/> |
789 | + <Footer x:Data="Page &P of &N"/> |
790 | + </PageSetup> |
791 | + <Print> |
792 | + <ValidPrinterInfo/> |
793 | + <PaperSizeIndex>9</PaperSizeIndex> |
794 | + <HorizontalResolution>600</HorizontalResolution> |
795 | + <VerticalResolution>600</VerticalResolution> |
796 | + </Print> |
797 | + <Selected/> |
798 | + <Panes> |
799 | + <Pane> |
800 | + <Number>3</Number> |
801 | + <ActiveRow>17</ActiveRow> |
802 | + </Pane> |
803 | + </Panes> |
804 | + <ProtectObjects>False</ProtectObjects> |
805 | + <ProtectScenarios>False</ProtectScenarios> |
806 | +</WorksheetOptions> |
807 | +</ss:Worksheet> |
808 | + |
809 | +</Workbook> |
810 | |
811 | === modified file 'bin/addons/product_attributes/product_attributes.py' |
812 | --- bin/addons/product_attributes/product_attributes.py 2016-09-28 08:24:48 +0000 |
813 | +++ bin/addons/product_attributes/product_attributes.py 2016-11-21 09:48:09 +0000 |
814 | @@ -1261,6 +1261,8 @@ |
815 | if not ids: |
816 | return True |
817 | data_obj = self.pool.get('ir.model.data') |
818 | + smrl_obj = self.pool.get('stock.mission.report.line') |
819 | + prod_status_obj = self.pool.get('product.status') |
820 | |
821 | if context is None: |
822 | context = {} |
823 | @@ -1290,6 +1292,18 @@ |
824 | _('White spaces are not allowed in product code'), |
825 | ) |
826 | |
827 | + # update local stock mission report lines : |
828 | + if 'state' in vals: |
829 | + prod_state = '' |
830 | + if vals['state']: |
831 | + state_id = vals['state'] |
832 | + if isinstance(state_id, (int, long)): |
833 | + state_id = [state_id] |
834 | + prod_state = prod_status_obj.read(cr, uid, state_id, ['code'], context=context)[0]['code'] |
835 | + local_smrl_ids = smrl_obj.search(cr, uid, [('product_state', '!=', prod_state), ('product_id', 'in', ids), ('full_view', '=', False), ('mission_report_id.local_report', '=', True)], context=context) |
836 | + if local_smrl_ids: |
837 | + smrl_obj.write(cr, uid, local_smrl_ids, {'product_state': prod_state}, context=context) |
838 | + |
839 | product_uom_categ = [] |
840 | if 'uom_id' in vals or 'uom_po_id' in vals: |
841 | if isinstance(ids, (int, long)): |