Merge lp:~unifield-team/unifield-server/us-1167 into lp:unifield-server
- us-1167
- Merge into trunk
Proposed by
Quentin THEURET @Amaris
Status: | Merged |
---|---|
Merged at revision: | 4191 |
Proposed branch: | lp:~unifield-team/unifield-server/us-1167 |
Merge into: | lp:unifield-server |
Diff against target: |
1246 lines (+927/-17) 12 files modified
bin/addons/mission_stock/mission_stock.py (+16/-5) bin/addons/msf_profile/data/patches.xml (+5/-1) bin/addons/msf_profile/i18n/fr_MF.po (+130/-9) bin/addons/msf_profile/msf_profile.py (+49/-0) bin/addons/msf_sync_data_server/data/sync_server.sync_rule.csv (+2/-2) bin/addons/msf_tools/__openerp__.py (+2/-0) bin/addons/msf_tools/report/__init__.py (+1/-0) bin/addons/msf_tools/report/report_inconsistencies.py (+433/-0) bin/addons/msf_tools/report/report_inconsistencies_report.xml (+20/-0) bin/addons/msf_tools/report/report_inconsistencies_view.xml (+92/-0) bin/addons/msf_tools/report/report_inconsistencies_xls.mako (+139/-0) bin/addons/product_attributes/product_attributes.py (+38/-0) |
To merge this branch: | bzr merge lp:~unifield-team/unifield-server/us-1167 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
UniField Reviewer Team | Pending | ||
Review via email: mp+315900@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-12-05 14:26:00 +0000 | |||
3 | +++ bin/addons/mission_stock/mission_stock.py 2017-02-03 13:54:39 +0000 | |||
4 | @@ -547,20 +547,25 @@ | |||
5 | 547 | line_obj = self.pool.get('stock.mission.report.line') | 547 | line_obj = self.pool.get('stock.mission.report.line') |
6 | 548 | for report in self.read(cr, uid, report_ids, ['local_report', 'full_view'], context=context): | 548 | for report in self.read(cr, uid, report_ids, ['local_report', 'full_view'], context=context): |
7 | 549 | # Create one line by product | 549 | # Create one line by product |
11 | 550 | cr.execute('''SELECT p.id, ps.code | 550 | cr.execute('''SELECT p.id, ps.code, p.active, p.state_ud, pis.code |
12 | 551 | FROM product_product p, product_template pt | 551 | FROM product_product p, product_template pt, product_status ps, product_international_status pis |
10 | 552 | LEFT JOIN product_status ps ON pt.state = ps.id | ||
13 | 553 | WHERE p.product_tmpl_id = pt.id | 552 | WHERE p.product_tmpl_id = pt.id |
14 | 553 | AND pt.state = ps.id | ||
15 | 554 | AND p.international_status = pis.id | ||
16 | 554 | AND NOT EXISTS ( | 555 | AND NOT EXISTS ( |
17 | 555 | SELECT product_id | 556 | SELECT product_id |
18 | 556 | FROM | 557 | FROM |
19 | 557 | stock_mission_report_line smrl WHERE mission_report_id = %s | 558 | stock_mission_report_line smrl WHERE mission_report_id = %s |
20 | 558 | AND p.id = smrl.product_id) | 559 | AND p.id = smrl.product_id) |
21 | 559 | ''' % report['id']) | 560 | ''' % report['id']) |
23 | 560 | for product, prod_state in cr.fetchall(): | 561 | for product, prod_state, prod_active, prod_state_ud, prod_creator in cr.fetchall(): |
24 | 561 | line_obj.create(cr, uid, { | 562 | line_obj.create(cr, uid, { |
26 | 562 | 'product_id': product, | 563 | 'product_id': product, |
27 | 563 | 'mission_report_id': report['id'], | 564 | 'mission_report_id': report['id'], |
28 | 565 | 'product_state': prod_state, | ||
29 | 566 | 'product_active': prod_active, | ||
30 | 567 | 'state_ud': prod_state_ud, | ||
31 | 568 | 'international_status_code': prod_creator, | ||
32 | 564 | 'product_state': prod_state or '', | 569 | 'product_state': prod_state or '', |
33 | 565 | }, context=context) | 570 | }, context=context) |
34 | 566 | 571 | ||
35 | @@ -957,6 +962,9 @@ | |||
36 | 957 | 'stock.mission.report.line': (lambda self, cr, uid, ids, c=None: ids, ['product_id'], 10), | 962 | 'stock.mission.report.line': (lambda self, cr, uid, ids, c=None: ids, ['product_id'], 10), |
37 | 958 | }, | 963 | }, |
38 | 959 | write_relate=False), | 964 | write_relate=False), |
39 | 965 | 'product_active': fields.boolean(string='Active'), | ||
40 | 966 | 'state_ud': fields.char(size=128, string='UniData status'), | ||
41 | 967 | 'international_status_code': fields.char(size=128, string='Product Creator'), | ||
42 | 960 | 'mission_report_id': fields.many2one('stock.mission.report', string='Mission Report', required=True), | 968 | 'mission_report_id': fields.many2one('stock.mission.report', string='Mission Report', required=True), |
43 | 961 | 'internal_qty': fields.float(digits=(16,2), string='Instance Stock'), | 969 | 'internal_qty': fields.float(digits=(16,2), string='Instance Stock'), |
44 | 962 | 'internal_val': fields.function(_get_internal_val, method=True, type='float', string='Instance Stock Val.'), | 970 | 'internal_val': fields.function(_get_internal_val, method=True, type='float', string='Instance Stock Val.'), |
45 | @@ -985,6 +993,7 @@ | |||
46 | 985 | string='HQ Instance', | 993 | string='HQ Instance', |
47 | 986 | required=True, | 994 | required=True, |
48 | 987 | ), | 995 | ), |
49 | 996 | |||
50 | 988 | } | 997 | } |
51 | 989 | 998 | ||
52 | 990 | @tools.cache(skiparg=2) | 999 | @tools.cache(skiparg=2) |
53 | @@ -1019,6 +1028,8 @@ | |||
54 | 1019 | 'in_pipe_coor_val': 0.00, | 1028 | 'in_pipe_coor_val': 0.00, |
55 | 1020 | 'instance_id': _get_default_destination_instance_id, | 1029 | 'instance_id': _get_default_destination_instance_id, |
56 | 1021 | 'product_state': '', | 1030 | 'product_state': '', |
57 | 1031 | 'state_ud': '', | ||
58 | 1032 | 'international_status_code': '', | ||
59 | 1022 | } | 1033 | } |
60 | 1023 | 1034 | ||
61 | 1024 | def update_full_view_line(self, cr, uid, context=None): | 1035 | def update_full_view_line(self, cr, uid, context=None): |
62 | 1025 | 1036 | ||
63 | === modified file 'bin/addons/msf_profile/data/patches.xml' | |||
64 | --- bin/addons/msf_profile/data/patches.xml 2017-01-31 16:17:06 +0000 | |||
65 | +++ bin/addons/msf_profile/data/patches.xml 2017-02-03 13:54:39 +0000 | |||
66 | @@ -150,7 +150,11 @@ | |||
67 | 150 | <record id="us_1671_stopped_products" model="patch.scripts"> | 150 | <record id="us_1671_stopped_products" model="patch.scripts"> |
68 | 151 | <field name="method">us_1671_stopped_products</field> | 151 | <field name="method">us_1671_stopped_products</field> |
69 | 152 | </record> | 152 | </record> |
71 | 153 | 153 | ||
72 | 154 | <record id="us_1167_status_inconsistencies" model="patch.scripts"> | ||
73 | 155 | <field name="method">us_1167_status_inconsistencies</field> | ||
74 | 156 | </record> | ||
75 | 157 | |||
76 | 154 | <record id="us_2075_partner_locally_created" model="patch.scripts"> | 158 | <record id="us_2075_partner_locally_created" model="patch.scripts"> |
77 | 155 | <field name="method">us_2075_partner_locally_created</field> | 159 | <field name="method">us_2075_partner_locally_created</field> |
78 | 156 | </record> | 160 | </record> |
79 | 157 | 161 | ||
80 | === modified file 'bin/addons/msf_profile/i18n/fr_MF.po' | |||
81 | --- bin/addons/msf_profile/i18n/fr_MF.po 2017-01-31 16:17:06 +0000 | |||
82 | +++ bin/addons/msf_profile/i18n/fr_MF.po 2017-02-03 13:54:39 +0000 | |||
83 | @@ -4658,7 +4658,7 @@ | |||
84 | 4658 | msgid "Search Real Kit Composition Item" | 4658 | msgid "Search Real Kit Composition Item" |
85 | 4659 | msgstr "Rechercher l'Article de la Composition Réelle du Kit" | 4659 | msgstr "Rechercher l'Article de la Composition Réelle du Kit" |
86 | 4660 | 4660 | ||
88 | 4661 | #. modules: process, financing_contract, account_voucher, account_hq_entries, account_override, product_attributes, base_report_designer, msf_accrual, return_claim, account_mcdb, analytic, msf_doc_import, stock, product, msf_homere_interface, hr, register_accounting, base, procurement_report, account_invoice_split, account, msf_outgoing, msf_audittrail, sale, procurement, purchase, product_list | 4661 | #. modules: process, financing_contract, account_voucher, account_hq_entries, account_override, product_attributes, base_report_designer, msf_accrual, return_claim, account_mcdb, analytic, msf_doc_import, stock, product, msf_homere_interface, hr, register_accounting, base, procurement_report, account_invoice_split, account, msf_outgoing, msf_audittrail, sale, procurement, purchase, product_list, msf_tools |
89 | 4662 | #: view:account.account.type:0 | 4662 | #: view:account.account.type:0 |
90 | 4663 | #: field:account.account.type,note:0 | 4663 | #: field:account.account.type,note:0 |
91 | 4664 | #: view:account.analytic.account:0 | 4664 | #: view:account.analytic.account:0 |
92 | @@ -4735,6 +4735,7 @@ | |||
93 | 4735 | #: report:msf.report_reception_in:0 | 4735 | #: report:msf.report_reception_in:0 |
94 | 4736 | #: view:stock.production.lot.revision:0 | 4736 | #: view:stock.production.lot.revision:0 |
95 | 4737 | #: field:stock.production.lot.revision,description:0 | 4737 | #: field:stock.production.lot.revision,description:0 |
96 | 4738 | #: report:addons/msf_tools/report/report_inconsistencies_xls.mako:81 | ||
97 | 4738 | #, python-format | 4739 | #, python-format |
98 | 4739 | msgid "Description" | 4740 | msgid "Description" |
99 | 4740 | msgstr "Description" | 4741 | msgstr "Description" |
100 | @@ -6421,6 +6422,7 @@ | |||
101 | 6421 | #: view:automated.import.job:0 | 6422 | #: view:automated.import.job:0 |
102 | 6422 | #: selection:automated.import.job,state:0 | 6423 | #: selection:automated.import.job,state:0 |
103 | 6423 | #: selection:export.report.stopped.products,state:0 | 6424 | #: selection:export.report.stopped.products,state:0 |
104 | 6425 | #: selection:export.report.inconsistencies,state:0 | ||
105 | 6424 | #: view:account.bank.statement:0 | 6426 | #: view:account.bank.statement:0 |
106 | 6425 | #: selection:account.bank.statement,state:0 | 6427 | #: selection:account.bank.statement,state:0 |
107 | 6426 | #: view:account.invoice:0 | 6428 | #: view:account.invoice:0 |
108 | @@ -6526,6 +6528,7 @@ | |||
109 | 6526 | #: selection:tender,internal_state:0 | 6528 | #: selection:tender,internal_state:0 |
110 | 6527 | #: selection:tender,state:0 | 6529 | #: selection:tender,state:0 |
111 | 6528 | #: selection:tender.line,state:0 | 6530 | #: selection:tender.line,state:0 |
112 | 6531 | #: view:automated.import.job:0 | ||
113 | 6529 | #, python-format | 6532 | #, python-format |
114 | 6530 | msgid "Draft" | 6533 | msgid "Draft" |
115 | 6531 | msgstr "Brouillon" | 6534 | msgstr "Brouillon" |
116 | @@ -7368,12 +7371,13 @@ | |||
117 | 7368 | msgid "Earmarked" | 7371 | msgid "Earmarked" |
118 | 7369 | msgstr "Réservé" | 7372 | msgstr "Réservé" |
119 | 7370 | 7373 | ||
121 | 7371 | #. modules: mission_stock, base, msf_instance | 7374 | #. modules: mission_stock, base, msf_instance, msf_tools |
122 | 7372 | #: field:workflow.workitem,inst_id:0 | 7375 | #: field:workflow.workitem,inst_id:0 |
123 | 7373 | #: field:stock.mission.report,instance_id:0 | 7376 | #: field:stock.mission.report,instance_id:0 |
124 | 7374 | #: field:account.target.costcenter,instance_id:0 | 7377 | #: field:account.target.costcenter,instance_id:0 |
125 | 7375 | #: model:ir.actions.act_window,name:msf_instance.action_msf_instance_setup | 7378 | #: model:ir.actions.act_window,name:msf_instance.action_msf_instance_setup |
126 | 7376 | #: field:msf.instance,instance:0 | 7379 | #: field:msf.instance,instance:0 |
127 | 7380 | #: report:addons/msf_tools/report/report_inconsistencies_xls.mako:79 | ||
128 | 7377 | msgid "Instance" | 7381 | msgid "Instance" |
129 | 7378 | msgstr "Instance" | 7382 | msgstr "Instance" |
130 | 7379 | 7383 | ||
131 | @@ -8393,10 +8397,11 @@ | |||
132 | 8393 | msgid "Budget Import" | 8397 | msgid "Budget Import" |
133 | 8394 | msgstr "Budget - Importation" | 8398 | msgstr "Budget - Importation" |
134 | 8395 | 8399 | ||
136 | 8396 | #. modules: supplier_catalogue, resource, msf_instance | 8400 | #. modules: supplier_catalogue, resource, msf_instance, msf_tools |
137 | 8397 | #: selection:msf.instance,state:0 | 8401 | #: selection:msf.instance,state:0 |
138 | 8398 | #: view:resource.resource:0 | 8402 | #: view:resource.resource:0 |
139 | 8399 | #: view:supplier.catalogue:0 | 8403 | #: view:supplier.catalogue:0 |
140 | 8404 | #: report:addons/msf_tools/report/report_inconsistencies_xls.mako:106 | ||
141 | 8400 | msgid "Inactive" | 8405 | msgid "Inactive" |
142 | 8401 | msgstr "Inactif" | 8406 | msgstr "Inactif" |
143 | 8402 | 8407 | ||
144 | @@ -10646,7 +10651,7 @@ | |||
145 | 10646 | msgid "The new %s Event %s has been created." | 10651 | msgid "The new %s Event %s has been created." |
146 | 10647 | msgstr "Le nouveau %s Evénement %s a été créé." | 10652 | msgstr "Le nouveau %s Evénement %s a été créé." |
147 | 10648 | 10653 | ||
149 | 10649 | #. modules: msf_budget, account, reason_types_moves, resource, product_attributes, financing_contract, res_currency_tables, msf_instance, product, sale, analytic, base, stock, analytic_distribution | 10654 | #. modules: msf_budget, account, reason_types_moves, resource, product_attributes, financing_contract, res_currency_tables, msf_instance, product, sale, analytic, base, stock, analytic_distribution, msf_tools |
150 | 10650 | #: field:account.account,code:0 | 10655 | #: field:account.account,code:0 |
151 | 10651 | #: report:account.account.balance:0 | 10656 | #: report:account.account.balance:0 |
152 | 10652 | #: field:account.account.template,code:0 | 10657 | #: field:account.account.template,code:0 |
153 | @@ -10683,6 +10688,7 @@ | |||
154 | 10683 | #: field:resource.resource,code:0 | 10688 | #: field:resource.resource,code:0 |
155 | 10684 | #: report:msf.report_reception_in:0 | 10689 | #: report:msf.report_reception_in:0 |
156 | 10685 | #: field:stock.incoterms,code:0 | 10690 | #: field:stock.incoterms,code:0 |
157 | 10691 | #: report:addons/msf_tools/report/report_inconsistencies_xls.mako:80 | ||
158 | 10686 | msgid "Code" | 10692 | msgid "Code" |
159 | 10687 | msgstr "Code" | 10693 | msgstr "Code" |
160 | 10688 | 10694 | ||
161 | @@ -11658,6 +11664,8 @@ | |||
162 | 11658 | #: selection:stock.forecast.line,state:0 | 11664 | #: selection:stock.forecast.line,state:0 |
163 | 11659 | #: view:stock.move:0 | 11665 | #: view:stock.move:0 |
164 | 11660 | #: selection:sync.client.entity_manager,state:0 | 11666 | #: selection:sync.client.entity_manager,state:0 |
165 | 11667 | #: selection:export.report.inconsistencies,state:0 | ||
166 | 11668 | #: selection:export.report.stopped.products,state:0 | ||
167 | 11661 | msgid "Ready" | 11669 | msgid "Ready" |
168 | 11662 | msgstr "Prêt" | 11670 | msgstr "Prêt" |
169 | 11663 | 11671 | ||
170 | @@ -23526,7 +23534,7 @@ | |||
171 | 23526 | msgid "Send SMS" | 23534 | msgid "Send SMS" |
172 | 23527 | msgstr "Envoyer SMS" | 23535 | msgstr "Envoyer SMS" |
173 | 23528 | 23536 | ||
175 | 23529 | #. modules: msf_partner, stock_override, kit, account_override, product_attributes, msf_doc_import, purchase_msf, msf_profile | 23537 | #. modules: msf_partner, stock_override, kit, account_override, product_attributes, msf_doc_import, purchase_msf, msf_profile, msf_tools |
176 | 23530 | #: code:addons/account_override/wizard/wizard_import_mapping.py:59 | 23538 | #: code:addons/account_override/wizard/wizard_import_mapping.py:59 |
177 | 23531 | #: code:addons/kit/kit.py:835 | 23539 | #: code:addons/kit/kit.py:835 |
178 | 23532 | #: code:addons/kit/kit.py:840 | 23540 | #: code:addons/kit/kit.py:840 |
179 | @@ -23604,9 +23612,22 @@ | |||
180 | 23604 | #: selection:wizard.import.po.simulation.screen,state:0 | 23612 | #: selection:wizard.import.po.simulation.screen,state:0 |
181 | 23605 | #: selection:wizard.import.po.simulation.screen.line,type_change:0 | 23613 | #: selection:wizard.import.po.simulation.screen.line,type_change:0 |
182 | 23606 | #: selection:wizard.simu.import.po.line,change_type:0 | 23614 | #: selection:wizard.simu.import.po.line,change_type:0 |
183 | 23615 | #: code:addons/msf_tools/automated_import.py:57 | ||
184 | 23616 | #: code:addons/msf_tools/automated_import.py:62 | ||
185 | 23617 | #: code:addons/msf_tools/automated_import.py:67 | ||
186 | 23618 | #: code:addons/msf_tools/automated_import.py:196 | ||
187 | 23619 | #: code:addons/msf_tools/automated_import.py:227 | ||
188 | 23620 | #: code:addons/msf_tools/automated_import.py:386 | ||
189 | 23621 | #: code:addons/msf_tools/automated_import.py:407 | ||
190 | 23622 | #: code:addons/msf_tools/automated_import_function.py:65 | ||
191 | 23623 | #: code:addons/msf_tools/automated_import_job.py:324 | ||
192 | 23624 | #: code:addons/msf_tools/msf_tools.py:875 | ||
193 | 23625 | #: code:addons/msf_tools/msf_tools.py:888 | ||
194 | 23626 | #: code:addons/msf_tools/report/report_inconsistencies.py:106 | ||
195 | 23627 | #: code:addons/msf_tools/report/report_stopped_products.py:106 | ||
196 | 23607 | #, python-format | 23628 | #, python-format |
197 | 23608 | msgid "Error" | 23629 | msgid "Error" |
199 | 23609 | msgstr "Error" | 23630 | msgstr "Erreur" |
200 | 23610 | 23631 | ||
201 | 23611 | #. modules: account_activable, analytic_distribution | 23632 | #. modules: account_activable, analytic_distribution |
202 | 23612 | #: code:addons/account_activable/account_activable.py:51 | 23633 | #: code:addons/account_activable/account_activable.py:51 |
203 | @@ -32054,6 +32075,8 @@ | |||
204 | 32054 | #: selection:wizard.import.po,state:0 | 32075 | #: selection:wizard.import.po,state:0 |
205 | 32055 | #: view:sourcing.line:0 | 32076 | #: view:sourcing.line:0 |
206 | 32056 | #: selection:wizard.register.import,state:0 | 32077 | #: selection:wizard.register.import,state:0 |
207 | 32078 | #: selection::export.report.inconsistencies,state:0 | ||
208 | 32079 | #: selection:export.report.stopped.products,state:0 | ||
209 | 32057 | #, python-format | 32080 | #, python-format |
210 | 32058 | msgid "In Progress" | 32081 | msgid "In Progress" |
211 | 32059 | msgstr "En Cours" | 32082 | msgstr "En Cours" |
212 | @@ -42472,8 +42495,10 @@ | |||
213 | 42472 | msgid "Asia/Phnom_Penh" | 42495 | msgid "Asia/Phnom_Penh" |
214 | 42473 | msgstr "Asia/Phnom_Penh" | 42496 | msgstr "Asia/Phnom_Penh" |
215 | 42474 | 42497 | ||
217 | 42475 | #. module: product_attributes | 42498 | #. modules: product_attributes, mission_stock, msf_tools |
218 | 42476 | #: field:product.product,international_status:0 | 42499 | #: field:product.product,international_status:0 |
219 | 42500 | #: field:stock.mission.report.line,international_status_code:0 | ||
220 | 42501 | #: report:addons/msf_tools/report/report_inconsistencies_xls.mako:82 | ||
221 | 42477 | msgid "Product Creator" | 42502 | msgid "Product Creator" |
222 | 42478 | msgstr "Créateur produit" | 42503 | msgstr "Créateur produit" |
223 | 42479 | 42504 | ||
224 | @@ -43961,6 +43986,9 @@ | |||
225 | 43961 | #: field:wizard.import.stock.warehouse.orderpoint.line,state:0 | 43986 | #: field:wizard.import.stock.warehouse.orderpoint.line,state:0 |
226 | 43962 | #: field:wizard.import.supplier.catalogue,state:0 | 43987 | #: field:wizard.import.supplier.catalogue,state:0 |
227 | 43963 | #: field:wizard.import.threshold.value.line,state:0 | 43988 | #: field:wizard.import.threshold.value.line,state:0 |
228 | 43989 | #: field:automated.import.job,state:0 | ||
229 | 43990 | #: field:export.report.inconsistencies,state:0 | ||
230 | 43991 | #: field:export.report.stopped.products,state:0 | ||
231 | 43964 | msgid "State" | 43992 | msgid "State" |
232 | 43965 | msgstr "État" | 43993 | msgstr "État" |
233 | 43966 | 43994 | ||
234 | @@ -49776,13 +49804,14 @@ | |||
235 | 49776 | msgid "RWANDAN FRANC" | 49804 | msgid "RWANDAN FRANC" |
236 | 49777 | msgstr "RWANDAN FRANC" | 49805 | msgstr "RWANDAN FRANC" |
237 | 49778 | 49806 | ||
239 | 49779 | #. modules: product_attributes, purchase_override, account_hq_entries, sale | 49807 | #. modules: product_attributes, purchase_override, account_hq_entries, sale, msf_tools |
240 | 49780 | #: model:ir.ui.menu,name:account_hq_entries.menu_hq | 49808 | #: model:ir.ui.menu,name:account_hq_entries.menu_hq |
241 | 49781 | #: selection:product.product,international_status:0 | 49809 | #: selection:product.product,international_status:0 |
242 | 49782 | #: report:msf.purchase.order:0 | 49810 | #: report:msf.purchase.order:0 |
243 | 49783 | #: report:msf.purchase.quotation:0 | 49811 | #: report:msf.purchase.quotation:0 |
244 | 49784 | #: report:purchase.order.merged:0 | 49812 | #: report:purchase.order.merged:0 |
245 | 49785 | #: report:msf.sale.order:0 | 49813 | #: report:msf.sale.order:0 |
246 | 49814 | #: report:addons/msf_tools/report/report_inconsistencies_xls.mako:90 | ||
247 | 49786 | msgid "HQ" | 49815 | msgid "HQ" |
248 | 49787 | msgstr "HQ / Siège" | 49816 | msgstr "HQ / Siège" |
249 | 49788 | 49817 | ||
250 | @@ -53592,7 +53621,7 @@ | |||
251 | 53592 | msgid "Navajo" | 53621 | msgid "Navajo" |
252 | 53593 | msgstr "Navajo" | 53622 | msgstr "Navajo" |
253 | 53594 | 53623 | ||
255 | 53595 | #. modules: product_nomenclature, process, financing_contract, account_override, procurement_cycle, supplier_catalogue, unifield_setup, stock, product, msf_homere_interface, hr, msf_instance, purchase_override, kit, sale_override, base, res_currency_functional, procurement_report, threshold_value, account, resource, msf_partner, procurement_auto, procurement, analytic_distribution | 53624 | #. modules: product_nomenclature, process, financing_contract, account_override, procurement_cycle, supplier_catalogue, unifield_setup, stock, product, msf_homere_interface, hr, msf_instance, purchase_override, kit, sale_override, base, res_currency_functional, procurement_report, threshold_value, account, resource, msf_partner, procurement_auto, procurement, analytic_distribution, mission_stock, msf_tools |
256 | 53596 | #: field:account.account,active:0 | 53625 | #: field:account.account,active:0 |
257 | 53597 | #: field:account.analytic.journal,active:0 | 53626 | #: field:account.analytic.journal,active:0 |
258 | 53598 | #: field:account.journal.period,active:0 | 53627 | #: field:account.journal.period,active:0 |
259 | @@ -53647,6 +53676,9 @@ | |||
260 | 53647 | #: field:supplier.catalogue,current:0 | 53676 | #: field:supplier.catalogue,current:0 |
261 | 53648 | #: field:threshold.value,active:0 | 53677 | #: field:threshold.value,active:0 |
262 | 53649 | #: field:ir.ui.menu,active:0 | 53678 | #: field:ir.ui.menu,active:0 |
263 | 53679 | #: field:stock.mission.report.line,product_active:0 | ||
264 | 53680 | #: field:automated.import,active:0 | ||
265 | 53681 | #: report:addons/msf_tools/report/report_inconsistencies_xls.mako:106 | ||
266 | 53650 | msgid "Active" | 53682 | msgid "Active" |
267 | 53651 | msgstr "Actif" | 53683 | msgstr "Actif" |
268 | 53652 | 53684 | ||
269 | @@ -54315,6 +54347,8 @@ | |||
270 | 54315 | #: code:addons/kit/wizard/substitute.py:687 | 54347 | #: code:addons/kit/wizard/substitute.py:687 |
271 | 54316 | #: code:addons/kit/wizard/substitute.py:1024 | 54348 | #: code:addons/kit/wizard/substitute.py:1024 |
272 | 54317 | #: code:addons/mission_stock/mission_stock.py:71 | 54349 | #: code:addons/mission_stock/mission_stock.py:71 |
273 | 54350 | #: code:addons/mission_stock/report/stock_mission_report.py:66 | ||
274 | 54351 | #: code:addons/mission_stock/report/stock_mission_report.py:77 | ||
275 | 54318 | #: code:addons/mission_stock/wizard/mission_stock_wizard.py:54 | 54352 | #: code:addons/mission_stock/wizard/mission_stock_wizard.py:54 |
276 | 54319 | #: code:addons/mission_stock/wizard/mission_stock_wizard.py:88 | 54353 | #: code:addons/mission_stock/wizard/mission_stock_wizard.py:88 |
277 | 54320 | #: code:addons/mission_stock/wizard/mission_stock_wizard.py:92 | 54354 | #: code:addons/mission_stock/wizard/mission_stock_wizard.py:92 |
278 | @@ -76100,6 +76134,93 @@ | |||
279 | 76100 | msgid "A line was added to the %s %s to re-source the canceled line." | 76134 | msgid "A line was added to the %s %s to re-source the canceled line." |
280 | 76101 | msgstr "Une ligne a été ajoutée a la %s %s pour 're-sourcer' la ligne annulée." | 76135 | msgstr "Une ligne a été ajoutée a la %s %s pour 're-sourcer' la ligne annulée." |
281 | 76102 | 76136 | ||
282 | 76137 | #. module: mission_stock | ||
283 | 76138 | #: field:stock.mission.report.line,state_ud:0 | ||
284 | 76139 | msgid "UniData status" | ||
285 | 76140 | msgstr "Statut UniData" | ||
286 | 76141 | |||
287 | 76142 | #. module: msf_tools | ||
288 | 76143 | #: field:export.report.inconsistencies,name:0 | ||
289 | 76144 | #: field:export.report.stopped.products,name:0 | ||
290 | 76145 | msgid "Generated On" | ||
291 | 76146 | msgstr "Généré le" | ||
292 | 76147 | |||
293 | 76148 | #. module: msf_tools | ||
294 | 76149 | #: code:addons/msf_tools/report/report_inconsistencies.py:107 | ||
295 | 76150 | #: code:addons/msf_tools/report/report_stopped_products.py:107 | ||
296 | 76151 | #, python-format | ||
297 | 76152 | msgid "Nothing to generate" | ||
298 | 76153 | msgstr "Rien à générer" | ||
299 | 76154 | |||
300 | 76155 | #. module: msf_tools | ||
301 | 76156 | #: model:ir.actions.report.xml,name:msf_tools.report_inconsistencies_xls | ||
302 | 76157 | msgid "Inconsistencies with HQ" | ||
303 | 76158 | msgstr "Incohérences avec le HQ" | ||
304 | 76159 | |||
305 | 76160 | #. module: msf_tools | ||
306 | 76161 | #: model:ir.actions.act_window,name:msf_tools.export_report_inconsistencies_action | ||
307 | 76162 | #: model:ir.ui.menu,name:msf_tools.export_report_inconsistencies_menu | ||
308 | 76163 | msgid "Product Status Inconsistencies" | ||
309 | 76164 | msgstr "Incohérences du statut des produits" | ||
310 | 76165 | |||
311 | 76166 | #. module: msf_tools | ||
312 | 76167 | #: view:export.report.inconsistencies:0 | ||
313 | 76168 | msgid "Export inconsistencies" | ||
314 | 76169 | msgstr "Exporter les incohérences" | ||
315 | 76170 | |||
316 | 76171 | #. module: msf_tools | ||
317 | 76172 | #: view:export.report.inconsistencies:0 | ||
318 | 76173 | #: view:export.report.stopped.products:0 | ||
319 | 76174 | msgid "Request information" | ||
320 | 76175 | msgstr "Demande d'informations" | ||
321 | 76176 | |||
322 | 76177 | #. module: msf_tools | ||
323 | 76178 | #: view:export.report.inconsistencies:0 | ||
324 | 76179 | #: view:export.report.stopped.products:0 | ||
325 | 76180 | msgid "Generate report" | ||
326 | 76181 | msgstr "Générer le rapport" | ||
327 | 76182 | |||
328 | 76183 | #. module: msf_tools | ||
329 | 76184 | #: view:export.report.inconsistencies:0 | ||
330 | 76185 | #: view:export.report.stopped.products:0 | ||
331 | 76186 | msgid "Status of the report" | ||
332 | 76187 | msgstr "État du rapport" | ||
333 | 76188 | |||
334 | 76189 | #. module: msf_tools | ||
335 | 76190 | #: view:export.report.inconsistencies:0 | ||
336 | 76191 | msgid "Your export inconsistent products demand will be treated quickly." | ||
337 | 76192 | msgstr "Votre export des produits incohérents sera traité rapidement." | ||
338 | 76193 | |||
339 | 76194 | #. module: msf_tools | ||
340 | 76195 | #: view:export.report.inconsistencies:0 | ||
341 | 76196 | msgid "Due to the volume of data, your report cannot be shown immediatly" | ||
342 | 76197 | msgstr "À cause du volume des données, le rapport ne peut pas être affiché immédiatement" | ||
343 | 76198 | |||
344 | 76199 | #. module: msf_tools | ||
345 | 76200 | #: view:export.report.inconsistencies:0 | ||
346 | 76201 | msgid "When the report will be ready, you can access to it by the menu Tools / Inconsistencies report" | ||
347 | 76202 | msgstr "Quand le rapport sera prêt, vous pourrez y accéder depuis le menu Outils / Rapport d'incohérences" | ||
348 | 76203 | |||
349 | 76204 | #. module: msf_tools | ||
350 | 76205 | #: report:addons/msf_tools/report/report_inconsistencies_xls.mako:75 | ||
351 | 76206 | msgid "There is no inconsistencies to report" | ||
352 | 76207 | msgstr "Il n'y a pas d'incohérence à reporter" | ||
353 | 76208 | |||
354 | 76209 | #. module: msf_tools | ||
355 | 76210 | #: report:addons/msf_tools/report/report_inconsistencies_xls.mako:85 | ||
356 | 76211 | msgid "Active/Inactive" | ||
357 | 76212 | msgstr "Actif/Inactif" | ||
358 | 76213 | |||
359 | 76214 | #. module: msf_tools | ||
360 | 76215 | #: report:addons/msf_tools/report/report_inconsistencies_xls.mako:83 | ||
361 | 76216 | msgid "UniField Status" | ||
362 | 76217 | msgstr "Statut UniField" | ||
363 | 76218 | |||
364 | 76219 | #. module: msf_tools | ||
365 | 76220 | #: report:addons/msf_tools/report/report_inconsistencies_xls.mako:84 | ||
366 | 76221 | msgid "Unidata Status" | ||
367 | 76222 | msgstr "Statut UniData" | ||
368 | 76223 | |||
369 | 76103 | #. modules: sale, msf_printed_documents | 76224 | #. modules: sale, msf_printed_documents |
370 | 76104 | #: report:msf.consumption_report:0 | 76225 | #: report:msf.consumption_report:0 |
371 | 76105 | msgid "Source Location :" | 76226 | msgid "Source Location :" |
372 | 76106 | 76227 | ||
373 | === modified file 'bin/addons/msf_profile/msf_profile.py' | |||
374 | --- bin/addons/msf_profile/msf_profile.py 2017-01-31 16:17:06 +0000 | |||
375 | +++ bin/addons/msf_profile/msf_profile.py 2017-02-03 13:54:39 +0000 | |||
376 | @@ -1117,9 +1117,58 @@ | |||
377 | 1117 | return True | 1117 | return True |
378 | 1118 | 1118 | ||
379 | 1119 | 1119 | ||
380 | 1120 | def us_1167_status_inconsistencies(self, cr, uid, *a, **b): | ||
381 | 1121 | ''' | ||
382 | 1122 | fill fields of stock.mission.report.line: | ||
383 | 1123 | - state_ud | ||
384 | 1124 | - product_active | ||
385 | 1125 | - international_status_code | ||
386 | 1126 | ''' | ||
387 | 1127 | prod_obj = self.pool.get('product.product') | ||
388 | 1128 | smrl_obj = self.pool.get('stock.mission.report.line') | ||
389 | 1129 | context = {} | ||
390 | 1130 | |||
391 | 1131 | prod_ids = prod_obj.search(cr, uid, [('active', 'in', ['t', 'f'])], context=context) | ||
392 | 1132 | smrl_to_update = smrl_obj.search(cr, uid, [('product_id', 'in', prod_ids), ('mission_report_id.local_report', '=', True)], context=context) | ||
393 | 1133 | |||
394 | 1134 | for smrl in smrl_obj.browse(cr, uid, smrl_to_update, context=context): | ||
395 | 1135 | smrl_obj.write(cr, uid, smrl.id, { | ||
396 | 1136 | 'state_ud': smrl.product_id.state_ud, | ||
397 | 1137 | 'product_active': smrl.product_id.active, | ||
398 | 1138 | 'international_status_code': smrl.product_id.international_status.code if smrl.product_id.international_status else '', | ||
399 | 1139 | }, context=context) | ||
400 | 1140 | |||
401 | 1141 | return True | ||
402 | 1142 | |||
403 | 1143 | |||
404 | 1144 | def us_1167_status_inconsistencies(self, cr, uid, *a, **b): | ||
405 | 1145 | ''' | ||
406 | 1146 | fill fields of stock.mission.report.line: | ||
407 | 1147 | - state_ud | ||
408 | 1148 | - product_active | ||
409 | 1149 | - international_status_code | ||
410 | 1150 | ''' | ||
411 | 1151 | prod_obj = self.pool.get('product.product') | ||
412 | 1152 | smrl_obj = self.pool.get('stock.mission.report.line') | ||
413 | 1153 | context = {} | ||
414 | 1154 | |||
415 | 1155 | prod_ids = prod_obj.search(cr, uid, [('active', 'in', ['t', 'f'])], context=context) | ||
416 | 1156 | smrl_to_update = smrl_obj.search(cr, uid, [('product_id', 'in', prod_ids), ('mission_report_id.local_report', '=', True)], context=context) | ||
417 | 1157 | |||
418 | 1158 | for smrl in smrl_obj.browse(cr, uid, smrl_to_update, context=context): | ||
419 | 1159 | smrl_obj.write(cr, uid, smrl.id, { | ||
420 | 1160 | 'state_ud': smrl.product_id.state_ud, | ||
421 | 1161 | 'product_active': smrl.product_id.active, | ||
422 | 1162 | 'international_status_code': smrl.product_id.international_status.code if smrl.product_id.international_status else '', | ||
423 | 1163 | }, context=context) | ||
424 | 1164 | |||
425 | 1165 | return True | ||
426 | 1166 | |||
427 | 1167 | |||
428 | 1120 | patch_scripts() | 1168 | patch_scripts() |
429 | 1121 | 1169 | ||
430 | 1122 | 1170 | ||
431 | 1171 | |||
432 | 1123 | class ir_model_data(osv.osv): | 1172 | class ir_model_data(osv.osv): |
433 | 1124 | _inherit = 'ir.model.data' | 1173 | _inherit = 'ir.model.data' |
434 | 1125 | _name = 'ir.model.data' | 1174 | _name = 'ir.model.data' |
435 | 1126 | 1175 | ||
436 | === modified file 'bin/addons/msf_sync_data_server/data/sync_server.sync_rule.csv' | |||
437 | --- bin/addons/msf_sync_data_server/data/sync_server.sync_rule.csv 2017-01-25 14:57:37 +0000 | |||
438 | +++ bin/addons/msf_sync_data_server/data/sync_server.sync_rule.csv 2017-02-03 13:54:39 +0000 | |||
439 | @@ -87,8 +87,8 @@ | |||
440 | 87 | 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 | 87 | 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 |
441 | 88 | msf_sync_data_server.budget_status,TRUE,TRUE,FALSE,FALSE,bidirectional,Up,"[('type','=','normal'), ('state', '!=', 'draft')]",['state'],OC,msf.budget,,Budget status,Valid,,432 | 88 | msf_sync_data_server.budget_status,TRUE,TRUE,FALSE,FALSE,bidirectional,Up,"[('type','=','normal'), ('state', '!=', 'draft')]",['state'],OC,msf.budget,,Budget status,Valid,,432 |
442 | 89 | 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 | 89 | 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 |
445 | 90 | 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 | 90 | 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', 'product_active', 'state_ud', 'international_status_code']",MISSION,stock.mission.report.line,,Mission Stock Report Line,Valid,,441 |
446 | 91 | 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 | 91 | 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', 'product_active', 'state_ud', 'international_status_code']",OC,stock.mission.report.line,,Mission Stock Report Line OC,Valid,,442 |
447 | 92 | 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 | 92 | 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 |
448 | 93 | 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 | 93 | 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 |
449 | 94 | 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 | 94 | 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 |
450 | 95 | 95 | ||
451 | === modified file 'bin/addons/msf_tools/__openerp__.py' | |||
452 | --- bin/addons/msf_tools/__openerp__.py 2016-10-26 16:06:31 +0000 | |||
453 | +++ bin/addons/msf_tools/__openerp__.py 2017-02-03 13:54:39 +0000 | |||
454 | @@ -41,6 +41,8 @@ | |||
455 | 41 | 'security/ir.model.access.csv', | 41 | 'security/ir.model.access.csv', |
456 | 42 | 'report/report_stopped_products_view.xml', | 42 | 'report/report_stopped_products_view.xml', |
457 | 43 | 'report/report_stopped_products_report.xml', | 43 | 'report/report_stopped_products_report.xml', |
458 | 44 | 'report/report_inconsistencies_view.xml', | ||
459 | 45 | 'report/report_inconsistencies_report.xml', | ||
460 | 44 | 'automated_import_data.xml', | 46 | 'automated_import_data.xml', |
461 | 45 | ], | 47 | ], |
462 | 46 | 'demo_xml': [ | 48 | 'demo_xml': [ |
463 | 47 | 49 | ||
464 | === modified file 'bin/addons/msf_tools/report/__init__.py' | |||
465 | --- bin/addons/msf_tools/report/__init__.py 2016-10-26 16:06:31 +0000 | |||
466 | +++ bin/addons/msf_tools/report/__init__.py 2017-02-03 13:54:39 +0000 | |||
467 | @@ -20,3 +20,4 @@ | |||
468 | 20 | ############################################################################## | 20 | ############################################################################## |
469 | 21 | 21 | ||
470 | 22 | import report_stopped_products | 22 | import report_stopped_products |
471 | 23 | import report_inconsistencies | ||
472 | 23 | 24 | ||
473 | === added file 'bin/addons/msf_tools/report/report_inconsistencies.py' | |||
474 | --- bin/addons/msf_tools/report/report_inconsistencies.py 1970-01-01 00:00:00 +0000 | |||
475 | +++ bin/addons/msf_tools/report/report_inconsistencies.py 2017-02-03 13:54:39 +0000 | |||
476 | @@ -0,0 +1,433 @@ | |||
477 | 1 | # -*- coding: utf-8 -*- | ||
478 | 2 | ############################################################################## | ||
479 | 3 | # | ||
480 | 4 | # OpenERP, Open Source Management Solution | ||
481 | 5 | # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). | ||
482 | 6 | # | ||
483 | 7 | # This program is free software: you can redistribute it and/or modify | ||
484 | 8 | # it under the terms of the GNU Affero General Public License as | ||
485 | 9 | # published by the Free Software Foundation, either version 3 of the | ||
486 | 10 | # License, or (at your option) any later version. | ||
487 | 11 | # | ||
488 | 12 | # This program is distributed in the hope that it will be useful, | ||
489 | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
490 | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
491 | 15 | # GNU Affero General Public License for more details. | ||
492 | 16 | # | ||
493 | 17 | # You should have received a copy of the GNU Affero General Public License | ||
494 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
495 | 19 | # | ||
496 | 20 | ############################################################################## | ||
497 | 21 | |||
498 | 22 | |||
499 | 23 | import time | ||
500 | 24 | import threading | ||
501 | 25 | from osv import fields | ||
502 | 26 | from osv import osv | ||
503 | 27 | from report import report_sxw | ||
504 | 28 | from spreadsheet_xml.spreadsheet_xml_write import SpreadsheetReport | ||
505 | 29 | from service.web_services import report_spool | ||
506 | 30 | from tools.translate import _ | ||
507 | 31 | |||
508 | 32 | |||
509 | 33 | |||
510 | 34 | class export_report_inconsistencies(osv.osv): | ||
511 | 35 | |||
512 | 36 | _name = 'export.report.inconsistencies' | ||
513 | 37 | _order = 'name desc' | ||
514 | 38 | |||
515 | 39 | _columns = { | ||
516 | 40 | 'name': fields.datetime(string='Generated On', readonly=True), | ||
517 | 41 | 'state': fields.selection( | ||
518 | 42 | [('draft', 'Draft'), | ||
519 | 43 | ('in_progress', 'In Progress'), | ||
520 | 44 | ('ready', 'Ready')], | ||
521 | 45 | string='State', | ||
522 | 46 | readonly=True, | ||
523 | 47 | ), | ||
524 | 48 | } | ||
525 | 49 | |||
526 | 50 | _defaults = { | ||
527 | 51 | 'state': lambda *a: 'draft', | ||
528 | 52 | } | ||
529 | 53 | |||
530 | 54 | |||
531 | 55 | def generate_report(self, cr, uid, ids, context=None): | ||
532 | 56 | ''' | ||
533 | 57 | Generate a report | ||
534 | 58 | Method is called by button on XML view (form) | ||
535 | 59 | ''' | ||
536 | 60 | prod_obj = self.pool.get('product.product') | ||
537 | 61 | data_obj = self.pool.get('ir.model.data') | ||
538 | 62 | |||
539 | 63 | res = {} | ||
540 | 64 | for report in self.browse(cr, uid, ids, context=context): | ||
541 | 65 | # get ids of all non-local products : | ||
542 | 66 | status_local_id = data_obj.get_object_reference(cr, uid, 'product_attributes', 'int_4')[1] | ||
543 | 67 | product_ids = prod_obj.search(cr, uid, [('international_status', '!=', status_local_id)], context=context) | ||
544 | 68 | if not product_ids: | ||
545 | 69 | continue | ||
546 | 70 | |||
547 | 71 | # state of report is in progress : | ||
548 | 72 | self.write(cr, uid, [report.id], { | ||
549 | 73 | 'name': time.strftime('%Y-%m-%d %H:%M:%S'), | ||
550 | 74 | 'state': 'in_progress' | ||
551 | 75 | }, context=context) | ||
552 | 76 | |||
553 | 77 | datas = { | ||
554 | 78 | 'ids': [report.id], | ||
555 | 79 | 'lines': product_ids, | ||
556 | 80 | } | ||
557 | 81 | |||
558 | 82 | cr.commit() | ||
559 | 83 | new_thread = threading.Thread(target=self.generate_report_bkg, args=(cr, uid, report.id, datas, context)) | ||
560 | 84 | new_thread.start() | ||
561 | 85 | new_thread.join(timeout=25.0) # join = wait until new_thread is finished but if it last more then timeout value, you can continue to work | ||
562 | 86 | |||
563 | 87 | res = { | ||
564 | 88 | 'type': 'ir.actions.act_window', | ||
565 | 89 | 'res_model': self._name, | ||
566 | 90 | 'view_type': 'form', | ||
567 | 91 | 'view_mode': 'form,tree', | ||
568 | 92 | 'res_id': report.id, | ||
569 | 93 | 'context': context, | ||
570 | 94 | 'target': 'same', | ||
571 | 95 | } | ||
572 | 96 | |||
573 | 97 | if new_thread.isAlive(): | ||
574 | 98 | view_id = data_obj.get_object_reference( | ||
575 | 99 | cr, uid, | ||
576 | 100 | 'msf_tools', | ||
577 | 101 | 'report_inconsistencies_info_view')[1] | ||
578 | 102 | res['view_id'] = [view_id] | ||
579 | 103 | |||
580 | 104 | if not res: | ||
581 | 105 | raise osv.except_osv( | ||
582 | 106 | _('Error'), | ||
583 | 107 | _("Nothing to generate") | ||
584 | 108 | ) | ||
585 | 109 | |||
586 | 110 | return res | ||
587 | 111 | |||
588 | 112 | |||
589 | 113 | def generate_report_bkg(self, cr, uid, report_ids, datas, context=None): | ||
590 | 114 | ''' | ||
591 | 115 | Generate the report in background (thread) | ||
592 | 116 | ''' | ||
593 | 117 | attachment_obj = self.pool.get('ir.attachment') | ||
594 | 118 | |||
595 | 119 | if context is None: | ||
596 | 120 | context ={} | ||
597 | 121 | |||
598 | 122 | if isinstance(report_ids, (int, long)): | ||
599 | 123 | report_ids = [report_ids] | ||
600 | 124 | |||
601 | 125 | import pooler | ||
602 | 126 | new_cr = pooler.get_db(cr.dbname).cursor() | ||
603 | 127 | |||
604 | 128 | # export datas : | ||
605 | 129 | report_name = "inconsistencies.xls" | ||
606 | 130 | attachment_name = "inconsistencies_report_%s.xls" % time.strftime('%d-%m-%Y_%Hh%M') | ||
607 | 131 | rp_spool = report_spool() | ||
608 | 132 | res_export = rp_spool.exp_report(cr.dbname, uid, report_name, report_ids, datas, context) | ||
609 | 133 | file_res = {'state': False} | ||
610 | 134 | while not file_res.get('state'): | ||
611 | 135 | file_res = rp_spool.exp_report_get(new_cr.dbname, uid, res_export) | ||
612 | 136 | time.sleep(0.5) | ||
613 | 137 | |||
614 | 138 | # attach report to the right panel : | ||
615 | 139 | attachment_obj.create(new_cr, uid, { | ||
616 | 140 | 'name': attachment_name, | ||
617 | 141 | 'datas_fname': attachment_name, | ||
618 | 142 | 'description': "Inconsistencies with HQ", | ||
619 | 143 | 'res_model': 'export.report.inconsistencies', | ||
620 | 144 | 'res_id': report_ids[0], | ||
621 | 145 | 'datas': file_res.get('result'), | ||
622 | 146 | }, context=context) | ||
623 | 147 | |||
624 | 148 | # state is now 'ready' : | ||
625 | 149 | self.write(new_cr, uid, report_ids, {'state': 'ready'}, context= context) | ||
626 | 150 | |||
627 | 151 | new_cr.commit() | ||
628 | 152 | new_cr.close(True) | ||
629 | 153 | |||
630 | 154 | return True | ||
631 | 155 | |||
632 | 156 | |||
633 | 157 | export_report_inconsistencies() | ||
634 | 158 | |||
635 | 159 | |||
636 | 160 | |||
637 | 161 | class parser_report_inconsistencies_xls(report_sxw.rml_parse): | ||
638 | 162 | ''' | ||
639 | 163 | To parse our mako template for inconsistencies | ||
640 | 164 | ''' | ||
641 | 165 | def __init__(self, cr, uid, name, context=None): | ||
642 | 166 | super(parser_report_inconsistencies_xls, self).__init__(cr, uid, name, context=context) | ||
643 | 167 | |||
644 | 168 | # localcontext allows you to call methods inside mako file : | ||
645 | 169 | self.localcontext.update({ | ||
646 | 170 | 'time': time, | ||
647 | 171 | 'get_uf_status': self.get_uf_status, | ||
648 | 172 | 'get_ud_status': self.get_ud_status, | ||
649 | 173 | 'get_inconsistent_lines': self.get_inconsistent_lines, | ||
650 | 174 | 'get_products_with_inconsistencies': self.get_products_with_inconsistencies, | ||
651 | 175 | 'get_product_creator_name_from_code': self.get_product_creator_name_from_code, | ||
652 | 176 | }) | ||
653 | 177 | |||
654 | 178 | # cached data | ||
655 | 179 | self.uf_status_cache = {} | ||
656 | 180 | self.prod_creator_cache = {} | ||
657 | 181 | self.inconsistent = {} | ||
658 | 182 | |||
659 | 183 | |||
660 | 184 | def get_inconsistent_lines(self, prod_id=None): | ||
661 | 185 | ''' | ||
662 | 186 | Return stock mission report lines that are inconsistent with HQ | ||
663 | 187 | Based on the fields: product_active, state_ud and international_status_code | ||
664 | 188 | |||
665 | 189 | prod_id: You can get only SMRL with product_id, if you don't give this information you | ||
666 | 190 | will get all inconsistents SMRL | ||
667 | 191 | ''' | ||
668 | 192 | smrl_obj = self.pool.get('stock.mission.report.line') | ||
669 | 193 | product_creator_obj = self.pool.get('product.international.status') | ||
670 | 194 | inconsistent_id_list = [] | ||
671 | 195 | |||
672 | 196 | intl_status_code_name = {} | ||
673 | 197 | intl_status_ids = product_creator_obj.search(self.cr, self.uid, []) | ||
674 | 198 | for intl_status in product_creator_obj.browse(self.cr, self.uid, intl_status_ids): | ||
675 | 199 | intl_status_code_name.setdefault(intl_status.code, intl_status.name) | ||
676 | 200 | |||
677 | 201 | if not self.inconsistent: | ||
678 | 202 | prod_obj = self.pool.get('product.product') | ||
679 | 203 | prod_status_obj = self.pool.get('product.status') | ||
680 | 204 | |||
681 | 205 | smrl_ids = smrl_obj.search(self.cr, self.uid, [('full_view', '=', False)], order='NO_ORDER', context=self.localcontext) | ||
682 | 206 | |||
683 | 207 | # check stock mission report line for inconsistencies with HQ (our instance): | ||
684 | 208 | self.inconsistent = {} | ||
685 | 209 | read_smrl_result = smrl_obj.read(self.cr, self.uid, smrl_ids, | ||
686 | 210 | ['product_id', 'product_state', 'state_ud', | ||
687 | 211 | 'product_active', 'mission_report_id', 'default_code', | ||
688 | 212 | 'international_status_code'], | ||
689 | 213 | context=self.localcontext) | ||
690 | 214 | |||
691 | 215 | read_smrl_result_dict = {} | ||
692 | 216 | all_product_ids = [] | ||
693 | 217 | for read_smrl in read_smrl_result: | ||
694 | 218 | read_smrl_result_dict[read_smrl['id']] = read_smrl | ||
695 | 219 | all_product_ids.append(read_smrl['product_id'][0]) | ||
696 | 220 | del read_smrl_result | ||
697 | 221 | |||
698 | 222 | # read all product informations | ||
699 | 223 | product_result = prod_obj.read(self.cr, self.uid, all_product_ids, | ||
700 | 224 | ['state', 'state_ud', 'active', 'name_template', | ||
701 | 225 | 'international_status', 'default_code'], | ||
702 | 226 | context=self.localcontext) | ||
703 | 227 | product_dict = dict((x['id'], x) for x in product_result) | ||
704 | 228 | |||
705 | 229 | # get all product_status | ||
706 | 230 | prod_status_ids = prod_status_obj.search(self.cr, self.uid, [], context=self.localcontext) | ||
707 | 231 | prod_status_result = prod_status_obj.read(self.cr, self.uid, prod_status_ids, ['code'], context=self.localcontext) | ||
708 | 232 | prod_status_dict = dict((x['id'], x['code']) for x in prod_status_result) | ||
709 | 233 | |||
710 | 234 | # get all instance id and build a level dict | ||
711 | 235 | instance_obj = self.pool.get('msf.instance') | ||
712 | 236 | instance_ids = instance_obj.search(self.cr, self.uid, []) | ||
713 | 237 | instance_read_result = instance_obj.read(self.cr, self.uid, instance_ids, | ||
714 | 238 | ['level', 'name'], context=self.localcontext) | ||
715 | 239 | instance_level_dict = dict((x['id'], x) for x in | ||
716 | 240 | instance_read_result) | ||
717 | 241 | |||
718 | 242 | # get all report id and build a instance dict | ||
719 | 243 | smr_obj = self.pool.get('stock.mission.report') | ||
720 | 244 | smr_ids = smr_obj.search(self.cr, self.uid, []) | ||
721 | 245 | smr_read_result = smr_obj.read(self.cr, self.uid, smr_ids, | ||
722 | 246 | ['instance_id'], context=self.localcontext) | ||
723 | 247 | smr_instance_dict = dict((x['id'], x) for x in | ||
724 | 248 | smr_read_result) | ||
725 | 249 | |||
726 | 250 | # get all uf_status codes | ||
727 | 251 | uf_status_obj = self.pool.get('product.status') | ||
728 | 252 | uf_status_code_ids = uf_status_obj.search(self.cr, self.uid, [], context=self.localcontext) | ||
729 | 253 | uf_status_code_read_result = uf_status_obj.read(self.cr, self.uid, | ||
730 | 254 | uf_status_code_ids, ['code', 'name'], context=self.localcontext) | ||
731 | 255 | uf_status_code_dict = dict((x['code'], x) for x in | ||
732 | 256 | uf_status_code_read_result) | ||
733 | 257 | |||
734 | 258 | product_result_dict = {} | ||
735 | 259 | state_ud_dict = {} | ||
736 | 260 | for product in product_result[0:100]: | ||
737 | 261 | inconsistent_id_list = [] | ||
738 | 262 | # get the lines matching this product | ||
739 | 263 | smrl_ids = smrl_obj.search(self.cr, self.uid, | ||
740 | 264 | [('full_view', '=', False), | ||
741 | 265 | ('product_id', '=', product['id'])], | ||
742 | 266 | order='NO_ORDER', context=self.localcontext) | ||
743 | 267 | |||
744 | 268 | # get the inconsistent related lines | ||
745 | 269 | for smrl_id in smrl_ids: | ||
746 | 270 | smrl = read_smrl_result_dict[smrl_id] | ||
747 | 271 | product = product_dict[smrl['product_id'][0]] | ||
748 | 272 | # in product_product state is False when empty | ||
749 | 273 | # in smrl product_state is '' when empty: | ||
750 | 274 | if not product['state'] and not smrl['product_state']: | ||
751 | 275 | pass | ||
752 | 276 | elif not product['state'] and smrl['product_state']: | ||
753 | 277 | inconsistent_id_list.append(smrl['id']) | ||
754 | 278 | continue | ||
755 | 279 | elif product['state'] and not smrl['product_state']: | ||
756 | 280 | inconsistent_id_list.append(smrl['id']) | ||
757 | 281 | continue | ||
758 | 282 | elif product['state'] and product['state'] in prod_status_dict: | ||
759 | 283 | state_code = prod_status_dict[product['state'][0]] | ||
760 | 284 | if state_code != smrl['product_state']: | ||
761 | 285 | inconsistent_id_list.append(smrl['id']) | ||
762 | 286 | continue | ||
763 | 287 | |||
764 | 288 | if not product['state_ud'] and not smrl['state_ud']: | ||
765 | 289 | pass | ||
766 | 290 | elif product['state_ud'] != smrl['state_ud']: | ||
767 | 291 | inconsistent_id_list.append(smrl['id']) | ||
768 | 292 | continue | ||
769 | 293 | |||
770 | 294 | if product['active'] != smrl['product_active']: # if null in DB smrl.product_active = False .... | ||
771 | 295 | inconsistent_id_list.append(smrl['id']) | ||
772 | 296 | continue | ||
773 | 297 | |||
774 | 298 | if inconsistent_id_list: | ||
775 | 299 | product_result_dict[product['id']] = {} | ||
776 | 300 | current_prod = product_result_dict[product['id']] | ||
777 | 301 | current_prod['smrl_list'] = [] | ||
778 | 302 | prod_state_ud = '' | ||
779 | 303 | if product['state_ud']: | ||
780 | 304 | if product['state_ud'] not in state_ud_dict: | ||
781 | 305 | product_browse_obj = prod_obj.browse(self.cr, self.uid, product['id'], context=self.localcontext) | ||
782 | 306 | state_ud_name = self.pool.get('ir.model.fields').get_browse_selection(self.cr, self.uid, product_browse_obj, 'state_ud', self.localcontext) | ||
783 | 307 | state_ud_dict[product['state_ud']] = state_ud_name | ||
784 | 308 | prod_state_ud = state_ud_dict[product['state_ud']] | ||
785 | 309 | current_prod.update({ | ||
786 | 310 | 'prod_default_code': product['default_code'], | ||
787 | 311 | 'prod_name_template': product['name_template'], | ||
788 | 312 | 'prod_international_status': product['international_status'] and product['international_status'][1] or '', | ||
789 | 313 | 'prod_state': product['state'] and product['state'][1] or '', | ||
790 | 314 | 'prod_state_ud': prod_state_ud, | ||
791 | 315 | 'prod_active': product['active'], | ||
792 | 316 | }) | ||
793 | 317 | |||
794 | 318 | # build the result list dict | ||
795 | 319 | for smrl_id in inconsistent_id_list: | ||
796 | 320 | smrl = read_smrl_result_dict[smrl_id] | ||
797 | 321 | instance_id = smr_instance_dict[smrl['mission_report_id'][0]]['instance_id'][0] | ||
798 | 322 | |||
799 | 323 | smrl_dict = { | ||
800 | 324 | 'instance_name': instance_level_dict[instance_id]['name'], | ||
801 | 325 | 'smrl_default_code': smrl['default_code'], | ||
802 | 326 | 'smrl_name_template': product['name_template'], | ||
803 | 327 | 'internationnal_status_code_name': smrl['international_status_code'] and intl_status_code_name.get(smrl['international_status_code'], '') or '', | ||
804 | 328 | 'uf_status_code': smrl['product_state'] and uf_status_code_dict[smrl['product_state']]['name'] or '', | ||
805 | 329 | 'ud_status_code': self.get_ud_status(smrl['state_ud']), | ||
806 | 330 | 'active': smrl['product_active'], | ||
807 | 331 | 'instance_level': instance_level_dict[instance_id]['level'], | ||
808 | 332 | } | ||
809 | 333 | product_result_dict[product['id']]['smrl_list'].append(smrl_dict) | ||
810 | 334 | product_result_dict[product['id']]['smrl_list'].sort(key=lambda smrl: smrl['instance_level']) | ||
811 | 335 | self.inconsistent[product['id']] = product_result_dict[product['id']] | ||
812 | 336 | |||
813 | 337 | if prod_id: | ||
814 | 338 | return self.inconsistent[prod_id] | ||
815 | 339 | else: | ||
816 | 340 | return self.inconsistent | ||
817 | 341 | |||
818 | 342 | |||
819 | 343 | def get_products_with_inconsistencies(self): | ||
820 | 344 | ''' | ||
821 | 345 | return a browse record list of inconsistent product_product | ||
822 | 346 | ''' | ||
823 | 347 | if not self.inconsistent: | ||
824 | 348 | self.inconsistent = self.get_inconsistent_lines() | ||
825 | 349 | |||
826 | 350 | prod_ids = self.inconsistent.keys() | ||
827 | 351 | |||
828 | 352 | # order product id by default code | ||
829 | 353 | prod_obj = self.pool.get('product.product') | ||
830 | 354 | prod_result = prod_obj.read(self.cr, self.uid, prod_ids, ['default_code'], self.localcontext) | ||
831 | 355 | prod_result.sort(key=lambda prod: prod['default_code']) | ||
832 | 356 | ordered_ids = [x['id'] for x in prod_result] | ||
833 | 357 | |||
834 | 358 | # order self.inconsistent according with this ids | ||
835 | 359 | final_result = [self.inconsistent[x] for x in ordered_ids] | ||
836 | 360 | return final_result | ||
837 | 361 | |||
838 | 362 | |||
839 | 363 | def get_uf_status(self, code): | ||
840 | 364 | ''' | ||
841 | 365 | Return the name of the unifield status with the given code | ||
842 | 366 | ''' | ||
843 | 367 | if code in self.uf_status_cache: | ||
844 | 368 | return self.uf_status_cache[code] | ||
845 | 369 | |||
846 | 370 | status_obj = self.pool.get('product.status') | ||
847 | 371 | code_ids = status_obj.search(self.cr, self.uid, [('code', '=', code)], context=self.localcontext) | ||
848 | 372 | res = "" | ||
849 | 373 | if code_ids: | ||
850 | 374 | res = status_obj.read(self.cr, self.uid, code_ids, ['name'])[0]['name'] | ||
851 | 375 | |||
852 | 376 | self.uf_status_cache[code] = res | ||
853 | 377 | |||
854 | 378 | return res | ||
855 | 379 | |||
856 | 380 | |||
857 | 381 | def get_ud_status(self, code): | ||
858 | 382 | ''' | ||
859 | 383 | Return the name of the unidata status with the given code | ||
860 | 384 | ''' | ||
861 | 385 | if not code or not isinstance(code, (str, unicode)): | ||
862 | 386 | return '' | ||
863 | 387 | return code.capitalize().replace('_', ' ') | ||
864 | 388 | |||
865 | 389 | |||
866 | 390 | def get_product_creator_name_from_code(self, code): | ||
867 | 391 | ''' | ||
868 | 392 | return the name of the product creator with the given code | ||
869 | 393 | ''' | ||
870 | 394 | if code in self.prod_creator_cache: | ||
871 | 395 | return self.prod_creator_cache[code] | ||
872 | 396 | |||
873 | 397 | prodstat_obj = self.pool.get('product.international.status') | ||
874 | 398 | prodstat_ids = prodstat_obj.search(self.cr, self.uid, [('code', '=', code)], context=self.localcontext) | ||
875 | 399 | if not prodstat_ids: | ||
876 | 400 | return code | ||
877 | 401 | |||
878 | 402 | name = prodstat_obj.read(self.cr, self.uid, prodstat_ids, ['name'], context=self.localcontext)[0]['name'] | ||
879 | 403 | self.prod_creator_cache[code] = name | ||
880 | 404 | |||
881 | 405 | return name | ||
882 | 406 | |||
883 | 407 | |||
884 | 408 | |||
885 | 409 | class report_inconsistencies_xls(SpreadsheetReport): | ||
886 | 410 | |||
887 | 411 | def __init(self, name, table, rml=False, parser=report_sxw.rml_parse, header='external', store=False): | ||
888 | 412 | super(report_inconsistencies_xls, self).__init__( | ||
889 | 413 | name, | ||
890 | 414 | table, | ||
891 | 415 | rml=rml, | ||
892 | 416 | parser=parser, | ||
893 | 417 | header=header, | ||
894 | 418 | store=store | ||
895 | 419 | ) | ||
896 | 420 | |||
897 | 421 | def create(self, cr, uid, ids, data, context=None): | ||
898 | 422 | a = super(report_inconsistencies_xls, self).create(cr, uid, ids, data, context=context) | ||
899 | 423 | return (a[0], 'xls') | ||
900 | 424 | |||
901 | 425 | |||
902 | 426 | |||
903 | 427 | report_inconsistencies_xls( | ||
904 | 428 | 'report.inconsistencies.xls', | ||
905 | 429 | 'export.report.inconsistencies', | ||
906 | 430 | 'addons/msf_tools/report/report_inconsistencies_xls.mako', | ||
907 | 431 | parser=parser_report_inconsistencies_xls, | ||
908 | 432 | header='internal', | ||
909 | 433 | ) | ||
910 | 0 | 434 | ||
911 | === added file 'bin/addons/msf_tools/report/report_inconsistencies_report.xml' | |||
912 | --- bin/addons/msf_tools/report/report_inconsistencies_report.xml 1970-01-01 00:00:00 +0000 | |||
913 | +++ bin/addons/msf_tools/report/report_inconsistencies_report.xml 2017-02-03 13:54:39 +0000 | |||
914 | @@ -0,0 +1,20 @@ | |||
915 | 1 | <?xml version="1.0" encoding="utf-8"?> | ||
916 | 2 | <openerp> | ||
917 | 3 | <data> | ||
918 | 4 | |||
919 | 5 | |||
920 | 6 | <report | ||
921 | 7 | id="report_inconsistencies_xls" | ||
922 | 8 | string="Inconsistencies with HQ" | ||
923 | 9 | model="export.report.inconsistencies" | ||
924 | 10 | name="inconsistencies.xls" | ||
925 | 11 | file="msf_tools/report/report_inconsistencies_xls.mako" | ||
926 | 12 | report_type="webkit" | ||
927 | 13 | header="False" | ||
928 | 14 | auto="False" | ||
929 | 15 | menu="False" | ||
930 | 16 | /> | ||
931 | 17 | |||
932 | 18 | |||
933 | 19 | </data> | ||
934 | 20 | </openerp> | ||
935 | 0 | \ No newline at end of file | 21 | \ No newline at end of file |
936 | 1 | 22 | ||
937 | === added file 'bin/addons/msf_tools/report/report_inconsistencies_view.xml' | |||
938 | --- bin/addons/msf_tools/report/report_inconsistencies_view.xml 1970-01-01 00:00:00 +0000 | |||
939 | +++ bin/addons/msf_tools/report/report_inconsistencies_view.xml 2017-02-03 13:54:39 +0000 | |||
940 | @@ -0,0 +1,92 @@ | |||
941 | 1 | <?xml version="1.0" encoding="utf-8"?> | ||
942 | 2 | <openerp> | ||
943 | 3 | <data> | ||
944 | 4 | |||
945 | 5 | |||
946 | 6 | <record id="export_report_inconsistencies_form_view" model="ir.ui.view"> | ||
947 | 7 | <field name="name">export.report.inconsistencies.form.view</field> | ||
948 | 8 | <field name="model">export.report.inconsistencies</field> | ||
949 | 9 | <field name="type">form</field> | ||
950 | 10 | <field name="arch" type="xml"> | ||
951 | 11 | <form string="Export inconsistencies"> | ||
952 | 12 | <separator colspan="4" string="Request information" /> | ||
953 | 13 | <field name="name" /> | ||
954 | 14 | <field name="state" /> | ||
955 | 15 | <button name="generate_report" type="object" string="Generate report" | ||
956 | 16 | icon="gtk-execute" states='draft' /> | ||
957 | 17 | </form> | ||
958 | 18 | </field> | ||
959 | 19 | </record> | ||
960 | 20 | |||
961 | 21 | |||
962 | 22 | <record id="export_report_inconsistencies_tree_view" model="ir.ui.view"> | ||
963 | 23 | <field name="name">export.report.inconsistencies.tree.view</field> | ||
964 | 24 | <field name="model">export.report.inconsistencies</field> | ||
965 | 25 | <field name="type">tree</field> | ||
966 | 26 | <field name="arch" type="xml"> | ||
967 | 27 | <tree string="Export inconsistencies"> | ||
968 | 28 | <field name="name" /> | ||
969 | 29 | <field name="state" /> | ||
970 | 30 | </tree> | ||
971 | 31 | </field> | ||
972 | 32 | </record> | ||
973 | 33 | |||
974 | 34 | |||
975 | 35 | <record id="report_inconsistencies_search_view" model="ir.ui.view"> | ||
976 | 36 | <field name="name">export.report.inconsistencies.search.view</field> | ||
977 | 37 | <field name="model">export.report.inconsistencies</field> <!-- _name of openERP object --> | ||
978 | 38 | <field name="type">search</field> | ||
979 | 39 | <field name="arch" type="xml"> | ||
980 | 40 | <search string="Export inconsistencies"> | ||
981 | 41 | <field name="name" /> | ||
982 | 42 | <field name="state" /> | ||
983 | 43 | </search> | ||
984 | 44 | </field> | ||
985 | 45 | </record> | ||
986 | 46 | |||
987 | 47 | |||
988 | 48 | <record id="report_inconsistencies_info_view" model="ir.ui.view"> | ||
989 | 49 | <field name="name">export.report.inconsistencies.info.view</field> | ||
990 | 50 | <field name="model">export.report.inconsistencies</field> | ||
991 | 51 | <field name="type">form</field> | ||
992 | 52 | <field name="priority" eval="99" /> | ||
993 | 53 | <field name="arch" type="xml"> | ||
994 | 54 | <form string="Status of the report" hide_new_button="1" hide_delete_button="1"> | ||
995 | 55 | <label> </label> | ||
996 | 56 | <group colspan="2" col="2"> | ||
997 | 57 | <html> | ||
998 | 58 | <div style="align: center"> | ||
999 | 59 | <p style="font-size:14px;align:center"> | ||
1000 | 60 | Your export inconsistent products demand will be treated quickly.<br /> | ||
1001 | 61 | </p> | ||
1002 | 62 | <p style="font-size:14px;align:center"> | ||
1003 | 63 | Due to the volume of data, your report cannot be shown immediatly.<br /> | ||
1004 | 64 | </p> | ||
1005 | 65 | <p style="font-size:14px;align:center"> | ||
1006 | 66 | When the report will be ready, you can access to it by the menu Tools / Inconsistencies report<br /> | ||
1007 | 67 | </p> | ||
1008 | 68 | </div> | ||
1009 | 69 | </html> | ||
1010 | 70 | </group> | ||
1011 | 71 | <label> </label> | ||
1012 | 72 | </form> | ||
1013 | 73 | </field> | ||
1014 | 74 | </record> | ||
1015 | 75 | |||
1016 | 76 | |||
1017 | 77 | <record id="export_report_inconsistencies_action" model="ir.actions.act_window"> | ||
1018 | 78 | <field name="name">Product Status Inconsistencies</field> | ||
1019 | 79 | <field name="res_model">export.report.inconsistencies</field> | ||
1020 | 80 | <field name="view_type">form</field> | ||
1021 | 81 | <field name="view_mode">tree,form</field> | ||
1022 | 82 | </record> | ||
1023 | 83 | |||
1024 | 84 | |||
1025 | 85 | <menuitem | ||
1026 | 86 | id="export_report_inconsistencies_menu" | ||
1027 | 87 | action="export_report_inconsistencies_action" | ||
1028 | 88 | parent="object_query.menu_preferences" | ||
1029 | 89 | sequence="51" /> | ||
1030 | 90 | |||
1031 | 91 | </data> | ||
1032 | 92 | </openerp> | ||
1033 | 0 | 93 | ||
1034 | === added file 'bin/addons/msf_tools/report/report_inconsistencies_xls.mako' | |||
1035 | --- bin/addons/msf_tools/report/report_inconsistencies_xls.mako 1970-01-01 00:00:00 +0000 | |||
1036 | +++ bin/addons/msf_tools/report/report_inconsistencies_xls.mako 2017-02-03 13:54:39 +0000 | |||
1037 | @@ -0,0 +1,139 @@ | |||
1038 | 1 | <?xml version="1.0"?> | ||
1039 | 2 | <?mso-application progid="Excel.Sheet"?> | ||
1040 | 3 | <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" | ||
1041 | 4 | xmlns:o="urn:schemas-microsoft-com:office:office" | ||
1042 | 5 | xmlns:x="urn:schemas-microsoft-com:office:excel" | ||
1043 | 6 | xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" | ||
1044 | 7 | xmlns:html="http://www.w3.org/TR/REC-html40"> | ||
1045 | 8 | <DocumentProperties xmlns="urn:schemas-microsoft-com:office:office"> | ||
1046 | 9 | <Author>MSFUser</Author> | ||
1047 | 10 | <LastAuthor>MSFUser</LastAuthor> | ||
1048 | 11 | <Created>2012-06-18T15:46:09Z</Created> | ||
1049 | 12 | <Company>Medecins Sans Frontieres</Company> | ||
1050 | 13 | <Version>11.9999</Version> | ||
1051 | 14 | </DocumentProperties> | ||
1052 | 15 | <ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel"> | ||
1053 | 16 | <WindowHeight>13170</WindowHeight> | ||
1054 | 17 | <WindowWidth>19020</WindowWidth> | ||
1055 | 18 | <WindowTopX>120</WindowTopX> | ||
1056 | 19 | <WindowTopY>60</WindowTopY> | ||
1057 | 20 | <ProtectStructure>False</ProtectStructure> | ||
1058 | 21 | <ProtectWindows>False</ProtectWindows> | ||
1059 | 22 | </ExcelWorkbook> | ||
1060 | 23 | |||
1061 | 24 | <Styles> | ||
1062 | 25 | <Style ss:ID="tab_header_orange"> | ||
1063 | 26 | <Alignment ss:Horizontal="Center" ss:Vertical="Center" ss:WrapText="1"/> | ||
1064 | 27 | <Interior ss:Color="#ffcc99" ss:Pattern="Solid"/> | ||
1065 | 28 | <Borders> | ||
1066 | 29 | <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1" /> | ||
1067 | 30 | <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1" /> | ||
1068 | 31 | <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1" /> | ||
1069 | 32 | <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1" /> | ||
1070 | 33 | </Borders> | ||
1071 | 34 | </Style> | ||
1072 | 35 | <Style ss:ID="tab_header_gray"> | ||
1073 | 36 | <Alignment ss:Horizontal="Center" ss:Vertical="Center" ss:WrapText="1"/> | ||
1074 | 37 | <Interior ss:Color="#dbdbdb" ss:Pattern="Solid"/> | ||
1075 | 38 | <Borders> | ||
1076 | 39 | <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1" /> | ||
1077 | 40 | <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1" /> | ||
1078 | 41 | <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1" /> | ||
1079 | 42 | <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1" /> | ||
1080 | 43 | </Borders> | ||
1081 | 44 | </Style> | ||
1082 | 45 | <Style ss:ID="tab_content"> | ||
1083 | 46 | <Alignment ss:Horizontal="Center" ss:Vertical="Center" ss:WrapText="1"/> | ||
1084 | 47 | <Borders> | ||
1085 | 48 | <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1" /> | ||
1086 | 49 | <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1" /> | ||
1087 | 50 | <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1" /> | ||
1088 | 51 | <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1" /> | ||
1089 | 52 | </Borders> | ||
1090 | 53 | </Style> | ||
1091 | 54 | </Styles> | ||
1092 | 55 | |||
1093 | 56 | |||
1094 | 57 | <ss:Worksheet ss:Name="Stopped products"> | ||
1095 | 58 | |||
1096 | 59 | <Table x:FullColumns="1" x:FullRows="1"> | ||
1097 | 60 | |||
1098 | 61 | <Columns ss:AutoFitWidth="1" ss:Width="90" /> # instance | ||
1099 | 62 | <Columns ss:AutoFitWidth="1" ss:Width="90" /> # code | ||
1100 | 63 | <Columns ss:AutoFitWidth="1" ss:Width="200" /> # product description | ||
1101 | 64 | <Columns ss:AutoFitWidth="1" ss:Width="90" /> # product creator | ||
1102 | 65 | <Columns ss:AutoFitWidth="1" ss:Width="90" /> # unifield status | ||
1103 | 66 | <Columns ss:AutoFitWidth="1" ss:Width="90" /> # unidata status | ||
1104 | 67 | <Columns ss:AutoFitWidth="1" ss:Width="90" /> # active | ||
1105 | 68 | |||
1106 | 69 | ##### Table with all stopped products ##### | ||
1107 | 70 | |||
1108 | 71 | % if not get_inconsistent_lines(): | ||
1109 | 72 | <Row ss:AutoFitHeight="1"> | ||
1110 | 73 | <Cell ss:StyleID="tab_content"><Data ss:Type="String"></Data></Cell> | ||
1111 | 74 | <Cell ss:StyleID="tab_content"><Data ss:Type="String"></Data></Cell> | ||
1112 | 75 | <Cell ss:StyleID="tab_content"><Data ss:Type="String">${_('There is no inconsistencies to report')|x}</Data></Cell> | ||
1113 | 76 | </Row> | ||
1114 | 77 | % else: | ||
1115 | 78 | <Row ss:AutoFitHeight="1"> | ||
1116 | 79 | <Cell ss:StyleID="tab_header_orange"><Data ss:Type="String">${_('Instance')|x}</Data></Cell> | ||
1117 | 80 | <Cell ss:StyleID="tab_header_orange"><Data ss:Type="String">${_('Code')|x}</Data></Cell> | ||
1118 | 81 | <Cell ss:StyleID="tab_header_orange"><Data ss:Type="String">${_('Description')|x}</Data></Cell> | ||
1119 | 82 | <Cell ss:StyleID="tab_header_orange"><Data ss:Type="String">${_('Product Creator')|x}</Data></Cell> | ||
1120 | 83 | <Cell ss:StyleID="tab_header_orange"><Data ss:Type="String">${_('UniField Status')|x}</Data></Cell> | ||
1121 | 84 | <Cell ss:StyleID="tab_header_orange"><Data ss:Type="String">${_('Unidata Status')|x}</Data></Cell> | ||
1122 | 85 | <Cell ss:StyleID="tab_header_orange"><Data ss:Type="String">${_('Active/Inactive')|x}</Data></Cell> | ||
1123 | 86 | </Row> | ||
1124 | 87 | % for prod in get_products_with_inconsistencies(): | ||
1125 | 88 | # HQ data: | ||
1126 | 89 | <Row ss:AutoFitHeight="1"> | ||
1127 | 90 | <Cell ss:StyleID="tab_header_gray"><Data ss:Type="String">${_('HQ')|x}</Data></Cell> | ||
1128 | 91 | <Cell ss:StyleID="tab_header_gray"><Data ss:Type="String">${(prod['prod_default_code'])|x}</Data></Cell> | ||
1129 | 92 | <Cell ss:StyleID="tab_header_gray"><Data ss:Type="String">${(prod['prod_name_template'])|x}</Data></Cell> | ||
1130 | 93 | <Cell ss:StyleID="tab_header_gray"><Data ss:Type="String">${(prod['prod_international_status'] or '')|x}</Data></Cell> | ||
1131 | 94 | <Cell ss:StyleID="tab_header_gray"><Data ss:Type="String">${(prod['prod_state'] or '')|x}</Data></Cell> | ||
1132 | 95 | <Cell ss:StyleID="tab_header_gray"><Data ss:Type="String">${(prod['prod_state_ud'] or '')|x}</Data></Cell> | ||
1133 | 96 | <Cell ss:StyleID="tab_header_gray"><Data ss:Type="String">${(_('Active') if prod['prod_active'] else _('Inactive'))|x}</Data></Cell> | ||
1134 | 97 | </Row> | ||
1135 | 98 | % for smrl in prod['smrl_list']: | ||
1136 | 99 | <Row ss:AutoFitHeight="1"> | ||
1137 | 100 | <Cell ss:StyleID="tab_content"><Data ss:Type="String">${(smrl['instance_name'])|x}</Data></Cell> | ||
1138 | 101 | <Cell ss:StyleID="tab_content"><Data ss:Type="String">${(smrl['smrl_default_code'])|x}</Data></Cell> | ||
1139 | 102 | <Cell ss:StyleID="tab_content"><Data ss:Type="String">${(smrl['smrl_name_template'])|x}</Data></Cell> | ||
1140 | 103 | <Cell ss:StyleID="tab_content"><Data ss:Type="String">${(smrl['internationnal_status_code_name'] or '')|x}</Data></Cell> | ||
1141 | 104 | <Cell ss:StyleID="tab_content"><Data ss:Type="String">${(smrl['uf_status_code'])|x}</Data></Cell> | ||
1142 | 105 | <Cell ss:StyleID="tab_content"><Data ss:Type="String">${(smrl['ud_status_code'] or '')|x}</Data></Cell> | ||
1143 | 106 | <Cell ss:StyleID="tab_content"><Data ss:Type="String">${(_('Active') if smrl['active'] else _('Inactive'))|x}</Data></Cell> | ||
1144 | 107 | </Row> | ||
1145 | 108 | % endfor | ||
1146 | 109 | % endfor | ||
1147 | 110 | % endif | ||
1148 | 111 | |||
1149 | 112 | |||
1150 | 113 | </Table> | ||
1151 | 114 | |||
1152 | 115 | <WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel"> | ||
1153 | 116 | <PageSetup> | ||
1154 | 117 | <Layout x:Orientation="Landscape"/> | ||
1155 | 118 | <Header x:Data="&C&"Arial,Bold"&14"/> | ||
1156 | 119 | <Footer x:Data="Page &P of &N"/> | ||
1157 | 120 | </PageSetup> | ||
1158 | 121 | <Print> | ||
1159 | 122 | <ValidPrinterInfo/> | ||
1160 | 123 | <PaperSizeIndex>9</PaperSizeIndex> | ||
1161 | 124 | <HorizontalResolution>600</HorizontalResolution> | ||
1162 | 125 | <VerticalResolution>600</VerticalResolution> | ||
1163 | 126 | </Print> | ||
1164 | 127 | <Selected/> | ||
1165 | 128 | <Panes> | ||
1166 | 129 | <Pane> | ||
1167 | 130 | <Number>3</Number> | ||
1168 | 131 | <ActiveRow>17</ActiveRow> | ||
1169 | 132 | </Pane> | ||
1170 | 133 | </Panes> | ||
1171 | 134 | <ProtectObjects>False</ProtectObjects> | ||
1172 | 135 | <ProtectScenarios>False</ProtectScenarios> | ||
1173 | 136 | </WorksheetOptions> | ||
1174 | 137 | </ss:Worksheet> | ||
1175 | 138 | |||
1176 | 139 | </Workbook> | ||
1177 | 0 | 140 | ||
1178 | === modified file 'bin/addons/product_attributes/product_attributes.py' | |||
1179 | --- bin/addons/product_attributes/product_attributes.py 2017-01-17 13:31:02 +0000 | |||
1180 | +++ bin/addons/product_attributes/product_attributes.py 2017-02-03 13:54:39 +0000 | |||
1181 | @@ -1294,6 +1294,7 @@ | |||
1182 | 1294 | return True | 1294 | return True |
1183 | 1295 | smrl_obj = self.pool.get('stock.mission.report.line') | 1295 | smrl_obj = self.pool.get('stock.mission.report.line') |
1184 | 1296 | prod_status_obj = self.pool.get('product.status') | 1296 | prod_status_obj = self.pool.get('product.status') |
1185 | 1297 | int_stat_obj = self.pool.get('product.international.status') | ||
1186 | 1297 | 1298 | ||
1187 | 1298 | if context is None: | 1299 | if context is None: |
1188 | 1299 | context = {} | 1300 | context = {} |
1189 | @@ -1335,6 +1336,33 @@ | |||
1190 | 1335 | if local_smrl_ids: | 1336 | if local_smrl_ids: |
1191 | 1336 | smrl_obj.write(cr, uid, local_smrl_ids, {'product_state': prod_state}, context=context) | 1337 | smrl_obj.write(cr, uid, local_smrl_ids, {'product_state': prod_state}, context=context) |
1192 | 1337 | 1338 | ||
1193 | 1339 | if 'international_status' in vals: | ||
1194 | 1340 | intstat_code = '' | ||
1195 | 1341 | if vals['international_status']: | ||
1196 | 1342 | intstat_id = vals['international_status'] | ||
1197 | 1343 | if isinstance(intstat_id, (int,long)): | ||
1198 | 1344 | intstat_id = [intstat_id] | ||
1199 | 1345 | intstat_code = int_stat_obj.read(cr, uid, intstat_id, ['code'], context=context)[0]['code'] | ||
1200 | 1346 | # just update SMRL that belongs to our instance: | ||
1201 | 1347 | local_smrl_ids = smrl_obj.search(cr, uid, [ | ||
1202 | 1348 | ('international_status_code', '!=', intstat_code), | ||
1203 | 1349 | ('product_id', 'in', ids), | ||
1204 | 1350 | ('full_view', '=', False), | ||
1205 | 1351 | ('mission_report_id.local_report', '=', True) | ||
1206 | 1352 | ], context=context) | ||
1207 | 1353 | if local_smrl_ids: | ||
1208 | 1354 | smrl_obj.write(cr, uid, local_smrl_ids, {'international_status_code': intstat_code or ''}, context=context) | ||
1209 | 1355 | |||
1210 | 1356 | if 'state_ud' in vals: | ||
1211 | 1357 | # just update SMRL that belongs to our instance: | ||
1212 | 1358 | local_smrl_ids = smrl_obj.search(cr, uid, [ | ||
1213 | 1359 | ('product_id', 'in', ids), | ||
1214 | 1360 | ('full_view', '=', False), | ||
1215 | 1361 | ('mission_report_id.local_report', '=', True) | ||
1216 | 1362 | ], context=context) | ||
1217 | 1363 | if local_smrl_ids: | ||
1218 | 1364 | smrl_obj.write(cr, uid, local_smrl_ids, {'state_ud': vals['state_ud'] or ''}, context=context) | ||
1219 | 1365 | |||
1220 | 1338 | product_uom_categ = [] | 1366 | product_uom_categ = [] |
1221 | 1339 | if 'uom_id' in vals or 'uom_po_id' in vals: | 1367 | if 'uom_id' in vals or 'uom_po_id' in vals: |
1222 | 1340 | if isinstance(ids, (int, long)): | 1368 | if isinstance(ids, (int, long)): |
1223 | @@ -1368,6 +1396,15 @@ | |||
1224 | 1368 | # 'state': phase_out_status, | 1396 | # 'state': phase_out_status, |
1225 | 1369 | }) | 1397 | }) |
1226 | 1370 | 1398 | ||
1227 | 1399 | if 'active' in vals: | ||
1228 | 1400 | local_smrl_ids = smrl_obj.search(cr, uid, [ | ||
1229 | 1401 | ('product_id', 'in', ids), | ||
1230 | 1402 | ('full_view', '=', False), | ||
1231 | 1403 | ('mission_report_id.local_report', '=', True) | ||
1232 | 1404 | ], context=context) | ||
1233 | 1405 | if local_smrl_ids: | ||
1234 | 1406 | smrl_obj.write(cr, uid, local_smrl_ids, {'product_active': vals['active']}, context=context) | ||
1235 | 1407 | |||
1236 | 1371 | if 'narcotic' in vals or 'controlled_substance' in vals: | 1408 | if 'narcotic' in vals or 'controlled_substance' in vals: |
1237 | 1372 | if vals.get('narcotic') == True or tools.ustr(vals.get('controlled_substance', '')) == 'True': | 1409 | if vals.get('narcotic') == True or tools.ustr(vals.get('controlled_substance', '')) == 'True': |
1238 | 1373 | vals['controlled_substance'] = 'True' | 1410 | vals['controlled_substance'] = 'True' |
1239 | @@ -1389,6 +1426,7 @@ | |||
1240 | 1389 | 1426 | ||
1241 | 1390 | return res | 1427 | return res |
1242 | 1391 | 1428 | ||
1243 | 1429 | |||
1244 | 1392 | def reactivate_product(self, cr, uid, ids, context=None): | 1430 | def reactivate_product(self, cr, uid, ids, context=None): |
1245 | 1393 | ''' | 1431 | ''' |
1246 | 1394 | Re-activate product. | 1432 | Re-activate product. |