Merge lp:~dorian-kemps/unifield-server/US-7025-7039 into lp:unifield-server

Proposed by jftempo
Status: Merged
Merged at revision: 5647
Proposed branch: lp:~dorian-kemps/unifield-server/US-7025-7039
Merge into: lp:unifield-server
Diff against target: 94 lines (+67/-0) (has conflicts)
2 files modified
bin/addons/msf_profile/data/patches.xml (+8/-0)
bin/addons/msf_profile/msf_profile.py (+59/-0)
Text conflict in bin/addons/msf_profile/data/patches.xml
To merge this branch: bzr merge lp:~dorian-kemps/unifield-server/US-7025-7039
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+380086@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
1=== modified file 'bin/addons/msf_profile/data/patches.xml'
2--- bin/addons/msf_profile/data/patches.xml 2020-02-18 10:24:23 +0000
3+++ bin/addons/msf_profile/data/patches.xml 2020-03-02 13:32:12 +0000
4@@ -501,6 +501,7 @@
5 <field name="method">us_6692_new_od_journals</field>
6 </record>
7
8+<<<<<<< TREE
9 <record id="us_6684_push_backup" model="patch.scripts">
10 <field name="method">us_6684_push_backup</field>
11 </record>
12@@ -512,5 +513,12 @@
13 <record id="us_7181_add_oc_subscrpition_to_unidata_products" model="patch.scripts">
14 <field name="method">us_7181_add_oc_subscrpition_to_unidata_products</field>
15 </record>
16+=======
17+ <!-- UF17.0 -->
18+ <record id="us_7025_7039_fix_nr_empty_ins" model="patch.scripts">
19+ <field name="method">us_7025_7039_fix_nr_empty_ins</field>
20+ </record>
21+
22+>>>>>>> MERGE-SOURCE
23 </data>
24 </openerp>
25
26=== modified file 'bin/addons/msf_profile/msf_profile.py'
27--- bin/addons/msf_profile/msf_profile.py 2020-02-18 10:24:23 +0000
28+++ bin/addons/msf_profile/msf_profile.py 2020-03-02 13:32:12 +0000
29@@ -52,6 +52,65 @@
30 'model': lambda *a: 'patch.scripts',
31 }
32
33+ # UF17.0
34+ def us_7025_7039_fix_nr_empty_ins(self, cr, uid, *a, **b):
35+ """
36+ 1. Set the Not Runs to run:
37+ - Error from coordo: "Exception: Something goes wrong with this message and no confirmation of delivery".
38+ - Error from project: "Exception: Unable to receive Shipment Details into an Incoming Shipment in this
39+ instance as IN IN/XXXXX (POXXXXX) already fully/partially cancelled/Closed".
40+ 2. Remove reference data from empty INs (Backorder, Origin, links to FO, links to PO, Ship Reference, ...) and
41+ modify "Change Reason" to "False movement, bug US-7025/7039".
42+ 3. Remove empty Draft IVOs.
43+ """
44+ # 1
45+ cr.execute("""
46+ SELECT id, identifier, arguments FROM sync_client_message_received
47+ WHERE run = 'f' AND remote_call IN ('stock.picking.closed_in_validates_delivery_out_ship', 'stock.picking.partial_shipped_fo_updates_in_po')
48+ """)
49+ to_run_ids = []
50+ to_run_name = []
51+ for msg in cr.fetchall():
52+ args = eval(msg[2])[0]
53+ if args.get('shipment_ref', False) and '-s' in args['shipment_ref'] or args.get('name', False) and '-s' in args['name']:
54+ to_run_ids.append(msg[0])
55+ to_run_name.append(msg[1])
56+ if to_run_ids:
57+ cr.execute("""
58+ UPDATE sync_client_message_received SET run = 't', manually_ran = 't', execution_date = %s
59+ WHERE id IN %s""", (time.strftime("%Y-%m-%d %H:%M:%S"), tuple(to_run_ids))
60+ )
61+ self._logger.warn('The following Not Runs have been set to Run: %s.', (', '.join(to_run_name),))
62+
63+ # 2
64+ cr.execute("""
65+ SELECT p.id, p.name FROM stock_picking p LEFT JOIN stock_move m ON p.id = m.picking_id WHERE m.id IS NULL
66+ AND p.type = 'in' AND p.subtype = 'standard' AND p.state = 'done'
67+ """)
68+ empty_in_ids = []
69+ empty_in_names = []
70+ for inc in cr.fetchall():
71+ empty_in_ids.append(inc[0])
72+ empty_in_names.append(inc[1])
73+ if empty_in_ids:
74+ cr.execute("""
75+ UPDATE stock_picking SET sale_id = NULL, purchase_id = NULL, backorder_id = NULL, origin = '',
76+ shipment_ref = '', change_reason = 'False movement, bug US-7025/7039' WHERE id IN %s
77+ """, (tuple(empty_in_ids),))
78+ self._logger.warn('The following empty INs have been modified: %s.', (', '.join(empty_in_names),))
79+
80+ # 3
81+ cr.execute("""
82+ DELETE FROM account_invoice WHERE id IN (
83+ SELECT a.id FROM account_invoice a LEFT JOIN account_invoice_line l ON a.id = l.invoice_id
84+ WHERE l.id IS NULL AND a.state = 'draft' AND a.type = 'out_invoice' AND a.is_debit_note = 'f'
85+ AND a.is_inkind_donation = 'f' AND a.is_intermission = 't'
86+ )
87+ """)
88+ self._logger.warn('%s empty IVOs have been deleted.', (cr.rowcount,))
89+
90+ return True
91+
92 # UF16.0
93 def us_7181_add_oc_subscrpition_to_unidata_products(self, cr, uid, *a, **b):
94 """

Subscribers

People subscribed via source and target branches