Merge lp:~jfb-tempo-consulting/unifield-server/US-6374 into lp:unifield-server
- US-6374
- Merge into trunk
Proposed by
jftempo
Status: | Merged |
---|---|
Merged at revision: | 5765 |
Proposed branch: | lp:~jfb-tempo-consulting/unifield-server/US-6374 |
Merge into: | lp:unifield-server |
Diff against target: |
1337 lines (+548/-170) (has conflicts) 15 files modified
bin/addons/base/rng/view.rng (+1/-0) bin/addons/delivery_mechanism/delivery_mechanism.py (+25/-6) bin/addons/msf_doc_import/wizard/wizard_in_simulation_screen.py (+98/-16) bin/addons/msf_outgoing/wizard/incoming_shipment_processor.py (+112/-24) bin/addons/msf_outgoing/wizard/incoming_shipment_processor_view.xml (+27/-8) bin/addons/msf_outgoing/wizard/picking_processor.py (+35/-0) bin/addons/msf_outgoing/wizard/split_move_processor.py (+5/-0) bin/addons/msf_printed_documents/report/report_reception.py (+11/-5) bin/addons/msf_printed_documents/report/report_reception.rml (+103/-37) bin/addons/msf_sync_data_server/data/sync_server.message_rule.csv (+4/-0) bin/addons/order_types/stock.py (+6/-1) bin/addons/sync_client/message.py (+25/-14) bin/addons/sync_client/orm.py (+3/-1) bin/addons/sync_so/picking.py (+91/-58) bin/report/report_sxw.py (+2/-0) Text conflict in bin/addons/msf_printed_documents/report/report_reception.py Text conflict in bin/addons/msf_sync_data_server/data/sync_server.message_rule.csv |
To merge this branch: | bzr merge lp:~jfb-tempo-consulting/unifield-server/US-6374 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
UniField Reviewer Team | Pending | ||
Review via email: mp+379948@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'bin/addons/base/rng/view.rng' | |||
2 | --- bin/addons/base/rng/view.rng 2020-02-28 11:04:39 +0000 | |||
3 | +++ bin/addons/base/rng/view.rng 2020-08-05 12:54:43 +0000 | |||
4 | @@ -596,6 +596,7 @@ | |||
5 | 596 | <rng:optional><rng:attribute name="help"/></rng:optional> | 596 | <rng:optional><rng:attribute name="help"/></rng:optional> |
6 | 597 | <rng:optional><rng:attribute name="default_focus"/></rng:optional> | 597 | <rng:optional><rng:attribute name="default_focus"/></rng:optional> |
7 | 598 | <rng:optional><rng:attribute name="header"/></rng:optional> | 598 | <rng:optional><rng:attribute name="header"/></rng:optional> |
8 | 599 | <rng:optional><rng:attribute name="set_ids"/></rng:optional> | ||
9 | 599 | <rng:zeroOrMore> | 600 | <rng:zeroOrMore> |
10 | 600 | <rng:choice> | 601 | <rng:choice> |
11 | 601 | <rng:ref name="form" /> | 602 | <rng:ref name="form" /> |
12 | 602 | 603 | ||
13 | === modified file 'bin/addons/delivery_mechanism/delivery_mechanism.py' | |||
14 | --- bin/addons/delivery_mechanism/delivery_mechanism.py 2020-03-20 14:08:02 +0000 | |||
15 | +++ bin/addons/delivery_mechanism/delivery_mechanism.py 2020-08-05 12:54:43 +0000 | |||
16 | @@ -711,11 +711,13 @@ | |||
17 | 711 | 711 | ||
18 | 712 | return res | 712 | return res |
19 | 713 | 713 | ||
21 | 714 | def do_incoming_shipment(self, cr, uid, wizard_ids, context=None): | 714 | def do_incoming_shipment(self, cr, uid, wizard_ids, shipment_ref=False, context=None, with_ppl=False): |
22 | 715 | """ | 715 | """ |
23 | 716 | Take the data in wizard_ids and lines of stock.incoming.processor and | 716 | Take the data in wizard_ids and lines of stock.incoming.processor and |
24 | 717 | do the split of stock.move according to the data. | 717 | do the split of stock.move according to the data. |
25 | 718 | """ | 718 | """ |
26 | 719 | |||
27 | 720 | |||
28 | 719 | # Objects | 721 | # Objects |
29 | 720 | inc_proc_obj = self.pool.get('stock.incoming.processor') | 722 | inc_proc_obj = self.pool.get('stock.incoming.processor') |
30 | 721 | move_proc_obj = self.pool.get('stock.move.in.processor') | 723 | move_proc_obj = self.pool.get('stock.move.in.processor') |
31 | @@ -802,7 +804,7 @@ | |||
32 | 802 | line = False | 804 | line = False |
33 | 803 | for line in move_proc_obj.browse(cr, uid, proc_ids, context=context): | 805 | for line in move_proc_obj.browse(cr, uid, proc_ids, context=context): |
34 | 804 | values = self._get_values_from_line(cr, uid, move, line, db_data_dict, context=context) | 806 | values = self._get_values_from_line(cr, uid, move, line, db_data_dict, context=context) |
36 | 805 | if context.get('do_not_process_incoming') and line.pack_info_id: | 807 | if (sync_in or context.get('do_not_process_incoming')) and line.pack_info_id: |
37 | 806 | # we are processing auto import IN, we must register pack_info data | 808 | # we are processing auto import IN, we must register pack_info data |
38 | 807 | values['pack_info_id'] = line.pack_info_id.id | 809 | values['pack_info_id'] = line.pack_info_id.id |
39 | 808 | 810 | ||
40 | @@ -851,7 +853,7 @@ | |||
41 | 851 | if out_values.get('location_dest_id', False): | 853 | if out_values.get('location_dest_id', False): |
42 | 852 | out_values.pop('location_dest_id') | 854 | out_values.pop('location_dest_id') |
43 | 853 | 855 | ||
45 | 854 | if line.pack_info_id: | 856 | if with_ppl and line.pack_info_id: |
46 | 855 | all_pack_info[line.pack_info_id.id] = True | 857 | all_pack_info[line.pack_info_id.id] = True |
47 | 856 | remaining_out_qty = line.quantity | 858 | remaining_out_qty = line.quantity |
48 | 857 | out_move = None | 859 | out_move = None |
49 | @@ -981,7 +983,16 @@ | |||
50 | 981 | processed_out_moves_by_exp.setdefault(line.prodlot_id and line.prodlot_id.life_date or False, []).append(out_move.id) | 983 | processed_out_moves_by_exp.setdefault(line.prodlot_id and line.prodlot_id.life_date or False, []).append(out_move.id) |
51 | 982 | else: | 984 | else: |
52 | 983 | # Just update the data of the initial out move | 985 | # Just update the data of the initial out move |
54 | 984 | processed_qty = lst_out_move is out_moves[-1] and uom_partial_qty - minus_qty or out_move.product_qty | 986 | if lst_out_move is out_moves[-1]: |
55 | 987 | processed_qty = uom_partial_qty - minus_qty | ||
56 | 988 | if processed_qty <= 0: | ||
57 | 989 | processed_qty = out_move.product_qty | ||
58 | 990 | elif context.get('auto_import_ok'): | ||
59 | 991 | # IN pre-processing : do not add extra qty in OUT, it will be added later on IN processing | ||
60 | 992 | processed_qty = out_move.product_qty | ||
61 | 993 | else: | ||
62 | 994 | processed_qty = out_move.product_qty | ||
63 | 995 | |||
64 | 985 | out_values.update({ | 996 | out_values.update({ |
65 | 986 | 'product_qty': processed_qty, | 997 | 'product_qty': processed_qty, |
66 | 987 | 'product_uom': line.uom_id.id, | 998 | 'product_uom': line.uom_id.id, |
67 | @@ -1053,6 +1064,7 @@ | |||
68 | 1053 | }) | 1064 | }) |
69 | 1054 | 1065 | ||
70 | 1055 | backorder_id = False | 1066 | backorder_id = False |
71 | 1067 | backorder_ids = False | ||
72 | 1056 | if context.get('for_dpo', False) and picking_dict['purchase_id']: | 1068 | if context.get('for_dpo', False) and picking_dict['purchase_id']: |
73 | 1057 | # Look for an available IN for the same purchase order in case of DPO | 1069 | # Look for an available IN for the same purchase order in case of DPO |
74 | 1058 | backorder_ids = self.search(cr, uid, [ | 1070 | backorder_ids = self.search(cr, uid, [ |
75 | @@ -1060,8 +1072,15 @@ | |||
76 | 1060 | ('in_dpo', '=', True), | 1072 | ('in_dpo', '=', True), |
77 | 1061 | ('state', '=', 'assigned'), | 1073 | ('state', '=', 'assigned'), |
78 | 1062 | ], limit=1, context=context) | 1074 | ], limit=1, context=context) |
81 | 1063 | if backorder_ids: | 1075 | elif sync_in and picking_dict['purchase_id'] and shipment_ref: |
82 | 1064 | backorder_id = backorder_ids[0] | 1076 | backorder_ids = self.search(cr, uid, [ |
83 | 1077 | ('purchase_id', '=', picking_dict['purchase_id'][0]), | ||
84 | 1078 | ('shipment_ref', '=', shipment_ref), | ||
85 | 1079 | ('state', '=', 'shipped'), | ||
86 | 1080 | ], limit=1, context=context) | ||
87 | 1081 | |||
88 | 1082 | if backorder_ids: | ||
89 | 1083 | backorder_id = backorder_ids[0] | ||
90 | 1065 | 1084 | ||
91 | 1066 | backorder_name = picking_dict['name'] | 1085 | backorder_name = picking_dict['name'] |
92 | 1067 | if not backorder_id: | 1086 | if not backorder_id: |
93 | 1068 | 1087 | ||
94 | === modified file 'bin/addons/msf_doc_import/wizard/wizard_in_simulation_screen.py' | |||
95 | --- bin/addons/msf_doc_import/wizard/wizard_in_simulation_screen.py 2020-07-02 15:09:34 +0000 | |||
96 | +++ bin/addons/msf_doc_import/wizard/wizard_in_simulation_screen.py 2020-08-05 12:54:43 +0000 | |||
97 | @@ -245,7 +245,7 @@ | |||
98 | 245 | 'context': context, | 245 | 'context': context, |
99 | 246 | } | 246 | } |
100 | 247 | 247 | ||
102 | 248 | def launch_import(self, cr, uid, ids, context=None): | 248 | def launch_import(self, cr, uid, ids, context=None, with_ppl=False): |
103 | 249 | ''' | 249 | ''' |
104 | 250 | ''' | 250 | ''' |
105 | 251 | if context is None: | 251 | if context is None: |
106 | @@ -254,10 +254,10 @@ | |||
107 | 254 | if isinstance(ids, (int, long)): | 254 | if isinstance(ids, (int, long)): |
108 | 255 | ids = [ids] | 255 | ids = [ids] |
109 | 256 | 256 | ||
111 | 257 | return self._import(cr, uid, ids, context=context) | 257 | return self._import(cr, uid, ids, context=context, with_ppl=with_ppl) |
112 | 258 | 258 | ||
113 | 259 | def launch_import_pack(self, cr, uid, ids, context=None): | 259 | def launch_import_pack(self, cr, uid, ids, context=None): |
115 | 260 | return self.launch_import(cr, uid, ids, context) | 260 | return self.launch_import(cr, uid, ids, context, with_ppl=True) |
116 | 261 | 261 | ||
117 | 262 | def populate(self, cr, uid, import_id, picking_id, context=None): | 262 | def populate(self, cr, uid, import_id, picking_id, context=None): |
118 | 263 | if context is None: | 263 | if context is None: |
119 | @@ -519,6 +519,50 @@ | |||
120 | 519 | 519 | ||
121 | 520 | return values, nb_line, error | 520 | return values, nb_line, error |
122 | 521 | 521 | ||
123 | 522 | def error_pick_already_processed(self, cr, uid, sol_id_sum, sol_id_to_wiz_line, context): | ||
124 | 523 | if not sol_id_sum: | ||
125 | 524 | return '' | ||
126 | 525 | cr.execute(''' | ||
127 | 526 | select m.sale_line_id, sum(m.product_qty) | ||
128 | 527 | from stock_move m, stock_picking p | ||
129 | 528 | where | ||
130 | 529 | m.picking_id = p.id and | ||
131 | 530 | p.type = 'out' and | ||
132 | 531 | p.subtype = 'picking' and | ||
133 | 532 | p.state = 'draft' and | ||
134 | 533 | m.state in ('assigned', 'confirmed') and | ||
135 | 534 | m.sale_line_id in %s | ||
136 | 535 | group by | ||
137 | 536 | m.sale_line_id | ||
138 | 537 | ''', (tuple(sol_id_sum.keys()),)) | ||
139 | 538 | extra_qty = {} | ||
140 | 539 | for x in cr.fetchall(): | ||
141 | 540 | if x[1] < sol_id_sum[x[0]]: | ||
142 | 541 | extra_qty[x[0]] = sol_id_sum[x[0]] - x[1] | ||
143 | 542 | |||
144 | 543 | already_process = {} | ||
145 | 544 | if extra_qty: | ||
146 | 545 | cr.execute(''' | ||
147 | 546 | select m.sale_line_id, sum(m.product_qty) | ||
148 | 547 | from stock_move m, stock_picking p | ||
149 | 548 | where | ||
150 | 549 | m.picking_id = p.id and | ||
151 | 550 | p.type = 'out' and | ||
152 | 551 | p.state not in ('draft', 'cancel') and | ||
153 | 552 | m.sale_line_id in %s | ||
154 | 553 | group by | ||
155 | 554 | m.sale_line_id | ||
156 | 555 | ''', (tuple(extra_qty.keys()),)) | ||
157 | 556 | for x in cr.fetchall(): | ||
158 | 557 | already_process[x[0]] = x[1] | ||
159 | 558 | |||
160 | 559 | if already_process: | ||
161 | 560 | details = [] | ||
162 | 561 | for sol in self.pool.get('sale.order.line').browse(cr, uid, already_process.keys(), fields_to_fetch=['product_id'], context=context): | ||
163 | 562 | details.append('Line number: %s, [%s] %s' % (sol_id_to_wiz_line.get(sol.id),sol.product_id.default_code, sol.product_id.name)) | ||
164 | 563 | return _('Warning the following product lines have already been processed in linked OUT/Pick document, so cannot be processed here. Please remove these lines before trying to processs the movement\n%s') % ("\n".join(details)) | ||
165 | 564 | return '' | ||
166 | 565 | |||
167 | 522 | # Simulation routing | 566 | # Simulation routing |
168 | 523 | def simulate(self, dbname, uid, ids, context=None): | 567 | def simulate(self, dbname, uid, ids, context=None): |
169 | 524 | ''' | 568 | ''' |
170 | @@ -966,6 +1010,27 @@ | |||
171 | 966 | err = _('Line %s of the Excel file: %s') % (file_line[0], err) | 1010 | err = _('Line %s of the Excel file: %s') % (file_line[0], err) |
172 | 967 | values_line_errors.append(err) | 1011 | values_line_errors.append(err) |
173 | 968 | 1012 | ||
174 | 1013 | if wiz.with_pack and not context.get('auto_import_ok'): | ||
175 | 1014 | # check if an out line has been forced | ||
176 | 1015 | cr.execute(''' | ||
177 | 1016 | select wiz_line.line_number, pol.linked_sol_id, sum(wiz_line.imp_product_qty) | ||
178 | 1017 | from wizard_import_in_line_simulation_screen wiz_line | ||
179 | 1018 | left join wizard_import_in_simulation_screen wiz on wiz.id = wiz_line.simu_id | ||
180 | 1019 | left join stock_move move_in on move_in.picking_id = wiz.picking_id and move_in.line_number = wiz_line.line_number | ||
181 | 1020 | left join purchase_order_line pol on pol.id = move_in.purchase_line_id | ||
182 | 1021 | where | ||
183 | 1022 | (wiz_line.type_change in ('', 'split') or wiz_line.type_change is NULL) and | ||
184 | 1023 | wiz.id = %s | ||
185 | 1024 | group by wiz_line.line_number, pol.linked_sol_id | ||
186 | 1025 | ''', (wiz.id,)) | ||
187 | 1026 | sol_id_to_wiz_line = {} | ||
188 | 1027 | sol_id_sum = {} | ||
189 | 1028 | for x in cr.fetchall(): | ||
190 | 1029 | sol_id_to_wiz_line[x[1]] = x[0] | ||
191 | 1030 | sol_id_sum[x[1]] = x[2] | ||
192 | 1031 | error_pick = self.error_pick_already_processed(cr, uid, sol_id_sum, sol_id_to_wiz_line, context) | ||
193 | 1032 | if error_pick: | ||
194 | 1033 | values_line_errors.append(error_pick) | ||
195 | 969 | 1034 | ||
196 | 970 | # Create new lines | 1035 | # Create new lines |
197 | 971 | for in_line in new_in_lines: | 1036 | for in_line in new_in_lines: |
198 | @@ -1049,7 +1114,7 @@ | |||
199 | 1049 | 1114 | ||
200 | 1050 | return {'type': 'ir.actions.act_window_close'} | 1115 | return {'type': 'ir.actions.act_window_close'} |
201 | 1051 | 1116 | ||
203 | 1052 | def _import_with_thread(self, cr, uid, partial_id, simu_id, context=None): | 1117 | def _import_with_thread(self, cr, uid, partial_id, simu_id, context=None, with_ppl=False): |
204 | 1053 | inc_proc_obj = self.pool.get('stock.incoming.processor') | 1118 | inc_proc_obj = self.pool.get('stock.incoming.processor') |
205 | 1054 | in_proc_obj = self.pool.get('stock.move.in.processor') | 1119 | in_proc_obj = self.pool.get('stock.move.in.processor') |
206 | 1055 | picking_obj = self.pool.get('stock.picking') | 1120 | picking_obj = self.pool.get('stock.picking') |
207 | @@ -1063,7 +1128,7 @@ | |||
208 | 1063 | prodlot_id = self.pool.get('stock.production.lot')._get_prodlot_from_expiry_date(new_cr, uid, line.expiry_date, line.product_id.id, context=context) | 1128 | prodlot_id = self.pool.get('stock.production.lot')._get_prodlot_from_expiry_date(new_cr, uid, line.expiry_date, line.product_id.id, context=context) |
209 | 1064 | in_proc_obj.write(new_cr, uid, [line.id], {'prodlot_id': prodlot_id}, context=context) | 1129 | in_proc_obj.write(new_cr, uid, [line.id], {'prodlot_id': prodlot_id}, context=context) |
210 | 1065 | 1130 | ||
212 | 1066 | new_picking = picking_obj.do_incoming_shipment(new_cr, uid, partial_id, context=context) | 1131 | new_picking = picking_obj.do_incoming_shipment(new_cr, uid, partial_id, context=context, with_ppl=with_ppl) |
213 | 1067 | if isinstance(new_picking, (int,long)): | 1132 | if isinstance(new_picking, (int,long)): |
214 | 1068 | context['new_picking'] = new_picking | 1133 | context['new_picking'] = new_picking |
215 | 1069 | new_cr.commit() | 1134 | new_cr.commit() |
216 | @@ -1087,7 +1152,7 @@ | |||
217 | 1087 | return True | 1152 | return True |
218 | 1088 | 1153 | ||
219 | 1089 | 1154 | ||
221 | 1090 | def _import(self, cr, uid, ids, context=None): | 1155 | def _import(self, cr, uid, ids, context=None, with_ppl=False): |
222 | 1091 | ''' | 1156 | ''' |
223 | 1092 | Create memeory moves and return to the standard incoming processing wizard | 1157 | Create memeory moves and return to the standard incoming processing wizard |
224 | 1093 | ''' | 1158 | ''' |
225 | @@ -1122,9 +1187,9 @@ | |||
226 | 1122 | cr.commit() | 1187 | cr.commit() |
227 | 1123 | if context.get('do_not_import_with_thread'): | 1188 | if context.get('do_not_import_with_thread'): |
228 | 1124 | # Auto VI IN import: do not process IN | 1189 | # Auto VI IN import: do not process IN |
230 | 1125 | self._import_with_thread(cr, uid, [partial_id], simu_id.id, context=context) | 1190 | self._import_with_thread(cr, uid, [partial_id], simu_id.id, context=context, with_ppl=with_ppl) |
231 | 1126 | else: | 1191 | else: |
233 | 1127 | new_thread = threading.Thread(target=self._import_with_thread, args=(cr, uid, [partial_id], simu_id.id, context)) | 1192 | new_thread = threading.Thread(target=self._import_with_thread, args=(cr, uid, [partial_id], simu_id.id, context, with_ppl)) |
234 | 1128 | new_thread.start() | 1193 | new_thread.start() |
235 | 1129 | new_thread.join(20) | 1194 | new_thread.join(20) |
236 | 1130 | if new_thread.isAlive(): | 1195 | if new_thread.isAlive(): |
237 | @@ -1157,18 +1222,35 @@ | |||
238 | 1157 | _name = 'wizard.import.in.pack.simulation.screen' | 1222 | _name = 'wizard.import.in.pack.simulation.screen' |
239 | 1158 | _rec_name = 'parcel_from' | 1223 | _rec_name = 'parcel_from' |
240 | 1159 | 1224 | ||
241 | 1225 | def _get_real_total(self, cr, uid, ids, f, a, context=None): | ||
242 | 1226 | res = {} | ||
243 | 1227 | for pack in self.browse(cr, uid, ids, context=context): | ||
244 | 1228 | res[pack.id] = {'real_total_volume': False, 'real_total_weight': False} | ||
245 | 1229 | |||
246 | 1230 | if pack.parcel_to and pack.parcel_from: | ||
247 | 1231 | nb_pack = pack.parcel_to - pack.parcel_from + 1 | ||
248 | 1232 | if pack.total_weight: | ||
249 | 1233 | res[pack.id]['real_total_weight'] = int(round(nb_pack * pack.total_weight, 0)) | ||
250 | 1234 | if pack.total_height and pack.total_length and pack.total_width: | ||
251 | 1235 | res[pack.id]['real_total_volume'] = int(round(pack.total_height * pack.total_length * pack.total_width * nb_pack / 1000, 0)) | ||
252 | 1236 | return res | ||
253 | 1237 | |||
254 | 1160 | _columns = { | 1238 | _columns = { |
255 | 1161 | 'wizard_id': fields.many2one('wizard.import.in.simulation.screen', 'Simu Wizard'), | 1239 | 'wizard_id': fields.many2one('wizard.import.in.simulation.screen', 'Simu Wizard'), |
264 | 1162 | 'parcel_from': fields.integer('Parcel From'), | 1240 | 'parcel_from': fields.integer_null('Parcel From'), |
265 | 1163 | 'parcel_to': fields.integer('Parcel To'), | 1241 | 'parcel_to': fields.integer_null('Parcel To'), |
266 | 1164 | 'parcel_qty': fields.integer('Parcel Qty'), | 1242 | 'parcel_qty': fields.integer_null('Parcel Qty'), |
267 | 1165 | 'total_weight': fields.float('Weight', digits=(16,2)), | 1243 | # on IN VI import file the fields are named total_xxx but the figures are p.p |
268 | 1166 | 'total_volume': fields.float('Volume', digits=(16,2)), | 1244 | 'total_weight': fields.float_null('Weight', digits=(16,2)), |
269 | 1167 | 'total_height': fields.float('Height', digits=(16,2)), | 1245 | 'total_volume': fields.float_null('Volume', digits=(16,2)), |
270 | 1168 | 'total_length': fields.float('Length', digits=(16,2)), | 1246 | 'total_height': fields.float_null('Height', digits=(16,2)), |
271 | 1169 | 'total_width': fields.float('Width', digits=(16,2)), | 1247 | 'total_length': fields.float_null('Length', digits=(16,2)), |
272 | 1248 | 'total_width': fields.float_null('Width', digits=(16,2)), | ||
273 | 1170 | 'packing_list': fields.char('Supplier Packing List', size=30), | 1249 | 'packing_list': fields.char('Supplier Packing List', size=30), |
274 | 1250 | 'ppl_name': fields.char('Supplier Packing List', size=128), | ||
275 | 1171 | 'integrity_status': fields.selection(string='Integrity Status', selection=PACK_INTEGRITY_STATUS_SELECTION, readonly=True), | 1251 | 'integrity_status': fields.selection(string='Integrity Status', selection=PACK_INTEGRITY_STATUS_SELECTION, readonly=True), |
276 | 1252 | 'real_total_volume': fields.function(_get_real_total, method=True, type='integer_null', string='Total volume for all packs', multi='real_total'), | ||
277 | 1253 | 'real_total_weight': fields.function(_get_real_total, method=True, type='integer_null', string='Total weight for all packs', multi='real_total'), | ||
278 | 1172 | } | 1254 | } |
279 | 1173 | 1255 | ||
280 | 1174 | _defaults = { | 1256 | _defaults = { |
281 | 1175 | 1257 | ||
282 | === modified file 'bin/addons/msf_outgoing/wizard/incoming_shipment_processor.py' | |||
283 | --- bin/addons/msf_outgoing/wizard/incoming_shipment_processor.py 2019-08-28 08:33:22 +0000 | |||
284 | +++ bin/addons/msf_outgoing/wizard/incoming_shipment_processor.py 2020-08-05 12:54:43 +0000 | |||
285 | @@ -125,10 +125,11 @@ | |||
286 | 125 | context = {} | 125 | context = {} |
287 | 126 | 126 | ||
288 | 127 | res = {} | 127 | res = {} |
290 | 128 | for wiz in self.browse(cr, uid, ids, context=context): | 128 | for wiz in self.browse(cr, uid, ids, fields_to_fetch=['linked_to_out', 'picking_id'], context=context): |
291 | 129 | res[wiz.id] = False | 129 | res[wiz.id] = False |
294 | 130 | if wiz.picking_id and wiz.picking_id.state == 'updated' and wiz.linked_to_out: | 130 | if wiz.picking_id and wiz.linked_to_out: |
295 | 131 | res[wiz.id] = True | 131 | if not self.pool.get('stock.move.in.processor').search_exist(cr, uid, [('wizard_id', '=', wiz.id),('pack_info_id', '=', False)], context=context): |
296 | 132 | res[wiz.id] = wiz.linked_to_out | ||
297 | 132 | 133 | ||
298 | 133 | return res | 134 | return res |
299 | 134 | 135 | ||
300 | @@ -158,7 +159,6 @@ | |||
301 | 158 | 159 | ||
302 | 159 | return res | 160 | return res |
303 | 160 | 161 | ||
304 | 161 | |||
305 | 162 | _columns = { | 162 | _columns = { |
306 | 163 | 'move_ids': fields.one2many( | 163 | 'move_ids': fields.one2many( |
307 | 164 | 'stock.move.in.processor', | 164 | 'stock.move.in.processor', |
308 | @@ -194,7 +194,7 @@ | |||
309 | 194 | ), | 194 | ), |
310 | 195 | 'draft': fields.boolean('Draft'), | 195 | 'draft': fields.boolean('Draft'), |
311 | 196 | 'already_processed': fields.boolean('Already processed'), | 196 | 'already_processed': fields.boolean('Already processed'), |
313 | 197 | 'linked_to_out': fields.boolean('Is this IN linked to a single Pick (same FO) ?'), | 197 | 'linked_to_out': fields.char('If the IN is linked to a single Pick (same FO) give the type of delivery doc (standard / picking)', size=16), |
314 | 198 | 'register_a_claim': fields.boolean( | 198 | 'register_a_claim': fields.boolean( |
315 | 199 | string='Register a Claim to Supplier', | 199 | string='Register a Claim to Supplier', |
316 | 200 | ), | 200 | ), |
317 | @@ -218,8 +218,10 @@ | |||
318 | 218 | 'claim_description': fields.text( | 218 | 'claim_description': fields.text( |
319 | 219 | string='Claim Description', | 219 | string='Claim Description', |
320 | 220 | ), | 220 | ), |
322 | 221 | 'display_process_to_ship_button': fields.function(_get_display_process_to_ship_button, method=True, type='boolean', string='Process to ship'), | 221 | 'display_process_to_ship_button': fields.function(_get_display_process_to_ship_button, method=True, type='char', string='Process to ship'), |
323 | 222 | 'location_dest_active_ok': fields.function(_get_location_dest_active_ok, method=True, type='boolean', string='Dest location is inactive ?', store=False), | 222 | 'location_dest_active_ok': fields.function(_get_location_dest_active_ok, method=True, type='boolean', string='Dest location is inactive ?', store=False), |
324 | 223 | 'fields_as_ro': fields.boolean('Set Cost/Split .. as RO', internal=True), | ||
325 | 224 | 'sequence_issue': fields.boolean('Issue with To ship'), | ||
326 | 223 | } | 225 | } |
327 | 224 | 226 | ||
328 | 225 | _defaults = { | 227 | _defaults = { |
329 | @@ -248,17 +250,33 @@ | |||
330 | 248 | picking = picking_obj.browse(cr, uid, vals.get('picking_id'), context=context) | 250 | picking = picking_obj.browse(cr, uid, vals.get('picking_id'), context=context) |
331 | 249 | 251 | ||
332 | 250 | cr.execute(""" | 252 | cr.execute(""" |
334 | 251 | select so.id from | 253 | select so.id, array_agg(distinct(out.name)), count(distinct(so.procurement_request)) from |
335 | 252 | stock_move m | 254 | stock_move m |
336 | 253 | left join stock_picking p on m.picking_id = p.id | 255 | left join stock_picking p on m.picking_id = p.id |
337 | 254 | left join purchase_order_line pol on m.purchase_line_id = pol.id | 256 | left join purchase_order_line pol on m.purchase_line_id = pol.id |
338 | 255 | left join sale_order_line sol on sol.id = pol.linked_sol_id | 257 | left join sale_order_line sol on sol.id = pol.linked_sol_id |
339 | 256 | left join sale_order so on so.id = sol.order_id | 258 | left join sale_order so on so.id = sol.order_id |
341 | 257 | where m.picking_id = %s and so.procurement_request = 'f' and coalesce(p.claim, 'f') = 'f' | 259 | left join stock_picking out on out.sale_id = so.id and out.type = 'out' and (out.subtype = 'picking' and out.state='draft' or out.subtype = 'standard' and out.state in ('draft', 'confirmed', 'assigned')) |
342 | 260 | where | ||
343 | 261 | m.picking_id = %s and | ||
344 | 262 | coalesce(p.claim, 'f') = 'f' | ||
345 | 258 | group by so.id | 263 | group by so.id |
346 | 259 | """, (vals.get('picking_id'), )) | 264 | """, (vals.get('picking_id'), )) |
347 | 260 | if cr.rowcount == 1: | 265 | if cr.rowcount == 1: |
349 | 261 | vals['linked_to_out'] = True | 266 | fetch_data = cr.fetchone() |
350 | 267 | if fetch_data[2] > 1: | ||
351 | 268 | # IN mixed with FO/IR | ||
352 | 269 | vals['linked_to_out'] = False | ||
353 | 270 | |||
354 | 271 | out_names = fetch_data[1] | ||
355 | 272 | out_type = False | ||
356 | 273 | for out_name in out_names: | ||
357 | 274 | if out_name and out_name.startswith('OUT/'): | ||
358 | 275 | out_type = out_name | ||
359 | 276 | break | ||
360 | 277 | if not out_type: | ||
361 | 278 | out_type = out_names and len(out_names) == 1 and out_names[0] and out_names[0].startswith('PICK/') and 'picking' or False | ||
362 | 279 | vals['linked_to_out'] = out_type | ||
363 | 262 | else: | 280 | else: |
364 | 263 | vals['linked_to_out'] = False | 281 | vals['linked_to_out'] = False |
365 | 264 | 282 | ||
366 | @@ -623,8 +641,18 @@ | |||
367 | 623 | 641 | ||
368 | 624 | 642 | ||
369 | 625 | def launch_simulation_pack(self, cr, uid, ids, context=None): | 643 | def launch_simulation_pack(self, cr, uid, ids, context=None): |
370 | 644 | if context is None: | ||
371 | 645 | context = {} | ||
372 | 646 | |||
373 | 647 | if not context.get('auto_import_ok'): | ||
374 | 648 | out = self.read(cr, uid, ids[0], ['linked_to_out'], context=context) | ||
375 | 649 | if out['linked_to_out'] != 'picking': | ||
376 | 650 | raise osv.except_osv(_('Warning'), _('This type of import cannot be used because related PICK document has been converted to %s') % out['linked_to_out']) | ||
377 | 651 | |||
378 | 626 | data = self.launch_simulation(cr, uid, ids, context) | 652 | data = self.launch_simulation(cr, uid, ids, context) |
379 | 627 | self.pool.get('wizard.import.in.simulation.screen').write(cr, uid, data['res_id'], {'with_pack': True}) | 653 | self.pool.get('wizard.import.in.simulation.screen').write(cr, uid, data['res_id'], {'with_pack': True}) |
380 | 654 | |||
381 | 655 | |||
382 | 628 | data['name'] = _('Incoming shipment simulation screen (pick and pack mode)') | 656 | data['name'] = _('Incoming shipment simulation screen (pick and pack mode)') |
383 | 629 | 657 | ||
384 | 630 | file_attached = self.check_if_has_import_file_in_attachment(cr, uid, ids, context=context) | 658 | file_attached = self.check_if_has_import_file_in_attachment(cr, uid, ids, context=context) |
385 | @@ -634,7 +662,8 @@ | |||
386 | 634 | 'filetype': self.pool.get('stock.picking').get_import_filetype(cr, uid, file_attached['name'], context=context), | 662 | 'filetype': self.pool.get('stock.picking').get_import_filetype(cr, uid, file_attached['name'], context=context), |
387 | 635 | }, context=context) | 663 | }, context=context) |
388 | 636 | self.pool.get('wizard.import.in.simulation.screen').launch_simulate(cr, uid, data['res_id'], context=context) | 664 | self.pool.get('wizard.import.in.simulation.screen').launch_simulate(cr, uid, data['res_id'], context=context) |
390 | 637 | self.pool.get('wizard.import.in.simulation.screen').launch_import_pack(cr, uid, data['res_id'], context=context) | 665 | # the following line process the IN but display the simu screen |
391 | 666 | #self.pool.get('wizard.import.in.simulation.screen').launch_import_pack(cr, uid, data['res_id'], context=context) | ||
392 | 638 | return data | 667 | return data |
393 | 639 | 668 | ||
394 | 640 | 669 | ||
395 | @@ -657,11 +686,6 @@ | |||
396 | 657 | if num_of_packs: | 686 | if num_of_packs: |
397 | 658 | if not self.pool.get('ppl.processor')._check_rounding(cr, uid, move.uom_id, num_of_packs, move.quantity, context=context): | 687 | if not self.pool.get('ppl.processor')._check_rounding(cr, uid, move.uom_id, num_of_packs, move.quantity, context=context): |
398 | 659 | rounding_issues.append(move.line_number) | 688 | rounding_issues.append(move.line_number) |
399 | 660 | if move.integrity_status and move.integrity_status != 'empty': | ||
400 | 661 | raise osv.except_osv( | ||
401 | 662 | _('Error'), | ||
402 | 663 | _('Please correct red lines before processing') | ||
403 | 664 | ) | ||
404 | 665 | 689 | ||
405 | 666 | if not total_qty: | 690 | if not total_qty: |
406 | 667 | raise osv.except_osv( | 691 | raise osv.except_osv( |
407 | @@ -731,10 +755,35 @@ | |||
408 | 731 | if isinstance(ids, (int,long)): | 755 | if isinstance(ids, (int,long)): |
409 | 732 | ids = [ids] | 756 | ids = [ids] |
410 | 733 | 757 | ||
411 | 758 | out = self.read(cr, uid, ids[0], ['linked_to_out'], context=context) | ||
412 | 759 | if out['linked_to_out'] != 'picking': | ||
413 | 760 | raise osv.except_osv(_('Warning'), _('This type of import cannot be used because related PICK document has been converted to %s') % out['linked_to_out']) | ||
414 | 761 | |||
415 | 734 | rounding_issues, sequence_ok = self.check_before_creating_pack_lines(cr, uid, ids, context=context) | 762 | rounding_issues, sequence_ok = self.check_before_creating_pack_lines(cr, uid, ids, context=context) |
416 | 763 | cr.execute(''' | ||
417 | 764 | select wiz_line.line_number, pol.linked_sol_id, sum(wiz_line.quantity) | ||
418 | 765 | from stock_move_in_processor wiz_line | ||
419 | 766 | left join stock_incoming_processor wiz on wiz.id = wiz_line.wizard_id | ||
420 | 767 | left join stock_move move_in on move_in.picking_id = wiz.picking_id and move_in.line_number = wiz_line.line_number | ||
421 | 768 | left join purchase_order_line pol on pol.id = move_in.purchase_line_id | ||
422 | 769 | where | ||
423 | 770 | wiz.id = %s | ||
424 | 771 | group by wiz_line.line_number, pol.linked_sol_id | ||
425 | 772 | ''', (ids[0],)) | ||
426 | 773 | sol_id_to_wiz_line = {} | ||
427 | 774 | sol_id_sum = {} | ||
428 | 775 | for x in cr.fetchall(): | ||
429 | 776 | sol_id_to_wiz_line[x[1]] = x[0] | ||
430 | 777 | sol_id_sum[x[1]] = x[2] | ||
431 | 778 | |||
432 | 779 | error_pick = self.pool.get('wizard.import.in.simulation.screen').error_pick_already_processed(cr, uid, sol_id_sum, sol_id_to_wiz_line, context) | ||
433 | 780 | if error_pick: | ||
434 | 781 | raise osv.except_osv(_('Error'), error_pick) | ||
435 | 735 | 782 | ||
436 | 736 | if not sequence_ok: | 783 | if not sequence_ok: |
437 | 737 | view_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'msf_outgoing', 'stock_incoming_processor_form_view')[1] | 784 | view_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'msf_outgoing', 'stock_incoming_processor_form_view')[1] |
438 | 785 | self.write(cr, uid, ids, {'sequence_issue': True}, context=context) | ||
439 | 786 | |||
440 | 738 | return { | 787 | return { |
441 | 739 | 'name': _('Products to Process'), | 788 | 'name': _('Products to Process'), |
442 | 740 | 'type': 'ir.actions.act_window', | 789 | 'type': 'ir.actions.act_window', |
443 | @@ -765,7 +814,8 @@ | |||
444 | 765 | 'context': context, | 814 | 'context': context, |
445 | 766 | } | 815 | } |
446 | 767 | 816 | ||
448 | 768 | return self.do_process_to_ship(cr, uid, ids, context=context) | 817 | self.pool.get('stock.picking').do_incoming_shipment(cr, uid, ids, context=context, with_ppl=True) |
449 | 818 | return {'type': 'ir.actions.act_window_close'} | ||
450 | 769 | 819 | ||
451 | 770 | 820 | ||
452 | 771 | def do_process_to_ship(self, cr, uid, ids, context=None): | 821 | def do_process_to_ship(self, cr, uid, ids, context=None): |
453 | @@ -851,6 +901,7 @@ | |||
454 | 851 | _name = 'stock.move.in.processor' | 901 | _name = 'stock.move.in.processor' |
455 | 852 | _inherit = 'stock.move.processor' | 902 | _inherit = 'stock.move.processor' |
456 | 853 | _description = 'Wizard lines for incoming shipment processing' | 903 | _description = 'Wizard lines for incoming shipment processing' |
457 | 904 | _order = 'line_number, from_pack, id' | ||
458 | 854 | 905 | ||
459 | 855 | def _get_move_info(self, cr, uid, ids, field_name, args, context=None): | 906 | def _get_move_info(self, cr, uid, ids, field_name, args, context=None): |
460 | 856 | return super(stock_move_in_processor, self)._get_move_info(cr, uid, ids, field_name, args, context=context) | 907 | return super(stock_move_in_processor, self)._get_move_info(cr, uid, ids, field_name, args, context=context) |
461 | @@ -958,6 +1009,31 @@ | |||
462 | 958 | cr.execute(sql, (value, ml_id)) | 1009 | cr.execute(sql, (value, ml_id)) |
463 | 959 | return True | 1010 | return True |
464 | 960 | 1011 | ||
465 | 1012 | def _get_pack_info(self, cr, uid, ids, field_name, args, context=None): | ||
466 | 1013 | if context is None: | ||
467 | 1014 | context = {} | ||
468 | 1015 | if isinstance(ids, (int,long)): | ||
469 | 1016 | ids = [ids] | ||
470 | 1017 | |||
471 | 1018 | res = {} | ||
472 | 1019 | for wiz in self.browse(cr, uid, ids, fields_to_fetch=['from_pack', 'to_pack'], context=context): | ||
473 | 1020 | if wiz['from_pack']: | ||
474 | 1021 | res[wiz.id] = '%s-%s' % (wiz['from_pack'], wiz['to_pack']) | ||
475 | 1022 | else: | ||
476 | 1023 | res[wiz.id] = False | ||
477 | 1024 | return res | ||
478 | 1025 | |||
479 | 1026 | def _search_pack_info(self, cr, uid, obj, name, args, context): | ||
480 | 1027 | dom = [] | ||
481 | 1028 | for arg in args: | ||
482 | 1029 | if arg[2]: | ||
483 | 1030 | d_p = arg[2].split('-') | ||
484 | 1031 | if d_p and d_p[0] and d_p[0].strip(): | ||
485 | 1032 | dom = [('from_pack', '=', d_p[0].strip())] | ||
486 | 1033 | if d_p and len(d_p)>1 and d_p[1] and d_p[1].strip(): | ||
487 | 1034 | dom.append(('to_pack', '=', d_p[1].strip())) | ||
488 | 1035 | return dom | ||
489 | 1036 | |||
490 | 961 | _columns = { | 1037 | _columns = { |
491 | 962 | # Parent wizard | 1038 | # Parent wizard |
492 | 963 | 'wizard_id': fields.many2one( | 1039 | 'wizard_id': fields.many2one( |
493 | @@ -1184,17 +1260,21 @@ | |||
494 | 1184 | help="Ticked if the product is a Controlled Substance", | 1260 | help="Ticked if the product is a Controlled Substance", |
495 | 1185 | ), | 1261 | ), |
496 | 1186 | 'pack_info_id': fields.many2one('wizard.import.in.pack.simulation.screen', 'Pack Info'), | 1262 | 'pack_info_id': fields.many2one('wizard.import.in.pack.simulation.screen', 'Pack Info'), |
504 | 1187 | 'from_pack': fields.integer(string='From p.'), | 1263 | 'from_pack': fields.integer_null(string='From p.'), |
505 | 1188 | 'to_pack': fields.integer(string='To p.'), | 1264 | 'to_pack': fields.integer_null(string='To p.'), |
506 | 1189 | 'weight': fields.float('Weight', digits=(16,2)), | 1265 | 'weight': fields.float_null('Weight', digits=(16,2)), |
507 | 1190 | 'volume': fields.float('Volume', digits=(16,2)), | 1266 | 'volume': fields.float_null('Volume', digits=(16,2)), |
508 | 1191 | 'height': fields.float('Height', digits=(16,2)), | 1267 | 'height': fields.float_null('Height', digits=(16,2)), |
509 | 1192 | 'length': fields.float('Length', digits=(16,2)), | 1268 | 'total_volume': fields.float_null(u'Total Volume [dm³]', digits=(16,0)), |
510 | 1193 | 'width': fields.float('Width', digits=(16,2)), | 1269 | 'total_weight': fields.float_null(u'Total Weight [kg]', digits=(16,0)), |
511 | 1270 | 'length': fields.float_null('Length', digits=(16,2)), | ||
512 | 1271 | 'width': fields.float_null('Width', digits=(16,2)), | ||
513 | 1194 | 'pack_id': fields.many2one('in.family.processor', string='Pack', ondelete='set null'), | 1272 | 'pack_id': fields.many2one('in.family.processor', string='Pack', ondelete='set null'), |
514 | 1195 | 'packing_list': fields.char('Supplier Packing List', size=30), | 1273 | 'packing_list': fields.char('Supplier Packing List', size=30), |
515 | 1274 | 'ppl_name': fields.char('Packing List', size=128), | ||
516 | 1196 | 'sequence_issue': fields.selection(PACK_INTEGRITY_STATUS_SELECTION, 'Sequence issue', readonly=True), | 1275 | 'sequence_issue': fields.selection(PACK_INTEGRITY_STATUS_SELECTION, 'Sequence issue', readonly=True), |
517 | 1197 | 'split_move_ok': fields.boolean(string='Is split move ?'), | 1276 | 'split_move_ok': fields.boolean(string='Is split move ?'), |
518 | 1277 | 'filter_pack': fields.function(_get_pack_info, method=True, type='char', string='Pack', fnct_search=_search_pack_info), | ||
519 | 1198 | } | 1278 | } |
520 | 1199 | 1279 | ||
521 | 1200 | 1280 | ||
522 | @@ -1217,13 +1297,21 @@ | |||
523 | 1217 | if context is None: | 1297 | if context is None: |
524 | 1218 | context = {} | 1298 | context = {} |
525 | 1219 | 1299 | ||
526 | 1300 | if not vals.get('cost'): | ||
527 | 1301 | # issue on IN processor from sync if new line created (because of a split in coordo) | ||
528 | 1302 | # then the price_unit should not come from product standard_price but from the original stock.move (i.e: from POL) | ||
529 | 1303 | # before this the unit price was temporary set to the standard_price, but changed on IN processing, this was too late | ||
530 | 1304 | if vals.get('move_id'): | ||
531 | 1305 | move_data = self.pool.get('stock.move').browse(cr, uid, vals['move_id'], fields_to_fetch=['price_unit', 'currency_id'], context=context) | ||
532 | 1306 | vals['cost'] = move_data.price_unit | ||
533 | 1307 | vals['currency'] = move_data.currency_id.id | ||
534 | 1308 | |||
535 | 1220 | if vals.get('product_id', False): | 1309 | if vals.get('product_id', False): |
536 | 1221 | if not vals.get('cost', False): | 1310 | if not vals.get('cost', False): |
537 | 1222 | price = product_obj.browse(cr, uid, vals['product_id'], context=context).standard_price | 1311 | price = product_obj.browse(cr, uid, vals['product_id'], context=context).standard_price |
538 | 1223 | vals['cost'] = price | 1312 | vals['cost'] = price |
539 | 1224 | if not vals.get('currency', False): | 1313 | if not vals.get('currency', False): |
540 | 1225 | vals['currency'] = user_obj.browse(cr, uid, uid, context=context).company_id.currency_id.id | 1314 | vals['currency'] = user_obj.browse(cr, uid, uid, context=context).company_id.currency_id.id |
541 | 1226 | |||
542 | 1227 | return super(stock_move_in_processor, self).create(cr, uid, vals, context=context) | 1315 | return super(stock_move_in_processor, self).create(cr, uid, vals, context=context) |
543 | 1228 | 1316 | ||
544 | 1229 | 1317 | ||
545 | 1230 | 1318 | ||
546 | === modified file 'bin/addons/msf_outgoing/wizard/incoming_shipment_processor_view.xml' | |||
547 | --- bin/addons/msf_outgoing/wizard/incoming_shipment_processor_view.xml 2019-08-28 08:33:22 +0000 | |||
548 | +++ bin/addons/msf_outgoing/wizard/incoming_shipment_processor_view.xml 2020-08-05 12:54:43 +0000 | |||
549 | @@ -12,11 +12,13 @@ | |||
550 | 12 | <field name="linked_to_out" invisible="1"/> | 12 | <field name="linked_to_out" invisible="1"/> |
551 | 13 | <field name="picking_id" invisible="1" /> | 13 | <field name="picking_id" invisible="1" /> |
552 | 14 | <field name="display_process_to_ship_button" invisible="1" /> | 14 | <field name="display_process_to_ship_button" invisible="1" /> |
555 | 15 | <button name="copy_all" type="object" icon="gtk-jump-to" colspan="2" string="Copy all" /> | 15 | <field name="sequence_issue" invisible="1" /> |
556 | 16 | <button name="uncopy_all" type="object" icon="gtk-undo" colspan="2" string="Clear all" /> | 16 | <field name="fields_as_ro" invisible="1" /> |
557 | 17 | <button name="copy_all" type="object" icon="gtk-jump-to" colspan="2" string="Copy all" set_ids="move_ids"/> | ||
558 | 18 | <button name="uncopy_all" type="object" icon="gtk-undo" colspan="2" string="Clear all" set_ids="move_ids"/> | ||
559 | 17 | <group name="import_file_lines" string="Import Lines" colspan="4"> | 19 | <group name="import_file_lines" string="Import Lines" colspan="4"> |
560 | 18 | <button name="launch_simulation" string="Import IN" icon="gtk-execute" colspan="1" type="object" /> | 20 | <button name="launch_simulation" string="Import IN" icon="gtk-execute" colspan="1" type="object" /> |
562 | 19 | <button name="launch_simulation_pack" string="Import IN, process IN & pick and pack" icon="gtk-execute" colspan="1" type="object" attrs="{'invisible': [('linked_to_out', '!=', True)]}"/> | 21 | <button name="launch_simulation_pack" string="Import IN, process IN & pick and pack" icon="gtk-execute" colspan="1" type="object" attrs="{'invisible': [('linked_to_out', '=', False)]}"/> |
563 | 20 | </group> | 22 | </group> |
564 | 21 | <field name="contains_dg" invisible="1" /> | 23 | <field name="contains_dg" invisible="1" /> |
565 | 22 | <field name="contains_kc" invisible="1" /> | 24 | <field name="contains_kc" invisible="1" /> |
566 | @@ -49,6 +51,15 @@ | |||
567 | 49 | </p> | 51 | </p> |
568 | 50 | </html> | 52 | </html> |
569 | 51 | </group> | 53 | </group> |
570 | 54 | <group colspan="4" attrs="{'invisible': [('sequence_issue', '=', False)]}"> | ||
571 | 55 | <html> | ||
572 | 56 | <p style="text-align: center; v-align: middle;color:#f27d0c; font-weight:bold; font-size:1.2em"> | ||
573 | 57 | <img src="/openerp/static/images/stock/gtk-dialog-warning.png" height="12" width="12" /> | ||
574 | 58 | <span><translate>Please correct red lines before processing or do not process to ship</translate></span> | ||
575 | 59 | <img src="/openerp/static/images/stock/gtk-dialog-warning.png" height="12" width="12" /> | ||
576 | 60 | </p> | ||
577 | 61 | </html> | ||
578 | 62 | </group> | ||
579 | 52 | <separator colspan="4" string="Move lines" /> | 63 | <separator colspan="4" string="Move lines" /> |
580 | 53 | <field name="move_ids" mode="tree" context="{'display_process_to_ship_button': display_process_to_ship_button}" | 64 | <field name="move_ids" mode="tree" context="{'display_process_to_ship_button': display_process_to_ship_button}" |
581 | 54 | colspan="4" nolabel="1" /> | 65 | colspan="4" nolabel="1" /> |
582 | @@ -88,7 +99,7 @@ | |||
583 | 88 | <button name="do_incoming_shipment" type="object" string="Process" icon="gtk-go-forward" attrs="{'invisible': [('location_dest_active_ok', '!=', True)]}" /> | 99 | <button name="do_incoming_shipment" type="object" string="Process" icon="gtk-go-forward" attrs="{'invisible': [('location_dest_active_ok', '!=', True)]}" /> |
584 | 89 | <button name="do_incoming_shipment" type="object" string="Process" icon="gtk-go-forward" attrs="{'invisible': [('location_dest_active_ok', '!=', False)]}" | 100 | <button name="do_incoming_shipment" type="object" string="Process" icon="gtk-go-forward" attrs="{'invisible': [('location_dest_active_ok', '!=', False)]}" |
585 | 90 | confirm="Warning the final destination location of these goods is no longer active, IN will be processed as normal but please check and process the Internal move created after manually. Continue ?" /> | 101 | confirm="Warning the final destination location of these goods is no longer active, IN will be processed as normal but please check and process the Internal move created after manually. Continue ?" /> |
587 | 91 | <button name="process_to_ship" attrs="{'invisible': [('display_process_to_ship_button', '!=', True)]}" type="object" string="Process to ship" icon="gtk-goto-last" /> | 102 | <button name="process_to_ship" attrs="{'invisible': ['|', ('display_process_to_ship_button', '=', False), ('register_a_claim', '=', True)]}" type="object" string="Process to ship" icon="gtk-goto-last" /> |
588 | 92 | </group> | 103 | </group> |
589 | 93 | </form> | 104 | </form> |
590 | 94 | </field> | 105 | </field> |
591 | @@ -129,6 +140,7 @@ | |||
592 | 129 | hide_delete_button="1" | 140 | hide_delete_button="1" |
593 | 130 | hide_new_button="1" | 141 | hide_new_button="1" |
594 | 131 | colors="red:integrity_status!='empty'" | 142 | colors="red:integrity_status!='empty'" |
595 | 143 | editable_style="new" | ||
596 | 132 | > | 144 | > |
597 | 133 | <!-- Invisible fields --> | 145 | <!-- Invisible fields --> |
598 | 134 | <field name="type_check" invisible="1" /> | 146 | <field name="type_check" invisible="1" /> |
599 | @@ -146,6 +158,7 @@ | |||
600 | 146 | type="object" | 158 | type="object" |
601 | 147 | icon="gtk-convert" | 159 | icon="gtk-convert" |
602 | 148 | string="Change Product" | 160 | string="Change Product" |
603 | 161 | attrs="{'invisible': [('fields_as_ro', '=', True)]}" | ||
604 | 149 | /> | 162 | /> |
605 | 150 | <field name="asset_id" | 163 | <field name="asset_id" |
606 | 151 | domain="[('product_id', '=', product_id)]" | 164 | domain="[('product_id', '=', product_id)]" |
607 | @@ -164,14 +177,20 @@ | |||
608 | 164 | <field name="uom_id" | 177 | <field name="uom_id" |
609 | 165 | domain="[('category_id', '=', ordered_uom_category)]" | 178 | domain="[('category_id', '=', ordered_uom_category)]" |
610 | 166 | on_change="onchange_uom_qty(uom_id, quantity)" | 179 | on_change="onchange_uom_qty(uom_id, quantity)" |
611 | 180 | attrs="{'readonly': [('fields_as_ro', '=', True)]}" | ||
612 | 167 | /> | 181 | /> |
616 | 168 | <field name="from_pack" on_change="onchange_from_pack_to_pack()" invisible="not context.get('display_process_to_ship_button')" /> | 182 | <field name="from_pack" readonly="1" /> |
617 | 169 | <field name="to_pack" on_change="onchange_from_pack_to_pack()" invisible="not context.get('display_process_to_ship_button')" /> | 183 | <field name="to_pack" readonly="1" /> |
618 | 170 | <field name="packing_list" on_change="onchange_from_pack_to_pack()" invisible="not context.get('display_process_to_ship_button')" /> | 184 | <field name="filter_pack" filter_selector="1" invisible="1" /> |
619 | 185 | <field name="total_volume" readonly="1" /> | ||
620 | 186 | <field name="total_weight" readonly="1" /> | ||
621 | 187 | <field name="ppl_name" readonly="1" filter_selector="1" /> | ||
622 | 188 | <field name="packing_list" readonly="1" filter_selector="1" /> | ||
623 | 171 | <button name="open_split_wizard" | 189 | <button name="open_split_wizard" |
624 | 172 | type="object" | 190 | type="object" |
625 | 173 | icon="terp-stock_effects-object-colorize" | 191 | icon="terp-stock_effects-object-colorize" |
626 | 174 | string="Split" | 192 | string="Split" |
627 | 193 | attrs="{'invisible': [('fields_as_ro', '=', True)]}" | ||
628 | 175 | /> | 194 | /> |
629 | 176 | <field name="prodlot_id" | 195 | <field name="prodlot_id" |
630 | 177 | domain="[('product_id', '=', product_id), ('check_type', '=', True)]" | 196 | domain="[('product_id', '=', product_id), ('check_type', '=', True)]" |
631 | @@ -187,7 +206,7 @@ | |||
632 | 187 | <field name="kc_check" widget="null_boolean" /> | 206 | <field name="kc_check" widget="null_boolean" /> |
633 | 188 | <field name="dg_check" widget="null_boolean" /> | 207 | <field name="dg_check" widget="null_boolean" /> |
634 | 189 | <field name="np_check" widget="null_boolean" /> | 208 | <field name="np_check" widget="null_boolean" /> |
636 | 190 | <field name="cost" /> | 209 | <field name="cost" attrs="{'readonly': [('fields_as_ro', '=', True)]}" /> |
637 | 191 | <field name="currency" /> | 210 | <field name="currency" /> |
638 | 192 | <field name="integrity_status" string="" /> | 211 | <field name="integrity_status" string="" /> |
639 | 193 | </tree> | 212 | </tree> |
640 | 194 | 213 | ||
641 | === modified file 'bin/addons/msf_outgoing/wizard/picking_processor.py' | |||
642 | --- bin/addons/msf_outgoing/wizard/picking_processor.py 2018-11-07 14:53:50 +0000 | |||
643 | +++ bin/addons/msf_outgoing/wizard/picking_processor.py 2020-08-05 12:54:43 +0000 | |||
644 | @@ -144,6 +144,21 @@ | |||
645 | 144 | _('No wizard found !'), | 144 | _('No wizard found !'), |
646 | 145 | ) | 145 | ) |
647 | 146 | 146 | ||
648 | 147 | if self._name == 'stock.incoming.processor': | ||
649 | 148 | line_obj = self.pool.get('stock.move.in.processor') | ||
650 | 149 | dom = context.get('selected_domain', []) | ||
651 | 150 | if dom: | ||
652 | 151 | dom = ['&', ('wizard_id', '=', ids[0])] + dom | ||
653 | 152 | else: | ||
654 | 153 | dom = [('wizard_id', '=', ids[0])] | ||
655 | 154 | lines_ids = line_obj.search(cr, uid, dom, context=context) | ||
656 | 155 | for move in line_obj.browse(cr, uid, lines_ids, context=context): | ||
657 | 156 | line_obj.write(cr, uid, [move.id], {'quantity': move.ordered_quantity}, context=context) | ||
658 | 157 | return { | ||
659 | 158 | 'type': 'ir.actions.refresh_o2m', | ||
660 | 159 | 'o2m_refresh': 'move_ids' | ||
661 | 160 | } | ||
662 | 161 | |||
663 | 147 | for wizard in self.browse(cr, uid, ids, context=context): | 162 | for wizard in self.browse(cr, uid, ids, context=context): |
664 | 148 | for move in wizard.move_ids: | 163 | for move in wizard.move_ids: |
665 | 149 | self.pool.get(move._name).write(cr, uid, [move.id], {'quantity': move.ordered_quantity}, context=context) | 164 | self.pool.get(move._name).write(cr, uid, [move.id], {'quantity': move.ordered_quantity}, context=context) |
666 | @@ -173,6 +188,21 @@ | |||
667 | 173 | _('No wizard found !'), | 188 | _('No wizard found !'), |
668 | 174 | ) | 189 | ) |
669 | 175 | 190 | ||
670 | 191 | if self._name == 'stock.incoming.processor': | ||
671 | 192 | line_obj = self.pool.get('stock.move.in.processor') | ||
672 | 193 | dom = context.get('selected_domain', []) | ||
673 | 194 | if dom: | ||
674 | 195 | dom = ['&', ('wizard_id', '=', ids[0])] + dom | ||
675 | 196 | else: | ||
676 | 197 | dom = [('wizard_id', '=', ids[0])] | ||
677 | 198 | lines_ids = line_obj.search(cr, uid, dom, context=context) | ||
678 | 199 | for move in line_obj.browse(cr, uid, lines_ids, context=context): | ||
679 | 200 | line_obj.write(cr, uid, [move.id], {'quantity': 0}, context=context) | ||
680 | 201 | return { | ||
681 | 202 | 'type': 'ir.actions.refresh_o2m', | ||
682 | 203 | 'o2m_refresh': 'move_ids' | ||
683 | 204 | } | ||
684 | 205 | |||
685 | 176 | for wizard in self.browse(cr, uid, ids, context=context): | 206 | for wizard in self.browse(cr, uid, ids, context=context): |
686 | 177 | move_obj = wizard.move_ids[0]._name | 207 | move_obj = wizard.move_ids[0]._name |
687 | 178 | move_ids = [x.id for x in wizard.move_ids] | 208 | move_ids = [x.id for x in wizard.move_ids] |
688 | @@ -218,13 +248,17 @@ | |||
689 | 218 | 'from_pack': move.pack_info_id.parcel_from, | 248 | 'from_pack': move.pack_info_id.parcel_from, |
690 | 219 | 'to_pack': move.pack_info_id.parcel_to, | 249 | 'to_pack': move.pack_info_id.parcel_to, |
691 | 220 | 'weight': move.pack_info_id.total_weight, | 250 | 'weight': move.pack_info_id.total_weight, |
692 | 251 | 'total_weight': move.pack_info_id.real_total_weight, | ||
693 | 221 | 'volume': move.pack_info_id.total_volume, | 252 | 'volume': move.pack_info_id.total_volume, |
694 | 253 | 'total_volume': move.pack_info_id.real_total_volume, | ||
695 | 222 | 'height': move.pack_info_id.total_height, | 254 | 'height': move.pack_info_id.total_height, |
696 | 223 | 'length': move.pack_info_id.total_length, | 255 | 'length': move.pack_info_id.total_length, |
697 | 224 | 'width': move.pack_info_id.total_width, | 256 | 'width': move.pack_info_id.total_width, |
698 | 225 | 'packing_list': move.pack_info_id.packing_list, | 257 | 'packing_list': move.pack_info_id.packing_list, |
699 | 258 | 'ppl_name': move.pack_info_id.ppl_name, | ||
700 | 226 | 'cost': move.price_unit, | 259 | 'cost': move.price_unit, |
701 | 227 | 'currency': move.currency_id.id, | 260 | 'currency': move.currency_id.id, |
702 | 261 | 'pack_info_id': move.pack_info_id.id, | ||
703 | 228 | }) | 262 | }) |
704 | 229 | line_obj.create(cr, uid, line_data, context=context) | 263 | line_obj.create(cr, uid, line_data, context=context) |
705 | 230 | 264 | ||
706 | @@ -1060,6 +1094,7 @@ | |||
707 | 1060 | 'nodestroy': True, | 1094 | 'nodestroy': True, |
708 | 1061 | 'target': 'new', | 1095 | 'target': 'new', |
709 | 1062 | 'res_id': split_wiz_id, | 1096 | 'res_id': split_wiz_id, |
710 | 1097 | 'keep_open': 1, | ||
711 | 1063 | 'context': context, | 1098 | 'context': context, |
712 | 1064 | } | 1099 | } |
713 | 1065 | 1100 | ||
714 | 1066 | 1101 | ||
715 | === modified file 'bin/addons/msf_outgoing/wizard/split_move_processor.py' | |||
716 | --- bin/addons/msf_outgoing/wizard/split_move_processor.py 2019-04-09 08:05:03 +0000 | |||
717 | +++ bin/addons/msf_outgoing/wizard/split_move_processor.py 2020-08-05 12:54:43 +0000 | |||
718 | @@ -83,6 +83,11 @@ | |||
719 | 83 | return { | 83 | return { |
720 | 84 | 'type': 'ir.actions.act_window_close' | 84 | 'type': 'ir.actions.act_window_close' |
721 | 85 | } | 85 | } |
722 | 86 | elif wiz['processor_type'] == 'stock.move.in.processor': | ||
723 | 87 | return { | ||
724 | 88 | 'type': 'ir.actions.refresh_popupo2m', | ||
725 | 89 | 'o2m_refresh': 'move_ids' | ||
726 | 90 | } | ||
727 | 86 | line_model = self.pool.get(wiz['processor_type']) | 91 | line_model = self.pool.get(wiz['processor_type']) |
728 | 87 | line = line_model.browse(cr, uid, wiz['processor_line_id'], context=context) | 92 | line = line_model.browse(cr, uid, wiz['processor_line_id'], context=context) |
729 | 88 | res_model = line_model._columns['wizard_id']._obj | 93 | res_model = line_model._columns['wizard_id']._obj |
730 | 89 | 94 | ||
731 | === modified file 'bin/addons/msf_printed_documents/report/report_reception.py' | |||
732 | --- bin/addons/msf_printed_documents/report/report_reception.py 2020-07-29 16:14:59 +0000 | |||
733 | +++ bin/addons/msf_printed_documents/report/report_reception.py 2020-08-05 12:54:43 +0000 | |||
734 | @@ -32,7 +32,7 @@ | |||
735 | 32 | 'time': time, | 32 | 'time': time, |
736 | 33 | 'getState': self.getState, | 33 | 'getState': self.getState, |
737 | 34 | 'enumerate': enumerate, | 34 | 'enumerate': enumerate, |
739 | 35 | 'get_lines': self.get_lines, | 35 | 'get_lines_by_packing': self.get_lines_by_packing, |
740 | 36 | 'getDateCreation': self.getDateCreation, | 36 | 'getDateCreation': self.getDateCreation, |
741 | 37 | 'getNbItem': self.getNbItem, | 37 | 'getNbItem': self.getNbItem, |
742 | 38 | 'check': self.check, | 38 | 'check': self.check, |
743 | @@ -215,10 +215,16 @@ | |||
744 | 215 | actual_receipt_date = time.strftime('%d/%m/%Y', time.strptime(o.date_done, '%Y-%m-%d %H:%M:%S')) | 215 | actual_receipt_date = time.strftime('%d/%m/%Y', time.strptime(o.date_done, '%Y-%m-%d %H:%M:%S')) |
745 | 216 | return actual_receipt_date | 216 | return actual_receipt_date |
746 | 217 | 217 | ||
751 | 218 | def get_lines(self, o): | 218 | def get_lines_by_packing(self, o): |
752 | 219 | return o.move_lines | 219 | pack_info = {} |
753 | 220 | 220 | for line in o.move_lines: | |
754 | 221 | 221 | pack_info.setdefault(line.pack_info_id or False, []).append(line) | |
755 | 222 | |||
756 | 223 | <<<<<<< TREE | ||
757 | 224 | |||
758 | 225 | ======= | ||
759 | 226 | return sorted(pack_info.items(), key=lambda x: x[0] and (x[0].ppl_name, x[0].packing_list, x[0].parcel_from)) | ||
760 | 227 | >>>>>>> MERGE-SOURCE | ||
761 | 222 | report_sxw.report_sxw('report.msf.report_reception_in', 'stock.picking', 'addons/msf_printed_documents/report/report_reception.rml', parser=report_reception, header=False) | 228 | report_sxw.report_sxw('report.msf.report_reception_in', 'stock.picking', 'addons/msf_printed_documents/report/report_reception.rml', parser=report_reception, header=False) |
762 | 223 | 229 | ||
763 | 224 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | 230 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
764 | 225 | 231 | ||
765 | === modified file 'bin/addons/msf_printed_documents/report/report_reception.rml' | |||
766 | --- bin/addons/msf_printed_documents/report/report_reception.rml 2020-06-18 15:56:24 +0000 | |||
767 | +++ bin/addons/msf_printed_documents/report/report_reception.rml 2020-08-05 12:54:43 +0000 | |||
768 | @@ -106,7 +106,7 @@ | |||
769 | 106 | <blockTableStyle id="OrderInformations2"> | 106 | <blockTableStyle id="OrderInformations2"> |
770 | 107 | <blockAlignment value="CENTER" /> | 107 | <blockAlignment value="CENTER" /> |
771 | 108 | <blockVAlign value="CENTER" /> | 108 | <blockVAlign value="CENTER" /> |
773 | 109 | <blockBackground colorName="silver" start="0,6" stop="0,6" /> | 109 | <blockBackground colorName="silver" start="0,7" stop="0,7" /> |
774 | 110 | <lineStyle kind="GRID" colorName="#000000" start="0,6" stop="-1,-1" thickness="0.5"/> | 110 | <lineStyle kind="GRID" colorName="#000000" start="0,6" stop="-1,-1" thickness="0.5"/> |
775 | 111 | <blockTopPadding value="0" /> | 111 | <blockTopPadding value="0" /> |
776 | 112 | <blockBottomPadding value="0" /> | 112 | <blockBottomPadding value="0" /> |
777 | @@ -121,6 +121,20 @@ | |||
778 | 121 | <lineStyle kind="LINEBEFORE" colorName="black" start="2,0" thickness="0.5" /> | 121 | <lineStyle kind="LINEBEFORE" colorName="black" start="2,0" thickness="0.5" /> |
779 | 122 | </blockTableStyle> | 122 | </blockTableStyle> |
780 | 123 | 123 | ||
781 | 124 | <blockTableStyle id="PackingList"> | ||
782 | 125 | <blockAlignment value="CENTER" /> | ||
783 | 126 | <blockValign value="MIDDLE" /> | ||
784 | 127 | <blockTopPadding value="10" /> | ||
785 | 128 | <blockBottomPadding value="0" /> | ||
786 | 129 | <blockBackground colorName="silver" start="0,0" stop="0,0" /> | ||
787 | 130 | <blockBackground colorName="silver" start="2,0" stop="2,0" /> | ||
788 | 131 | <blockBackground colorName="silver" start="4,0" stop="4,0" /> | ||
789 | 132 | <blockBackground colorName="silver" start="6,0" stop="6,0" /> | ||
790 | 133 | <blockBackground colorName="silver" start="8,0" stop="8,0" /> | ||
791 | 134 | <blockBackground colorName="silver" start="10,0" stop="10,0" /> | ||
792 | 135 | <lineStyle kind="LINEBEFORE" colorName="black" start="0,0" thickness="0.5" /> | ||
793 | 136 | </blockTableStyle> | ||
794 | 137 | |||
795 | 124 | <blockTableStyle id="OrderInformations4"> | 138 | <blockTableStyle id="OrderInformations4"> |
796 | 125 | <blockValign value="MIDDLE" /> | 139 | <blockValign value="MIDDLE" /> |
797 | 126 | <lineStyle kind="INNERGRID" colorName="#000000" thickness="0.5" /> | 140 | <lineStyle kind="INNERGRID" colorName="#000000" thickness="0.5" /> |
798 | @@ -410,7 +424,9 @@ | |||
799 | 410 | <tr><td></td></tr> | 424 | <tr><td></td></tr> |
800 | 411 | </blockTable> | 425 | </blockTable> |
801 | 412 | 426 | ||
803 | 413 | <blockTable colWidths="800.0" style="OrderInformations2" repeatRows="7"> | 427 | <section> |
804 | 428 | [[ repeatIn(get_lines_by_packing(objects[0]), 'pack') ]] | ||
805 | 429 | <blockTable colWidths="800.0" style="OrderInformations2" repeatRows="8"> | ||
806 | 414 | 430 | ||
807 | 415 | <tr><td></td></tr> | 431 | <tr><td></td></tr> |
808 | 416 | <tr> | 432 | <tr> |
809 | @@ -476,23 +492,72 @@ | |||
810 | 476 | 492 | ||
811 | 477 | </td> | 493 | </td> |
812 | 478 | </tr> | 494 | </tr> |
813 | 495 | <tr> | ||
814 | 496 | <td> | ||
815 | 497 | <blockTable colWidths="60,80,100,70,60,30,50,40,90,75,91,54" style="PackingList"> | ||
816 | 498 | <tr> | ||
817 | 499 | <td> | ||
818 | 500 | <para style="TextInformation5" alignment="CENTER">Packing List</para> | ||
819 | 501 | </td> | ||
820 | 502 | |||
821 | 503 | <td> | ||
822 | 504 | <para style="TextInformation5" alignment="CENTER">[[ pack[0].ppl_name ]]</para> | ||
823 | 505 | |||
824 | 506 | </td> | ||
825 | 507 | |||
826 | 508 | <td> | ||
827 | 509 | <para style="TextInformation5" alignment="CENTER">Supplier Packing List</para> | ||
828 | 510 | </td> | ||
829 | 511 | <td> | ||
830 | 512 | <para style="TextInformation5" alignment="CENTER">[[ pack[0].packing_list ]]</para> | ||
831 | 513 | </td> | ||
832 | 514 | <td> | ||
833 | 515 | <para style="TextInformation5" alignment="CENTER">From parcel</para> | ||
834 | 516 | </td> | ||
835 | 517 | <td> | ||
836 | 518 | <para style="TextInformation5" alignment="CENTER">[[ pack[0].parcel_from or '' ]]</para> | ||
837 | 519 | </td> | ||
838 | 520 | <td> | ||
839 | 521 | <para style="TextInformation5" alignment="CENTER">To parcel</para> | ||
840 | 522 | </td> | ||
841 | 523 | <td> | ||
842 | 524 | <para style="TextInformation5" alignment="CENTER">[[ pack[0].parcel_to or '' ]]</para> | ||
843 | 525 | </td> | ||
844 | 526 | <td> | ||
845 | 527 | <para style="TextInformation5" alignment="CENTER">Total volume</para> | ||
846 | 528 | </td> | ||
847 | 529 | <td> | ||
848 | 530 | <para style="TextInformation5" alignment="CENTER">[[ pack[0].real_total_volume and u'%s dm³'%pack[0].real_total_volume or '' ]]</para> | ||
849 | 531 | </td> | ||
850 | 532 | <td> | ||
851 | 533 | <para style="TextInformation5" alignment="CENTER">Total weight</para> | ||
852 | 534 | </td> | ||
853 | 535 | <td> | ||
854 | 536 | <para style="TextInformation5" alignment="CENTER">[[ pack[0].real_total_weight and '%s kg'%pack[0].real_total_weight or '' ]]</para> | ||
855 | 537 | </td> | ||
856 | 538 | </tr> | ||
857 | 539 | </blockTable> | ||
858 | 540 | |||
859 | 541 | |||
860 | 542 | </td> | ||
861 | 543 | </tr> | ||
862 | 479 | 544 | ||
863 | 480 | <tr> | 545 | <tr> |
864 | 481 | <td> | 546 | <td> |
865 | 482 | <blockTable colWidths="30,370,50,40,50,40,75,53,20,18,18,18,18" style="OrderInformations3"> | 547 | <blockTable colWidths="30,370,50,40,50,40,75,53,20,18,18,18,18" style="OrderInformations3"> |
866 | 483 | <tr> | 548 | <tr> |
867 | 484 | <td> | 549 | <td> |
869 | 485 | <para style="TextInformation4" alignment="CENTER">Item</para> | 550 | <para style="TextInformation4" alignment="CENTER">Item</para> <!-- 30 --> |
870 | 486 | </td> | 551 | </td> |
871 | 487 | 552 | ||
872 | 488 | <td> | 553 | <td> |
873 | 489 | <blockTable colWidths="110,260" style="OrderInformations4"> | 554 | <blockTable colWidths="110,260" style="OrderInformations4"> |
874 | 490 | <tr> | 555 | <tr> |
875 | 491 | <td> | 556 | <td> |
877 | 492 | <para style="TextInformation" alignment="LEFT">Code</para> | 557 | <para style="TextInformation" alignment="LEFT">Code</para> <!-- 110 --> |
878 | 493 | </td> | 558 | </td> |
879 | 494 | <td> | 559 | <td> |
881 | 495 | <para style="TextInformation" alignment="LEFT">Description</para> | 560 | <para style="TextInformation" alignment="LEFT">Description</para> <!-- 260 --> |
882 | 496 | </td> | 561 | </td> |
883 | 497 | </tr> | 562 | </tr> |
884 | 498 | <tr> | 563 | <tr> |
885 | @@ -508,37 +573,37 @@ | |||
886 | 508 | </td> | 573 | </td> |
887 | 509 | 574 | ||
888 | 510 | <td> | 575 | <td> |
920 | 511 | <para style="TextInformation5" alignment="CENTER">Qty confirmed</para> | 576 | <para style="TextInformation5" alignment="CENTER">Qty confirmed</para> <!-- 50 --> |
921 | 512 | </td> | 577 | </td> |
922 | 513 | <td> | 578 | <td> |
923 | 514 | <para style="TextInformation5" alignment="CENTER">Unit of Measure</para> | 579 | <para style="TextInformation5" alignment="CENTER">Unit of Measure</para> <!-- 40 --> |
924 | 515 | </td> | 580 | </td> |
925 | 516 | <td> | 581 | <td> |
926 | 517 | <para style="TextInformation5" alignment="CENTER">Qty backorder</para> | 582 | <para style="TextInformation5" alignment="CENTER">Qty backorder</para> <!-- 50 --> |
927 | 518 | </td> | 583 | </td> |
928 | 519 | <td> | 584 | <td> |
929 | 520 | <para style="TextInformation5" alignment="CENTER">Qty received</para> | 585 | <para style="TextInformation5" alignment="CENTER">Qty received</para> <!-- 40 --> |
930 | 521 | </td> | 586 | </td> |
931 | 522 | <td> | 587 | <td> |
932 | 523 | <para style="TextInformation5" alignment="CENTER">Batch / Serial number</para> | 588 | <para style="TextInformation5" alignment="CENTER">Batch / Serial number</para> <!-- 75 --> |
933 | 524 | </td> | 589 | </td> |
934 | 525 | <td> | 590 | <td> |
935 | 526 | <para style="TextInformation5" alignment="CENTER">Expiry date</para> | 591 | <para style="TextInformation5" alignment="CENTER">Expiry date</para> <!-- 53 --> |
936 | 527 | </td> | 592 | </td> |
937 | 528 | <td> | 593 | <td> |
938 | 529 | <para style="TextInformation4" alignment="CENTER">ED</para> | 594 | <para style="TextInformation4" alignment="CENTER">ED</para> <!-- 20 --> |
939 | 530 | </td> | 595 | </td> |
940 | 531 | <td> | 596 | <td> |
941 | 532 | <para style="TextInformation4" alignment="CENTER">BM</para> | 597 | <para style="TextInformation4" alignment="CENTER">BM</para> <!-- 18 --> |
942 | 533 | </td> | 598 | </td> |
943 | 534 | <td> | 599 | <td> |
944 | 535 | <para style="TextInformation4" alignment="CENTER">KC</para> | 600 | <para style="TextInformation4" alignment="CENTER">KC</para> <!-- 18 --> |
945 | 536 | </td> | 601 | </td> |
946 | 537 | <td> | 602 | <td> |
947 | 538 | <para style="TextInformation4" alignment="CENTER">DG</para> | 603 | <para style="TextInformation4" alignment="CENTER">DG</para> <!-- 18 --> |
948 | 539 | </td> | 604 | </td> |
949 | 540 | <td> | 605 | <td> |
950 | 541 | <para style="TextInformation4" alignment="CENTER">CS</para> | 606 | <para style="TextInformation4" alignment="CENTER">CS</para> <!-- 18 --> |
951 | 542 | </td> | 607 | </td> |
952 | 543 | </tr> | 608 | </tr> |
953 | 544 | </blockTable> | 609 | </blockTable> |
954 | @@ -552,7 +617,7 @@ | |||
955 | 552 | 617 | ||
956 | 553 | 618 | ||
957 | 554 | <tr> | 619 | <tr> |
959 | 555 | [[ repeatIn(get_lines(objects[0]), 'line') ]] | 620 | [[ repeatIn(pack[1], 'line') ]] |
960 | 556 | <td> | 621 | <td> |
961 | 557 | <blockTable colWidths="30,370,50,40,50,40,75,53,20,18,18,18,18" style="OrderInformations3"> | 622 | <blockTable colWidths="30,370,50,40,50,40,75,53,20,18,18,18,18" style="OrderInformations3"> |
962 | 558 | <tr> | 623 | <tr> |
963 | @@ -622,6 +687,7 @@ | |||
964 | 622 | </tr> | 687 | </tr> |
965 | 623 | 688 | ||
966 | 624 | </blockTable> | 689 | </blockTable> |
967 | 690 | </section> | ||
968 | 625 | 691 | ||
969 | 626 | <blockTable colWidths="800.0" style="OrderInformationsRien" > | 692 | <blockTable colWidths="800.0" style="OrderInformationsRien" > |
970 | 627 | <tr> | 693 | <tr> |
971 | 628 | 694 | ||
972 | === modified file 'bin/addons/msf_sync_data_server/data/sync_server.message_rule.csv' | |||
973 | --- bin/addons/msf_sync_data_server/data/sync_server.message_rule.csv 2020-06-09 09:58:28 +0000 | |||
974 | +++ bin/addons/msf_sync_data_server/data/sync_server.message_rule.csv 2020-08-05 12:54:43 +0000 | |||
975 | @@ -8,7 +8,11 @@ | |||
976 | 8 | msf_sync_data_server.pol_create_sol,TRUE,TRUE,"['sync_local_id', 'order_id/name','product_id/id', 'product_id/name', 'name', 'state', 'product_qty', 'product_uom', 'price_unit', 'analytic_distribution_id/id','comment','have_analytic_distribution_from_header','line_number', 'nomen_manda_0/id','nomen_manda_1/id','nomen_manda_2/id','nomen_manda_3/id', 'nomenclature_description','notes','default_name','default_code','is_line_split','date_planned', 'stock_take_date', 'ir_name_for_sync']","[('sync_linked_sol', '=', False), ('order_id.partner_type', 'not in',['external','esc']), ('state', 'in', ['validated', 'confirmed', 'done']), ('order_id.state', 'not in', ['draft', 'draft_p', 'cancel'])]",partner_id,MISSION,sale.order.line.create_so_line,purchase.order.line,PO line creates FO line,11,,Valid | 8 | msf_sync_data_server.pol_create_sol,TRUE,TRUE,"['sync_local_id', 'order_id/name','product_id/id', 'product_id/name', 'name', 'state', 'product_qty', 'product_uom', 'price_unit', 'analytic_distribution_id/id','comment','have_analytic_distribution_from_header','line_number', 'nomen_manda_0/id','nomen_manda_1/id','nomen_manda_2/id','nomen_manda_3/id', 'nomenclature_description','notes','default_name','default_code','is_line_split','date_planned', 'stock_take_date', 'ir_name_for_sync']","[('sync_linked_sol', '=', False), ('order_id.partner_type', 'not in',['external','esc']), ('state', 'in', ['validated', 'confirmed', 'done']), ('order_id.state', 'not in', ['draft', 'draft_p', 'cancel'])]",partner_id,MISSION,sale.order.line.create_so_line,purchase.order.line,PO line creates FO line,11,,Valid |
977 | 9 | msf_sync_data_server.sol_updates_pol,TRUE,TRUE,"['resourced_original_line/id', 'resourced_original_remote_line','sync_sourced_origin', 'sync_local_id', 'sync_linked_pol', 'order_id/name', 'product_id/id', 'product_id/name', 'name', 'state','product_uom_qty', 'product_uom', 'price_unit', 'in_name_goods_return', 'analytic_distribution_id/id','comment','have_analytic_distribution_from_header','line_number', 'nomen_manda_0/id','nomen_manda_1/id','nomen_manda_2/id','nomen_manda_3/id', 'nomenclature_description','notes','default_name','default_code','date_planned','is_line_split', 'original_line_id/id', 'confirmed_delivery_date', 'stock_take_date', 'cancel_split_ok', 'modification_comment', 'from_cancel_out', 'pol_external_ref']","[('order_id.partner_type', '!=', 'external'), ('state', '!=', 'draft'), ('product_uom_qty', '!=', 0.0), '!', '&', ('order_id.fo_created_by_po_sync', '=', False), ('order_id.state', '=', 'draft')]",partner_id,MISSION,purchase.order.line.sol_update_original_pol,sale.order.line,FO line updates PO line,12,"[('order_id.state', 'in', ['draft', 'draft_p']), ('order_id.partner_type', 'not in', ['external', 'esc']), ('order_id.client_order_ref', '=', False)]",Valid | 9 | msf_sync_data_server.sol_updates_pol,TRUE,TRUE,"['resourced_original_line/id', 'resourced_original_remote_line','sync_sourced_origin', 'sync_local_id', 'sync_linked_pol', 'order_id/name', 'product_id/id', 'product_id/name', 'name', 'state','product_uom_qty', 'product_uom', 'price_unit', 'in_name_goods_return', 'analytic_distribution_id/id','comment','have_analytic_distribution_from_header','line_number', 'nomen_manda_0/id','nomen_manda_1/id','nomen_manda_2/id','nomen_manda_3/id', 'nomenclature_description','notes','default_name','default_code','date_planned','is_line_split', 'original_line_id/id', 'confirmed_delivery_date', 'stock_take_date', 'cancel_split_ok', 'modification_comment', 'from_cancel_out', 'pol_external_ref']","[('order_id.partner_type', '!=', 'external'), ('state', '!=', 'draft'), ('product_uom_qty', '!=', 0.0), '!', '&', ('order_id.fo_created_by_po_sync', '=', False), ('order_id.state', '=', 'draft')]",partner_id,MISSION,purchase.order.line.sol_update_original_pol,sale.order.line,FO line updates PO line,12,"[('order_id.state', 'in', ['draft', 'draft_p']), ('order_id.partner_type', 'not in', ['external', 'esc']), ('order_id.client_order_ref', '=', False)]",Valid |
978 | 10 | msf_sync_data_server.pol_update_date_expected,TRUE,TRUE,"['sync_local_id', 'sync_linked_pol']","[('id', '=', 0)]",partner_id,MISSION,purchase.order.line.update_date_expected,sale.order.line,Update IN expected date,55,,Valid | 10 | msf_sync_data_server.pol_update_date_expected,TRUE,TRUE,"['sync_local_id', 'sync_linked_pol']","[('id', '=', 0)]",partner_id,MISSION,purchase.order.line.update_date_expected,sale.order.line,Update IN expected date,55,,Valid |
979 | 11 | <<<<<<< TREE | ||
980 | 11 | msf_sync_data_server.partial_shipped_coordo_updates_in_at_project,TRUE,TRUE,"['name', 'state', 'origin', 'partner_type_stock_picking', 'shipment_id/name', 'min_date', 'note', 'claim', 'move_lines/processed_stock_move', 'move_lines/id', 'move_lines/state','move_lines/original_qty_partial', 'move_lines/line_number', 'move_lines/name', 'move_lines/change_reason', 'move_lines/product_id/id', 'move_lines/product_id/name', 'move_lines/product_id/default_code', 'move_lines/product_qty', 'move_lines/prodlot_id/id','move_lines/prodlot_id/name','move_lines/prodlot_id/life_date', 'move_lines/prodlot_id/type', 'move_lines/prodlot_id/comment', 'move_lines/expired_date', 'move_lines/asset_id/id','move_lines/product_uom/id', 'move_lines/product_uom/name', 'move_lines/date', 'move_lines/date_expected', 'move_lines/note', 'move_lines/location_dest_id/usage', 'move_lines/comment', 'move_lines/sale_line_id/id', 'move_lines/sale_line_id/in_name_goods_return', 'sale_id/claim_name_goods_return', 'sale_id/client_order_ref']","['&','&','&','&','&',('partner_type_stock_picking', '!=', 'external'), ('type', '=', 'out'), ('subtype', 'in', ['standard', 'packing']), ('state', 'in', ['done', 'delivered']), ('already_shipped', '=', True), ('do_not_sync', '=', False)]",partner_id,MISSION,stock.picking.partial_shipped_fo_updates_in_po,stock.picking,Partial shipped at Coordo updates IN at Project,19,,Valid | 12 | msf_sync_data_server.partial_shipped_coordo_updates_in_at_project,TRUE,TRUE,"['name', 'state', 'origin', 'partner_type_stock_picking', 'shipment_id/name', 'min_date', 'note', 'claim', 'move_lines/processed_stock_move', 'move_lines/id', 'move_lines/state','move_lines/original_qty_partial', 'move_lines/line_number', 'move_lines/name', 'move_lines/change_reason', 'move_lines/product_id/id', 'move_lines/product_id/name', 'move_lines/product_id/default_code', 'move_lines/product_qty', 'move_lines/prodlot_id/id','move_lines/prodlot_id/name','move_lines/prodlot_id/life_date', 'move_lines/prodlot_id/type', 'move_lines/prodlot_id/comment', 'move_lines/expired_date', 'move_lines/asset_id/id','move_lines/product_uom/id', 'move_lines/product_uom/name', 'move_lines/date', 'move_lines/date_expected', 'move_lines/note', 'move_lines/location_dest_id/usage', 'move_lines/comment', 'move_lines/sale_line_id/id', 'move_lines/sale_line_id/in_name_goods_return', 'sale_id/claim_name_goods_return', 'sale_id/client_order_ref']","['&','&','&','&','&',('partner_type_stock_picking', '!=', 'external'), ('type', '=', 'out'), ('subtype', 'in', ['standard', 'packing']), ('state', 'in', ['done', 'delivered']), ('already_shipped', '=', True), ('do_not_sync', '=', False)]",partner_id,MISSION,stock.picking.partial_shipped_fo_updates_in_po,stock.picking,Partial shipped at Coordo updates IN at Project,19,,Valid |
981 | 13 | ======= | ||
982 | 14 | msf_sync_data_server.partial_shipped_coordo_updates_in_at_project,TRUE,TRUE,"['name', 'previous_step_id/name', 'state', 'origin', 'partner_type_stock_picking', 'shipment_id/name', 'min_date', 'note', 'claim', 'packing_list', 'move_lines/processed_stock_move', 'move_lines/id', 'move_lines/state','move_lines/original_qty_partial', 'move_lines/line_number', 'move_lines/name', 'move_lines/change_reason', 'move_lines/product_id/id', 'move_lines/product_id/name', 'move_lines/product_id/default_code', 'move_lines/product_qty', 'move_lines/prodlot_id/id','move_lines/prodlot_id/name','move_lines/prodlot_id/life_date', 'move_lines/prodlot_id/type', 'move_lines/prodlot_id/comment', 'move_lines/expired_date', 'move_lines/asset_id/id','move_lines/product_uom/id', 'move_lines/product_uom/name', 'move_lines/date', 'move_lines/date_expected', 'move_lines/note', 'move_lines/location_dest_id/usage', 'move_lines/comment', 'move_lines/sale_line_id/id', 'move_lines/sale_line_id/in_name_goods_return', 'move_lines/from_pack', 'move_lines/to_pack', 'move_lines/weight', 'move_lines/height', 'move_lines/length', 'move_lines/width', 'sale_id/claim_name_goods_return', 'sale_id/client_order_ref']","['&','&','&','&','&',('partner_type_stock_picking', '!=', 'external'), ('type', '=', 'out'), ('subtype', 'in', ['standard', 'packing']), ('state', '=', 'done'), ('already_shipped', '=', True), ('do_not_sync', '=', False)]",partner_id,MISSION,stock.picking.partial_shipped_fo_updates_in_po,stock.picking,Partial shipped at Coordo updates IN at Project,19,,Valid | ||
983 | 15 | >>>>>>> MERGE-SOURCE | ||
984 | 12 | msf_sync_data_server.moves_from_dpo_closed_coordo_updates_in_at_project,TRUE,TRUE,"['name', 'state', 'origin', 'subtype', 'partner_type_stock_picking', 'shipment_id/name', 'min_date', 'note', 'move_lines/processed_stock_move', 'move_lines/id', 'move_lines/state','move_lines/original_qty_partial', 'move_lines/line_number', 'move_lines/name', 'move_lines/change_reason', 'move_lines/product_id/id', 'move_lines/product_id/name', 'move_lines/product_id/default_code', 'move_lines/product_qty', 'move_lines/prodlot_id/id','move_lines/prodlot_id/name','move_lines/prodlot_id/life_date', 'move_lines/prodlot_id/type', 'move_lines/prodlot_id/comment', 'move_lines/expired_date', 'move_lines/asset_id/id','move_lines/product_uom/id', 'move_lines/product_uom/name', 'move_lines/date', 'move_lines/date_expected', 'move_lines/note', 'move_lines/dpo_line_id', 'move_lines/comment']","['&', '&', '&', ('partner_type_stock_picking', '!=', 'external'), ('type', '=', 'out'), ('subtype', 'in', ['picking', 'standard']), ('dpo_out', '=', True)]",partner_id,MISSION,stock.picking.partial_shippped_dpo_updates_in_po,stock.picking,Moves from DPO closed at Coordo updates IN at Project,20,,Valid | 16 | msf_sync_data_server.moves_from_dpo_closed_coordo_updates_in_at_project,TRUE,TRUE,"['name', 'state', 'origin', 'subtype', 'partner_type_stock_picking', 'shipment_id/name', 'min_date', 'note', 'move_lines/processed_stock_move', 'move_lines/id', 'move_lines/state','move_lines/original_qty_partial', 'move_lines/line_number', 'move_lines/name', 'move_lines/change_reason', 'move_lines/product_id/id', 'move_lines/product_id/name', 'move_lines/product_id/default_code', 'move_lines/product_qty', 'move_lines/prodlot_id/id','move_lines/prodlot_id/name','move_lines/prodlot_id/life_date', 'move_lines/prodlot_id/type', 'move_lines/prodlot_id/comment', 'move_lines/expired_date', 'move_lines/asset_id/id','move_lines/product_uom/id', 'move_lines/product_uom/name', 'move_lines/date', 'move_lines/date_expected', 'move_lines/note', 'move_lines/dpo_line_id', 'move_lines/comment']","['&', '&', '&', ('partner_type_stock_picking', '!=', 'external'), ('type', '=', 'out'), ('subtype', 'in', ['picking', 'standard']), ('dpo_out', '=', True)]",partner_id,MISSION,stock.picking.partial_shippped_dpo_updates_in_po,stock.picking,Moves from DPO closed at Coordo updates IN at Project,20,,Valid |
985 | 13 | msf_sync_data_server.dpo_service_lines_update_in_at_project,FALSE,TRUE,"['order_id/name', 'order_id/delivery_confirmed_date', 'sync_local_id', 'origin', 'confirmed_delivery_date', 'name', 'product_uom/id', 'product_uom/name', 'link_sol_id/line_number', 'notes', 'product_qty', 'product_id/name', 'product_id/id', 'product_id/default_code', 'comment']","[('dest_partner_id.partner_type', '=', 'internal'), ('order_id.order_type', '=', 'direct'), ('order_id.state', 'in', ['approved', 'done']), ('product_id.type', 'in', ['service', 'service_recep'])]",dest_partner_id,MISSION,purchase.order.line.confirmed_dpo_service_lines_update_in_po,purchase.order.line,DPO service lines update IN at Project,21,,Valid | 17 | msf_sync_data_server.dpo_service_lines_update_in_at_project,FALSE,TRUE,"['order_id/name', 'order_id/delivery_confirmed_date', 'sync_local_id', 'origin', 'confirmed_delivery_date', 'name', 'product_uom/id', 'product_uom/name', 'link_sol_id/line_number', 'notes', 'product_qty', 'product_id/name', 'product_id/id', 'product_id/default_code', 'comment']","[('dest_partner_id.partner_type', '=', 'internal'), ('order_id.order_type', '=', 'direct'), ('order_id.state', 'in', ['approved', 'done']), ('product_id.type', 'in', ['service', 'service_recep'])]",dest_partner_id,MISSION,purchase.order.line.confirmed_dpo_service_lines_update_in_po,purchase.order.line,DPO service lines update IN at Project,21,,Valid |
986 | 14 | msf_sync_data_server.closed_in_validates_delivery_out_ship,TRUE,TRUE,"['name', 'state', 'shipment_ref']","['&','&','&','&','&',('partner_type_stock_picking', '!=', 'external'), ('type', '=', 'in'),('subtype', 'in', ['standard']), ('state', '=', 'done'), ('shipment_ref', '!=', False), ('dpo_incoming', '=', False)]",partner_id,MISSION,stock.picking.closed_in_validates_delivery_out_ship,stock.picking,Closed IN validates delivery of OUT-SHIP,26,,Valid | 18 | msf_sync_data_server.closed_in_validates_delivery_out_ship,TRUE,TRUE,"['name', 'state', 'shipment_ref']","['&','&','&','&','&',('partner_type_stock_picking', '!=', 'external'), ('type', '=', 'in'),('subtype', 'in', ['standard']), ('state', '=', 'done'), ('shipment_ref', '!=', False), ('dpo_incoming', '=', False)]",partner_id,MISSION,stock.picking.closed_in_validates_delivery_out_ship,stock.picking,Closed IN validates delivery of OUT-SHIP,26,,Valid |
987 | 15 | 19 | ||
988 | === modified file 'bin/addons/order_types/stock.py' | |||
989 | --- bin/addons/order_types/stock.py 2019-09-18 14:06:52 +0000 | |||
990 | +++ bin/addons/order_types/stock.py 2020-08-05 12:54:43 +0000 | |||
991 | @@ -210,8 +210,10 @@ | |||
992 | 210 | self._check_restriction_line(cr, uid, ids, context=context) | 210 | self._check_restriction_line(cr, uid, ids, context=context) |
993 | 211 | 211 | ||
994 | 212 | certif = False | 212 | certif = False |
995 | 213 | from_esc = False | ||
996 | 213 | for pick in self.browse(cr, uid, ids, context=context): | 214 | for pick in self.browse(cr, uid, ids, context=context): |
997 | 214 | if pick.type in ['in', 'out']: | 215 | if pick.type in ['in', 'out']: |
998 | 216 | from_esc = pick.partner_id.partner_type == 'esc' and pick.state == 'updated' | ||
999 | 215 | if not context.get('yesorno', False) : | 217 | if not context.get('yesorno', False) : |
1000 | 216 | for move in pick.move_lines: | 218 | for move in pick.move_lines: |
1001 | 217 | if move.order_type in ['donation_exp', 'donation_st', 'in_kind']: | 219 | if move.order_type in ['donation_exp', 'donation_st', 'in_kind']: |
1002 | @@ -256,7 +258,10 @@ | |||
1003 | 256 | if wiz_ids: | 258 | if wiz_ids: |
1004 | 257 | proc_id = wiz_ids[0] | 259 | proc_id = wiz_ids[0] |
1005 | 258 | else: | 260 | else: |
1007 | 259 | proc_id = wizard_obj.create(cr, uid, {'picking_id': pick.id}) | 261 | write_data = {'picking_id': pick.id} |
1008 | 262 | if from_esc: | ||
1009 | 263 | write_data['fields_as_ro'] = True | ||
1010 | 264 | proc_id = wizard_obj.create(cr, uid, write_data) | ||
1011 | 260 | wizard_obj.create_lines(cr, uid, proc_id, context=context) | 265 | wizard_obj.create_lines(cr, uid, proc_id, context=context) |
1012 | 261 | 266 | ||
1013 | 262 | res = { | 267 | res = { |
1014 | 263 | 268 | ||
1015 | === modified file 'bin/addons/sync_client/message.py' | |||
1016 | --- bin/addons/sync_client/message.py 2019-12-02 17:32:44 +0000 | |||
1017 | +++ bin/addons/sync_client/message.py 2020-08-05 12:54:43 +0000 | |||
1018 | @@ -261,21 +261,32 @@ | |||
1019 | 261 | ignored_ids = list(set(obj_ids_temp) - set(obj_ids)) | 261 | ignored_ids = list(set(obj_ids_temp) - set(obj_ids)) |
1020 | 262 | dest = self.pool.get(rule.model).get_destination_name(cr, uid, obj_ids, rule.destination_name, context=context) | 262 | dest = self.pool.get(rule.model).get_destination_name(cr, uid, obj_ids, rule.destination_name, context=context) |
1021 | 263 | args = {} | 263 | args = {} |
1022 | 264 | for obj_id in obj_ids: | ||
1023 | 265 | if initial == False: # default action | ||
1024 | 266 | args[obj_id] = self.pool.get(rule.model).get_message_arguments(cr, uid, obj_id, rule, context=context) | ||
1025 | 267 | else: # UF-2483: fake RW sync on creation of the RW instance | ||
1026 | 268 | args[obj_id] = "Initial RW Sync - Ignore" | ||
1027 | 269 | |||
1028 | 270 | generated_ids = [] | 264 | generated_ids = [] |
1037 | 271 | for id in obj_ids: | 265 | |
1038 | 272 | for destination in (dest[id] if hasattr(dest[id], '__iter__') else [dest[id]]): | 266 | |
1039 | 273 | # UF-2531: allow this when creating usb msg for the INT from scratch from RW to CP | 267 | if obj_ids and rule.model == 'stock.picking' and rule.remote_call in ('stock.picking.partial_shipped_fo_updates_in_po', 'stock.picking.partial_shippped_dpo_updates_in_po'): |
1040 | 274 | if destination is False: | 268 | cr.execute("select array_agg(id) from stock_picking where id in %s group by subtype, partner_id, origin, claim, coalesce(shipment_id, id)", (tuple(obj_ids),)) |
1041 | 275 | destination = 'fake' | 269 | for picks in cr.fetchall(): |
1042 | 276 | # UF-2483: By default the "sent" parameter is False | 270 | arg = self.pool.get('stock.picking').get_message_arguments(cr, uid, picks[0], rule, context=context) |
1043 | 277 | self.create_message(cr, uid, identifiers[id], rule.remote_call, args[id], destination, initial, context) | 271 | first_id = picks[0][0] |
1044 | 278 | generated_ids.append(id) | 272 | self.create_message(cr, uid, identifiers[first_id], rule.remote_call, arg, dest[first_id], initial, context) |
1045 | 273 | generated_ids += picks[0] | ||
1046 | 274 | else: | ||
1047 | 275 | for obj_id in obj_ids: | ||
1048 | 276 | if initial == False: # default action | ||
1049 | 277 | args[obj_id] = self.pool.get(rule.model).get_message_arguments(cr, uid, obj_id, rule, context=context) | ||
1050 | 278 | else: # UF-2483: fake RW sync on creation of the RW instance | ||
1051 | 279 | args[obj_id] = "Initial RW Sync - Ignore" | ||
1052 | 280 | |||
1053 | 281 | |||
1054 | 282 | for id in obj_ids: | ||
1055 | 283 | for destination in (dest[id] if hasattr(dest[id], '__iter__') else [dest[id]]): | ||
1056 | 284 | # UF-2531: allow this when creating usb msg for the INT from scratch from RW to CP | ||
1057 | 285 | if destination is False: | ||
1058 | 286 | destination = 'fake' | ||
1059 | 287 | # UF-2483: By default the "sent" parameter is False | ||
1060 | 288 | self.create_message(cr, uid, identifiers[id], rule.remote_call, args[id], destination, initial, context) | ||
1061 | 289 | generated_ids.append(id) | ||
1062 | 279 | 290 | ||
1063 | 280 | return generated_ids, ignored_ids | 291 | return generated_ids, ignored_ids |
1064 | 281 | 292 | ||
1065 | 282 | 293 | ||
1066 | === modified file 'bin/addons/sync_client/orm.py' | |||
1067 | --- bin/addons/sync_client/orm.py 2020-01-03 13:16:16 +0000 | |||
1068 | +++ bin/addons/sync_client/orm.py 2020-08-05 12:54:43 +0000 | |||
1069 | @@ -804,7 +804,9 @@ | |||
1070 | 804 | """ | 804 | """ |
1071 | 805 | rule_dest_field = rule.destination_name | 805 | rule_dest_field = rule.destination_name |
1072 | 806 | fields = eval(rule.arguments) | 806 | fields = eval(rule.arguments) |
1074 | 807 | res = self.export_data_json(cr, uid, [res_id], fields, destination=destination, rule_dest_field=rule_dest_field, context=context) | 807 | if isinstance(res_id, (int, long)): |
1075 | 808 | res_id = [res_id] | ||
1076 | 809 | res = self.export_data_json(cr, uid, res_id, fields, destination=destination, rule_dest_field=rule_dest_field, context=context) | ||
1077 | 808 | return res['datas'] | 810 | return res['datas'] |
1078 | 809 | 811 | ||
1079 | 810 | def export_data_json(self, cr, uid, ids, fields_to_export, destination=False, rule_dest_field=False, context=None): | 812 | def export_data_json(self, cr, uid, ids, fields_to_export, destination=False, rule_dest_field=False, context=None): |
1080 | 811 | 813 | ||
1081 | === modified file 'bin/addons/sync_so/picking.py' | |||
1082 | --- bin/addons/sync_so/picking.py 2019-10-29 09:27:27 +0000 | |||
1083 | +++ bin/addons/sync_so/picking.py 2020-08-05 12:54:43 +0000 | |||
1084 | @@ -27,6 +27,7 @@ | |||
1085 | 27 | 27 | ||
1086 | 28 | from sync_common import xmlid_to_sdref | 28 | from sync_common import xmlid_to_sdref |
1087 | 29 | from sync_client import get_sale_purchase_logger | 29 | from sync_client import get_sale_purchase_logger |
1088 | 30 | from sync_client.message import dict_to_obj | ||
1089 | 30 | 31 | ||
1090 | 31 | from tools.translate import _ | 32 | from tools.translate import _ |
1091 | 32 | 33 | ||
1092 | @@ -155,68 +156,79 @@ | |||
1093 | 155 | dpo_line_id = data.get('dpo_line_id', False) | 156 | dpo_line_id = data.get('dpo_line_id', False) |
1094 | 156 | 157 | ||
1095 | 157 | # build a dic which can be used directly to update the stock move | 158 | # build a dic which can be used directly to update the stock move |
1121 | 158 | result = {'line_number': data['line_number'], | 159 | result = { |
1122 | 159 | 'product_id': product_id, | 160 | 'line_number': data['line_number'], |
1123 | 160 | 'product_uom': uom_id, | 161 | 'product_id': product_id, |
1124 | 161 | 'product_uos': uom_id, | 162 | 'product_uom': uom_id, |
1125 | 162 | 'uom_id': uom_id, | 163 | 'product_uos': uom_id, |
1126 | 163 | 'date': data['date'], | 164 | 'uom_id': uom_id, |
1127 | 164 | 'date_expected': data['date_expected'], | 165 | 'date': data['date'], |
1128 | 165 | 'state': state, | 166 | 'date_expected': data['date_expected'], |
1129 | 166 | 167 | 'state': state, | |
1130 | 167 | 'original_qty_partial': data['original_qty_partial'], # UTP-972 | 168 | |
1131 | 168 | 169 | 'original_qty_partial': data['original_qty_partial'], # UTP-972 | |
1132 | 169 | 'prodlot_id': batch_id, | 170 | |
1133 | 170 | 'expired_date': expired_date, | 171 | 'prodlot_id': batch_id, |
1134 | 171 | 172 | 'expired_date': expired_date, | |
1135 | 172 | 'dpo_line_id': dpo_line_id, | 173 | |
1136 | 173 | 'sync_dpo': dpo_line_id and True or False, | 174 | 'dpo_line_id': dpo_line_id, |
1137 | 174 | 175 | 'sync_dpo': dpo_line_id and True or False, | |
1138 | 175 | 'asset_id': asset_id, | 176 | |
1139 | 176 | 'change_reason': data['change_reason'] or None, | 177 | 'asset_id': asset_id, |
1140 | 177 | 'name': data['name'], | 178 | 'change_reason': data['change_reason'] or None, |
1141 | 178 | 'quantity': data['product_qty'] or 0.0, | 179 | 'name': data['name'], |
1142 | 179 | 'note': data['note'], | 180 | 'quantity': data['product_qty'] or 0.0, |
1143 | 180 | 'comment': data.get('comment'), | 181 | 'note': data['note'], |
1144 | 181 | 'sale_line_id': data.get('sale_line_id', False) and data['sale_line_id'].get('id', False) or False, | 182 | 'comment': data.get('comment'), |
1145 | 182 | } | 183 | 'sale_line_id': data.get('sale_line_id', False) and data['sale_line_id'].get('id', False) or False, |
1146 | 184 | |||
1147 | 185 | } | ||
1148 | 186 | for k in ['from_pack', 'to_pack', 'weight', 'height', 'length', 'width']: | ||
1149 | 187 | result[k] = data.get(k) | ||
1150 | 183 | return result | 188 | return result |
1151 | 184 | 189 | ||
1153 | 185 | def package_data_update_in(self, cr, uid, source, out_info, context=None): | 190 | def package_data_update_in(self, cr, uid, source, pick_dict, context=None): |
1154 | 186 | ''' | 191 | ''' |
1155 | 187 | package the data to get info concerning already processed or not | 192 | package the data to get info concerning already processed or not |
1156 | 188 | ''' | 193 | ''' |
1157 | 189 | result = {} | 194 | result = {} |
1168 | 190 | if out_info.get('move_lines', False): | 195 | for out_info_dict_to_obj in pick_dict: |
1169 | 191 | for line in out_info['move_lines']: | 196 | out_info = out_info_dict_to_obj.to_dict() |
1170 | 192 | # Don't get the returned pack lines | 197 | if out_info.get('move_lines', False): |
1171 | 193 | if line.get('location_dest_id', {}).get('usage', 'customer') == 'customer': | 198 | for line in out_info['move_lines']: |
1172 | 194 | # aggregate according to line number | 199 | # Don't get the returned pack lines |
1173 | 195 | line_dic = result.setdefault(line.get('line_number'), {}) | 200 | if line.get('location_dest_id', {}).get('usage', 'customer') == 'customer': |
1174 | 196 | # set the data | 201 | # aggregate according to line number |
1175 | 197 | line_dic.setdefault('data', []).append(self.format_data(cr, uid, line, source, context=context)) | 202 | line_dic = result.setdefault(line.get('line_number'), {}) |
1176 | 198 | # set the flag to know if the data has already been processed (partially or completely) in Out side | 203 | # set the data |
1177 | 199 | line_dic.update({'out_processed': line_dic.setdefault('out_processed', False) or line['processed_stock_move']}) | 204 | line_dic.setdefault('data', []).append(self.format_data(cr, uid, line, source, context=context)) |
1178 | 205 | # set the flag to know if the data has already been processed (partially or completely) in Out side | ||
1179 | 206 | line_dic.update({'out_processed': line_dic.setdefault('out_processed', False) or line['processed_stock_move']}) | ||
1180 | 207 | line_dic['data'][-1].update({'packing_list': out_info.get('packing_list'), 'ppl_name': out_info.get('previous_step_id') and out_info.get('previous_step_id').get('name') or out_info.get('name')}) | ||
1181 | 200 | 208 | ||
1182 | 201 | 209 | ||
1183 | 202 | return result | 210 | return result |
1184 | 203 | 211 | ||
1186 | 204 | def picking_data_update_in(self, cr, uid, source, out_info, context=None): | 212 | def picking_data_update_in(self, cr, uid, source, pick_info, context=None): |
1187 | 205 | ''' | 213 | ''' |
1188 | 206 | If data come from a stock move (DPO), re-arrange data to match with partial_shipped_fo_updates_in_po method | 214 | If data come from a stock move (DPO), re-arrange data to match with partial_shipped_fo_updates_in_po method |
1189 | 207 | ''' | 215 | ''' |
1202 | 208 | result = {} | 216 | result = [] |
1203 | 209 | 217 | ||
1204 | 210 | for key in out_info.keys(): | 218 | for data in pick_info: |
1205 | 211 | if key != 'move_lines': | 219 | out_info = data.to_dict() |
1206 | 212 | result[key] = out_info.get(key) | 220 | res = {} |
1207 | 213 | 221 | for key in out_info.keys(): | |
1208 | 214 | if out_info.get('subtype', False) in ('standard', 'picking') and out_info.get('move_lines', False): | 222 | if key != 'move_lines': |
1209 | 215 | for line in out_info['move_lines']: | 223 | res[key] = out_info.get(key) |
1210 | 216 | # Don't get the lines without dpo_line_id | 224 | |
1211 | 217 | if line.get('dpo_line_id', False): | 225 | if out_info.get('subtype', False) in ('standard', 'picking') and out_info.get('move_lines', False): |
1212 | 218 | result.setdefault('move_lines', []) | 226 | for line in out_info['move_lines']: |
1213 | 219 | result['move_lines'].append(line) | 227 | # Don't get the lines without dpo_line_id |
1214 | 228 | if line.get('dpo_line_id', False): | ||
1215 | 229 | res.setdefault('move_lines', []) | ||
1216 | 230 | res['move_lines'].append(line) | ||
1217 | 231 | result.append(dict_to_obj(res)) | ||
1218 | 220 | 232 | ||
1219 | 221 | return result | 233 | return result |
1220 | 222 | 234 | ||
1221 | @@ -241,12 +253,14 @@ | |||
1222 | 241 | if not found: | 253 | if not found: |
1223 | 242 | already_shipped_moves.append({move_id: quantity}) | 254 | already_shipped_moves.append({move_id: quantity}) |
1224 | 243 | 255 | ||
1226 | 244 | def partial_shipped_fo_updates_in_po(self, cr, uid, source, out_info, context=None): | 256 | def partial_shipped_fo_updates_in_po(self, cr, uid, source, *pick_info, **kwargs): |
1227 | 245 | ''' | 257 | ''' |
1228 | 246 | ' This sync method is used for updating the IN of Project side when the OUT/PICK at Coordo side became done. | 258 | ' This sync method is used for updating the IN of Project side when the OUT/PICK at Coordo side became done. |
1229 | 247 | ' In partial shipment/OUT, when the last shipment/OUT is made, the original IN will become Available Shipped, no new IN will | 259 | ' In partial shipment/OUT, when the last shipment/OUT is made, the original IN will become Available Shipped, no new IN will |
1230 | 248 | ' be created, as the whole quantiy of the IN is delivered (but not yet received at Project side) | 260 | ' be created, as the whole quantiy of the IN is delivered (but not yet received at Project side) |
1231 | 249 | ''' | 261 | ''' |
1232 | 262 | |||
1233 | 263 | context = kwargs.get('context') | ||
1234 | 250 | move_proc = self.pool.get('stock.move.in.processor') | 264 | move_proc = self.pool.get('stock.move.in.processor') |
1235 | 251 | if context is None: | 265 | if context is None: |
1236 | 252 | context = {} | 266 | context = {} |
1237 | @@ -256,13 +270,13 @@ | |||
1238 | 256 | # Load common data (mainly for reason type) into context | 270 | # Load common data (mainly for reason type) into context |
1239 | 257 | self.pool.get('data.tools').load_common_data(cr, uid, [], context=context) | 271 | self.pool.get('data.tools').load_common_data(cr, uid, [], context=context) |
1240 | 258 | 272 | ||
1245 | 259 | if not isinstance(out_info, dict): | 273 | #if not isinstance(out_info, dict): |
1246 | 260 | pick_dict = out_info.to_dict() | 274 | # pick_dict = out_info.to_dict() |
1247 | 261 | else: | 275 | #else: |
1248 | 262 | pick_dict = out_info | 276 | # pick_dict = out_info |
1249 | 263 | 277 | ||
1250 | 264 | if context.get('for_dpo'): | 278 | if context.get('for_dpo'): |
1252 | 265 | pick_dict = self.picking_data_update_in(cr, uid, source, pick_dict, context=context) | 279 | self.picking_data_update_in(cr, uid, source, pick_info, context=context) |
1253 | 266 | #US-1352: Reset this flag immediately, otherwise it will impact on other normal shipments! | 280 | #US-1352: Reset this flag immediately, otherwise it will impact on other normal shipments! |
1254 | 267 | context.update({'for_dpo': False}) | 281 | context.update({'for_dpo': False}) |
1255 | 268 | 282 | ||
1256 | @@ -275,8 +289,9 @@ | |||
1257 | 275 | warehouse_obj = self.pool.get('stock.warehouse') | 289 | warehouse_obj = self.pool.get('stock.warehouse') |
1258 | 276 | 290 | ||
1259 | 277 | # package data | 291 | # package data |
1261 | 278 | pack_data = self.package_data_update_in(cr, uid, source, pick_dict, context=context) | 292 | pack_data = self.package_data_update_in(cr, uid, source, pick_info, context=context) |
1262 | 279 | # Look for the PO name, which has the reference to the FO on Coordo as source.out_info.origin | 293 | # Look for the PO name, which has the reference to the FO on Coordo as source.out_info.origin |
1263 | 294 | pick_dict = pick_info[0].to_dict() | ||
1264 | 280 | so_ref = source + "." + pick_dict['origin'] | 295 | so_ref = source + "." + pick_dict['origin'] |
1265 | 281 | po_id = so_po_common.get_po_id_by_so_ref(cr, uid, so_ref, context) | 296 | po_id = so_po_common.get_po_id_by_so_ref(cr, uid, so_ref, context) |
1266 | 282 | # prepare the shipment/OUT reference to update to IN | 297 | # prepare the shipment/OUT reference to update to IN |
1267 | @@ -295,6 +310,7 @@ | |||
1268 | 295 | if po_ids: | 310 | if po_ids: |
1269 | 296 | po_id = po_ids[0] | 311 | po_id = po_ids[0] |
1270 | 297 | 312 | ||
1271 | 313 | |||
1272 | 298 | if not po_id and not pick_dict.get('claim', False): | 314 | if not po_id and not pick_dict.get('claim', False): |
1273 | 299 | # UF-1830: Check if the PO exist, if not, and in restore mode, send a warning and create a message to remove the ref on the partner document | 315 | # UF-1830: Check if the PO exist, if not, and in restore mode, send a warning and create a message to remove the ref on the partner document |
1274 | 300 | if context.get('restore_flag'): | 316 | if context.get('restore_flag'): |
1275 | @@ -362,6 +378,9 @@ | |||
1276 | 362 | 378 | ||
1277 | 363 | in_id = self.create(cr, uid, in_claim_dict, context=context) | 379 | in_id = self.create(cr, uid, in_claim_dict, context=context) |
1278 | 364 | 380 | ||
1279 | 381 | pack_info_obj = self.pool.get('wizard.import.in.pack.simulation.screen') | ||
1280 | 382 | pack_info_created = {} | ||
1281 | 383 | |||
1282 | 365 | if in_id: | 384 | if in_id: |
1283 | 366 | in_name = self.read(cr, uid, in_id, ['name'], context=context)['name'] | 385 | in_name = self.read(cr, uid, in_id, ['name'], context=context)['name'] |
1284 | 367 | in_processor = self.pool.get('stock.incoming.processor').create(cr, uid, {'picking_id': in_id}, context=context) | 386 | in_processor = self.pool.get('stock.incoming.processor').create(cr, uid, {'picking_id': in_id}, context=context) |
1285 | @@ -377,6 +396,20 @@ | |||
1286 | 377 | already_shipped_moves = [] | 396 | already_shipped_moves = [] |
1287 | 378 | # get the corresponding picking line ids | 397 | # get the corresponding picking line ids |
1288 | 379 | for data in line_data['data']: | 398 | for data in line_data['data']: |
1289 | 399 | if data.get('from_pack') and data.get('to_pack'): | ||
1290 | 400 | pack_key = '%s-%s-%s' % (data.get('from_pack'), data.get('to_pack'), data.get('ppl_name')) | ||
1291 | 401 | if pack_key not in pack_info_created: | ||
1292 | 402 | pack_info_created[pack_key] = pack_info_obj.create(cr, uid, { | ||
1293 | 403 | 'parcel_from': data['from_pack'], | ||
1294 | 404 | 'parcel_to': data['to_pack'], | ||
1295 | 405 | 'total_weight': data['weight'], | ||
1296 | 406 | 'total_height': data['height'], | ||
1297 | 407 | 'total_length': data['length'], | ||
1298 | 408 | 'total_width': data['width'], | ||
1299 | 409 | 'packing_list': data.get('packing_list'), | ||
1300 | 410 | 'ppl_name': data.get('ppl_name'), | ||
1301 | 411 | }) | ||
1302 | 412 | data['pack_info_id'] = pack_info_created[pack_key] | ||
1303 | 380 | ln = data.get('line_number') | 413 | ln = data.get('line_number') |
1304 | 381 | # UF-2148: if the line contains 0 qty, just ignore it! | 414 | # UF-2148: if the line contains 0 qty, just ignore it! |
1305 | 382 | qty = data.get('quantity', 0) | 415 | qty = data.get('quantity', 0) |
1306 | @@ -453,7 +486,7 @@ | |||
1307 | 453 | self._logger.info(message) | 486 | self._logger.info(message) |
1308 | 454 | raise Exception(message) | 487 | raise Exception(message) |
1309 | 455 | 488 | ||
1311 | 456 | move_id = False # REF-99: declare the variable before using it, otherwise if it go to else, then line 268 "if not move_id" -> problem! | 489 | move_id = False |
1312 | 457 | if move_ids and len(move_ids) == 1: # if there is only one move, take it for process | 490 | if move_ids and len(move_ids) == 1: # if there is only one move, take it for process |
1313 | 458 | move_id = move_ids[0] | 491 | move_id = move_ids[0] |
1314 | 459 | else: # if there are more than 1 moves, then pick the next one not existing in the partial_datas[in_id] | 492 | else: # if there are more than 1 moves, then pick the next one not existing in the partial_datas[in_id] |
1315 | @@ -525,7 +558,7 @@ | |||
1316 | 525 | self._add_to_shipped_moves(already_shipped_moves, move_id, data['quantity']) | 558 | self._add_to_shipped_moves(already_shipped_moves, move_id, data['quantity']) |
1317 | 526 | 559 | ||
1318 | 527 | # for the last Shipment of an FO, no new INcoming shipment will be created --> same value as in_id | 560 | # for the last Shipment of an FO, no new INcoming shipment will be created --> same value as in_id |
1320 | 528 | new_picking = self.do_incoming_shipment(cr, uid, in_processor, context) | 561 | new_picking = self.do_incoming_shipment(cr, uid, in_processor, shipment_ref=shipment_ref, context=context) |
1321 | 529 | 562 | ||
1322 | 530 | # Set the backorder reference to the IN !!!! THIS NEEDS TO BE CHECKED WITH SUPPLY PM! | 563 | # Set the backorder reference to the IN !!!! THIS NEEDS TO BE CHECKED WITH SUPPLY PM! |
1323 | 531 | if new_picking != in_id: | 564 | if new_picking != in_id: |
1324 | 532 | 565 | ||
1325 | === modified file 'bin/report/report_sxw.py' | |||
1326 | --- bin/report/report_sxw.py 2020-06-18 15:56:24 +0000 | |||
1327 | +++ bin/report/report_sxw.py 2020-08-05 12:54:43 +0000 | |||
1328 | @@ -176,8 +176,10 @@ | |||
1329 | 176 | 176 | ||
1330 | 177 | _fields_process = { | 177 | _fields_process = { |
1331 | 178 | 'float': _float_format, | 178 | 'float': _float_format, |
1332 | 179 | 'float_null': _float_format, | ||
1333 | 179 | 'date': _date_format, | 180 | 'date': _date_format, |
1334 | 180 | 'integer': _int_format, | 181 | 'integer': _int_format, |
1335 | 182 | 'integer_null': _int_format, | ||
1336 | 181 | 'datetime' : _dttime_format | 183 | 'datetime' : _dttime_format |
1337 | 182 | } | 184 | } |
1338 | 183 | 185 |