odoo-addon-stock-release-channel 16.0.2.9.0__py3-none-any.whl → 16.0.2.10.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- odoo/addons/stock_release_channel/README.rst +11 -3
- odoo/addons/stock_release_channel/__manifest__.py +5 -3
- odoo/addons/stock_release_channel/i18n/stock_release_channel.pot +48 -20
- odoo/addons/stock_release_channel/models/__init__.py +2 -0
- odoo/addons/stock_release_channel/models/res_company.py +15 -0
- odoo/addons/stock_release_channel/models/res_config_settings.py +13 -0
- odoo/addons/stock_release_channel/models/stock_release_channel.py +132 -73
- odoo/addons/stock_release_channel/readme/CONTRIBUTORS.rst +1 -0
- odoo/addons/stock_release_channel/static/description/index.html +5 -3
- odoo/addons/stock_release_channel/tests/test_channel_computed_fields.py +72 -54
- odoo/addons/stock_release_channel/views/res_config_settings.xml +28 -0
- odoo/addons/stock_release_channel/views/stock_release_channel_views.xml +256 -164
- {odoo_addon_stock_release_channel-16.0.2.9.0.dist-info → odoo_addon_stock_release_channel-16.0.2.10.0.dist-info}/METADATA +13 -5
- {odoo_addon_stock_release_channel-16.0.2.9.0.dist-info → odoo_addon_stock_release_channel-16.0.2.10.0.dist-info}/RECORD +16 -13
- {odoo_addon_stock_release_channel-16.0.2.9.0.dist-info → odoo_addon_stock_release_channel-16.0.2.10.0.dist-info}/WHEEL +0 -0
- {odoo_addon_stock_release_channel-16.0.2.9.0.dist-info → odoo_addon_stock_release_channel-16.0.2.10.0.dist-info}/top_level.txt +0 -0
|
@@ -7,7 +7,7 @@ Stock Release Channels
|
|
|
7
7
|
!! This file is generated by oca-gen-addon-readme !!
|
|
8
8
|
!! changes will be overwritten. !!
|
|
9
9
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
10
|
-
!! source digest: sha256:
|
|
10
|
+
!! source digest: sha256:194f165bf8bfb3d0b5feaa49a267582d8046ac179f9c831b4b895ba35b35c79a
|
|
11
11
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
12
12
|
|
|
13
13
|
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
|
|
@@ -104,6 +104,7 @@ Authors
|
|
|
104
104
|
~~~~~~~
|
|
105
105
|
|
|
106
106
|
* Camptocamp
|
|
107
|
+
* BCIM
|
|
107
108
|
* ACSONE SA/NV
|
|
108
109
|
|
|
109
110
|
Contributors
|
|
@@ -114,6 +115,7 @@ Contributors
|
|
|
114
115
|
* Sébastien Alix <sebastien.alix@camptocamp.com>
|
|
115
116
|
* Jacques-Etienne Baudoux <je@bcim.be>
|
|
116
117
|
* Laurent Mignon <laurent.mignon@acsone.eu>
|
|
118
|
+
* Michael Tietz (MT Software) <mtietz@mt-software.de>
|
|
117
119
|
|
|
118
120
|
Design
|
|
119
121
|
~~~~~~
|
|
@@ -145,10 +147,16 @@ promote its widespread use.
|
|
|
145
147
|
.. |maintainer-sebalix| image:: https://github.com/sebalix.png?size=40px
|
|
146
148
|
:target: https://github.com/sebalix
|
|
147
149
|
:alt: sebalix
|
|
150
|
+
.. |maintainer-jbaudoux| image:: https://github.com/jbaudoux.png?size=40px
|
|
151
|
+
:target: https://github.com/jbaudoux
|
|
152
|
+
:alt: jbaudoux
|
|
153
|
+
.. |maintainer-mt-software-de| image:: https://github.com/mt-software-de.png?size=40px
|
|
154
|
+
:target: https://github.com/mt-software-de
|
|
155
|
+
:alt: mt-software-de
|
|
148
156
|
|
|
149
|
-
Current `
|
|
157
|
+
Current `maintainers <https://odoo-community.org/page/maintainer-role>`__:
|
|
150
158
|
|
|
151
|
-
|maintainer-sebalix|
|
|
159
|
+
|maintainer-sebalix| |maintainer-jbaudoux| |maintainer-mt-software-de|
|
|
152
160
|
|
|
153
161
|
This module is part of the `OCA/wms <https://github.com/OCA/wms/tree/16.0/stock_release_channel>`_ project on GitHub.
|
|
154
162
|
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
# Copyright 2020 Camptocamp
|
|
2
|
+
# Copyright 2023 Michael Tietz (MT Software) <mtietz@mt-software.de>
|
|
2
3
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
|
|
3
4
|
|
|
4
5
|
{
|
|
5
6
|
"name": "Stock Release Channels",
|
|
6
7
|
"summary": "Manage workload in WMS with release channels",
|
|
7
|
-
"version": "16.0.2.
|
|
8
|
+
"version": "16.0.2.10.0",
|
|
8
9
|
"development_status": "Beta",
|
|
9
10
|
"license": "AGPL-3",
|
|
10
|
-
"author": "Camptocamp, ACSONE SA/NV,Odoo Community Association (OCA)",
|
|
11
|
-
"maintainers": ["sebalix"],
|
|
11
|
+
"author": "Camptocamp, BCIM, ACSONE SA/NV, Odoo Community Association (OCA)",
|
|
12
|
+
"maintainers": ["sebalix", "jbaudoux", "mt-software-de"],
|
|
12
13
|
"website": "https://github.com/OCA/wms",
|
|
13
14
|
"depends": [
|
|
14
15
|
"web",
|
|
@@ -19,6 +20,7 @@
|
|
|
19
20
|
"views/res_partner.xml",
|
|
20
21
|
"views/stock_release_channel_views.xml",
|
|
21
22
|
"views/stock_picking_views.xml",
|
|
23
|
+
"views/res_config_settings.xml",
|
|
22
24
|
"data/queue_job_data.xml",
|
|
23
25
|
"data/ir_cron_data.xml",
|
|
24
26
|
"security/stock_release_channel.xml",
|
|
@@ -27,24 +27,27 @@ msgstr ""
|
|
|
27
27
|
|
|
28
28
|
#. module: stock_release_channel
|
|
29
29
|
#: model_terms:ir.ui.view,arch_db:stock_release_channel.stock_release_channel_kanban_view
|
|
30
|
-
msgid "<span class=\"
|
|
30
|
+
msgid "<span class=\"ms-2\">Lock</span>"
|
|
31
31
|
msgstr ""
|
|
32
32
|
|
|
33
33
|
#. module: stock_release_channel
|
|
34
34
|
#: model_terms:ir.ui.view,arch_db:stock_release_channel.stock_release_channel_kanban_view
|
|
35
|
-
msgid "<span>
|
|
35
|
+
msgid "<span class=\"ms-2\">Sleep</span>"
|
|
36
36
|
msgstr ""
|
|
37
37
|
|
|
38
38
|
#. module: stock_release_channel
|
|
39
39
|
#: model_terms:ir.ui.view,arch_db:stock_release_channel.stock_release_channel_kanban_view
|
|
40
|
-
msgid "<span>
|
|
40
|
+
msgid "<span class=\"ms-2\">Unlock</span>"
|
|
41
41
|
msgstr ""
|
|
42
42
|
|
|
43
43
|
#. module: stock_release_channel
|
|
44
44
|
#: model_terms:ir.ui.view,arch_db:stock_release_channel.stock_release_channel_kanban_view
|
|
45
|
-
msgid ""
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
msgid "<span class=\"ms-2\">Wake Up</span>"
|
|
46
|
+
msgstr ""
|
|
47
|
+
|
|
48
|
+
#. module: stock_release_channel
|
|
49
|
+
#: model_terms:ir.ui.view,arch_db:stock_release_channel.stock_release_channel_kanban_view
|
|
50
|
+
msgid "<span>Actions</span>"
|
|
48
51
|
msgstr ""
|
|
49
52
|
|
|
50
53
|
#. module: stock_release_channel
|
|
@@ -178,11 +181,27 @@ msgstr ""
|
|
|
178
181
|
msgid "Channel %(name)s has no validated transfer yet."
|
|
179
182
|
msgstr ""
|
|
180
183
|
|
|
184
|
+
#. module: stock_release_channel
|
|
185
|
+
#: model:ir.model.fields,field_description:stock_release_channel.field_res_company__release_channel_show_last_picking_done
|
|
186
|
+
#: model:ir.model.fields,field_description:stock_release_channel.field_res_config_settings__release_channel_show_last_picking_done
|
|
187
|
+
msgid "Channels dashboard - Show last delivery done"
|
|
188
|
+
msgstr ""
|
|
189
|
+
|
|
181
190
|
#. module: stock_release_channel
|
|
182
191
|
#: model:ir.model.fields,field_description:stock_release_channel.field_stock_release_channel__color
|
|
183
192
|
msgid "Color"
|
|
184
193
|
msgstr ""
|
|
185
194
|
|
|
195
|
+
#. module: stock_release_channel
|
|
196
|
+
#: model:ir.model,name:stock_release_channel.model_res_company
|
|
197
|
+
msgid "Companies"
|
|
198
|
+
msgstr ""
|
|
199
|
+
|
|
200
|
+
#. module: stock_release_channel
|
|
201
|
+
#: model:ir.model,name:stock_release_channel.model_res_config_settings
|
|
202
|
+
msgid "Config Settings"
|
|
203
|
+
msgstr ""
|
|
204
|
+
|
|
186
205
|
#. module: stock_release_channel
|
|
187
206
|
#: model:ir.model,name:stock_release_channel.model_res_partner
|
|
188
207
|
msgid "Contact"
|
|
@@ -258,6 +277,14 @@ msgstr ""
|
|
|
258
277
|
msgid "In progress Related Transfers"
|
|
259
278
|
msgstr ""
|
|
260
279
|
|
|
280
|
+
#. module: stock_release_channel
|
|
281
|
+
#: model:ir.model.fields,help:stock_release_channel.field_res_company__release_channel_show_last_picking_done
|
|
282
|
+
#: model:ir.model.fields,help:stock_release_channel.field_res_config_settings__release_channel_show_last_picking_done
|
|
283
|
+
msgid ""
|
|
284
|
+
"In release channels dashboard, add link to last done picking and show "
|
|
285
|
+
"transfer date"
|
|
286
|
+
msgstr ""
|
|
287
|
+
|
|
261
288
|
#. module: stock_release_channel
|
|
262
289
|
#: model:ir.model.fields,field_description:stock_release_channel.field_stock_release_channel__is_action_lock_allowed
|
|
263
290
|
msgid "Is Action Lock Allowed"
|
|
@@ -303,6 +330,11 @@ msgstr ""
|
|
|
303
330
|
msgid "Last Modified on"
|
|
304
331
|
msgstr ""
|
|
305
332
|
|
|
333
|
+
#. module: stock_release_channel
|
|
334
|
+
#: model_terms:ir.ui.view,arch_db:stock_release_channel.stock_release_channel_kanban_view
|
|
335
|
+
msgid "Last Transfer"
|
|
336
|
+
msgstr ""
|
|
337
|
+
|
|
306
338
|
#. module: stock_release_channel
|
|
307
339
|
#: model:ir.model.fields,field_description:stock_release_channel.field_stock_release_channel__write_uid
|
|
308
340
|
msgid "Last Updated by"
|
|
@@ -340,7 +372,6 @@ msgstr ""
|
|
|
340
372
|
|
|
341
373
|
#. module: stock_release_channel
|
|
342
374
|
#: model_terms:ir.ui.view,arch_db:stock_release_channel.stock_release_channel_form_view
|
|
343
|
-
#: model_terms:ir.ui.view,arch_db:stock_release_channel.stock_release_channel_kanban_view
|
|
344
375
|
msgid "Lock"
|
|
345
376
|
msgstr ""
|
|
346
377
|
|
|
@@ -418,11 +449,6 @@ msgstr ""
|
|
|
418
449
|
msgid "Options"
|
|
419
450
|
msgstr ""
|
|
420
451
|
|
|
421
|
-
#. module: stock_release_channel
|
|
422
|
-
#: model_terms:ir.ui.view,arch_db:stock_release_channel.stock_release_channel_kanban_view
|
|
423
|
-
msgid "Overall Progress"
|
|
424
|
-
msgstr ""
|
|
425
|
-
|
|
426
452
|
#. module: stock_release_channel
|
|
427
453
|
#: model:ir.model.fields,field_description:stock_release_channel.field_stock_release_channel__partner_ids
|
|
428
454
|
msgid "Partners"
|
|
@@ -541,9 +567,18 @@ msgstr ""
|
|
|
541
567
|
msgid "Settings"
|
|
542
568
|
msgstr ""
|
|
543
569
|
|
|
570
|
+
#. module: stock_release_channel
|
|
571
|
+
#: model:ir.model.fields,field_description:stock_release_channel.field_stock_release_channel__show_last_picking_done
|
|
572
|
+
msgid "Show Last Picking Done"
|
|
573
|
+
msgstr ""
|
|
574
|
+
|
|
575
|
+
#. module: stock_release_channel
|
|
576
|
+
#: model_terms:ir.ui.view,arch_db:stock_release_channel.res_config_settings_view
|
|
577
|
+
msgid "Show last delivery done in release channels dashboard"
|
|
578
|
+
msgstr ""
|
|
579
|
+
|
|
544
580
|
#. module: stock_release_channel
|
|
545
581
|
#: model_terms:ir.ui.view,arch_db:stock_release_channel.stock_release_channel_form_view
|
|
546
|
-
#: model_terms:ir.ui.view,arch_db:stock_release_channel.stock_release_channel_kanban_view
|
|
547
582
|
msgid "Sleep"
|
|
548
583
|
msgstr ""
|
|
549
584
|
|
|
@@ -647,11 +682,6 @@ msgstr ""
|
|
|
647
682
|
msgid "Transfers Done Today"
|
|
648
683
|
msgstr ""
|
|
649
684
|
|
|
650
|
-
#. module: stock_release_channel
|
|
651
|
-
#: model_terms:ir.ui.view,arch_db:stock_release_channel.stock_release_channel_kanban_view
|
|
652
|
-
msgid "Transfers Progress"
|
|
653
|
-
msgstr ""
|
|
654
|
-
|
|
655
685
|
#. module: stock_release_channel
|
|
656
686
|
#: model_terms:ir.ui.view,arch_db:stock_release_channel.view_picking_internal_search
|
|
657
687
|
msgid "Transfers that couldn't be assigned in a release channel"
|
|
@@ -659,7 +689,6 @@ msgstr ""
|
|
|
659
689
|
|
|
660
690
|
#. module: stock_release_channel
|
|
661
691
|
#: model_terms:ir.ui.view,arch_db:stock_release_channel.stock_release_channel_form_view
|
|
662
|
-
#: model_terms:ir.ui.view,arch_db:stock_release_channel.stock_release_channel_kanban_view
|
|
663
692
|
msgid "Unlock"
|
|
664
693
|
msgstr ""
|
|
665
694
|
|
|
@@ -685,7 +714,6 @@ msgstr ""
|
|
|
685
714
|
|
|
686
715
|
#. module: stock_release_channel
|
|
687
716
|
#: model_terms:ir.ui.view,arch_db:stock_release_channel.stock_release_channel_form_view
|
|
688
|
-
#: model_terms:ir.ui.view,arch_db:stock_release_channel.stock_release_channel_kanban_view
|
|
689
717
|
msgid "Wake Up"
|
|
690
718
|
msgstr ""
|
|
691
719
|
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Copyright 2024 Jacques-Etienne Baudoux (BCIM) <je@bcim.be>
|
|
2
|
+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/lgpl).
|
|
3
|
+
|
|
4
|
+
from odoo import fields, models
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class ResCompany(models.Model):
|
|
8
|
+
_inherit = "res.company"
|
|
9
|
+
|
|
10
|
+
release_channel_show_last_picking_done = fields.Boolean(
|
|
11
|
+
string="Channels dashboard - Show last delivery done",
|
|
12
|
+
help="In release channels dashboard, add link to last done picking "
|
|
13
|
+
"and show transfer date",
|
|
14
|
+
default=True,
|
|
15
|
+
)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Copyright 2024 Jacques-Etienne Baudoux (BCIM) <je@bcim.be>
|
|
2
|
+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/lgpl).
|
|
3
|
+
|
|
4
|
+
from odoo import fields, models
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class ResConfigSettings(models.TransientModel):
|
|
8
|
+
_inherit = "res.config.settings"
|
|
9
|
+
|
|
10
|
+
release_channel_show_last_picking_done = fields.Boolean(
|
|
11
|
+
related="company_id.release_channel_show_last_picking_done",
|
|
12
|
+
readonly=False,
|
|
13
|
+
)
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
# Copyright 2020 Camptocamp
|
|
2
|
+
# Copyright 2022 Jacques-Etienne Baudoux (BCIM) <je@bcim.be>
|
|
3
|
+
# Copyright 2023 Michael Tietz (MT Software) <mtietz@mt-software.de>
|
|
2
4
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
|
|
3
5
|
|
|
4
6
|
import logging
|
|
7
|
+
from collections import defaultdict
|
|
8
|
+
from copy import deepcopy
|
|
5
9
|
|
|
6
10
|
from pytz import timezone
|
|
7
11
|
|
|
@@ -210,6 +214,9 @@ class StockReleaseChannel(models.Model):
|
|
|
210
214
|
string="Partners",
|
|
211
215
|
context={"active_test": False},
|
|
212
216
|
)
|
|
217
|
+
show_last_picking_done = fields.Boolean(
|
|
218
|
+
compute="_compute_show_last_picking_done",
|
|
219
|
+
)
|
|
213
220
|
|
|
214
221
|
@api.depends("state")
|
|
215
222
|
def _compute_is_action_lock_allowed(self):
|
|
@@ -236,6 +243,12 @@ class StockReleaseChannel(models.Model):
|
|
|
236
243
|
for rec in self:
|
|
237
244
|
rec.is_release_allowed = rec.state == "open" and not rec.release_forbidden
|
|
238
245
|
|
|
246
|
+
def _compute_show_last_picking_done(self):
|
|
247
|
+
for rec in self:
|
|
248
|
+
rec.show_last_picking_done = (
|
|
249
|
+
self.env.company.release_channel_show_last_picking_done
|
|
250
|
+
)
|
|
251
|
+
|
|
239
252
|
@api.model
|
|
240
253
|
def _get_is_release_allowed_domain(self):
|
|
241
254
|
return [("state", "=", "open"), ("release_forbidden", "=", False)]
|
|
@@ -272,8 +285,8 @@ class StockReleaseChannel(models.Model):
|
|
|
272
285
|
|
|
273
286
|
def _field_picking_domains(self):
|
|
274
287
|
return {
|
|
275
|
-
"
|
|
276
|
-
"
|
|
288
|
+
"all": [],
|
|
289
|
+
"release_ready": [
|
|
277
290
|
("release_ready", "=", True),
|
|
278
291
|
# FIXME not TZ friendly
|
|
279
292
|
(
|
|
@@ -282,91 +295,135 @@ class StockReleaseChannel(models.Model):
|
|
|
282
295
|
fields.Datetime.now().replace(hour=23, minute=59),
|
|
283
296
|
),
|
|
284
297
|
],
|
|
285
|
-
"
|
|
298
|
+
"released": [
|
|
286
299
|
("last_release_date", "!=", False),
|
|
287
300
|
("state", "in", ("assigned", "waiting", "confirmed")),
|
|
288
301
|
],
|
|
289
|
-
"
|
|
302
|
+
"assigned": [
|
|
290
303
|
("last_release_date", "!=", False),
|
|
291
304
|
("state", "=", "assigned"),
|
|
292
305
|
],
|
|
293
|
-
"
|
|
306
|
+
"waiting": [
|
|
294
307
|
("last_release_date", "!=", False),
|
|
295
308
|
("state", "in", ("waiting", "confirmed")),
|
|
296
309
|
],
|
|
297
|
-
"
|
|
310
|
+
"late": [
|
|
298
311
|
("last_release_date", "!=", False),
|
|
299
312
|
("scheduled_date", "<", fields.Datetime.now()),
|
|
300
313
|
("state", "in", ("assigned", "waiting", "confirmed")),
|
|
301
314
|
],
|
|
302
|
-
"
|
|
315
|
+
"priority": [
|
|
303
316
|
("last_release_date", "!=", False),
|
|
304
317
|
("priority", "=", "1"),
|
|
305
318
|
("state", "in", ("assigned", "waiting", "confirmed")),
|
|
306
319
|
],
|
|
307
|
-
"
|
|
320
|
+
"done": [
|
|
308
321
|
("state", "=", "done"),
|
|
309
322
|
("date_done", ">", fields.Datetime.now().replace(hour=0, minute=0)),
|
|
310
323
|
],
|
|
311
324
|
}
|
|
312
325
|
|
|
326
|
+
@api.model
|
|
327
|
+
def _get_picking_read_group_fields(self):
|
|
328
|
+
"Additional fields to read on read_group of stock.pickings"
|
|
329
|
+
return []
|
|
330
|
+
|
|
331
|
+
@api.model
|
|
332
|
+
def _get_picking_compute_fields(self):
|
|
333
|
+
"""This returns a list of tuples
|
|
334
|
+
the first value of the tuple represents the prefix of computed field
|
|
335
|
+
and the second value represents the field used to set the computed field"""
|
|
336
|
+
return [("count", "release_channel_id_count")]
|
|
337
|
+
|
|
338
|
+
@api.model
|
|
339
|
+
def _get_move_read_group_fields(self):
|
|
340
|
+
"Additional fields to read on read_group of stock.moves"
|
|
341
|
+
return []
|
|
342
|
+
|
|
343
|
+
@api.model
|
|
344
|
+
def _get_move_compute_fields(self):
|
|
345
|
+
"""This returns a list of tuples
|
|
346
|
+
the first value of the tuple represents the prefix of computed field
|
|
347
|
+
and the second value represents the field used to set the computed field"""
|
|
348
|
+
return [("count", "picking_id_count")]
|
|
349
|
+
|
|
350
|
+
@api.model
|
|
351
|
+
def _get_compute_field_name(self, prefix, name, domain_name):
|
|
352
|
+
return f"{prefix}_{name}_{domain_name}"
|
|
353
|
+
|
|
354
|
+
@api.model
|
|
355
|
+
def _get_default_aggregate_values(self):
|
|
356
|
+
picking_compute_fields = self._get_picking_compute_fields()
|
|
357
|
+
move_compute_fields = self._get_move_compute_fields()
|
|
358
|
+
default_values = {}
|
|
359
|
+
for domain_name, _d in self._field_picking_domains().items():
|
|
360
|
+
for prefix, _fetch in picking_compute_fields:
|
|
361
|
+
field = self._get_compute_field_name(prefix, "picking", domain_name)
|
|
362
|
+
default_values[field] = 0
|
|
363
|
+
for prefix, _fetch in move_compute_fields:
|
|
364
|
+
field = self._get_compute_field_name(prefix, "move", domain_name)
|
|
365
|
+
default_values[field] = 0
|
|
366
|
+
return default_values
|
|
367
|
+
|
|
313
368
|
# TODO maybe we have to do raw SQL to include the picking + moves counts in
|
|
314
369
|
# a single query
|
|
315
370
|
def _compute_picking_count(self):
|
|
316
371
|
domains = self._field_picking_domains()
|
|
317
|
-
|
|
318
|
-
|
|
372
|
+
picking_channels = defaultdict(
|
|
373
|
+
lambda: {"channel_id": False, "matched_domains": []}
|
|
374
|
+
)
|
|
375
|
+
all_picking_ids = set()
|
|
376
|
+
channels_aggregate_values = defaultdict(lambda: defaultdict(lambda: 0))
|
|
377
|
+
picking_read_fields = self._get_picking_read_group_fields()
|
|
378
|
+
picking_compute_fields = self._get_picking_compute_fields()
|
|
379
|
+
for domain_name, domain in domains.items():
|
|
319
380
|
data = self.env["stock.picking"].read_group(
|
|
320
381
|
domain + [("release_channel_id", "in", self.ids)],
|
|
321
|
-
["release_channel_id", "picking_ids:array_agg(id)"]
|
|
382
|
+
["release_channel_id", "picking_ids:array_agg(id)"]
|
|
383
|
+
+ picking_read_fields,
|
|
322
384
|
["release_channel_id"],
|
|
323
385
|
)
|
|
324
|
-
|
|
325
|
-
row["release_channel_id"]
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
all_picking_ids = [
|
|
341
|
-
pid for picking_ids in picking_ids_per_field.values() for pid in picking_ids
|
|
342
|
-
]
|
|
386
|
+
for row in data:
|
|
387
|
+
channel_id = row["release_channel_id"] and row["release_channel_id"][0]
|
|
388
|
+
if not channel_id:
|
|
389
|
+
continue
|
|
390
|
+
picking_ids = row["picking_ids"]
|
|
391
|
+
all_picking_ids.update(picking_ids)
|
|
392
|
+
for picking_id in picking_ids:
|
|
393
|
+
picking_channels[picking_id]["channel_id"] = channel_id
|
|
394
|
+
picking_channels[picking_id]["matched_domains"].append(domain_name)
|
|
395
|
+
|
|
396
|
+
for prefix, fetch in picking_compute_fields:
|
|
397
|
+
field = self._get_compute_field_name(prefix, "picking", domain_name)
|
|
398
|
+
channels_aggregate_values[channel_id][field] = row[fetch]
|
|
399
|
+
move_read_fields = self._get_move_read_group_fields()
|
|
400
|
+
move_compute_fields = self._get_move_compute_fields()
|
|
343
401
|
data = self.env["stock.move"].read_group(
|
|
344
402
|
# TODO for now we do estimates, later we may improve the domains per
|
|
345
403
|
# field, but now we can run one sql query on stock.move for all fields
|
|
346
|
-
[("picking_id", "in", all_picking_ids), ("state", "!=", "cancel")],
|
|
347
|
-
["picking_id"],
|
|
404
|
+
[("picking_id", "in", list(all_picking_ids)), ("state", "!=", "cancel")],
|
|
405
|
+
["picking_id"] + move_read_fields,
|
|
348
406
|
["picking_id"],
|
|
349
407
|
)
|
|
350
|
-
|
|
351
|
-
row["picking_id"][0]
|
|
352
|
-
for
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
move_estimate = sum(
|
|
360
|
-
move_count.get(picking_id, 0) for picking_id in picking_ids
|
|
361
|
-
)
|
|
362
|
-
record[move_field] = move_estimate
|
|
363
|
-
|
|
408
|
+
for row in data:
|
|
409
|
+
picking_id = row["picking_id"][0]
|
|
410
|
+
for matched_domain in picking_channels[picking_id]["matched_domains"]:
|
|
411
|
+
for prefix, fetch in move_compute_fields:
|
|
412
|
+
field = self._get_compute_field_name(prefix, "move", matched_domain)
|
|
413
|
+
channel_id = picking_channels[picking_id]["channel_id"]
|
|
414
|
+
channels_aggregate_values[channel_id][field] += row[fetch]
|
|
415
|
+
|
|
416
|
+
default_aggregate_values = self._get_default_aggregate_values()
|
|
364
417
|
for record in self:
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
418
|
+
values = deepcopy(default_aggregate_values)
|
|
419
|
+
values.update(channels_aggregate_values.get(record.id, {}))
|
|
420
|
+
for prefix, _fetch in self._get_picking_compute_fields():
|
|
421
|
+
values[f"{prefix}_picking_full_progress"] = (
|
|
422
|
+
values[f"{prefix}_picking_release_ready"]
|
|
423
|
+
+ values[f"{prefix}_picking_released"]
|
|
424
|
+
+ values[f"{prefix}_picking_done"]
|
|
425
|
+
)
|
|
426
|
+
record.write(values)
|
|
370
427
|
|
|
371
428
|
def _query_get_chain(self, pickings):
|
|
372
429
|
"""Get all stock.picking before an outgoing one
|
|
@@ -409,7 +466,7 @@ class StockReleaseChannel(models.Model):
|
|
|
409
466
|
)
|
|
410
467
|
self.env["stock.picking"].flush_model(["state"])
|
|
411
468
|
for channel in self:
|
|
412
|
-
domain = self._field_picking_domains()["
|
|
469
|
+
domain = self._field_picking_domains()["released"]
|
|
413
470
|
domain += [("release_channel_id", "=", channel.id)]
|
|
414
471
|
released = self.env["stock.picking"].search(domain)
|
|
415
472
|
|
|
@@ -437,7 +494,7 @@ class StockReleaseChannel(models.Model):
|
|
|
437
494
|
def _compute_last_done_picking(self):
|
|
438
495
|
for channel in self:
|
|
439
496
|
# TODO we have one query per channel, could be better
|
|
440
|
-
domain = self._field_picking_domains()["
|
|
497
|
+
domain = self._field_picking_domains()["done"]
|
|
441
498
|
domain += [("release_channel_id", "=", channel.id)]
|
|
442
499
|
picking = self.env["stock.picking"].search(
|
|
443
500
|
domain, limit=1, order="date_done DESC"
|
|
@@ -557,35 +614,36 @@ class StockReleaseChannel(models.Model):
|
|
|
557
614
|
|
|
558
615
|
def action_picking_all(self):
|
|
559
616
|
return self._action_picking_for_field(
|
|
560
|
-
"
|
|
617
|
+
"all", context={"search_default_release_ready": 1}
|
|
561
618
|
)
|
|
562
619
|
|
|
563
620
|
def action_picking_release_ready(self):
|
|
564
|
-
return self._action_picking_for_field("
|
|
621
|
+
return self._action_picking_for_field("release_ready")
|
|
565
622
|
|
|
566
623
|
def action_picking_released(self):
|
|
567
|
-
return self._action_picking_for_field("
|
|
624
|
+
return self._action_picking_for_field("released")
|
|
568
625
|
|
|
569
626
|
def action_picking_assigned(self):
|
|
570
|
-
return self._action_picking_for_field("
|
|
627
|
+
return self._action_picking_for_field("assigned")
|
|
571
628
|
|
|
572
629
|
def action_picking_waiting(self):
|
|
573
|
-
return self._action_picking_for_field("
|
|
630
|
+
return self._action_picking_for_field("waiting")
|
|
574
631
|
|
|
575
632
|
def action_picking_late(self):
|
|
576
|
-
return self._action_picking_for_field("
|
|
633
|
+
return self._action_picking_for_field("late")
|
|
577
634
|
|
|
578
635
|
def action_picking_priority(self):
|
|
579
|
-
return self._action_picking_for_field("
|
|
636
|
+
return self._action_picking_for_field("priority")
|
|
580
637
|
|
|
581
638
|
def action_picking_done(self):
|
|
582
|
-
return self._action_picking_for_field("
|
|
639
|
+
return self._action_picking_for_field("done")
|
|
583
640
|
|
|
584
641
|
def _action_picking_for_field(self, field_domain, context=None):
|
|
585
642
|
domain = self._field_picking_domains()[field_domain]
|
|
586
643
|
domain += [("release_channel_id", "in", self.ids)]
|
|
587
644
|
pickings = self.env["stock.picking"].search(domain)
|
|
588
|
-
|
|
645
|
+
field = self._get_compute_field_name("count", "picking", field_domain)
|
|
646
|
+
field_descr = self._fields[field]._description_string(self.env)
|
|
589
647
|
return self._build_action(
|
|
590
648
|
"stock_available_to_promise_release.stock_picking_release_action",
|
|
591
649
|
pickings,
|
|
@@ -595,35 +653,36 @@ class StockReleaseChannel(models.Model):
|
|
|
595
653
|
|
|
596
654
|
def action_move_all(self):
|
|
597
655
|
return self._action_move_for_field(
|
|
598
|
-
"
|
|
656
|
+
"all", context={"search_default_release_ready": 1}
|
|
599
657
|
)
|
|
600
658
|
|
|
601
659
|
def action_move_release_ready(self):
|
|
602
|
-
return self._action_move_for_field("
|
|
660
|
+
return self._action_move_for_field("release_ready")
|
|
603
661
|
|
|
604
662
|
def action_move_released(self):
|
|
605
|
-
return self._action_move_for_field("
|
|
663
|
+
return self._action_move_for_field("released")
|
|
606
664
|
|
|
607
665
|
def action_move_assigned(self):
|
|
608
|
-
return self._action_move_for_field("
|
|
666
|
+
return self._action_move_for_field("assigned")
|
|
609
667
|
|
|
610
668
|
def action_move_waiting(self):
|
|
611
|
-
return self._action_move_for_field("
|
|
669
|
+
return self._action_move_for_field("waiting")
|
|
612
670
|
|
|
613
671
|
def action_move_late(self):
|
|
614
|
-
return self._action_move_for_field("
|
|
672
|
+
return self._action_move_for_field("late")
|
|
615
673
|
|
|
616
674
|
def action_move_priority(self):
|
|
617
|
-
return self._action_move_for_field("
|
|
675
|
+
return self._action_move_for_field("priority")
|
|
618
676
|
|
|
619
677
|
def action_move_done(self):
|
|
620
|
-
return self._action_move_for_field("
|
|
678
|
+
return self._action_move_for_field("done")
|
|
621
679
|
|
|
622
680
|
def _action_move_for_field(self, field_domain, context=None):
|
|
623
681
|
domain = self._field_picking_domains()[field_domain]
|
|
624
682
|
domain += [("release_channel_id", "in", self.ids)]
|
|
625
683
|
pickings = self.env["stock.picking"].search(domain)
|
|
626
|
-
|
|
684
|
+
field = self._get_compute_field_name("count", "picking", field_domain)
|
|
685
|
+
field_descr = self._fields[field]._description_string(self.env)
|
|
627
686
|
xmlid = "stock_available_to_promise_release.stock_move_release_action"
|
|
628
687
|
action = self.env["ir.actions.act_window"]._for_xml_id(xmlid)
|
|
629
688
|
action["display_name"] = "{} ({})".format(
|
|
@@ -678,7 +737,7 @@ class StockReleaseChannel(models.Model):
|
|
|
678
737
|
|
|
679
738
|
def _get_pickings_to_release(self):
|
|
680
739
|
"""Get the pickings to release."""
|
|
681
|
-
domain = self._field_picking_domains()["
|
|
740
|
+
domain = self._field_picking_domains()["release_ready"]
|
|
682
741
|
domain += [("release_channel_id", "in", self.ids)]
|
|
683
742
|
return self.env["stock.picking"].search(domain)
|
|
684
743
|
|
|
@@ -686,7 +745,7 @@ class StockReleaseChannel(models.Model):
|
|
|
686
745
|
if not self.max_batch_mode:
|
|
687
746
|
raise exceptions.UserError(_("No Max transfers to release is configured."))
|
|
688
747
|
|
|
689
|
-
waiting_domain = self._field_picking_domains()["
|
|
748
|
+
waiting_domain = self._field_picking_domains()["waiting"]
|
|
690
749
|
waiting_domain += [("release_channel_id", "=", self.id)]
|
|
691
750
|
released_in_progress = self.env["stock.picking"].search_count(waiting_domain)
|
|
692
751
|
|