Merge lp:~unifield-team/unifield-server/us-1167 into lp:unifield-server

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
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+315900@code.launchpad.net
To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'bin/addons/mission_stock/mission_stock.py'
--- bin/addons/mission_stock/mission_stock.py 2016-12-05 14:26:00 +0000
+++ bin/addons/mission_stock/mission_stock.py 2017-02-03 13:54:39 +0000
@@ -547,20 +547,25 @@
547 line_obj = self.pool.get('stock.mission.report.line')547 line_obj = self.pool.get('stock.mission.report.line')
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):
549 # Create one line by product549 # Create one line by product
550 cr.execute('''SELECT p.id, ps.code550 cr.execute('''SELECT p.id, ps.code, p.active, p.state_ud, pis.code
551 FROM product_product p, product_template pt551 FROM product_product p, product_template pt, product_status ps, product_international_status pis
552 LEFT JOIN product_status ps ON pt.state = ps.id
553 WHERE p.product_tmpl_id = pt.id552 WHERE p.product_tmpl_id = pt.id
553 AND pt.state = ps.id
554 AND p.international_status = pis.id
554 AND NOT EXISTS (555 AND NOT EXISTS (
555 SELECT product_id556 SELECT product_id
556 FROM557 FROM
557 stock_mission_report_line smrl WHERE mission_report_id = %s558 stock_mission_report_line smrl WHERE mission_report_id = %s
558 AND p.id = smrl.product_id)559 AND p.id = smrl.product_id)
559 ''' % report['id'])560 ''' % report['id'])
560 for product, prod_state in cr.fetchall():561 for product, prod_state, prod_active, prod_state_ud, prod_creator in cr.fetchall():
561 line_obj.create(cr, uid, {562 line_obj.create(cr, uid, {
562 'product_id': product,563 'product_id': product,
563 'mission_report_id': report['id'],564 'mission_report_id': report['id'],
565 'product_state': prod_state,
566 'product_active': prod_active,
567 'state_ud': prod_state_ud,
568 'international_status_code': prod_creator,
564 'product_state': prod_state or '',569 'product_state': prod_state or '',
565 }, context=context)570 }, context=context)
566571
@@ -957,6 +962,9 @@
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),
958 },963 },
959 write_relate=False),964 write_relate=False),
965 'product_active': fields.boolean(string='Active'),
966 'state_ud': fields.char(size=128, string='UniData status'),
967 'international_status_code': fields.char(size=128, string='Product Creator'),
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),
961 'internal_qty': fields.float(digits=(16,2), string='Instance Stock'),969 'internal_qty': fields.float(digits=(16,2), string='Instance Stock'),
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.'),
@@ -985,6 +993,7 @@
985 string='HQ Instance',993 string='HQ Instance',
986 required=True,994 required=True,
987 ),995 ),
996
988 }997 }
989998
990 @tools.cache(skiparg=2)999 @tools.cache(skiparg=2)
@@ -1019,6 +1028,8 @@
1019 'in_pipe_coor_val': 0.00,1028 'in_pipe_coor_val': 0.00,
1020 'instance_id': _get_default_destination_instance_id,1029 'instance_id': _get_default_destination_instance_id,
1021 'product_state': '',1030 'product_state': '',
1031 'state_ud': '',
1032 'international_status_code': '',
1022 }1033 }
10231034
1024 def update_full_view_line(self, cr, uid, context=None):1035 def update_full_view_line(self, cr, uid, context=None):
10251036
=== modified file 'bin/addons/msf_profile/data/patches.xml'
--- bin/addons/msf_profile/data/patches.xml 2017-01-31 16:17:06 +0000
+++ bin/addons/msf_profile/data/patches.xml 2017-02-03 13:54:39 +0000
@@ -150,7 +150,11 @@
150 <record id="us_1671_stopped_products" model="patch.scripts">150 <record id="us_1671_stopped_products" model="patch.scripts">
151 <field name="method">us_1671_stopped_products</field>151 <field name="method">us_1671_stopped_products</field>
152 </record>152 </record>
153153
154 <record id="us_1167_status_inconsistencies" model="patch.scripts">
155 <field name="method">us_1167_status_inconsistencies</field>
156 </record>
157
154 <record id="us_2075_partner_locally_created" model="patch.scripts">158 <record id="us_2075_partner_locally_created" model="patch.scripts">
155 <field name="method">us_2075_partner_locally_created</field>159 <field name="method">us_2075_partner_locally_created</field>
156 </record>160 </record>
157161
=== modified file 'bin/addons/msf_profile/i18n/fr_MF.po'
--- bin/addons/msf_profile/i18n/fr_MF.po 2017-01-31 16:17:06 +0000
+++ bin/addons/msf_profile/i18n/fr_MF.po 2017-02-03 13:54:39 +0000
@@ -4658,7 +4658,7 @@
4658msgid "Search Real Kit Composition Item"4658msgid "Search Real Kit Composition Item"
4659msgstr "Rechercher l'Article de la Composition Réelle du Kit"4659msgstr "Rechercher l'Article de la Composition Réelle du Kit"
46604660
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_list4661#. 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
4662#: view:account.account.type:04662#: view:account.account.type:0
4663#: field:account.account.type,note:04663#: field:account.account.type,note:0
4664#: view:account.analytic.account:04664#: view:account.analytic.account:0
@@ -4735,6 +4735,7 @@
4735#: report:msf.report_reception_in:04735#: report:msf.report_reception_in:0
4736#: view:stock.production.lot.revision:04736#: view:stock.production.lot.revision:0
4737#: field:stock.production.lot.revision,description:04737#: field:stock.production.lot.revision,description:0
4738#: report:addons/msf_tools/report/report_inconsistencies_xls.mako:81
4738#, python-format4739#, python-format
4739msgid "Description"4740msgid "Description"
4740msgstr "Description"4741msgstr "Description"
@@ -6421,6 +6422,7 @@
6421#: view:automated.import.job:06422#: view:automated.import.job:0
6422#: selection:automated.import.job,state:06423#: selection:automated.import.job,state:0
6423#: selection:export.report.stopped.products,state:06424#: selection:export.report.stopped.products,state:0
6425#: selection:export.report.inconsistencies,state:0
6424#: view:account.bank.statement:06426#: view:account.bank.statement:0
6425#: selection:account.bank.statement,state:06427#: selection:account.bank.statement,state:0
6426#: view:account.invoice:06428#: view:account.invoice:0
@@ -6526,6 +6528,7 @@
6526#: selection:tender,internal_state:06528#: selection:tender,internal_state:0
6527#: selection:tender,state:06529#: selection:tender,state:0
6528#: selection:tender.line,state:06530#: selection:tender.line,state:0
6531#: view:automated.import.job:0
6529#, python-format6532#, python-format
6530msgid "Draft"6533msgid "Draft"
6531msgstr "Brouillon"6534msgstr "Brouillon"
@@ -7368,12 +7371,13 @@
7368msgid "Earmarked"7371msgid "Earmarked"
7369msgstr "Réservé"7372msgstr "Réservé"
73707373
7371#. modules: mission_stock, base, msf_instance7374#. modules: mission_stock, base, msf_instance, msf_tools
7372#: field:workflow.workitem,inst_id:07375#: field:workflow.workitem,inst_id:0
7373#: field:stock.mission.report,instance_id:07376#: field:stock.mission.report,instance_id:0
7374#: field:account.target.costcenter,instance_id:07377#: field:account.target.costcenter,instance_id:0
7375#: model:ir.actions.act_window,name:msf_instance.action_msf_instance_setup7378#: model:ir.actions.act_window,name:msf_instance.action_msf_instance_setup
7376#: field:msf.instance,instance:07379#: field:msf.instance,instance:0
7380#: report:addons/msf_tools/report/report_inconsistencies_xls.mako:79
7377msgid "Instance"7381msgid "Instance"
7378msgstr "Instance"7382msgstr "Instance"
73797383
@@ -8393,10 +8397,11 @@
8393msgid "Budget Import"8397msgid "Budget Import"
8394msgstr "Budget - Importation"8398msgstr "Budget - Importation"
83958399
8396#. modules: supplier_catalogue, resource, msf_instance8400#. modules: supplier_catalogue, resource, msf_instance, msf_tools
8397#: selection:msf.instance,state:08401#: selection:msf.instance,state:0
8398#: view:resource.resource:08402#: view:resource.resource:0
8399#: view:supplier.catalogue:08403#: view:supplier.catalogue:0
8404#: report:addons/msf_tools/report/report_inconsistencies_xls.mako:106
8400msgid "Inactive"8405msgid "Inactive"
8401msgstr "Inactif"8406msgstr "Inactif"
84028407
@@ -10646,7 +10651,7 @@
10646msgid "The new %s Event %s has been created."10651msgid "The new %s Event %s has been created."
10647msgstr "Le nouveau %s Evénement %s a été créé."10652msgstr "Le nouveau %s Evénement %s a été créé."
1064810653
10649#. modules: msf_budget, account, reason_types_moves, resource, product_attributes, financing_contract, res_currency_tables, msf_instance, product, sale, analytic, base, stock, analytic_distribution10654#. 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
10650#: field:account.account,code:010655#: field:account.account,code:0
10651#: report:account.account.balance:010656#: report:account.account.balance:0
10652#: field:account.account.template,code:010657#: field:account.account.template,code:0
@@ -10683,6 +10688,7 @@
10683#: field:resource.resource,code:010688#: field:resource.resource,code:0
10684#: report:msf.report_reception_in:010689#: report:msf.report_reception_in:0
10685#: field:stock.incoterms,code:010690#: field:stock.incoterms,code:0
10691#: report:addons/msf_tools/report/report_inconsistencies_xls.mako:80
10686msgid "Code"10692msgid "Code"
10687msgstr "Code"10693msgstr "Code"
1068810694
@@ -11658,6 +11664,8 @@
11658#: selection:stock.forecast.line,state:011664#: selection:stock.forecast.line,state:0
11659#: view:stock.move:011665#: view:stock.move:0
11660#: selection:sync.client.entity_manager,state:011666#: selection:sync.client.entity_manager,state:0
11667#: selection:export.report.inconsistencies,state:0
11668#: selection:export.report.stopped.products,state:0
11661msgid "Ready"11669msgid "Ready"
11662msgstr "Prêt"11670msgstr "Prêt"
1166311671
@@ -23526,7 +23534,7 @@
23526msgid "Send SMS"23534msgid "Send SMS"
23527msgstr "Envoyer SMS"23535msgstr "Envoyer SMS"
2352823536
23529#. modules: msf_partner, stock_override, kit, account_override, product_attributes, msf_doc_import, purchase_msf, msf_profile23537#. modules: msf_partner, stock_override, kit, account_override, product_attributes, msf_doc_import, purchase_msf, msf_profile, msf_tools
23530#: code:addons/account_override/wizard/wizard_import_mapping.py:5923538#: code:addons/account_override/wizard/wizard_import_mapping.py:59
23531#: code:addons/kit/kit.py:83523539#: code:addons/kit/kit.py:835
23532#: code:addons/kit/kit.py:84023540#: code:addons/kit/kit.py:840
@@ -23604,9 +23612,22 @@
23604#: selection:wizard.import.po.simulation.screen,state:023612#: selection:wizard.import.po.simulation.screen,state:0
23605#: selection:wizard.import.po.simulation.screen.line,type_change:023613#: selection:wizard.import.po.simulation.screen.line,type_change:0
23606#: selection:wizard.simu.import.po.line,change_type:023614#: selection:wizard.simu.import.po.line,change_type:0
23615#: code:addons/msf_tools/automated_import.py:57
23616#: code:addons/msf_tools/automated_import.py:62
23617#: code:addons/msf_tools/automated_import.py:67
23618#: code:addons/msf_tools/automated_import.py:196
23619#: code:addons/msf_tools/automated_import.py:227
23620#: code:addons/msf_tools/automated_import.py:386
23621#: code:addons/msf_tools/automated_import.py:407
23622#: code:addons/msf_tools/automated_import_function.py:65
23623#: code:addons/msf_tools/automated_import_job.py:324
23624#: code:addons/msf_tools/msf_tools.py:875
23625#: code:addons/msf_tools/msf_tools.py:888
23626#: code:addons/msf_tools/report/report_inconsistencies.py:106
23627#: code:addons/msf_tools/report/report_stopped_products.py:106
23607#, python-format23628#, python-format
23608msgid "Error"23629msgid "Error"
23609msgstr "Error"23630msgstr "Erreur"
2361023631
23611#. modules: account_activable, analytic_distribution23632#. modules: account_activable, analytic_distribution
23612#: code:addons/account_activable/account_activable.py:5123633#: code:addons/account_activable/account_activable.py:51
@@ -32054,6 +32075,8 @@
32054#: selection:wizard.import.po,state:032075#: selection:wizard.import.po,state:0
32055#: view:sourcing.line:032076#: view:sourcing.line:0
32056#: selection:wizard.register.import,state:032077#: selection:wizard.register.import,state:0
32078#: selection::export.report.inconsistencies,state:0
32079#: selection:export.report.stopped.products,state:0
32057#, python-format32080#, python-format
32058msgid "In Progress"32081msgid "In Progress"
32059msgstr "En Cours"32082msgstr "En Cours"
@@ -42472,8 +42495,10 @@
42472msgid "Asia/Phnom_Penh"42495msgid "Asia/Phnom_Penh"
42473msgstr "Asia/Phnom_Penh"42496msgstr "Asia/Phnom_Penh"
4247442497
42475#. module: product_attributes42498#. modules: product_attributes, mission_stock, msf_tools
42476#: field:product.product,international_status:042499#: field:product.product,international_status:0
42500#: field:stock.mission.report.line,international_status_code:0
42501#: report:addons/msf_tools/report/report_inconsistencies_xls.mako:82
42477msgid "Product Creator"42502msgid "Product Creator"
42478msgstr "Créateur produit"42503msgstr "Créateur produit"
4247942504
@@ -43961,6 +43986,9 @@
43961#: field:wizard.import.stock.warehouse.orderpoint.line,state:043986#: field:wizard.import.stock.warehouse.orderpoint.line,state:0
43962#: field:wizard.import.supplier.catalogue,state:043987#: field:wizard.import.supplier.catalogue,state:0
43963#: field:wizard.import.threshold.value.line,state:043988#: field:wizard.import.threshold.value.line,state:0
43989#: field:automated.import.job,state:0
43990#: field:export.report.inconsistencies,state:0
43991#: field:export.report.stopped.products,state:0
43964msgid "State"43992msgid "State"
43965msgstr "État"43993msgstr "État"
4396643994
@@ -49776,13 +49804,14 @@
49776msgid "RWANDAN FRANC"49804msgid "RWANDAN FRANC"
49777msgstr "RWANDAN FRANC"49805msgstr "RWANDAN FRANC"
4977849806
49779#. modules: product_attributes, purchase_override, account_hq_entries, sale49807#. modules: product_attributes, purchase_override, account_hq_entries, sale, msf_tools
49780#: model:ir.ui.menu,name:account_hq_entries.menu_hq49808#: model:ir.ui.menu,name:account_hq_entries.menu_hq
49781#: selection:product.product,international_status:049809#: selection:product.product,international_status:0
49782#: report:msf.purchase.order:049810#: report:msf.purchase.order:0
49783#: report:msf.purchase.quotation:049811#: report:msf.purchase.quotation:0
49784#: report:purchase.order.merged:049812#: report:purchase.order.merged:0
49785#: report:msf.sale.order:049813#: report:msf.sale.order:0
49814#: report:addons/msf_tools/report/report_inconsistencies_xls.mako:90
49786msgid "HQ"49815msgid "HQ"
49787msgstr "HQ / Siège"49816msgstr "HQ / Siège"
4978849817
@@ -53592,7 +53621,7 @@
53592msgid "Navajo"53621msgid "Navajo"
53593msgstr "Navajo"53622msgstr "Navajo"
5359453623
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_distribution53624#. 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
53596#: field:account.account,active:053625#: field:account.account,active:0
53597#: field:account.analytic.journal,active:053626#: field:account.analytic.journal,active:0
53598#: field:account.journal.period,active:053627#: field:account.journal.period,active:0
@@ -53647,6 +53676,9 @@
53647#: field:supplier.catalogue,current:053676#: field:supplier.catalogue,current:0
53648#: field:threshold.value,active:053677#: field:threshold.value,active:0
53649#: field:ir.ui.menu,active:053678#: field:ir.ui.menu,active:0
53679#: field:stock.mission.report.line,product_active:0
53680#: field:automated.import,active:0
53681#: report:addons/msf_tools/report/report_inconsistencies_xls.mako:106
53650msgid "Active"53682msgid "Active"
53651msgstr "Actif"53683msgstr "Actif"
5365253684
@@ -54315,6 +54347,8 @@
54315#: code:addons/kit/wizard/substitute.py:68754347#: code:addons/kit/wizard/substitute.py:687
54316#: code:addons/kit/wizard/substitute.py:102454348#: code:addons/kit/wizard/substitute.py:1024
54317#: code:addons/mission_stock/mission_stock.py:7154349#: code:addons/mission_stock/mission_stock.py:71
54350#: code:addons/mission_stock/report/stock_mission_report.py:66
54351#: code:addons/mission_stock/report/stock_mission_report.py:77
54318#: code:addons/mission_stock/wizard/mission_stock_wizard.py:5454352#: code:addons/mission_stock/wizard/mission_stock_wizard.py:54
54319#: code:addons/mission_stock/wizard/mission_stock_wizard.py:8854353#: code:addons/mission_stock/wizard/mission_stock_wizard.py:88
54320#: code:addons/mission_stock/wizard/mission_stock_wizard.py:9254354#: code:addons/mission_stock/wizard/mission_stock_wizard.py:92
@@ -76100,6 +76134,93 @@
76100msgid "A line was added to the %s %s to re-source the canceled line."76134msgid "A line was added to the %s %s to re-source the canceled line."
76101msgstr "Une ligne a été ajoutée a la %s %s pour 're-sourcer' la ligne annulée."76135msgstr "Une ligne a été ajoutée a la %s %s pour 're-sourcer' la ligne annulée."
7610276136
76137#. module: mission_stock
76138#: field:stock.mission.report.line,state_ud:0
76139msgid "UniData status"
76140msgstr "Statut UniData"
76141
76142#. module: msf_tools
76143#: field:export.report.inconsistencies,name:0
76144#: field:export.report.stopped.products,name:0
76145msgid "Generated On"
76146msgstr "Généré le"
76147
76148#. module: msf_tools
76149#: code:addons/msf_tools/report/report_inconsistencies.py:107
76150#: code:addons/msf_tools/report/report_stopped_products.py:107
76151#, python-format
76152msgid "Nothing to generate"
76153msgstr "Rien à générer"
76154
76155#. module: msf_tools
76156#: model:ir.actions.report.xml,name:msf_tools.report_inconsistencies_xls
76157msgid "Inconsistencies with HQ"
76158msgstr "Incohérences avec le HQ"
76159
76160#. module: msf_tools
76161#: model:ir.actions.act_window,name:msf_tools.export_report_inconsistencies_action
76162#: model:ir.ui.menu,name:msf_tools.export_report_inconsistencies_menu
76163msgid "Product Status Inconsistencies"
76164msgstr "Incohérences du statut des produits"
76165
76166#. module: msf_tools
76167#: view:export.report.inconsistencies:0
76168msgid "Export inconsistencies"
76169msgstr "Exporter les incohérences"
76170
76171#. module: msf_tools
76172#: view:export.report.inconsistencies:0
76173#: view:export.report.stopped.products:0
76174msgid "Request information"
76175msgstr "Demande d'informations"
76176
76177#. module: msf_tools
76178#: view:export.report.inconsistencies:0
76179#: view:export.report.stopped.products:0
76180msgid "Generate report"
76181msgstr "Générer le rapport"
76182
76183#. module: msf_tools
76184#: view:export.report.inconsistencies:0
76185#: view:export.report.stopped.products:0
76186msgid "Status of the report"
76187msgstr "État du rapport"
76188
76189#. module: msf_tools
76190#: view:export.report.inconsistencies:0
76191msgid "Your export inconsistent products demand will be treated quickly."
76192msgstr "Votre export des produits incohérents sera traité rapidement."
76193
76194#. module: msf_tools
76195#: view:export.report.inconsistencies:0
76196msgid "Due to the volume of data, your report cannot be shown immediatly"
76197msgstr "À cause du volume des données, le rapport ne peut pas être affiché immédiatement"
76198
76199#. module: msf_tools
76200#: view:export.report.inconsistencies:0
76201msgid "When the report will be ready, you can access to it by the menu Tools / Inconsistencies report"
76202msgstr "Quand le rapport sera prêt, vous pourrez y accéder depuis le menu Outils / Rapport d'incohérences"
76203
76204#. module: msf_tools
76205#: report:addons/msf_tools/report/report_inconsistencies_xls.mako:75
76206msgid "There is no inconsistencies to report"
76207msgstr "Il n'y a pas d'incohérence à reporter"
76208
76209#. module: msf_tools
76210#: report:addons/msf_tools/report/report_inconsistencies_xls.mako:85
76211msgid "Active/Inactive"
76212msgstr "Actif/Inactif"
76213
76214#. module: msf_tools
76215#: report:addons/msf_tools/report/report_inconsistencies_xls.mako:83
76216msgid "UniField Status"
76217msgstr "Statut UniField"
76218
76219#. module: msf_tools
76220#: report:addons/msf_tools/report/report_inconsistencies_xls.mako:84
76221msgid "Unidata Status"
76222msgstr "Statut UniData"
76223
76103#. modules: sale, msf_printed_documents76224#. modules: sale, msf_printed_documents
76104#: report:msf.consumption_report:076225#: report:msf.consumption_report:0
76105msgid "Source Location :"76226msgid "Source Location :"
7610676227
=== modified file 'bin/addons/msf_profile/msf_profile.py'
--- bin/addons/msf_profile/msf_profile.py 2017-01-31 16:17:06 +0000
+++ bin/addons/msf_profile/msf_profile.py 2017-02-03 13:54:39 +0000
@@ -1117,9 +1117,58 @@
1117 return True1117 return True
11181118
11191119
1120 def us_1167_status_inconsistencies(self, cr, uid, *a, **b):
1121 '''
1122 fill fields of stock.mission.report.line:
1123 - state_ud
1124 - product_active
1125 - international_status_code
1126 '''
1127 prod_obj = self.pool.get('product.product')
1128 smrl_obj = self.pool.get('stock.mission.report.line')
1129 context = {}
1130
1131 prod_ids = prod_obj.search(cr, uid, [('active', 'in', ['t', 'f'])], context=context)
1132 smrl_to_update = smrl_obj.search(cr, uid, [('product_id', 'in', prod_ids), ('mission_report_id.local_report', '=', True)], context=context)
1133
1134 for smrl in smrl_obj.browse(cr, uid, smrl_to_update, context=context):
1135 smrl_obj.write(cr, uid, smrl.id, {
1136 'state_ud': smrl.product_id.state_ud,
1137 'product_active': smrl.product_id.active,
1138 'international_status_code': smrl.product_id.international_status.code if smrl.product_id.international_status else '',
1139 }, context=context)
1140
1141 return True
1142
1143
1144 def us_1167_status_inconsistencies(self, cr, uid, *a, **b):
1145 '''
1146 fill fields of stock.mission.report.line:
1147 - state_ud
1148 - product_active
1149 - international_status_code
1150 '''
1151 prod_obj = self.pool.get('product.product')
1152 smrl_obj = self.pool.get('stock.mission.report.line')
1153 context = {}
1154
1155 prod_ids = prod_obj.search(cr, uid, [('active', 'in', ['t', 'f'])], context=context)
1156 smrl_to_update = smrl_obj.search(cr, uid, [('product_id', 'in', prod_ids), ('mission_report_id.local_report', '=', True)], context=context)
1157
1158 for smrl in smrl_obj.browse(cr, uid, smrl_to_update, context=context):
1159 smrl_obj.write(cr, uid, smrl.id, {
1160 'state_ud': smrl.product_id.state_ud,
1161 'product_active': smrl.product_id.active,
1162 'international_status_code': smrl.product_id.international_status.code if smrl.product_id.international_status else '',
1163 }, context=context)
1164
1165 return True
1166
1167
1120patch_scripts()1168patch_scripts()
11211169
11221170
1171
1123class ir_model_data(osv.osv):1172class ir_model_data(osv.osv):
1124 _inherit = 'ir.model.data'1173 _inherit = 'ir.model.data'
1125 _name = 'ir.model.data'1174 _name = 'ir.model.data'
11261175
=== modified file 'bin/addons/msf_sync_data_server/data/sync_server.sync_rule.csv'
--- bin/addons/msf_sync_data_server/data/sync_server.sync_rule.csv 2017-01-25 14:57:37 +0000
+++ bin/addons/msf_sync_data_server/data/sync_server.sync_rule.csv 2017-02-03 13:54:39 +0000
@@ -87,8 +87,8 @@
87msf_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,,43187msf_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
88msf_sync_data_server.budget_status,TRUE,TRUE,FALSE,FALSE,bidirectional,Up,"[('type','=','normal'), ('state', '!=', 'draft')]",['state'],OC,msf.budget,,Budget status,Valid,,43288msf_sync_data_server.budget_status,TRUE,TRUE,FALSE,FALSE,bidirectional,Up,"[('type','=','normal'), ('state', '!=', 'draft')]",['state'],OC,msf.budget,,Budget status,Valid,,432
89msf_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,,44089msf_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
90msf_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,,44190msf_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
91msf_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,,44291msf_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
92msf_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,,45092msf_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
93msf_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,,45193msf_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
94msf_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,,45294msf_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
9595
=== modified file 'bin/addons/msf_tools/__openerp__.py'
--- bin/addons/msf_tools/__openerp__.py 2016-10-26 16:06:31 +0000
+++ bin/addons/msf_tools/__openerp__.py 2017-02-03 13:54:39 +0000
@@ -41,6 +41,8 @@
41 'security/ir.model.access.csv',41 'security/ir.model.access.csv',
42 'report/report_stopped_products_view.xml',42 'report/report_stopped_products_view.xml',
43 'report/report_stopped_products_report.xml',43 'report/report_stopped_products_report.xml',
44 'report/report_inconsistencies_view.xml',
45 'report/report_inconsistencies_report.xml',
44 'automated_import_data.xml',46 'automated_import_data.xml',
45 ],47 ],
46 'demo_xml': [48 'demo_xml': [
4749
=== modified file 'bin/addons/msf_tools/report/__init__.py'
--- bin/addons/msf_tools/report/__init__.py 2016-10-26 16:06:31 +0000
+++ bin/addons/msf_tools/report/__init__.py 2017-02-03 13:54:39 +0000
@@ -20,3 +20,4 @@
20##############################################################################20##############################################################################
2121
22import report_stopped_products22import report_stopped_products
23import report_inconsistencies
2324
=== added file 'bin/addons/msf_tools/report/report_inconsistencies.py'
--- bin/addons/msf_tools/report/report_inconsistencies.py 1970-01-01 00:00:00 +0000
+++ bin/addons/msf_tools/report/report_inconsistencies.py 2017-02-03 13:54:39 +0000
@@ -0,0 +1,433 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22
23import time
24import threading
25from osv import fields
26from osv import osv
27from report import report_sxw
28from spreadsheet_xml.spreadsheet_xml_write import SpreadsheetReport
29from service.web_services import report_spool
30from tools.translate import _
31
32
33
34class export_report_inconsistencies(osv.osv):
35
36 _name = 'export.report.inconsistencies'
37 _order = 'name desc'
38
39 _columns = {
40 'name': fields.datetime(string='Generated On', readonly=True),
41 'state': fields.selection(
42 [('draft', 'Draft'),
43 ('in_progress', 'In Progress'),
44 ('ready', 'Ready')],
45 string='State',
46 readonly=True,
47 ),
48 }
49
50 _defaults = {
51 'state': lambda *a: 'draft',
52 }
53
54
55 def generate_report(self, cr, uid, ids, context=None):
56 '''
57 Generate a report
58 Method is called by button on XML view (form)
59 '''
60 prod_obj = self.pool.get('product.product')
61 data_obj = self.pool.get('ir.model.data')
62
63 res = {}
64 for report in self.browse(cr, uid, ids, context=context):
65 # get ids of all non-local products :
66 status_local_id = data_obj.get_object_reference(cr, uid, 'product_attributes', 'int_4')[1]
67 product_ids = prod_obj.search(cr, uid, [('international_status', '!=', status_local_id)], context=context)
68 if not product_ids:
69 continue
70
71 # state of report is in progress :
72 self.write(cr, uid, [report.id], {
73 'name': time.strftime('%Y-%m-%d %H:%M:%S'),
74 'state': 'in_progress'
75 }, context=context)
76
77 datas = {
78 'ids': [report.id],
79 'lines': product_ids,
80 }
81
82 cr.commit()
83 new_thread = threading.Thread(target=self.generate_report_bkg, args=(cr, uid, report.id, datas, context))
84 new_thread.start()
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
86
87 res = {
88 'type': 'ir.actions.act_window',
89 'res_model': self._name,
90 'view_type': 'form',
91 'view_mode': 'form,tree',
92 'res_id': report.id,
93 'context': context,
94 'target': 'same',
95 }
96
97 if new_thread.isAlive():
98 view_id = data_obj.get_object_reference(
99 cr, uid,
100 'msf_tools',
101 'report_inconsistencies_info_view')[1]
102 res['view_id'] = [view_id]
103
104 if not res:
105 raise osv.except_osv(
106 _('Error'),
107 _("Nothing to generate")
108 )
109
110 return res
111
112
113 def generate_report_bkg(self, cr, uid, report_ids, datas, context=None):
114 '''
115 Generate the report in background (thread)
116 '''
117 attachment_obj = self.pool.get('ir.attachment')
118
119 if context is None:
120 context ={}
121
122 if isinstance(report_ids, (int, long)):
123 report_ids = [report_ids]
124
125 import pooler
126 new_cr = pooler.get_db(cr.dbname).cursor()
127
128 # export datas :
129 report_name = "inconsistencies.xls"
130 attachment_name = "inconsistencies_report_%s.xls" % time.strftime('%d-%m-%Y_%Hh%M')
131 rp_spool = report_spool()
132 res_export = rp_spool.exp_report(cr.dbname, uid, report_name, report_ids, datas, context)
133 file_res = {'state': False}
134 while not file_res.get('state'):
135 file_res = rp_spool.exp_report_get(new_cr.dbname, uid, res_export)
136 time.sleep(0.5)
137
138 # attach report to the right panel :
139 attachment_obj.create(new_cr, uid, {
140 'name': attachment_name,
141 'datas_fname': attachment_name,
142 'description': "Inconsistencies with HQ",
143 'res_model': 'export.report.inconsistencies',
144 'res_id': report_ids[0],
145 'datas': file_res.get('result'),
146 }, context=context)
147
148 # state is now 'ready' :
149 self.write(new_cr, uid, report_ids, {'state': 'ready'}, context= context)
150
151 new_cr.commit()
152 new_cr.close(True)
153
154 return True
155
156
157export_report_inconsistencies()
158
159
160
161class parser_report_inconsistencies_xls(report_sxw.rml_parse):
162 '''
163 To parse our mako template for inconsistencies
164 '''
165 def __init__(self, cr, uid, name, context=None):
166 super(parser_report_inconsistencies_xls, self).__init__(cr, uid, name, context=context)
167
168 # localcontext allows you to call methods inside mako file :
169 self.localcontext.update({
170 'time': time,
171 'get_uf_status': self.get_uf_status,
172 'get_ud_status': self.get_ud_status,
173 'get_inconsistent_lines': self.get_inconsistent_lines,
174 'get_products_with_inconsistencies': self.get_products_with_inconsistencies,
175 'get_product_creator_name_from_code': self.get_product_creator_name_from_code,
176 })
177
178 # cached data
179 self.uf_status_cache = {}
180 self.prod_creator_cache = {}
181 self.inconsistent = {}
182
183
184 def get_inconsistent_lines(self, prod_id=None):
185 '''
186 Return stock mission report lines that are inconsistent with HQ
187 Based on the fields: product_active, state_ud and international_status_code
188
189 prod_id: You can get only SMRL with product_id, if you don't give this information you
190 will get all inconsistents SMRL
191 '''
192 smrl_obj = self.pool.get('stock.mission.report.line')
193 product_creator_obj = self.pool.get('product.international.status')
194 inconsistent_id_list = []
195
196 intl_status_code_name = {}
197 intl_status_ids = product_creator_obj.search(self.cr, self.uid, [])
198 for intl_status in product_creator_obj.browse(self.cr, self.uid, intl_status_ids):
199 intl_status_code_name.setdefault(intl_status.code, intl_status.name)
200
201 if not self.inconsistent:
202 prod_obj = self.pool.get('product.product')
203 prod_status_obj = self.pool.get('product.status')
204
205 smrl_ids = smrl_obj.search(self.cr, self.uid, [('full_view', '=', False)], order='NO_ORDER', context=self.localcontext)
206
207 # check stock mission report line for inconsistencies with HQ (our instance):
208 self.inconsistent = {}
209 read_smrl_result = smrl_obj.read(self.cr, self.uid, smrl_ids,
210 ['product_id', 'product_state', 'state_ud',
211 'product_active', 'mission_report_id', 'default_code',
212 'international_status_code'],
213 context=self.localcontext)
214
215 read_smrl_result_dict = {}
216 all_product_ids = []
217 for read_smrl in read_smrl_result:
218 read_smrl_result_dict[read_smrl['id']] = read_smrl
219 all_product_ids.append(read_smrl['product_id'][0])
220 del read_smrl_result
221
222 # read all product informations
223 product_result = prod_obj.read(self.cr, self.uid, all_product_ids,
224 ['state', 'state_ud', 'active', 'name_template',
225 'international_status', 'default_code'],
226 context=self.localcontext)
227 product_dict = dict((x['id'], x) for x in product_result)
228
229 # get all product_status
230 prod_status_ids = prod_status_obj.search(self.cr, self.uid, [], context=self.localcontext)
231 prod_status_result = prod_status_obj.read(self.cr, self.uid, prod_status_ids, ['code'], context=self.localcontext)
232 prod_status_dict = dict((x['id'], x['code']) for x in prod_status_result)
233
234 # get all instance id and build a level dict
235 instance_obj = self.pool.get('msf.instance')
236 instance_ids = instance_obj.search(self.cr, self.uid, [])
237 instance_read_result = instance_obj.read(self.cr, self.uid, instance_ids,
238 ['level', 'name'], context=self.localcontext)
239 instance_level_dict = dict((x['id'], x) for x in
240 instance_read_result)
241
242 # get all report id and build a instance dict
243 smr_obj = self.pool.get('stock.mission.report')
244 smr_ids = smr_obj.search(self.cr, self.uid, [])
245 smr_read_result = smr_obj.read(self.cr, self.uid, smr_ids,
246 ['instance_id'], context=self.localcontext)
247 smr_instance_dict = dict((x['id'], x) for x in
248 smr_read_result)
249
250 # get all uf_status codes
251 uf_status_obj = self.pool.get('product.status')
252 uf_status_code_ids = uf_status_obj.search(self.cr, self.uid, [], context=self.localcontext)
253 uf_status_code_read_result = uf_status_obj.read(self.cr, self.uid,
254 uf_status_code_ids, ['code', 'name'], context=self.localcontext)
255 uf_status_code_dict = dict((x['code'], x) for x in
256 uf_status_code_read_result)
257
258 product_result_dict = {}
259 state_ud_dict = {}
260 for product in product_result[0:100]:
261 inconsistent_id_list = []
262 # get the lines matching this product
263 smrl_ids = smrl_obj.search(self.cr, self.uid,
264 [('full_view', '=', False),
265 ('product_id', '=', product['id'])],
266 order='NO_ORDER', context=self.localcontext)
267
268 # get the inconsistent related lines
269 for smrl_id in smrl_ids:
270 smrl = read_smrl_result_dict[smrl_id]
271 product = product_dict[smrl['product_id'][0]]
272 # in product_product state is False when empty
273 # in smrl product_state is '' when empty:
274 if not product['state'] and not smrl['product_state']:
275 pass
276 elif not product['state'] and smrl['product_state']:
277 inconsistent_id_list.append(smrl['id'])
278 continue
279 elif product['state'] and not smrl['product_state']:
280 inconsistent_id_list.append(smrl['id'])
281 continue
282 elif product['state'] and product['state'] in prod_status_dict:
283 state_code = prod_status_dict[product['state'][0]]
284 if state_code != smrl['product_state']:
285 inconsistent_id_list.append(smrl['id'])
286 continue
287
288 if not product['state_ud'] and not smrl['state_ud']:
289 pass
290 elif product['state_ud'] != smrl['state_ud']:
291 inconsistent_id_list.append(smrl['id'])
292 continue
293
294 if product['active'] != smrl['product_active']: # if null in DB smrl.product_active = False ....
295 inconsistent_id_list.append(smrl['id'])
296 continue
297
298 if inconsistent_id_list:
299 product_result_dict[product['id']] = {}
300 current_prod = product_result_dict[product['id']]
301 current_prod['smrl_list'] = []
302 prod_state_ud = ''
303 if product['state_ud']:
304 if product['state_ud'] not in state_ud_dict:
305 product_browse_obj = prod_obj.browse(self.cr, self.uid, product['id'], context=self.localcontext)
306 state_ud_name = self.pool.get('ir.model.fields').get_browse_selection(self.cr, self.uid, product_browse_obj, 'state_ud', self.localcontext)
307 state_ud_dict[product['state_ud']] = state_ud_name
308 prod_state_ud = state_ud_dict[product['state_ud']]
309 current_prod.update({
310 'prod_default_code': product['default_code'],
311 'prod_name_template': product['name_template'],
312 'prod_international_status': product['international_status'] and product['international_status'][1] or '',
313 'prod_state': product['state'] and product['state'][1] or '',
314 'prod_state_ud': prod_state_ud,
315 'prod_active': product['active'],
316 })
317
318 # build the result list dict
319 for smrl_id in inconsistent_id_list:
320 smrl = read_smrl_result_dict[smrl_id]
321 instance_id = smr_instance_dict[smrl['mission_report_id'][0]]['instance_id'][0]
322
323 smrl_dict = {
324 'instance_name': instance_level_dict[instance_id]['name'],
325 'smrl_default_code': smrl['default_code'],
326 'smrl_name_template': product['name_template'],
327 'internationnal_status_code_name': smrl['international_status_code'] and intl_status_code_name.get(smrl['international_status_code'], '') or '',
328 'uf_status_code': smrl['product_state'] and uf_status_code_dict[smrl['product_state']]['name'] or '',
329 'ud_status_code': self.get_ud_status(smrl['state_ud']),
330 'active': smrl['product_active'],
331 'instance_level': instance_level_dict[instance_id]['level'],
332 }
333 product_result_dict[product['id']]['smrl_list'].append(smrl_dict)
334 product_result_dict[product['id']]['smrl_list'].sort(key=lambda smrl: smrl['instance_level'])
335 self.inconsistent[product['id']] = product_result_dict[product['id']]
336
337 if prod_id:
338 return self.inconsistent[prod_id]
339 else:
340 return self.inconsistent
341
342
343 def get_products_with_inconsistencies(self):
344 '''
345 return a browse record list of inconsistent product_product
346 '''
347 if not self.inconsistent:
348 self.inconsistent = self.get_inconsistent_lines()
349
350 prod_ids = self.inconsistent.keys()
351
352 # order product id by default code
353 prod_obj = self.pool.get('product.product')
354 prod_result = prod_obj.read(self.cr, self.uid, prod_ids, ['default_code'], self.localcontext)
355 prod_result.sort(key=lambda prod: prod['default_code'])
356 ordered_ids = [x['id'] for x in prod_result]
357
358 # order self.inconsistent according with this ids
359 final_result = [self.inconsistent[x] for x in ordered_ids]
360 return final_result
361
362
363 def get_uf_status(self, code):
364 '''
365 Return the name of the unifield status with the given code
366 '''
367 if code in self.uf_status_cache:
368 return self.uf_status_cache[code]
369
370 status_obj = self.pool.get('product.status')
371 code_ids = status_obj.search(self.cr, self.uid, [('code', '=', code)], context=self.localcontext)
372 res = ""
373 if code_ids:
374 res = status_obj.read(self.cr, self.uid, code_ids, ['name'])[0]['name']
375
376 self.uf_status_cache[code] = res
377
378 return res
379
380
381 def get_ud_status(self, code):
382 '''
383 Return the name of the unidata status with the given code
384 '''
385 if not code or not isinstance(code, (str, unicode)):
386 return ''
387 return code.capitalize().replace('_', ' ')
388
389
390 def get_product_creator_name_from_code(self, code):
391 '''
392 return the name of the product creator with the given code
393 '''
394 if code in self.prod_creator_cache:
395 return self.prod_creator_cache[code]
396
397 prodstat_obj = self.pool.get('product.international.status')
398 prodstat_ids = prodstat_obj.search(self.cr, self.uid, [('code', '=', code)], context=self.localcontext)
399 if not prodstat_ids:
400 return code
401
402 name = prodstat_obj.read(self.cr, self.uid, prodstat_ids, ['name'], context=self.localcontext)[0]['name']
403 self.prod_creator_cache[code] = name
404
405 return name
406
407
408
409class report_inconsistencies_xls(SpreadsheetReport):
410
411 def __init(self, name, table, rml=False, parser=report_sxw.rml_parse, header='external', store=False):
412 super(report_inconsistencies_xls, self).__init__(
413 name,
414 table,
415 rml=rml,
416 parser=parser,
417 header=header,
418 store=store
419 )
420
421 def create(self, cr, uid, ids, data, context=None):
422 a = super(report_inconsistencies_xls, self).create(cr, uid, ids, data, context=context)
423 return (a[0], 'xls')
424
425
426
427report_inconsistencies_xls(
428 'report.inconsistencies.xls',
429 'export.report.inconsistencies',
430 'addons/msf_tools/report/report_inconsistencies_xls.mako',
431 parser=parser_report_inconsistencies_xls,
432 header='internal',
433)
0434
=== added file 'bin/addons/msf_tools/report/report_inconsistencies_report.xml'
--- bin/addons/msf_tools/report/report_inconsistencies_report.xml 1970-01-01 00:00:00 +0000
+++ bin/addons/msf_tools/report/report_inconsistencies_report.xml 2017-02-03 13:54:39 +0000
@@ -0,0 +1,20 @@
1<?xml version="1.0" encoding="utf-8"?>
2<openerp>
3 <data>
4
5
6 <report
7 id="report_inconsistencies_xls"
8 string="Inconsistencies with HQ"
9 model="export.report.inconsistencies"
10 name="inconsistencies.xls"
11 file="msf_tools/report/report_inconsistencies_xls.mako"
12 report_type="webkit"
13 header="False"
14 auto="False"
15 menu="False"
16 />
17
18
19 </data>
20</openerp>
0\ No newline at end of file21\ No newline at end of file
122
=== added file 'bin/addons/msf_tools/report/report_inconsistencies_view.xml'
--- bin/addons/msf_tools/report/report_inconsistencies_view.xml 1970-01-01 00:00:00 +0000
+++ bin/addons/msf_tools/report/report_inconsistencies_view.xml 2017-02-03 13:54:39 +0000
@@ -0,0 +1,92 @@
1<?xml version="1.0" encoding="utf-8"?>
2<openerp>
3 <data>
4
5
6 <record id="export_report_inconsistencies_form_view" model="ir.ui.view">
7 <field name="name">export.report.inconsistencies.form.view</field>
8 <field name="model">export.report.inconsistencies</field>
9 <field name="type">form</field>
10 <field name="arch" type="xml">
11 <form string="Export inconsistencies">
12 <separator colspan="4" string="Request information" />
13 <field name="name" />
14 <field name="state" />
15 <button name="generate_report" type="object" string="Generate report"
16 icon="gtk-execute" states='draft' />
17 </form>
18 </field>
19 </record>
20
21
22 <record id="export_report_inconsistencies_tree_view" model="ir.ui.view">
23 <field name="name">export.report.inconsistencies.tree.view</field>
24 <field name="model">export.report.inconsistencies</field>
25 <field name="type">tree</field>
26 <field name="arch" type="xml">
27 <tree string="Export inconsistencies">
28 <field name="name" />
29 <field name="state" />
30 </tree>
31 </field>
32 </record>
33
34
35 <record id="report_inconsistencies_search_view" model="ir.ui.view">
36 <field name="name">export.report.inconsistencies.search.view</field>
37 <field name="model">export.report.inconsistencies</field> <!-- _name of openERP object -->
38 <field name="type">search</field>
39 <field name="arch" type="xml">
40 <search string="Export inconsistencies">
41 <field name="name" />
42 <field name="state" />
43 </search>
44 </field>
45 </record>
46
47
48 <record id="report_inconsistencies_info_view" model="ir.ui.view">
49 <field name="name">export.report.inconsistencies.info.view</field>
50 <field name="model">export.report.inconsistencies</field>
51 <field name="type">form</field>
52 <field name="priority" eval="99" />
53 <field name="arch" type="xml">
54 <form string="Status of the report" hide_new_button="1" hide_delete_button="1">
55 <label> </label>
56 <group colspan="2" col="2">
57 <html>
58 <div style="align: center">
59 <p style="font-size:14px;align:center">
60 Your export inconsistent products demand will be treated quickly.<br />
61 </p>
62 <p style="font-size:14px;align:center">
63 Due to the volume of data, your report cannot be shown immediatly.<br />
64 </p>
65 <p style="font-size:14px;align:center">
66 When the report will be ready, you can access to it by the menu Tools / Inconsistencies report<br />
67 </p>
68 </div>
69 </html>
70 </group>
71 <label> </label>
72 </form>
73 </field>
74 </record>
75
76
77 <record id="export_report_inconsistencies_action" model="ir.actions.act_window">
78 <field name="name">Product Status Inconsistencies</field>
79 <field name="res_model">export.report.inconsistencies</field>
80 <field name="view_type">form</field>
81 <field name="view_mode">tree,form</field>
82 </record>
83
84
85 <menuitem
86 id="export_report_inconsistencies_menu"
87 action="export_report_inconsistencies_action"
88 parent="object_query.menu_preferences"
89 sequence="51" />
90
91 </data>
92</openerp>
093
=== added file 'bin/addons/msf_tools/report/report_inconsistencies_xls.mako'
--- bin/addons/msf_tools/report/report_inconsistencies_xls.mako 1970-01-01 00:00:00 +0000
+++ bin/addons/msf_tools/report/report_inconsistencies_xls.mako 2017-02-03 13:54:39 +0000
@@ -0,0 +1,139 @@
1<?xml version="1.0"?>
2<?mso-application progid="Excel.Sheet"?>
3<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
4 xmlns:o="urn:schemas-microsoft-com:office:office"
5 xmlns:x="urn:schemas-microsoft-com:office:excel"
6 xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
7 xmlns:html="http://www.w3.org/TR/REC-html40">
8 <DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
9 <Author>MSFUser</Author>
10 <LastAuthor>MSFUser</LastAuthor>
11 <Created>2012-06-18T15:46:09Z</Created>
12 <Company>Medecins Sans Frontieres</Company>
13 <Version>11.9999</Version>
14</DocumentProperties>
15<ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
16 <WindowHeight>13170</WindowHeight>
17 <WindowWidth>19020</WindowWidth>
18 <WindowTopX>120</WindowTopX>
19 <WindowTopY>60</WindowTopY>
20 <ProtectStructure>False</ProtectStructure>
21 <ProtectWindows>False</ProtectWindows>
22</ExcelWorkbook>
23
24<Styles>
25 <Style ss:ID="tab_header_orange">
26 <Alignment ss:Horizontal="Center" ss:Vertical="Center" ss:WrapText="1"/>
27 <Interior ss:Color="#ffcc99" ss:Pattern="Solid"/>
28 <Borders>
29 <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1" />
30 <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1" />
31 <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1" />
32 <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1" />
33 </Borders>
34 </Style>
35 <Style ss:ID="tab_header_gray">
36 <Alignment ss:Horizontal="Center" ss:Vertical="Center" ss:WrapText="1"/>
37 <Interior ss:Color="#dbdbdb" ss:Pattern="Solid"/>
38 <Borders>
39 <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1" />
40 <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1" />
41 <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1" />
42 <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1" />
43 </Borders>
44 </Style>
45 <Style ss:ID="tab_content">
46 <Alignment ss:Horizontal="Center" ss:Vertical="Center" ss:WrapText="1"/>
47 <Borders>
48 <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1" />
49 <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1" />
50 <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1" />
51 <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1" />
52 </Borders>
53 </Style>
54</Styles>
55
56
57<ss:Worksheet ss:Name="Stopped products">
58
59 <Table x:FullColumns="1" x:FullRows="1">
60
61 <Columns ss:AutoFitWidth="1" ss:Width="90" /> # instance
62 <Columns ss:AutoFitWidth="1" ss:Width="90" /> # code
63 <Columns ss:AutoFitWidth="1" ss:Width="200" /> # product description
64 <Columns ss:AutoFitWidth="1" ss:Width="90" /> # product creator
65 <Columns ss:AutoFitWidth="1" ss:Width="90" /> # unifield status
66 <Columns ss:AutoFitWidth="1" ss:Width="90" /> # unidata status
67 <Columns ss:AutoFitWidth="1" ss:Width="90" /> # active
68
69 ##### Table with all stopped products #####
70
71 % if not get_inconsistent_lines():
72 <Row ss:AutoFitHeight="1">
73 <Cell ss:StyleID="tab_content"><Data ss:Type="String"></Data></Cell>
74 <Cell ss:StyleID="tab_content"><Data ss:Type="String"></Data></Cell>
75 <Cell ss:StyleID="tab_content"><Data ss:Type="String">${_('There is no inconsistencies to report')|x}</Data></Cell>
76 </Row>
77 % else:
78 <Row ss:AutoFitHeight="1">
79 <Cell ss:StyleID="tab_header_orange"><Data ss:Type="String">${_('Instance')|x}</Data></Cell>
80 <Cell ss:StyleID="tab_header_orange"><Data ss:Type="String">${_('Code')|x}</Data></Cell>
81 <Cell ss:StyleID="tab_header_orange"><Data ss:Type="String">${_('Description')|x}</Data></Cell>
82 <Cell ss:StyleID="tab_header_orange"><Data ss:Type="String">${_('Product Creator')|x}</Data></Cell>
83 <Cell ss:StyleID="tab_header_orange"><Data ss:Type="String">${_('UniField Status')|x}</Data></Cell>
84 <Cell ss:StyleID="tab_header_orange"><Data ss:Type="String">${_('Unidata Status')|x}</Data></Cell>
85 <Cell ss:StyleID="tab_header_orange"><Data ss:Type="String">${_('Active/Inactive')|x}</Data></Cell>
86 </Row>
87 % for prod in get_products_with_inconsistencies():
88 # HQ data:
89 <Row ss:AutoFitHeight="1">
90 <Cell ss:StyleID="tab_header_gray"><Data ss:Type="String">${_('HQ')|x}</Data></Cell>
91 <Cell ss:StyleID="tab_header_gray"><Data ss:Type="String">${(prod['prod_default_code'])|x}</Data></Cell>
92 <Cell ss:StyleID="tab_header_gray"><Data ss:Type="String">${(prod['prod_name_template'])|x}</Data></Cell>
93 <Cell ss:StyleID="tab_header_gray"><Data ss:Type="String">${(prod['prod_international_status'] or '')|x}</Data></Cell>
94 <Cell ss:StyleID="tab_header_gray"><Data ss:Type="String">${(prod['prod_state'] or '')|x}</Data></Cell>
95 <Cell ss:StyleID="tab_header_gray"><Data ss:Type="String">${(prod['prod_state_ud'] or '')|x}</Data></Cell>
96 <Cell ss:StyleID="tab_header_gray"><Data ss:Type="String">${(_('Active') if prod['prod_active'] else _('Inactive'))|x}</Data></Cell>
97 </Row>
98 % for smrl in prod['smrl_list']:
99 <Row ss:AutoFitHeight="1">
100 <Cell ss:StyleID="tab_content"><Data ss:Type="String">${(smrl['instance_name'])|x}</Data></Cell>
101 <Cell ss:StyleID="tab_content"><Data ss:Type="String">${(smrl['smrl_default_code'])|x}</Data></Cell>
102 <Cell ss:StyleID="tab_content"><Data ss:Type="String">${(smrl['smrl_name_template'])|x}</Data></Cell>
103 <Cell ss:StyleID="tab_content"><Data ss:Type="String">${(smrl['internationnal_status_code_name'] or '')|x}</Data></Cell>
104 <Cell ss:StyleID="tab_content"><Data ss:Type="String">${(smrl['uf_status_code'])|x}</Data></Cell>
105 <Cell ss:StyleID="tab_content"><Data ss:Type="String">${(smrl['ud_status_code'] or '')|x}</Data></Cell>
106 <Cell ss:StyleID="tab_content"><Data ss:Type="String">${(_('Active') if smrl['active'] else _('Inactive'))|x}</Data></Cell>
107 </Row>
108 % endfor
109 % endfor
110 % endif
111
112
113 </Table>
114
115 <WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
116 <PageSetup>
117 <Layout x:Orientation="Landscape"/>
118 <Header x:Data="&amp;C&amp;&quot;Arial,Bold&quot;&amp;14"/>
119 <Footer x:Data="Page &amp;P of &amp;N"/>
120 </PageSetup>
121 <Print>
122 <ValidPrinterInfo/>
123 <PaperSizeIndex>9</PaperSizeIndex>
124 <HorizontalResolution>600</HorizontalResolution>
125 <VerticalResolution>600</VerticalResolution>
126 </Print>
127 <Selected/>
128 <Panes>
129 <Pane>
130 <Number>3</Number>
131 <ActiveRow>17</ActiveRow>
132 </Pane>
133 </Panes>
134 <ProtectObjects>False</ProtectObjects>
135 <ProtectScenarios>False</ProtectScenarios>
136</WorksheetOptions>
137</ss:Worksheet>
138
139</Workbook>
0140
=== modified file 'bin/addons/product_attributes/product_attributes.py'
--- bin/addons/product_attributes/product_attributes.py 2017-01-17 13:31:02 +0000
+++ bin/addons/product_attributes/product_attributes.py 2017-02-03 13:54:39 +0000
@@ -1294,6 +1294,7 @@
1294 return True1294 return True
1295 smrl_obj = self.pool.get('stock.mission.report.line')1295 smrl_obj = self.pool.get('stock.mission.report.line')
1296 prod_status_obj = self.pool.get('product.status')1296 prod_status_obj = self.pool.get('product.status')
1297 int_stat_obj = self.pool.get('product.international.status')
12971298
1298 if context is None:1299 if context is None:
1299 context = {}1300 context = {}
@@ -1335,6 +1336,33 @@
1335 if local_smrl_ids:1336 if local_smrl_ids:
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)
13371338
1339 if 'international_status' in vals:
1340 intstat_code = ''
1341 if vals['international_status']:
1342 intstat_id = vals['international_status']
1343 if isinstance(intstat_id, (int,long)):
1344 intstat_id = [intstat_id]
1345 intstat_code = int_stat_obj.read(cr, uid, intstat_id, ['code'], context=context)[0]['code']
1346 # just update SMRL that belongs to our instance:
1347 local_smrl_ids = smrl_obj.search(cr, uid, [
1348 ('international_status_code', '!=', intstat_code),
1349 ('product_id', 'in', ids),
1350 ('full_view', '=', False),
1351 ('mission_report_id.local_report', '=', True)
1352 ], context=context)
1353 if local_smrl_ids:
1354 smrl_obj.write(cr, uid, local_smrl_ids, {'international_status_code': intstat_code or ''}, context=context)
1355
1356 if 'state_ud' in vals:
1357 # just update SMRL that belongs to our instance:
1358 local_smrl_ids = smrl_obj.search(cr, uid, [
1359 ('product_id', 'in', ids),
1360 ('full_view', '=', False),
1361 ('mission_report_id.local_report', '=', True)
1362 ], context=context)
1363 if local_smrl_ids:
1364 smrl_obj.write(cr, uid, local_smrl_ids, {'state_ud': vals['state_ud'] or ''}, context=context)
1365
1338 product_uom_categ = []1366 product_uom_categ = []
1339 if 'uom_id' in vals or 'uom_po_id' in vals:1367 if 'uom_id' in vals or 'uom_po_id' in vals:
1340 if isinstance(ids, (int, long)):1368 if isinstance(ids, (int, long)):
@@ -1368,6 +1396,15 @@
1368 # 'state': phase_out_status,1396 # 'state': phase_out_status,
1369 })1397 })
13701398
1399 if 'active' in vals:
1400 local_smrl_ids = smrl_obj.search(cr, uid, [
1401 ('product_id', 'in', ids),
1402 ('full_view', '=', False),
1403 ('mission_report_id.local_report', '=', True)
1404 ], context=context)
1405 if local_smrl_ids:
1406 smrl_obj.write(cr, uid, local_smrl_ids, {'product_active': vals['active']}, context=context)
1407
1371 if 'narcotic' in vals or 'controlled_substance' in vals:1408 if 'narcotic' in vals or 'controlled_substance' in vals:
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':
1373 vals['controlled_substance'] = 'True'1410 vals['controlled_substance'] = 'True'
@@ -1389,6 +1426,7 @@
13891426
1390 return res1427 return res
13911428
1429
1392 def reactivate_product(self, cr, uid, ids, context=None):1430 def reactivate_product(self, cr, uid, ids, context=None):
1393 '''1431 '''
1394 Re-activate product.1432 Re-activate product.

Subscribers

People subscribed via source and target branches

to all changes: