Merge lp:~julie-w/unifield-server/US-6557 into lp:unifield-server

Proposed by jftempo
Status: Merged
Merged at revision: 5602
Proposed branch: lp:~julie-w/unifield-server/US-6557
Merge into: lp:unifield-server
Diff against target: 973 lines (+598/-186) (has conflicts)
8 files modified
bin/addons/account/account_invoice_view.xml (+42/-0)
bin/addons/account_override/account_invoice_view.xml (+14/-0)
bin/addons/account_override/period.py (+19/-0)
bin/addons/msf_profile/data/patches.xml (+21/-0)
bin/addons/msf_profile/i18n/fr_MF.po (+104/-0)
bin/addons/msf_profile/msf_profile.py (+298/-148)
bin/addons/vertical_integration/report/hq_report_ocb.py (+85/-38)
bin/addons/vertical_integration/vertical_integration_wizard.xml (+15/-0)
Text conflict in bin/addons/account/account_invoice_view.xml
Text conflict in bin/addons/account_override/account_invoice_view.xml
Text conflict in bin/addons/msf_profile/data/patches.xml
Text conflict in bin/addons/msf_profile/i18n/fr_MF.po
Text conflict in bin/addons/msf_profile/msf_profile.py
To merge this branch: bzr merge lp:~julie-w/unifield-server/US-6557
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+378504@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/account/account_invoice_view.xml'
--- bin/addons/account/account_invoice_view.xml 2020-01-21 14:01:11 +0000
+++ bin/addons/account/account_invoice_view.xml 2020-02-04 10:20:45 +0000
@@ -358,6 +358,7 @@
358 ('from_supply', '=', True),358 ('from_supply', '=', True),
359 ('partner_type', 'in', ('intermission', 'section'))]}"/>359 ('partner_type', 'in', ('intermission', 'section'))]}"/>
360 <field name="payment_term" widget="selection"/>360 <field name="payment_term" widget="selection"/>
361<<<<<<< TREE
361 <field colspan="4" name="invoice_line" nolabel="1" context="{'fake': 1, 'from_inv_form': True}">362 <field colspan="4" name="invoice_line" nolabel="1" context="{'fake': 1, 'from_inv_form': True}">
362 <tree string="Invoice Line"363 <tree string="Invoice Line"
363 colors="red:inactive_product == True or analytic_distribution_state in ('invalid', 'invalid_small_amount');blue:inactive_product == False and analytic_distribution_state in ('valid');black:inactive_product == False and analytic_distribution_state in ('none')"364 colors="red:inactive_product == True or analytic_distribution_state in ('invalid', 'invalid_small_amount');blue:inactive_product == False and analytic_distribution_state in ('valid');black:inactive_product == False and analytic_distribution_state in ('none')"
@@ -397,6 +398,47 @@
397 <field name="price_subtotal"/>398 <field name="price_subtotal"/>
398 </tree>399 </tree>
399 </field>400 </field>
401=======
402 <field colspan="4" name="invoice_line" nolabel="1" context="{'fake': 1, 'from_inv_form': True}">
403 <tree string="Invoice Line"
404 colors="red:inactive_product == True or analytic_distribution_state in ('invalid');blue:inactive_product == False and analytic_distribution_state in ('valid');black:inactive_product == False and analytic_distribution_state in ('none')"
405 editable="both">
406 <field name="invoice_type" invisible="1"/>
407 <field name="line_synced" invisible="1"/>
408 <field name="from_supply" invisible="1"/>
409 <field name="partner_type" invisible="1"/>
410 <field name="line_number" displayon="noteditable"/>
411 <field name="is_corrected" invisible="1"/>
412 <button name="button_open_analytic_lines" string="Have been corrected" type="object"
413 icon="terp-mail-" attrs="{'invisible': [('is_corrected', '=', False)]}"/>
414 <field name="name"/>
415 <field name="inactive_product" invisible="1"/>
416 <field name="account_id"
417 domain="[('journal_id', '=', parent.journal_id), ('restricted_area', '=', 'invoice_lines')]"
418 context="{'type': parent.type, 'journal_type': parent.journal_type}"
419 />
420 <button name="button_analytic_distribution" string="Analytical Distribution" type="object"
421 icon="terp-stock_symbol-selection" context="context"
422 attrs="{'invisible': [('is_allocatable', '=', False)]}"/>
423 <field name="analytic_distribution_state_recap" readonly="1"/>
424 <field name="analytic_distribution_state" invisible="1"/>
425 <field name="is_allocatable" invisible="1"/>
426 <field name="quantity"
427 attrs="{'readonly': ['|',
428 '&amp;', ('invoice_type', '=', 'in_invoice'), '|', ('line_synced', '=', True), ('from_supply', '=', True),
429 '&amp;', '&amp;', ('invoice_type', '=', 'out_invoice'), ('from_supply', '=', True), ('partner_type', 'in', ('intermission', 'section'))]}"/>
430 <field name="product_id" invisible="1"/>
431 <field name="uos_id" string="UoM"
432 on_change="uos_id_change(product_id, uos_id, quantity, name, parent.type, parent.partner_id, parent.fiscal_position, price_unit, parent.address_invoice_id, parent.currency_id, {'company_id': parent.company_id})"
433 attrs="{'readonly': ['|',
434 '&amp;', ('invoice_type', '=', 'in_invoice'), '|', ('line_synced', '=', True), ('from_supply', '=', True),
435 '&amp;', '&amp;', ('invoice_type', '=', 'out_invoice'), ('from_supply', '=', True), ('partner_type', 'in', ('intermission', 'section'))]}"/>
436 <field name="price_unit"
437 attrs="{'readonly': [('invoice_type', '=', 'in_invoice'), ('line_synced', '=', True)]}"/>
438 <field name="price_subtotal"/>
439 </tree>
440 </field>
441>>>>>>> MERGE-SOURCE
400 <group col="1" colspan="2">442 <group col="1" colspan="2">
401 <field name="tax_line" nolabel="1">443 <field name="tax_line" nolabel="1">
402 <tree editable="bottom" string="Taxes">444 <tree editable="bottom" string="Taxes">
403445
=== modified file 'bin/addons/account_corrections/wizard/analytic_distribution_wizard.py'
=== modified file 'bin/addons/account_override/account_invoice_view.xml'
--- bin/addons/account_override/account_invoice_view.xml 2020-01-21 14:01:11 +0000
+++ bin/addons/account_override/account_invoice_view.xml 2020-02-04 10:20:45 +0000
@@ -390,9 +390,14 @@
390 <label string="" colspan="2"/>390 <label string="" colspan="2"/>
391 <field name="check_total" required="2"/>391 <field name="check_total" required="2"/>
392 <field colspan="4" name="invoice_line" nolabel="1" widget="one2many_list">392 <field colspan="4" name="invoice_line" nolabel="1" widget="one2many_list">
393<<<<<<< TREE
393 <tree string="Donation Lines" editable="both"394 <tree string="Donation Lines" editable="both"
394 colors="red:analytic_distribution_state in ('invalid', 'invalid_small_amount') or inactive_product == True;black:analytic_distribution_state in ('none','valid') and inactive_product == False">395 colors="red:analytic_distribution_state in ('invalid', 'invalid_small_amount') or inactive_product == True;black:analytic_distribution_state in ('none','valid') and inactive_product == False">
395 <field name="line_number" readonly="1" displayon="noteditable"/>396 <field name="line_number" readonly="1" displayon="noteditable"/>
397=======
398 <tree string="Donation Lines" editable="both">
399 <field name="line_number" readonly="1" displayon="noteditable"/>
400>>>>>>> MERGE-SOURCE
396 <field name="is_corrected" invisible="1"/>401 <field name="is_corrected" invisible="1"/>
397 <button name="button_open_analytic_lines" string="Have been corrected" type="object" icon="terp-mail-" attrs="{'invisible': [('is_corrected', '=', False)]}"/>402 <button name="button_open_analytic_lines" string="Have been corrected" type="object" icon="terp-mail-" attrs="{'invisible': [('is_corrected', '=', False)]}"/>
398 <field name="product_id"403 <field name="product_id"
@@ -533,12 +538,21 @@
533 </group>538 </group>
534 <field colspan="4" name="invoice_line" nolabel="1" widget="one2many_list" context="{'is_intermission': True, 'from_inv_form': True}">539 <field colspan="4" name="invoice_line" nolabel="1" widget="one2many_list" context="{'is_intermission': True, 'from_inv_form': True}">
535 <tree string="Intermission Voucher Lines"540 <tree string="Intermission Voucher Lines"
541<<<<<<< TREE
536 editable="both"542 editable="both"
537 colors="red:analytic_distribution_state in ('invalid', 'invalid_small_amount') or inactive_product == True;black:inactive_product == False and analytic_distribution_state in ('none', 'valid')">543 colors="red:analytic_distribution_state in ('invalid', 'invalid_small_amount') or inactive_product == True;black:inactive_product == False and analytic_distribution_state in ('none', 'valid')">
538 <field name="from_supply" invisible="1"/>544 <field name="from_supply" invisible="1"/>
539 <field name="line_synced" invisible="1"/>545 <field name="line_synced" invisible="1"/>
540 <field name="invoice_type" invisible="1"/>546 <field name="invoice_type" invisible="1"/>
541 <field name="line_number" displayon="noteditable"/>547 <field name="line_number" displayon="noteditable"/>
548=======
549 editable="both"
550 colors="red:analytic_distribution_state == 'invalid' or inactive_product == True;black:inactive_product == False and analytic_distribution_state in ('none', 'valid')">
551 <field name="from_supply" invisible="1"/>
552 <field name="line_synced" invisible="1"/>
553 <field name="invoice_type" invisible="1"/>
554 <field name="line_number" displayon="noteditable"/>
555>>>>>>> MERGE-SOURCE
542 <field name="is_corrected" invisible="1"/>556 <field name="is_corrected" invisible="1"/>
543 <button name="button_open_analytic_lines" string="Have been corrected" type="object" icon="terp-mail-" attrs="{'invisible': [('is_corrected', '=', False)]}"/>557 <button name="button_open_analytic_lines" string="Have been corrected" type="object" icon="terp-mail-" attrs="{'invisible': [('is_corrected', '=', False)]}"/>
544 <field name="name"/>558 <field name="name"/>
545559
=== modified file 'bin/addons/account_override/period.py'
--- bin/addons/account_override/period.py 2018-11-08 09:39:41 +0000
+++ bin/addons/account_override/period.py 2020-02-04 10:20:45 +0000
@@ -103,6 +103,22 @@
103 period_id = period_id and get_next_period_id(self, cr, uid, period_id, context=context)103 period_id = period_id and get_next_period_id(self, cr, uid, period_id, context=context)
104 return period_id or False104 return period_id or False
105105
106
107def get_previous_period_id(self, cr, uid, period_id, context=None):
108 """
109 Returns the id of the previous regular period if it exists (no special period), else returns False.
110 For the special periods, its returns the related regular period (Period 13 to 16 N ==> Dec. N).
111 """
112 if context is None:
113 context = {}
114 period = self.browse(cr, uid, period_id, fields_to_fetch=['date_start'], context=context)
115 previous_period_ids = self.search(cr, uid, [('date_start', '<=', period.date_start),
116 ('special', '=', False),
117 ('id', '!=', period_id)],
118 order='date_start DESC', limit=1, context=context)
119 return previous_period_ids and previous_period_ids[0] or False
120
121
106def _get_middle_years(self, cr, uid, fy1, fy2, context=None):122def _get_middle_years(self, cr, uid, fy1, fy2, context=None):
107 """123 """
108 Returns the list of the FY ids included between both Fiscal Years in parameter.124 Returns the list of the FY ids included between both Fiscal Years in parameter.
@@ -189,6 +205,9 @@
189 def get_next_period_id_at_index(self, cr, uid, period_id, index, context=None):205 def get_next_period_id_at_index(self, cr, uid, period_id, index, context=None):
190 return get_next_period_id_at_index(self, cr, uid, period_id, index, context)206 return get_next_period_id_at_index(self, cr, uid, period_id, index, context)
191207
208 def get_previous_period_id(self, cr, uid, period_id, context=None):
209 return get_previous_period_id(self, cr, uid, period_id, context)
210
192 def get_period_range(self, cr, uid, period_from_id, period_to_id, context=None):211 def get_period_range(self, cr, uid, period_from_id, period_to_id, context=None):
193 return get_period_range(self, cr, uid, period_from_id, period_to_id, context=context)212 return get_period_range(self, cr, uid, period_from_id, period_to_id, context=context)
194213
195214
=== modified file 'bin/addons/analytic_distribution/analytic_distribution_wizard_view.xml'
=== modified file 'bin/addons/analytic_distribution/wizard/analytic_distribution_wizard.py'
=== modified file 'bin/addons/msf_profile/data/patches.xml'
--- bin/addons/msf_profile/data/patches.xml 2020-01-28 10:17:39 +0000
+++ bin/addons/msf_profile/data/patches.xml 2020-02-04 10:20:45 +0000
@@ -477,6 +477,7 @@
477 <field name="method">us_6768_trigger_FP_sync</field>477 <field name="method">us_6768_trigger_FP_sync</field>
478 </record>478 </record>
479479
480<<<<<<< TREE
480 <!-- UF15.1 -->481 <!-- UF15.1 -->
481 <record id="us_6930_gen_unreconcile" model="patch.scripts">482 <record id="us_6930_gen_unreconcile" model="patch.scripts">
482 <field name="method">us_6930_gen_unreconcile</field>483 <field name="method">us_6930_gen_unreconcile</field>
@@ -496,5 +497,25 @@
496 <field name="method">us_6692_new_od_journals</field>497 <field name="method">us_6692_new_od_journals</field>
497 </record>498 </record>
498499
500=======
501 <!-- UF15.1 -->
502 <record id="us_6930_gen_unreconcile" model="patch.scripts">
503 <field name="method">us_6930_gen_unreconcile</field>
504 </record>
505
506 <record id="us_6905_manage_bned_switch" model="patch.scripts">
507 <field name="method">us_6905_manage_bned_switch</field>
508 </record>
509
510 <record id="rec_entries_uf14_1_uf15" model="patch.scripts">
511 <field name="method">rec_entries_uf14_1_uf15</field>
512 </record>
513
514 <!-- UF16.0 -->
515 <record id="us_6692_new_od_journals" model="patch.scripts">
516 <field name="method">us_6692_new_od_journals</field>
517 </record>
518
519>>>>>>> MERGE-SOURCE
499 </data>520 </data>
500</openerp>521</openerp>
501522
=== modified file 'bin/addons/msf_profile/i18n/fr_MF.po'
--- bin/addons/msf_profile/i18n/fr_MF.po 2020-01-28 11:28:56 +0000
+++ bin/addons/msf_profile/i18n/fr_MF.po 2020-02-04 10:20:45 +0000
@@ -106598,6 +106598,7 @@
106598msgid "Funding Pool not found."106598msgid "Funding Pool not found."
106599msgstr "Funding Pool non trouvé."106599msgstr "Funding Pool non trouvé."
106600106600
106601<<<<<<< TREE
106601#. modules: account_override, account, register_accounting, msf_instance, finance106602#. modules: account_override, account, register_accounting, msf_instance, finance
106602#: selection:account.analytic.journal,type:0106603#: selection:account.analytic.journal,type:0
106603#: selection:account.journal,type:0106604#: selection:account.journal,type:0
@@ -106732,3 +106733,106 @@
106732#: view:analytic.distribution.wizard:0106733#: view:analytic.distribution.wizard:0
106733msgid "Make sure that there is only one Analytic Distribution line for the entries having a booking amount inferior or equal to 1."106734msgid "Make sure that there is only one Analytic Distribution line for the entries having a booking amount inferior or equal to 1."
106734msgstr "Assurez-vous de n'avoir qu'une seule ligne de Distribution Analytique pour les écritures ayant un montant d'enregistrement inférieur ou égal à 1."106735msgstr "Assurez-vous de n'avoir qu'une seule ligne de Distribution Analytique pour les écritures ayant un montant d'enregistrement inférieur ou égal à 1."
106736=======
106737#. modules: account_override, account, register_accounting, msf_instance, finance
106738#: selection:account.analytic.journal,type:0
106739#: selection:account.journal,type:0
106740#: selection:account.analytic.line,journal_type:0
106741#: selection:account.move,journal_type:0
106742#: selection:account.move.line,journal_type:0
106743#: selection:cash.request.liquidity,type:0
106744#: selection:cash.request.liquidity.bank,type:0
106745#: selection:cash.request.liquidity.cash,type:0
106746#: selection:cash.request.liquidity.cheque,type:0
106747#: selection:account.analytic.journal.fake,type:0
106748#: selection:account.journal.fake,type:0
106749#: selection:wizard.register.opening.confirmation,register_type:0
106750msgid "Correction Auto"
106751msgstr "Correction Auto"
106752
106753#. modules: account_override, account, register_accounting, msf_instance, finance
106754#: selection:account.analytic.journal,type:0
106755#: selection:account.journal,type:0
106756#: selection:account.analytic.line,journal_type:0
106757#: selection:account.move,journal_type:0
106758#: selection:account.move.line,journal_type:0
106759#: selection:cash.request.liquidity,type:0
106760#: selection:cash.request.liquidity.bank,type:0
106761#: selection:cash.request.liquidity.cash,type:0
106762#: selection:cash.request.liquidity.cheque,type:0
106763#: selection:account.analytic.journal.fake,type:0
106764#: selection:account.journal.fake,type:0
106765#: selection:wizard.register.opening.confirmation,register_type:0
106766msgid "Correction Manual"
106767msgstr "Correction Manuelle"
106768
106769#. modules: account_override, account, register_accounting, msf_instance, finance
106770#: selection:account.analytic.journal,type:0
106771#: selection:account.journal,type:0
106772#: selection:account.analytic.line,journal_type:0
106773#: selection:account.move,journal_type:0
106774#: selection:account.move.line,journal_type:0
106775#: selection:cash.request.liquidity,type:0
106776#: selection:cash.request.liquidity.bank,type:0
106777#: selection:cash.request.liquidity.cash,type:0
106778#: selection:cash.request.liquidity.cheque,type:0
106779#: selection:account.analytic.journal.fake,type:0
106780#: selection:account.journal.fake,type:0
106781#: selection:wizard.register.opening.confirmation,register_type:0
106782msgid "Correction HQ"
106783msgstr "Correction HQ"
106784
106785#. module: account_journal
106786#: constraint:account.journal:0
106787msgid "The analytic journal selected must have the same type and prop. instance as this journal."
106788msgstr "Le journal analytique sélectionné doit avoir le même type et la même instance prop. que ce journal."
106789
106790#. module: account_journal
106791#: constraint:account.journal:0
106792msgid "A journal with this type already exists for this instance."
106793msgstr "Un journal de ce type existe déjà pour cette instance."
106794
106795#. module: account
106796#: constraint:account.analytic.journal:0
106797msgid "An analytic journal with this type already exists for this instance."
106798msgstr "Un journal analytique de ce type existe déjà pour cette instance."
106799
106800#. module: account_journal
106801#: constraint:account.journal:0
106802msgid "The prop. instance of the \"Correction HQ\" journal must be a coordination."
106803msgstr "L'instance prop. du journal de type \"Correction HQ\" doit être une coordination."
106804
106805#. module: account
106806#: constraint:account.analytic.journal:0
106807msgid "The prop. instance of the \"Correction HQ\" analytic journal must be a coordination."
106808msgstr "L'instance prop. du journal analytique de type \"Correction HQ\" doit être une coordination."
106809
106810#. module: account_override
106811#: code:addons/account_override/account.py:1198
106812#, python-format
106813msgid "The journal %s is forbidden in manual entries."
106814msgstr "Le journal %s est interdit dans les écritures manuelles."
106815
106816#. modules: account_hq_entries, account_corrections, analytic_distribution
106817#: code:addons/account_hq_entries/wizard/hq_entries_validation.py:269
106818#: code:addons/account_hq_entries/wizard/hq_entries_validation.py:568
106819#: code:addons/account_corrections/account_move_line.py:731
106820#: code:addons/analytic_distribution/analytic_line.py:354
106821#, python-format
106822msgid "No \"correction HQ\" journal found!"
106823msgstr "Aucun journal de type \"correction HQ\" n'a été trouvé !"
106824
106825#. modules: account_hq_entries, analytic_distribution
106826#: code:addons/account_hq_entries/wizard/hq_entries_validation.py:350
106827#: code:addons/account_hq_entries/wizard/hq_entries_validation.py:531
106828#: code:addons/analytic_distribution/analytic_line.py:359
106829#, python-format
106830msgid "No \"correction HQ\" analytic journal found!"
106831msgstr "Aucun journal analytique de type \"correction HQ\" n'a été trouvé !"
106832
106833#. module: vertical_integration
106834#: model:ir.actions.act_window,name:vertical_integration.action_hq_export_ocb_old
106835#: model:ir.ui.menu,name:vertical_integration.menu_action_hq_export_ocb_old
106836msgid "Export to HQ system (OCB) Access Interface"
106837msgstr "Interface d'accès de l'Export vers le système HQ (OCB)"
106838>>>>>>> MERGE-SOURCE
106735106839
=== modified file 'bin/addons/msf_profile/msf_profile.py'
--- bin/addons/msf_profile/msf_profile.py 2020-01-28 10:17:39 +0000
+++ bin/addons/msf_profile/msf_profile.py 2020-02-04 10:20:45 +0000
@@ -52,154 +52,304 @@
52 'model': lambda *a: 'patch.scripts',52 'model': lambda *a: 'patch.scripts',
53 }53 }
5454
55 # UF16.055<<<<<<< TREE
56 def us_6692_new_od_journals(self, cr, uid, *a, **b):56 # UF16.0
57 """57 def us_6692_new_od_journals(self, cr, uid, *a, **b):
58 1. Change the type of the existing correction journals (except OD) to "Correction Manual" so they remain usable58 """
5959 1. Change the type of the existing correction journals (except OD) to "Correction Manual" so they remain usable
60 2. Create:60
61 - ODM journals in all existing instances61 2. Create:
62 - ODHQ journals in existing coordo instances62 - ODM journals in all existing instances
6363 - ODHQ journals in existing coordo instances
64 Notes:64
65 - creations are done in Python as the objects created must sync normally65 Notes:
66 - none of these journals already exists in prod. DB.66 - creations are done in Python as the objects created must sync normally
67 """67 - none of these journals already exists in prod. DB.
68 user_obj = self.pool.get('res.users')68 """
69 analytic_journal_obj = self.pool.get('account.analytic.journal')69 user_obj = self.pool.get('res.users')
70 journal_obj = self.pool.get('account.journal')70 analytic_journal_obj = self.pool.get('account.analytic.journal')
71 current_instance = user_obj.browse(cr, uid, uid, fields_to_fetch=['company_id']).company_id.instance_id71 journal_obj = self.pool.get('account.journal')
72 if current_instance: # existing instances only72 current_instance = user_obj.browse(cr, uid, uid, fields_to_fetch=['company_id']).company_id.instance_id
73 # existing correction journals73 if current_instance: # existing instances only
74 cr.execute("""74 # existing correction journals
75 UPDATE account_analytic_journal75 cr.execute("""
76 SET type = 'correction_manual'76 UPDATE account_analytic_journal
77 WHERE type = 'correction'77 SET type = 'correction_manual'
78 AND code != 'OD';78 WHERE type = 'correction'
79 """)79 AND code != 'OD';
80 self._logger.warn('%s correction analytic journal(s) updated.' % (cr.rowcount,))80 """)
81 cr.execute("""81 self._logger.warn('%s correction analytic journal(s) updated.' % (cr.rowcount,))
82 UPDATE account_journal82 cr.execute("""
83 SET type = 'correction_manual'83 UPDATE account_journal
84 WHERE type = 'correction'84 SET type = 'correction_manual'
85 AND code != 'OD';85 WHERE type = 'correction'
86 """)86 AND code != 'OD';
87 self._logger.warn('%s correction journal(s) updated.' % (cr.rowcount,))87 """)
88 # ODM analytic journal88 self._logger.warn('%s correction journal(s) updated.' % (cr.rowcount,))
89 odm_analytic_vals = {89 # ODM analytic journal
90 # Prop. Instance: by default the current one is used90 odm_analytic_vals = {
91 'code': 'ODM',91 # Prop. Instance: by default the current one is used
92 'name': 'Correction manual',92 'code': 'ODM',
93 'type': 'correction_manual',93 'name': 'Correction manual',
94 }94 'type': 'correction_manual',
95 odm_analytic_journal_id = analytic_journal_obj.create(cr, uid, odm_analytic_vals)95 }
96 # ODM G/L journal96 odm_analytic_journal_id = analytic_journal_obj.create(cr, uid, odm_analytic_vals)
97 odm_vals = {97 # ODM G/L journal
98 # Prop. Instance: by default the current one is used98 odm_vals = {
99 'code': 'ODM',99 # Prop. Instance: by default the current one is used
100 'name': 'Correction manual',100 'code': 'ODM',
101 'type': 'correction_manual',101 'name': 'Correction manual',
102 'analytic_journal_id': odm_analytic_journal_id,102 'type': 'correction_manual',
103 }103 'analytic_journal_id': odm_analytic_journal_id,
104 journal_obj.create(cr, uid, odm_vals)104 }
105 if current_instance.level == 'coordo':105 journal_obj.create(cr, uid, odm_vals)
106 # ODHQ analytic journal106 if current_instance.level == 'coordo':
107 odhq_analytic_vals = {107 # ODHQ analytic journal
108 # Prop. Instance: by default the current one is used108 odhq_analytic_vals = {
109 'code': 'ODHQ',109 # Prop. Instance: by default the current one is used
110 'name': 'Correction automatic HQ',110 'code': 'ODHQ',
111 'type': 'correction_hq',111 'name': 'Correction automatic HQ',
112 }112 'type': 'correction_hq',
113 odhq_analytic_journal_id = analytic_journal_obj.create(cr, uid, odhq_analytic_vals)113 }
114 # ODHQ G/L journal114 odhq_analytic_journal_id = analytic_journal_obj.create(cr, uid, odhq_analytic_vals)
115 odhq_vals = {115 # ODHQ G/L journal
116 # Prop. Instance: by default the current one is used116 odhq_vals = {
117 'code': 'ODHQ',117 # Prop. Instance: by default the current one is used
118 'name': 'Correction automatic HQ',118 'code': 'ODHQ',
119 'type': 'correction_hq',119 'name': 'Correction automatic HQ',
120 'analytic_journal_id': odhq_analytic_journal_id,120 'type': 'correction_hq',
121 }121 'analytic_journal_id': odhq_analytic_journal_id,
122 journal_obj.create(cr, uid, odhq_vals)122 }
123 return True123 journal_obj.create(cr, uid, odhq_vals)
124124 return True
125 # UF15.2125
126 def rec_entries_uf14_1_uf15(self, cr, uid, *a, **b):126 # UF15.2
127 current_instance = self.pool.get('res.users').browse(cr, uid, uid, fields_to_fetch=['company_id']).company_id.instance_id127 def rec_entries_uf14_1_uf15(self, cr, uid, *a, **b):
128 if current_instance:128 current_instance = self.pool.get('res.users').browse(cr, uid, uid, fields_to_fetch=['company_id']).company_id.instance_id
129 trigger_obj = self.pool.get('sync.trigger.something.target')129 if current_instance:
130 cr.execute('''130 trigger_obj = self.pool.get('sync.trigger.something.target')
131 select sdref, values, source from sync_client_update_received where model='account.move.reconcile' and execution_date > ( select applied from sync_client_version where name='UF15.0') and fields not like '%action_date%'131 cr.execute('''
132 ''')132 select sdref, values, source from sync_client_update_received where model='account.move.reconcile' and execution_date > ( select applied from sync_client_version where name='UF15.0') and fields not like '%action_date%'
133133 ''')
134 for update in cr.fetchall():134
135 rec_number = False135 for update in cr.fetchall():
136 try:136 rec_number = False
137 rec_number = eval(update[1])137 try:
138 except:138 rec_number = eval(update[1])
139 self._logger.warn('Unable to parse values, sdref: %s' % update[0])139 except:
140140 self._logger.warn('Unable to parse values, sdref: %s' % update[0])
141 if rec_number:141
142 trigger_obj.create(cr, uid, {'name': 'trigger_rec', 'destination': update[2] , 'args': rec_number[0], 'local': True})142 if rec_number:
143143 trigger_obj.create(cr, uid, {'name': 'trigger_rec', 'destination': update[2] , 'args': rec_number[0], 'local': True})
144 return True144
145145 return True
146 # UF15.1146
147 def us_6930_gen_unreconcile(self, cr, uid, *a, **b):147 # UF15.1
148 # generate updates to delete reconcile done after UF15.0148 def us_6930_gen_unreconcile(self, cr, uid, *a, **b):
149 current_instance = self.pool.get('res.users').browse(cr, uid, uid, fields_to_fetch=['company_id']).company_id.instance_id149 # generate updates to delete reconcile done after UF15.0
150 if current_instance:150 current_instance = self.pool.get('res.users').browse(cr, uid, uid, fields_to_fetch=['company_id']).company_id.instance_id
151 unrec_obj = self.pool.get('account.move.unreconcile')151 if current_instance:
152 cr.execute('''152 unrec_obj = self.pool.get('account.move.unreconcile')
153 select d.name from ir_model_data d153 cr.execute('''
154 left join154 select d.name from ir_model_data d
155 account_move_reconcile rec on d.model='account.move.reconcile' and d.res_id = rec.id155 left join
156 where d.model='account.move.reconcile' and rec.id is null and touched like '%action_date%'156 account_move_reconcile rec on d.model='account.move.reconcile' and d.res_id = rec.id
157 ''')157 where d.model='account.move.reconcile' and rec.id is null and touched like '%action_date%'
158 for sdref_rec in cr.fetchall():158 ''')
159 unrec_obj.create(cr, uid, {'reconcile_sdref': sdref_rec[0]})159 for sdref_rec in cr.fetchall():
160 return True160 unrec_obj.create(cr, uid, {'reconcile_sdref': sdref_rec[0]})
161161 return True
162 def us_6905_manage_bned_switch(self, cr, uid, *a, **b):162
163 fake_ed = '2999-12-31'163 def us_6905_manage_bned_switch(self, cr, uid, *a, **b):
164 fake_bn = 'TO-BE-REPLACED'164 fake_ed = '2999-12-31'
165165 fake_bn = 'TO-BE-REPLACED'
166 lot_obj = self.pool.get('stock.production.lot')166
167167 lot_obj = self.pool.get('stock.production.lot')
168 # old move with BN or ED if product is no_bn no_ed168
169 # set no on bn or en moves169 # old move with BN or ED if product is no_bn no_ed
170 cr.execute('''170 # set no on bn or en moves
171 update stock_move set prodlot_id=NULL, expired_date=NULL, hidden_batch_management_mandatory='f', hidden_perishable_mandatory='f', old_lot_info=(select name||'#'||life_date from stock_production_lot where id=stock_move.prodlot_id)||E'\n'||COALESCE(old_lot_info, '') where id in171 cr.execute('''
172 (select m.id from stock_move m, product_product p where p.id = m.product_id and p.perishable='f' and p.batch_management='f' and m.prodlot_id is not null and m.state in ('done', 'cancel'))172 update stock_move set prodlot_id=NULL, expired_date=NULL, hidden_batch_management_mandatory='f', hidden_perishable_mandatory='f', old_lot_info=(select name||'#'||life_date from stock_production_lot where id=stock_move.prodlot_id)||E'\n'||COALESCE(old_lot_info, '') where id in
173 ''')173 (select m.id from stock_move m, product_product p where p.id = m.product_id and p.perishable='f' and p.batch_management='f' and m.prodlot_id is not null and m.state in ('done', 'cancel'))
174 self._logger.warn('%d done/cancel moves set from ED or BN to no' % (cr.rowcount, ))174 ''')
175175 self._logger.warn('%d done/cancel moves set from ED or BN to no' % (cr.rowcount, ))
176176
177 # set bn on no moves177
178 cr.execute('''select distinct(product_id) from stock_move m, product_product p where p.id = m.product_id and p.perishable='t' and p.batch_management='t' and m.prodlot_id is null and m.state = 'done' and m.product_qty!=0 and m.location_dest_id != m.location_id''')178 # set bn on no moves
179 self._logger.warn('%d done/cancel moves set from NO to BN' % (cr.rowcount, ))179 cr.execute('''select distinct(product_id) from stock_move m, product_product p where p.id = m.product_id and p.perishable='t' and p.batch_management='t' and m.prodlot_id is null and m.state = 'done' and m.product_qty!=0 and m.location_dest_id != m.location_id''')
180 for prod_id in cr.fetchall():180 self._logger.warn('%d done/cancel moves set from NO to BN' % (cr.rowcount, ))
181 batch_id = lot_obj._get_or_create_lot(cr, uid, name=fake_bn, expiry_date=fake_ed, product_id=prod_id)181 for prod_id in cr.fetchall():
182 cr.execute("update stock_move set hidden_batch_management_mandatory='t', hidden_perishable_mandatory='f', prodlot_id=%s, expired_date=%s, old_lot_info='US-6905 BN set'||E'\n'||COALESCE(old_lot_info, '') where product_id=%s and prodlot_id is null and state = 'done' and product_qty!=0 and location_dest_id != location_id", (batch_id, fake_ed, prod_id))182 batch_id = lot_obj._get_or_create_lot(cr, uid, name=fake_bn, expiry_date=fake_ed, product_id=prod_id)
183183 cr.execute("update stock_move set hidden_batch_management_mandatory='t', hidden_perishable_mandatory='f', prodlot_id=%s, expired_date=%s, old_lot_info='US-6905 BN set'||E'\n'||COALESCE(old_lot_info, '') where product_id=%s and prodlot_id is null and state = 'done' and product_qty!=0 and location_dest_id != location_id", (batch_id, fake_ed, prod_id))
184 # set ed on no moves184
185 cr.execute('''select distinct(product_id) from stock_move m, product_product p where p.id = m.product_id and p.perishable='t' and p.batch_management='f' and m.prodlot_id is null and m.state = 'done' and m.product_qty!=0 and m.location_dest_id != m.location_id''')185 # set ed on no moves
186 self._logger.warn('%d done/cancel moves set from NO to ED' % (cr.rowcount, ))186 cr.execute('''select distinct(product_id) from stock_move m, product_product p where p.id = m.product_id and p.perishable='t' and p.batch_management='f' and m.prodlot_id is null and m.state = 'done' and m.product_qty!=0 and m.location_dest_id != m.location_id''')
187 for prod_id in cr.fetchall():187 self._logger.warn('%d done/cancel moves set from NO to ED' % (cr.rowcount, ))
188 batch_id = lot_obj._get_or_create_lot(cr, uid, name=False, expiry_date=fake_ed, product_id=prod_id)188 for prod_id in cr.fetchall():
189 cr.execute("update stock_move set hidden_batch_management_mandatory='f', hidden_perishable_mandatory='t', prodlot_id=%s, expired_date=%s, old_lot_info='US-6905 EN set'||E'\n'||COALESCE(old_lot_info, '') where product_id=%s and prodlot_id is null and state = 'done' and product_qty!=0 and location_dest_id != location_id", (batch_id, fake_ed, prod_id))189 batch_id = lot_obj._get_or_create_lot(cr, uid, name=False, expiry_date=fake_ed, product_id=prod_id)
190190 cr.execute("update stock_move set hidden_batch_management_mandatory='f', hidden_perishable_mandatory='t', prodlot_id=%s, expired_date=%s, old_lot_info='US-6905 EN set'||E'\n'||COALESCE(old_lot_info, '') where product_id=%s and prodlot_id is null and state = 'done' and product_qty!=0 and location_dest_id != location_id", (batch_id, fake_ed, prod_id))
191 # set ed on bn moves191
192 cr.execute("update stock_production_lot set name='MSFBN/'||name, type='internal' where id in (select lot.id from stock_production_lot lot, product_product p where p.id = lot.product_id and type='standard' and p.perishable='t' and p.batch_management='f') returning name")192 # set ed on bn moves
193 for lot in cr.fetchall():193 cr.execute("update stock_production_lot set name='MSFBN/'||name, type='internal' where id in (select lot.id from stock_production_lot lot, product_product p where p.id = lot.product_id and type='standard' and p.perishable='t' and p.batch_management='f') returning name")
194 self._logger.warn('BN %s from standard to internal' % (lot[0], ))194 for lot in cr.fetchall():
195195 self._logger.warn('BN %s from standard to internal' % (lot[0], ))
196 # set bn on ed moves196
197 cr.execute("update stock_production_lot set type='standard', name='S'||name where id in (select lot.id from stock_production_lot lot, product_product p where p.id = lot.product_id and type='internal' and p.perishable='t' and p.batch_management='t') returning name")197 # set bn on ed moves
198 for lot in cr.fetchall():198 cr.execute("update stock_production_lot set type='standard', name='S'||name where id in (select lot.id from stock_production_lot lot, product_product p where p.id = lot.product_id and type='internal' and p.perishable='t' and p.batch_management='t') returning name")
199 self._logger.warn('BN %s from internal to standard' % (lot[0], ))199 for lot in cr.fetchall():
200200 self._logger.warn('BN %s from internal to standard' % (lot[0], ))
201 return True201
202202 return True
203
204=======
205 # UF16.0
206 def us_6692_new_od_journals(self, cr, uid, *a, **b):
207 """
208 1. Change the type of the existing correction journals (except OD) to "Correction Manual" so they remain usable
209
210 2. Create:
211 - ODM journals in all existing instances
212 - ODHQ journals in existing coordo instances
213
214 Notes:
215 - creations are done in Python as the objects created must sync normally
216 - none of these journals already exists in prod. DB.
217 """
218 user_obj = self.pool.get('res.users')
219 analytic_journal_obj = self.pool.get('account.analytic.journal')
220 journal_obj = self.pool.get('account.journal')
221 current_instance = user_obj.browse(cr, uid, uid, fields_to_fetch=['company_id']).company_id.instance_id
222 if current_instance: # existing instances only
223 # existing correction journals
224 cr.execute("""
225 UPDATE account_analytic_journal
226 SET type = 'correction_manual'
227 WHERE type = 'correction'
228 AND code != 'OD';
229 """)
230 self._logger.warn('%s correction analytic journal(s) updated.' % (cr.rowcount,))
231 cr.execute("""
232 UPDATE account_journal
233 SET type = 'correction_manual'
234 WHERE type = 'correction'
235 AND code != 'OD';
236 """)
237 self._logger.warn('%s correction journal(s) updated.' % (cr.rowcount,))
238 # ODM analytic journal
239 odm_analytic_vals = {
240 # Prop. Instance: by default the current one is used
241 'code': 'ODM',
242 'name': 'Correction manual',
243 'type': 'correction_manual',
244 }
245 odm_analytic_journal_id = analytic_journal_obj.create(cr, uid, odm_analytic_vals)
246 # ODM G/L journal
247 odm_vals = {
248 # Prop. Instance: by default the current one is used
249 'code': 'ODM',
250 'name': 'Correction manual',
251 'type': 'correction_manual',
252 'analytic_journal_id': odm_analytic_journal_id,
253 }
254 journal_obj.create(cr, uid, odm_vals)
255 if current_instance.level == 'coordo':
256 # ODHQ analytic journal
257 odhq_analytic_vals = {
258 # Prop. Instance: by default the current one is used
259 'code': 'ODHQ',
260 'name': 'Correction automatic HQ',
261 'type': 'correction_hq',
262 }
263 odhq_analytic_journal_id = analytic_journal_obj.create(cr, uid, odhq_analytic_vals)
264 # ODHQ G/L journal
265 odhq_vals = {
266 # Prop. Instance: by default the current one is used
267 'code': 'ODHQ',
268 'name': 'Correction automatic HQ',
269 'type': 'correction_hq',
270 'analytic_journal_id': odhq_analytic_journal_id,
271 }
272 journal_obj.create(cr, uid, odhq_vals)
273 return True
274
275 # UF15.2
276 def rec_entries_uf14_1_uf15(self, cr, uid, *a, **b):
277 current_instance = self.pool.get('res.users').browse(cr, uid, uid, fields_to_fetch=['company_id']).company_id.instance_id
278 if current_instance:
279 trigger_obj = self.pool.get('sync.trigger.something.target')
280 cr.execute('''
281 select sdref, values, source from sync_client_update_received where model='account.move.reconcile' and execution_date > ( select applied from sync_client_version where name='UF15.0') and fields not like '%action_date%'
282 ''')
283
284 for update in cr.fetchall():
285 rec_number = False
286 try:
287 rec_number = eval(update[1])
288 except:
289 self._logger.warn('Unable to parse values, sdref: %s' % update[0])
290
291 if rec_number:
292 trigger_obj.create(cr, uid, {'name': 'trigger_rec', 'destination': update[2] , 'args': rec_number[0], 'local': True})
293
294 return True
295
296 # UF15.1
297 def us_6930_gen_unreconcile(self, cr, uid, *a, **b):
298 # generate updates to delete reconcile done after UF15.0
299 current_instance = self.pool.get('res.users').browse(cr, uid, uid, fields_to_fetch=['company_id']).company_id.instance_id
300 if current_instance:
301 unrec_obj = self.pool.get('account.move.unreconcile')
302 cr.execute('''
303 select d.name from ir_model_data d
304 left join
305 account_move_reconcile rec on d.model='account.move.reconcile' and d.res_id = rec.id
306 where d.model='account.move.reconcile' and rec.id is null and touched like '%action_date%'
307 ''')
308 for sdref_rec in cr.fetchall():
309 unrec_obj.create(cr, uid, {'reconcile_sdref': sdref_rec[0]})
310 return True
311
312 def us_6905_manage_bned_switch(self, cr, uid, *a, **b):
313 fake_ed = '2999-12-31'
314 fake_bn = 'TO-BE-REPLACED'
315
316 lot_obj = self.pool.get('stock.production.lot')
317
318 # old move with BN or ED if product is no_bn no_ed
319 # set no on bn or en moves
320 cr.execute('''
321 update stock_move set prodlot_id=NULL, expired_date=NULL, hidden_batch_management_mandatory='f', hidden_perishable_mandatory='f', old_lot_info=(select name||'#'||life_date from stock_production_lot where id=stock_move.prodlot_id)||E'\n'||COALESCE(old_lot_info, '') where id in
322 (select m.id from stock_move m, product_product p where p.id = m.product_id and p.perishable='f' and p.batch_management='f' and m.prodlot_id is not null and m.state in ('done', 'cancel'))
323 ''')
324 self._logger.warn('%d done/cancel moves set from ED or BN to no' % (cr.rowcount, ))
325
326
327 # set bn on no moves
328 cr.execute('''select distinct(product_id) from stock_move m, product_product p where p.id = m.product_id and p.perishable='t' and p.batch_management='t' and m.prodlot_id is null and m.state = 'done' and m.product_qty!=0 and m.location_dest_id != m.location_id''')
329 self._logger.warn('%d done/cancel moves set from NO to BN' % (cr.rowcount, ))
330 for prod_id in cr.fetchall():
331 batch_id = lot_obj._get_or_create_lot(cr, uid, name=fake_bn, expiry_date=fake_ed, product_id=prod_id)
332 cr.execute("update stock_move set hidden_batch_management_mandatory='t', hidden_perishable_mandatory='f', prodlot_id=%s, expired_date=%s, old_lot_info='US-6905 BN set'||E'\n'||COALESCE(old_lot_info, '') where product_id=%s and prodlot_id is null and state = 'done' and product_qty!=0 and location_dest_id != location_id", (batch_id, fake_ed, prod_id))
333
334 # set ed on no moves
335 cr.execute('''select distinct(product_id) from stock_move m, product_product p where p.id = m.product_id and p.perishable='t' and p.batch_management='f' and m.prodlot_id is null and m.state = 'done' and m.product_qty!=0 and m.location_dest_id != m.location_id''')
336 self._logger.warn('%d done/cancel moves set from NO to ED' % (cr.rowcount, ))
337 for prod_id in cr.fetchall():
338 batch_id = lot_obj._get_or_create_lot(cr, uid, name=False, expiry_date=fake_ed, product_id=prod_id)
339 cr.execute("update stock_move set hidden_batch_management_mandatory='f', hidden_perishable_mandatory='t', prodlot_id=%s, expired_date=%s, old_lot_info='US-6905 EN set'||E'\n'||COALESCE(old_lot_info, '') where product_id=%s and prodlot_id is null and state = 'done' and product_qty!=0 and location_dest_id != location_id", (batch_id, fake_ed, prod_id))
340
341 # set ed on bn moves
342 cr.execute("update stock_production_lot set name='MSFBN/'||name, type='internal' where id in (select lot.id from stock_production_lot lot, product_product p where p.id = lot.product_id and type='standard' and p.perishable='t' and p.batch_management='f') returning name")
343 for lot in cr.fetchall():
344 self._logger.warn('BN %s from standard to internal' % (lot[0], ))
345
346 # set bn on ed moves
347 cr.execute("update stock_production_lot set type='standard', name='S'||name where id in (select lot.id from stock_production_lot lot, product_product p where p.id = lot.product_id and type='internal' and p.perishable='t' and p.batch_management='t') returning name")
348 for lot in cr.fetchall():
349 self._logger.warn('BN %s from internal to standard' % (lot[0], ))
350 return True
351
352>>>>>>> MERGE-SOURCE
203 # UF15.0353 # UF15.0
204 def us_6768_trigger_FP_sync(self, cr, uid, *a, **b):354 def us_6768_trigger_FP_sync(self, cr, uid, *a, **b):
205 """355 """
206356
=== modified file 'bin/addons/stock/physical_inventory.py'
=== modified file 'bin/addons/stock/wizard/physical_inventory_generate_counting_sheet.py'
=== modified file 'bin/addons/vertical_integration/report/hq_report_ocb.py'
--- bin/addons/vertical_integration/report/hq_report_ocb.py 2019-12-13 15:12:51 +0000
+++ bin/addons/vertical_integration/report/hq_report_ocb.py 2020-02-04 10:20:45 +0000
@@ -397,6 +397,8 @@
397 context = {}397 context = {}
398 # Prepare some values398 # Prepare some values
399 pool = pooler.get_pool(cr.dbname)399 pool = pooler.get_pool(cr.dbname)
400 mi_obj = pool.get('msf.instance')
401 period_obj = pool.get('account.period')
400 excluded_journal_types = ['hq', 'migration'] # journal types that should not be used to take lines402 excluded_journal_types = ['hq', 'migration'] # journal types that should not be used to take lines
401 # Fetch data from wizard403 # Fetch data from wizard
402 if not data.get('form', False):404 if not data.get('form', False):
@@ -408,10 +410,12 @@
408 instance_id = form.get('instance_id', False)410 instance_id = form.get('instance_id', False)
409 if not fy_id or not period_id or not instance_ids or not instance_id:411 if not fy_id or not period_id or not instance_ids or not instance_id:
410 raise osv.except_osv(_('Warning'), _('Some info are missing. Either fiscalyear or period or instance.'))412 raise osv.except_osv(_('Warning'), _('Some info are missing. Either fiscalyear or period or instance.'))
413 instance_lvl = mi_obj.browse(cr, uid, instance_id, fields_to_fetch=['level'], context=context).level
411 fy = pool.get('account.fiscalyear').browse(cr, uid, fy_id)414 fy = pool.get('account.fiscalyear').browse(cr, uid, fy_id)
412 last_fy_year = strptime(fy.date_start, '%Y-%m-%d').tm_year - 1 # Take previous year regarding given fiscalyear415 last_fy_year = strptime(fy.date_start, '%Y-%m-%d').tm_year - 1 # Take previous year regarding given fiscalyear
413 first_day_of_last_fy = '%s-01-01' % (last_fy_year)416 first_day_of_last_fy = '%s-01-01' % (last_fy_year)
414 period = pool.get('account.period').browse(cr, uid, period_id)417 period = period_obj.browse(cr, uid, period_id, fields_to_fetch=['date_stop', 'date_start', 'number'])
418 previous_period_id = period_obj.get_previous_period_id(cr, uid, period_id, context=context)
415 last_day_of_period = period.date_stop419 last_day_of_period = period.date_stop
416 first_day_of_period = period.date_start420 first_day_of_period = period.date_start
417 selection = form.get('selection', False)421 selection = form.get('selection', False)
@@ -436,7 +440,6 @@
436 plresult_ji_in_ids = []440 plresult_ji_in_ids = []
437 if period.number == 12:441 if period.number == 12:
438 ayec_obj = pool.get("account.year.end.closing")442 ayec_obj = pool.get("account.year.end.closing")
439 mi_obj = pool.get('msf.instance')
440 m_obj = pool.get('account.move')443 m_obj = pool.get('account.move')
441 ml_obj = pool.get('account.move.line')444 ml_obj = pool.get('account.move.line')
442445
@@ -466,13 +469,33 @@
466 # SQLREQUESTS DICTIONNARY469 # SQLREQUESTS DICTIONNARY
467 # - key: name of the SQL request470 # - key: name of the SQL request
468 # - value: the SQL request to use471 # - value: the SQL request to use
469 sqlrequests = {472 partner_sql = """
470 'partner': """473 SELECT id, name, ref, partner_type, CASE WHEN active='t' THEN 'True' WHEN active='f' THEN 'False' END AS active%s
471 SELECT id, name, ref, partner_type, CASE WHEN active='t' THEN 'True' WHEN active='f' THEN 'False' END AS active
472 FROM res_partner 474 FROM res_partner
473 WHERE partner_type != 'internal'475 WHERE partner_type != 'internal'
474 and name != 'To be defined';476 and name != 'To be defined';
475 """,477 """ % (not context.get("old_vi") and ", comment" or "")
478 if not previous_period_id or instance_lvl == 'section':
479 # empty report in case there is no previous period or an HQ instance is selected
480 balance_previous_month_sql = "SELECT '' AS no_line;"
481 else:
482 # note: even balances with zero amount are displayed in the report
483 balance_previous_month_sql = """
484 SELECT acc.code, curr.name, SUM(COALESCE(aml.debit_currency,0) - COALESCE(aml.credit_currency,0))
485 FROM account_move_line aml
486 INNER JOIN account_journal j ON aml.journal_id = j.id
487 INNER JOIN account_account acc ON aml.account_id = acc.id
488 INNER JOIN res_currency curr ON aml.currency_id = curr.id
489 INNER JOIN account_move m ON aml.move_id = m.id
490 WHERE aml.period_id = %s
491 AND j.type NOT IN %s
492 AND aml.instance_id IN %s
493 AND m.state = 'posted'
494 GROUP BY acc.code, curr.name
495 ORDER BY acc.code, curr.name;
496 """
497 sqlrequests = {
498 'partner': partner_sql,
476 'employee': """499 'employee': """
477 SELECT r.name, e.identification_id, r.active, e.employee_type500 SELECT r.name, e.identification_id, r.active, e.employee_type
478 FROM hr_employee AS e, resource_resource AS r501 FROM hr_employee AS e, resource_resource AS r
@@ -634,6 +657,7 @@
634 AND m.state = 'posted'657 AND m.state = 'posted'
635 ORDER BY aml.id;658 ORDER BY aml.id;
636 """,659 """,
660 'balance_previous_month': balance_previous_month_sql,
637 }661 }
638 if plresult_ji_in_ids:662 if plresult_ji_in_ids:
639 # NOTE: for these entries: booking and fonctional ccy are same663 # NOTE: for these entries: booking and fonctional ccy are same
@@ -676,9 +700,12 @@
676 # + If you cannot do a SQL request to create the content of the file, do a simple request (with key) and add a postprocess function that returns the result you want700 # + If you cannot do a SQL request to create the content of the file, do a simple request (with key) and add a postprocess function that returns the result you want
677 instance_name = 'OCB' # since US-949701 instance_name = 'OCB' # since US-949
678 reg_types = ('cash', 'bank', 'cheque')702 reg_types = ('cash', 'bank', 'cheque')
703 partner_header = ['XML_ID', 'Name', 'Reference', 'Partner type', 'Active/inactive']
704 if not context.get('old_vi'):
705 partner_header.append('Notes')
679 processrequests = [706 processrequests = [
680 {707 {
681 'headers': ['XML_ID', 'Name', 'Reference', 'Partner type', 'Active/inactive'],708 'headers': partner_header,
682 'filename': instance_name + '_' + year + month + '_Partners.csv',709 'filename': instance_name + '_' + year + month + '_Partners.csv',
683 'key': 'partner',710 'key': 'partner',
684 'function': 'postprocess_partners',711 'function': 'postprocess_partners',
@@ -699,37 +726,6 @@
699 'fnct_params': ([('account.journal', 'type', 3)], context),726 'fnct_params': ([('account.journal', 'type', 3)], context),
700 },727 },
701 {728 {
702 'headers': ['Name', 'Code', 'Type', 'Status'],
703 'filename': instance_name + '_' + year + month + '_Cost Centres.csv',
704 'key': 'costcenter',
705 'query_params': (last_day_of_period, last_day_of_period, tuple(instance_ids),last_day_of_period, last_day_of_period, tuple(instance_ids)),
706 'function': 'postprocess_selection_columns',
707 'fnct_params': [('account.analytic.account', 'type', 2)],
708 },
709 {
710 'headers': ['CCY name', 'CCY code', 'Rate', 'Month'],
711 'filename': instance_name + '_' + year + month + '_FX rates.csv',
712 'key': 'fxrate',
713 'query_params': (first_day_of_last_fy, last_day_of_period),
714 },
715 {
716 'headers': ['Instance', 'Code', 'Name', 'Period', 'Starting balance', 'Calculated balance', 'Closing balance', 'Currency'],
717 'filename': instance_name + '_' + year + month + '_Liquidity Balances.csv',
718 'key': 'liquidity',
719 'query_params': (tuple([period_yyyymm]), reg_types, first_day_of_period, reg_types, first_day_of_period,
720 last_day_of_period, reg_types, last_day_of_period, tuple(instance_ids)),
721 'function': 'postprocess_liquidity_balances',
722 'fnct_params': context,
723 },
724 {
725 'headers': ['Name', 'Code', 'Donor code', 'Grant amount', 'Reporting CCY', 'State'],
726 'filename': instance_name + '_' + year + month + '_Financing contracts.csv',
727 'key': 'contract',
728 'query_params': (tuple(instance_ids),),
729 'function': 'postprocess_selection_columns',
730 'fnct_params': [('financing.contract.contract', 'state', 5)],
731 },
732 {
733 'headers': ['DB ID', 'Instance', 'Journal', 'Entry sequence', 'Description', 'Reference', 'Document date', 'Posting date', 'G/L Account', 'Third party', 'Destination', 'Cost centre', 'Funding pool', 'Booking debit', 'Booking credit', 'Booking currency', 'Functional debit', 'Functional credit', 'Functional CCY', 'Emplid', 'Partner DB ID'],729 'headers': ['DB ID', 'Instance', 'Journal', 'Entry sequence', 'Description', 'Reference', 'Document date', 'Posting date', 'G/L Account', 'Third party', 'Destination', 'Cost centre', 'Funding pool', 'Booking debit', 'Booking credit', 'Booking currency', 'Functional debit', 'Functional credit', 'Functional CCY', 'Emplid', 'Partner DB ID'],
734 'filename': instance_name + '_' + year + month + '_Monthly Export.csv',730 'filename': instance_name + '_' + year + month + '_Monthly Export.csv',
735 'key': 'rawdata',731 'key': 'rawdata',
@@ -758,6 +754,57 @@
758 'object': 'account.move.line',754 'object': 'account.move.line',
759 },755 },
760 ]756 ]
757 if context.get('old_vi'):
758 processrequests.extend([
759 {
760 'headers': ['Name', 'Code', 'Type', 'Status'],
761 'filename': instance_name + '_' + year + month + '_Cost Centres.csv',
762 'key': 'costcenter',
763 'query_params': (
764 last_day_of_period, last_day_of_period, tuple(instance_ids), last_day_of_period,
765 last_day_of_period,
766 tuple(instance_ids)),
767 'function': 'postprocess_selection_columns',
768 'fnct_params': [('account.analytic.account', 'type', 2)],
769 },
770 {
771 'headers': ['Name', 'Code', 'Donor code', 'Grant amount', 'Reporting CCY', 'State'],
772 'filename': instance_name + '_' + year + month + '_Financing contracts.csv',
773 'key': 'contract',
774 'query_params': (tuple(instance_ids),),
775 'function': 'postprocess_selection_columns',
776 'fnct_params': [('financing.contract.contract', 'state', 5)],
777 },
778 {
779 'headers': ['CCY name', 'CCY code', 'Rate', 'Month'],
780 'filename': instance_name + '_' + year + month + '_FX rates.csv',
781 'key': 'fxrate',
782 'query_params': (first_day_of_last_fy, last_day_of_period),
783 },
784 {
785 'headers': ['Instance', 'Code', 'Name', 'Period', 'Starting balance', 'Calculated balance',
786 'Closing balance', 'Currency'],
787 'filename': instance_name + '_' + year + month + '_Liquidity Balances.csv',
788 'key': 'liquidity',
789 'query_params': (
790 tuple([period_yyyymm]), reg_types, first_day_of_period, reg_types, first_day_of_period,
791 last_day_of_period, reg_types, last_day_of_period, tuple(instance_ids)),
792 'function': 'postprocess_liquidity_balances',
793 'fnct_params': context,
794 },
795 ])
796 if not context.get('old_vi'):
797 processrequests.extend([
798 {
799 'headers': ['G/L Account', 'Booking currency', 'Balance'],
800 'filename': instance_name + '_' + year + month + '_Balance_previous_month.csv',
801 'key': 'balance_previous_month',
802 'query_params': (previous_period_id,
803 # note: engagements are also excluded since there are no ENG/ENGI "G/L" journals
804 tuple(excluded_journal_types + ['cur_adj']),
805 tuple(instance_ids)),
806 }
807 ])
761 if plresult_ji_in_ids:808 if plresult_ji_in_ids:
762 processrequests.append({809 processrequests.append({
763 'filename': instance_name + '_' + year + month + '_Monthly Export.csv',810 'filename': instance_name + '_' + year + month + '_Monthly Export.csv',
764811
=== modified file 'bin/addons/vertical_integration/vertical_integration_wizard.xml'
--- bin/addons/vertical_integration/vertical_integration_wizard.xml 2017-10-17 09:57:39 +0000
+++ bin/addons/vertical_integration/vertical_integration_wizard.xml 2020-02-04 10:20:45 +0000
@@ -109,6 +109,21 @@
109 action="action_hq_export_ocb"109 action="action_hq_export_ocb"
110 id="menu_action_hq_export_ocb" sequence="30"/>110 id="menu_action_hq_export_ocb" sequence="30"/>
111111
112 <!-- OLD OCB VI (to be deleted once this version will be dropped) -->
113 <record id="action_hq_export_ocb_old" model="ir.actions.act_window">
114 <field name="name">Export to HQ system (OCB) Access Interface</field>
115 <field name="type">ir.actions.act_window</field>
116 <field name="res_model">ocb.export.wizard</field>
117 <field name="view_type">form</field>
118 <field name="view_mode">form</field>
119 <field name="view_id" ref="ocb_export_wizard"/>
120 <field name="context">{'old_vi': True}</field>
121 <field name="target">new</field>
122 </record>
123 <menuitem parent="account.menu_finance_generic_reporting"
124 action="action_hq_export_ocb_old"
125 id="menu_action_hq_export_ocb_old" sequence="32"/>
126
112 <!-- OCB matching export -->127 <!-- OCB matching export -->
113128
114 <record id="ocb_matching_export_wizard" model="ir.ui.view">129 <record id="ocb_matching_export_wizard" model="ir.ui.view">

Subscribers

People subscribed via source and target branches