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

Proposed by jftempo
Status: Merged
Merged at revision: 6458
Proposed branch: lp:~dorian-kemps/unifield-server/US-10880
Merge into: lp:unifield-server
Diff against target: 69 lines (+15/-11)
1 file modified
bin/addons/return_claim/return_claim.py (+15/-11)
To merge this branch: bzr merge lp:~dorian-kemps/unifield-server/US-10880
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+440710@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/return_claim/return_claim.py'
2--- bin/addons/return_claim/return_claim.py 2022-03-04 17:22:48 +0000
3+++ bin/addons/return_claim/return_claim.py 2023-04-11 07:52:45 +0000
4@@ -1235,10 +1235,11 @@
5 picking_tools.all(cr, uid, ids, context=context)
6 return True
7
8- def _cancel_out_line_linked_to_extcu_ir(self, cr, uid, picking, context=None):
9+ def _cancel_out_line_linked_to_extcu_ir(self, cr, uid, picking, claim_from_popup, context=None):
10 '''
11 Check if IN/INT moves are linked to an IR and if this IR has an ExtCU location Requestor.
12- If that is the case, we cancel the qty from processed move lines of the linked OUT
13+ If that is the case, we cancel the qty from processed non-cancelled move lines of the linked OUT for normal
14+ claims, and non-closed/cancelled moves lines of the linked OUT for claims from scratch
15 '''
16 if context is None:
17 context = {}
18@@ -1253,9 +1254,12 @@
19 if origin_ir.location_requestor_id.usage == 'customer' \
20 and origin_ir.location_requestor_id.location_category == 'consumption_unit' \
21 and origin_ir.location_requestor_id.chained_picking_type == 'out':
22- out_move_ids = move_obj.search(cr, uid, [('sale_line_id', '=', current_sol.id),
23- ('state', '!=', 'cancel')], order='create_date desc',
24- context=context)
25+ out_domain = [('sale_line_id', '=', current_sol.id)]
26+ if not claim_from_popup:
27+ out_domain.append(('state', 'not in', ['done', 'cancel']))
28+ else:
29+ out_domain.append(('state', '!=', 'cancel'))
30+ out_move_ids = move_obj.search(cr, uid, out_domain, order='create_date desc', context=context)
31 for out_move in move_obj.browse(cr, uid, out_move_ids,
32 fields_to_fetch=['product_qty', 'product_id'], context=context):
33 # Check for same data
34@@ -1329,9 +1333,9 @@
35 # if the linked PO lines has an IR whose Location Requestor is ExtCU
36 if not obj.replacement_picking_expected_claim_event:
37 if event_picking.type == 'in':
38- self._cancel_out_line_linked_to_extcu_ir(cr, uid, origin_picking, context=context)
39+ self._cancel_out_line_linked_to_extcu_ir(cr, uid, origin_picking, obj.from_picking_wizard_claim_event, context=context)
40 else:
41- self._cancel_out_line_linked_to_extcu_ir(cr, uid, event_picking, context=context)
42+ self._cancel_out_line_linked_to_extcu_ir(cr, uid, event_picking, obj.from_picking_wizard_claim_event, context=context)
43 # confirm the picking - in custom event function because we need to take the type of picking into account for self.log messages
44 picking_tools.confirm(cr, uid, event_picking.id, context=context)
45 # we check availability for created or wizard picking (wizard picking can be waiting as it is chained picking)
46@@ -1374,9 +1378,9 @@
47 # if the linked PO lines has an IR whose Location Requestor is ExtCU
48 if not obj.replacement_picking_expected_claim_event:
49 if event_picking.type == 'in':
50- self._cancel_out_line_linked_to_extcu_ir(cr, uid, origin_picking, context=context)
51+ self._cancel_out_line_linked_to_extcu_ir(cr, uid, origin_picking, obj.from_picking_wizard_claim_event, context=context)
52 else:
53- self._cancel_out_line_linked_to_extcu_ir(cr, uid, event_picking, context=context)
54+ self._cancel_out_line_linked_to_extcu_ir(cr, uid, event_picking, obj.from_picking_wizard_claim_event, context=context)
55 # confirm the picking - in custom event function because we need to take the type of picking into account for self.log messages
56 picking_tools.confirm(cr, uid, event_picking.id, context=context)
57 # we check availability for created or wizard picking (wizard picking can be waiting as it is chained picking)
58@@ -1428,9 +1432,9 @@
59 # if the linked PO lines has an IR whose Location Requestor is ExtCU
60 if not obj.replacement_picking_expected_claim_event:
61 if obj.event_picking_id_claim_event.type == 'in':
62- self._cancel_out_line_linked_to_extcu_ir(cr, uid, origin_picking, context=context)
63+ self._cancel_out_line_linked_to_extcu_ir(cr, uid, origin_picking, obj.from_picking_wizard_claim_event, context=context)
64 else:
65- self._cancel_out_line_linked_to_extcu_ir(cr, uid, obj.event_picking_id_claim_event, context=context)
66+ self._cancel_out_line_linked_to_extcu_ir(cr, uid, obj.event_picking_id_claim_event, obj.from_picking_wizard_claim_event, context=context)
67 # don't generate financial documents if the claim is linked to an internal or intermission partner
68 inv_status = claim.partner_id_return_claim.partner_type in ['internal', 'intermission'] and 'none' or '2binvoiced'
69 # get the picking values and move values according to claim type

Subscribers

People subscribed via source and target branches