odoo-addon-project-task-stock 18.0.1.0.0.2__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.
Files changed (35) hide show
  1. odoo/addons/project_task_stock/README.rst +146 -0
  2. odoo/addons/project_task_stock/__init__.py +1 -0
  3. odoo/addons/project_task_stock/__manifest__.py +24 -0
  4. odoo/addons/project_task_stock/demo/project_data.xml +28 -0
  5. odoo/addons/project_task_stock/demo/stock_picking_type_data.xml +11 -0
  6. odoo/addons/project_task_stock/i18n/es.po +337 -0
  7. odoo/addons/project_task_stock/i18n/fr.po +337 -0
  8. odoo/addons/project_task_stock/i18n/hr.po +345 -0
  9. odoo/addons/project_task_stock/i18n/it.po +344 -0
  10. odoo/addons/project_task_stock/i18n/project_task_stock.pot +329 -0
  11. odoo/addons/project_task_stock/i18n/pt_BR.po +345 -0
  12. odoo/addons/project_task_stock/models/__init__.py +7 -0
  13. odoo/addons/project_task_stock/models/account_analytic_line.py +21 -0
  14. odoo/addons/project_task_stock/models/project_project.py +45 -0
  15. odoo/addons/project_task_stock/models/project_task.py +279 -0
  16. odoo/addons/project_task_stock/models/stock_move.py +135 -0
  17. odoo/addons/project_task_stock/models/stock_scrap.py +25 -0
  18. odoo/addons/project_task_stock/readme/CONFIGURE.md +25 -0
  19. odoo/addons/project_task_stock/readme/CONTRIBUTORS.md +3 -0
  20. odoo/addons/project_task_stock/readme/DESCRIPTION.md +1 -0
  21. odoo/addons/project_task_stock/readme/USAGE.md +21 -0
  22. odoo/addons/project_task_stock/static/description/icon.png +0 -0
  23. odoo/addons/project_task_stock/static/description/index.html +485 -0
  24. odoo/addons/project_task_stock/tests/__init__.py +4 -0
  25. odoo/addons/project_task_stock/tests/common.py +100 -0
  26. odoo/addons/project_task_stock/tests/test_project_task_stock.py +350 -0
  27. odoo/addons/project_task_stock/views/project_project_view.xml +24 -0
  28. odoo/addons/project_task_stock/views/project_task_type_view.xml +14 -0
  29. odoo/addons/project_task_stock/views/project_task_view.xml +142 -0
  30. odoo/addons/project_task_stock/views/stock_move_view.xml +65 -0
  31. odoo/addons/project_task_stock/views/stock_scrap_views.xml +13 -0
  32. odoo_addon_project_task_stock-18.0.1.0.0.2.dist-info/METADATA +161 -0
  33. odoo_addon_project_task_stock-18.0.1.0.0.2.dist-info/RECORD +35 -0
  34. odoo_addon_project_task_stock-18.0.1.0.0.2.dist-info/WHEEL +5 -0
  35. odoo_addon_project_task_stock-18.0.1.0.0.2.dist-info/top_level.txt +1 -0
@@ -0,0 +1,485 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5
+ <meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
6
+ <title>Project Task Stock</title>
7
+ <style type="text/css">
8
+
9
+ /*
10
+ :Author: David Goodger (goodger@python.org)
11
+ :Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
12
+ :Copyright: This stylesheet has been placed in the public domain.
13
+
14
+ Default cascading style sheet for the HTML output of Docutils.
15
+ Despite the name, some widely supported CSS2 features are used.
16
+
17
+ See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
18
+ customize this style sheet.
19
+ */
20
+
21
+ /* used to remove borders from tables and images */
22
+ .borderless, table.borderless td, table.borderless th {
23
+ border: 0 }
24
+
25
+ table.borderless td, table.borderless th {
26
+ /* Override padding for "table.docutils td" with "! important".
27
+ The right padding separates the table cells. */
28
+ padding: 0 0.5em 0 0 ! important }
29
+
30
+ .first {
31
+ /* Override more specific margin styles with "! important". */
32
+ margin-top: 0 ! important }
33
+
34
+ .last, .with-subtitle {
35
+ margin-bottom: 0 ! important }
36
+
37
+ .hidden {
38
+ display: none }
39
+
40
+ .subscript {
41
+ vertical-align: sub;
42
+ font-size: smaller }
43
+
44
+ .superscript {
45
+ vertical-align: super;
46
+ font-size: smaller }
47
+
48
+ a.toc-backref {
49
+ text-decoration: none ;
50
+ color: black }
51
+
52
+ blockquote.epigraph {
53
+ margin: 2em 5em ; }
54
+
55
+ dl.docutils dd {
56
+ margin-bottom: 0.5em }
57
+
58
+ object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
59
+ overflow: hidden;
60
+ }
61
+
62
+ /* Uncomment (and remove this text!) to get bold-faced definition list terms
63
+ dl.docutils dt {
64
+ font-weight: bold }
65
+ */
66
+
67
+ div.abstract {
68
+ margin: 2em 5em }
69
+
70
+ div.abstract p.topic-title {
71
+ font-weight: bold ;
72
+ text-align: center }
73
+
74
+ div.admonition, div.attention, div.caution, div.danger, div.error,
75
+ div.hint, div.important, div.note, div.tip, div.warning {
76
+ margin: 2em ;
77
+ border: medium outset ;
78
+ padding: 1em }
79
+
80
+ div.admonition p.admonition-title, div.hint p.admonition-title,
81
+ div.important p.admonition-title, div.note p.admonition-title,
82
+ div.tip p.admonition-title {
83
+ font-weight: bold ;
84
+ font-family: sans-serif }
85
+
86
+ div.attention p.admonition-title, div.caution p.admonition-title,
87
+ div.danger p.admonition-title, div.error p.admonition-title,
88
+ div.warning p.admonition-title, .code .error {
89
+ color: red ;
90
+ font-weight: bold ;
91
+ font-family: sans-serif }
92
+
93
+ /* Uncomment (and remove this text!) to get reduced vertical space in
94
+ compound paragraphs.
95
+ div.compound .compound-first, div.compound .compound-middle {
96
+ margin-bottom: 0.5em }
97
+
98
+ div.compound .compound-last, div.compound .compound-middle {
99
+ margin-top: 0.5em }
100
+ */
101
+
102
+ div.dedication {
103
+ margin: 2em 5em ;
104
+ text-align: center ;
105
+ font-style: italic }
106
+
107
+ div.dedication p.topic-title {
108
+ font-weight: bold ;
109
+ font-style: normal }
110
+
111
+ div.figure {
112
+ margin-left: 2em ;
113
+ margin-right: 2em }
114
+
115
+ div.footer, div.header {
116
+ clear: both;
117
+ font-size: smaller }
118
+
119
+ div.line-block {
120
+ display: block ;
121
+ margin-top: 1em ;
122
+ margin-bottom: 1em }
123
+
124
+ div.line-block div.line-block {
125
+ margin-top: 0 ;
126
+ margin-bottom: 0 ;
127
+ margin-left: 1.5em }
128
+
129
+ div.sidebar {
130
+ margin: 0 0 0.5em 1em ;
131
+ border: medium outset ;
132
+ padding: 1em ;
133
+ background-color: #ffffee ;
134
+ width: 40% ;
135
+ float: right ;
136
+ clear: right }
137
+
138
+ div.sidebar p.rubric {
139
+ font-family: sans-serif ;
140
+ font-size: medium }
141
+
142
+ div.system-messages {
143
+ margin: 5em }
144
+
145
+ div.system-messages h1 {
146
+ color: red }
147
+
148
+ div.system-message {
149
+ border: medium outset ;
150
+ padding: 1em }
151
+
152
+ div.system-message p.system-message-title {
153
+ color: red ;
154
+ font-weight: bold }
155
+
156
+ div.topic {
157
+ margin: 2em }
158
+
159
+ h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
160
+ h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
161
+ margin-top: 0.4em }
162
+
163
+ h1.title {
164
+ text-align: center }
165
+
166
+ h2.subtitle {
167
+ text-align: center }
168
+
169
+ hr.docutils {
170
+ width: 75% }
171
+
172
+ img.align-left, .figure.align-left, object.align-left, table.align-left {
173
+ clear: left ;
174
+ float: left ;
175
+ margin-right: 1em }
176
+
177
+ img.align-right, .figure.align-right, object.align-right, table.align-right {
178
+ clear: right ;
179
+ float: right ;
180
+ margin-left: 1em }
181
+
182
+ img.align-center, .figure.align-center, object.align-center {
183
+ display: block;
184
+ margin-left: auto;
185
+ margin-right: auto;
186
+ }
187
+
188
+ table.align-center {
189
+ margin-left: auto;
190
+ margin-right: auto;
191
+ }
192
+
193
+ .align-left {
194
+ text-align: left }
195
+
196
+ .align-center {
197
+ clear: both ;
198
+ text-align: center }
199
+
200
+ .align-right {
201
+ text-align: right }
202
+
203
+ /* reset inner alignment in figures */
204
+ div.align-right {
205
+ text-align: inherit }
206
+
207
+ /* div.align-center * { */
208
+ /* text-align: left } */
209
+
210
+ .align-top {
211
+ vertical-align: top }
212
+
213
+ .align-middle {
214
+ vertical-align: middle }
215
+
216
+ .align-bottom {
217
+ vertical-align: bottom }
218
+
219
+ ol.simple, ul.simple {
220
+ margin-bottom: 1em }
221
+
222
+ ol.arabic {
223
+ list-style: decimal }
224
+
225
+ ol.loweralpha {
226
+ list-style: lower-alpha }
227
+
228
+ ol.upperalpha {
229
+ list-style: upper-alpha }
230
+
231
+ ol.lowerroman {
232
+ list-style: lower-roman }
233
+
234
+ ol.upperroman {
235
+ list-style: upper-roman }
236
+
237
+ p.attribution {
238
+ text-align: right ;
239
+ margin-left: 50% }
240
+
241
+ p.caption {
242
+ font-style: italic }
243
+
244
+ p.credits {
245
+ font-style: italic ;
246
+ font-size: smaller }
247
+
248
+ p.label {
249
+ white-space: nowrap }
250
+
251
+ p.rubric {
252
+ font-weight: bold ;
253
+ font-size: larger ;
254
+ color: maroon ;
255
+ text-align: center }
256
+
257
+ p.sidebar-title {
258
+ font-family: sans-serif ;
259
+ font-weight: bold ;
260
+ font-size: larger }
261
+
262
+ p.sidebar-subtitle {
263
+ font-family: sans-serif ;
264
+ font-weight: bold }
265
+
266
+ p.topic-title {
267
+ font-weight: bold }
268
+
269
+ pre.address {
270
+ margin-bottom: 0 ;
271
+ margin-top: 0 ;
272
+ font: inherit }
273
+
274
+ pre.literal-block, pre.doctest-block, pre.math, pre.code {
275
+ margin-left: 2em ;
276
+ margin-right: 2em }
277
+
278
+ pre.code .ln { color: gray; } /* line numbers */
279
+ pre.code, code { background-color: #eeeeee }
280
+ pre.code .comment, code .comment { color: #5C6576 }
281
+ pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
282
+ pre.code .literal.string, code .literal.string { color: #0C5404 }
283
+ pre.code .name.builtin, code .name.builtin { color: #352B84 }
284
+ pre.code .deleted, code .deleted { background-color: #DEB0A1}
285
+ pre.code .inserted, code .inserted { background-color: #A3D289}
286
+
287
+ span.classifier {
288
+ font-family: sans-serif ;
289
+ font-style: oblique }
290
+
291
+ span.classifier-delimiter {
292
+ font-family: sans-serif ;
293
+ font-weight: bold }
294
+
295
+ span.interpreted {
296
+ font-family: sans-serif }
297
+
298
+ span.option {
299
+ white-space: nowrap }
300
+
301
+ span.pre {
302
+ white-space: pre }
303
+
304
+ span.problematic, pre.problematic {
305
+ color: red }
306
+
307
+ span.section-subtitle {
308
+ /* font-size relative to parent (h1..h6 element) */
309
+ font-size: 80% }
310
+
311
+ table.citation {
312
+ border-left: solid 1px gray;
313
+ margin-left: 1px }
314
+
315
+ table.docinfo {
316
+ margin: 2em 4em }
317
+
318
+ table.docutils {
319
+ margin-top: 0.5em ;
320
+ margin-bottom: 0.5em }
321
+
322
+ table.footnote {
323
+ border-left: solid 1px black;
324
+ margin-left: 1px }
325
+
326
+ table.docutils td, table.docutils th,
327
+ table.docinfo td, table.docinfo th {
328
+ padding-left: 0.5em ;
329
+ padding-right: 0.5em ;
330
+ vertical-align: top }
331
+
332
+ table.docutils th.field-name, table.docinfo th.docinfo-name {
333
+ font-weight: bold ;
334
+ text-align: left ;
335
+ white-space: nowrap ;
336
+ padding-left: 0 }
337
+
338
+ /* "booktabs" style (no vertical lines) */
339
+ table.docutils.booktabs {
340
+ border: 0px;
341
+ border-top: 2px solid;
342
+ border-bottom: 2px solid;
343
+ border-collapse: collapse;
344
+ }
345
+ table.docutils.booktabs * {
346
+ border: 0px;
347
+ }
348
+ table.docutils.booktabs th {
349
+ border-bottom: thin solid;
350
+ text-align: left;
351
+ }
352
+
353
+ h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
354
+ h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
355
+ font-size: 100% }
356
+
357
+ ul.auto-toc {
358
+ list-style-type: none }
359
+
360
+ </style>
361
+ </head>
362
+ <body>
363
+ <div class="document" id="project-task-stock">
364
+ <h1 class="title">Project Task Stock</h1>
365
+
366
+ <!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
367
+ !! This file is generated by oca-gen-addon-readme !!
368
+ !! changes will be overwritten. !!
369
+ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
370
+ !! source digest: sha256:f4449348b761ce99bc87fd7df05d21f50bc3fc545a1d9a997017cfe768f08fce
371
+ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
372
+ <p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/project/tree/18.0/project_task_stock"><img alt="OCA/project" src="https://img.shields.io/badge/github-OCA%2Fproject-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/project-18-0/project-18-0-project_task_stock"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/project&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
373
+ <p>This module allows to consume products directly from a project task.</p>
374
+ <p><strong>Table of contents</strong></p>
375
+ <div class="contents local topic" id="contents">
376
+ <ul class="simple">
377
+ <li><a class="reference internal" href="#configuration" id="toc-entry-1">Configuration</a></li>
378
+ <li><a class="reference internal" href="#usage" id="toc-entry-2">Usage</a></li>
379
+ <li><a class="reference internal" href="#bug-tracker" id="toc-entry-3">Bug Tracker</a></li>
380
+ <li><a class="reference internal" href="#credits" id="toc-entry-4">Credits</a><ul>
381
+ <li><a class="reference internal" href="#authors" id="toc-entry-5">Authors</a></li>
382
+ <li><a class="reference internal" href="#contributors" id="toc-entry-6">Contributors</a></li>
383
+ <li><a class="reference internal" href="#maintainers" id="toc-entry-7">Maintainers</a></li>
384
+ </ul>
385
+ </li>
386
+ </ul>
387
+ </div>
388
+ <div class="section" id="configuration">
389
+ <h1><a class="toc-backref" href="#toc-entry-1">Configuration</a></h1>
390
+ <p>To configure this module, you need to:</p>
391
+ <ol class="arabic simple">
392
+ <li>Go to <em>Inventory -&gt; Configuration -&gt; Settings</em> and check “Storage
393
+ Locations” option.</li>
394
+ <li>Go to <em>Inventory -&gt; Configuration -&gt; Operation types</em>.</li>
395
+ <li>Create a new operation type with the following options:<ul>
396
+ <li>`Operation type`: Task material</li>
397
+ <li>`Code`: TM</li>
398
+ <li>`Type of operation`: Delivery</li>
399
+ <li>`Default Source Location`: WH/Stock</li>
400
+ <li>`Default Destination Location`: WH/Stock/Shelf 1</li>
401
+ </ul>
402
+ </li>
403
+ <li>Go to <em>Project -&gt; Configuration -&gt; Projects</em>.</li>
404
+ <li>Create a new project with the following options:<ul>
405
+ <li>`Name`: Task material</li>
406
+ <li>`Operation type`: Task material</li>
407
+ </ul>
408
+ </li>
409
+ <li>Go to <em>Project -&gt; Configuration -&gt; Task Stages</em> and edit some
410
+ records.<ul>
411
+ <li>`In progress`: Check Use Stock Moves option and add the created
412
+ project.</li>
413
+ <li>`Done`: Check Use Stock Moves option + Done Stock Moves and add
414
+ the created project.</li>
415
+ </ul>
416
+ </li>
417
+ </ol>
418
+ </div>
419
+ <div class="section" id="usage">
420
+ <h1><a class="toc-backref" href="#toc-entry-2">Usage</a></h1>
421
+ <ol class="arabic simple">
422
+ <li>Go to <em>Projects -&gt; Task material (project)</em> and create a task and
423
+ edit it.</li>
424
+ <li><em>Stock Info</em> is displayed in the <em>Extra info</em> tab with the same
425
+ project information, but it can be modified.</li>
426
+ <li>Add some product to <em>Stock Info</em> tab and set some initial demand (1
427
+ for example).</li>
428
+ <li>Click on the button <em>Confirm material</em> to confirm all moves.</li>
429
+ <li>Change the stage to Done.</li>
430
+ <li><em>Stock Info</em> tab is readonly and some buttons show in header:<ul>
431
+ <li>`Check availability materials`: Product availability will be
432
+ checked.</li>
433
+ <li>`Transfer Materials`: Stock moves are confirmed and moved from
434
+ one location to another.</li>
435
+ <li>`Unreserve`: Remove the reservation stock of the products.</li>
436
+ <li>`Cancel Materials`: Set the moves of the products as cancelled.</li>
437
+ <li>`Scrap`: Allows the defined products to be scrapped.</li>
438
+ </ul>
439
+ </li>
440
+ </ol>
441
+ </div>
442
+ <div class="section" id="bug-tracker">
443
+ <h1><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h1>
444
+ <p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/project/issues">GitHub Issues</a>.
445
+ In case of trouble, please check there if your issue has already been reported.
446
+ If you spotted it first, help us to smash it by providing a detailed and welcomed
447
+ <a class="reference external" href="https://github.com/OCA/project/issues/new?body=module:%20project_task_stock%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
448
+ <p>Do not contact contributors directly about support or help with technical issues.</p>
449
+ </div>
450
+ <div class="section" id="credits">
451
+ <h1><a class="toc-backref" href="#toc-entry-4">Credits</a></h1>
452
+ <div class="section" id="authors">
453
+ <h2><a class="toc-backref" href="#toc-entry-5">Authors</a></h2>
454
+ <ul class="simple">
455
+ <li>Tecnativa</li>
456
+ </ul>
457
+ </div>
458
+ <div class="section" id="contributors">
459
+ <h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
460
+ <ul class="simple">
461
+ <li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:<ul>
462
+ <li>Víctor Martínez</li>
463
+ <li>Pedro M. Baeza</li>
464
+ </ul>
465
+ </li>
466
+ </ul>
467
+ </div>
468
+ <div class="section" id="maintainers">
469
+ <h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
470
+ <p>This module is maintained by the OCA.</p>
471
+ <a class="reference external image-reference" href="https://odoo-community.org">
472
+ <img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
473
+ </a>
474
+ <p>OCA, or the Odoo Community Association, is a nonprofit organization whose
475
+ mission is to support the collaborative development of Odoo features and
476
+ promote its widespread use.</p>
477
+ <p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
478
+ <p><a class="reference external image-reference" href="https://github.com/victoralmau"><img alt="victoralmau" src="https://github.com/victoralmau.png?size=40px" /></a></p>
479
+ <p>This module is part of the <a class="reference external" href="https://github.com/OCA/project/tree/18.0/project_task_stock">OCA/project</a> project on GitHub.</p>
480
+ <p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
481
+ </div>
482
+ </div>
483
+ </div>
484
+ </body>
485
+ </html>
@@ -0,0 +1,4 @@
1
+ # Copyright 2022 Tecnativa - Víctor Martínez
2
+ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
3
+
4
+ from . import test_project_task_stock
@@ -0,0 +1,100 @@
1
+ # Copyright 2022-2025 Tecnativa - Víctor Martínez
2
+ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
3
+
4
+ from odoo.tests import Form
5
+ from odoo.tests.common import new_test_user
6
+
7
+ from odoo.addons.base.tests.common import BaseCommon
8
+
9
+
10
+ class TestProjectStockBase(BaseCommon):
11
+ @classmethod
12
+ def setUpClass(cls):
13
+ super().setUpClass()
14
+ cls.product_a = cls.env["product.product"].create(
15
+ {
16
+ "name": "Test product A",
17
+ "type": "consu",
18
+ "is_storable": True,
19
+ "standard_price": 10,
20
+ }
21
+ )
22
+ cls.product_b = cls.env["product.product"].create(
23
+ {
24
+ "name": "Test product B",
25
+ "type": "consu",
26
+ "is_storable": True,
27
+ "standard_price": 20,
28
+ }
29
+ )
30
+ cls.product_c = cls.env["product.product"].create(
31
+ {
32
+ "name": "Test product C",
33
+ "type": "consu",
34
+ "is_storable": True,
35
+ "standard_price": 0,
36
+ }
37
+ )
38
+ cls.picking_type = cls.env.ref("project_task_stock.stock_picking_type_tm_test")
39
+ cls.location = cls.picking_type.default_location_src_id
40
+ cls.location_dest = cls.picking_type.default_location_dest_id
41
+ cls.plan = cls.env["account.analytic.plan"].create({"name": "Projects Plan"})
42
+ cls.analytic_account = cls.env["account.analytic.account"].create(
43
+ {
44
+ "name": "Test account",
45
+ "plan_id": cls.plan.id,
46
+ "company_id": False,
47
+ },
48
+ )
49
+ cls.analytic_account_2 = cls.analytic_account.copy(
50
+ {
51
+ "name": "Test account 2",
52
+ "plan_id": cls.plan.id,
53
+ "company_id": False,
54
+ }
55
+ )
56
+ cls.project = cls.env.ref("project_task_stock.project_project_tm_test")
57
+ cls.project.account_id = cls.analytic_account
58
+ cls.stage_in_progress = cls.env.ref("project.project_stage_1")
59
+ cls.stage_done = cls.env.ref("project.project_stage_2")
60
+ group_stock_user = "stock.group_stock_user"
61
+ cls.basic_user = new_test_user(
62
+ cls.env,
63
+ login="basic-user",
64
+ groups=f"project.group_project_user,{group_stock_user}",
65
+ )
66
+ new_test_user(
67
+ cls.env,
68
+ login="manager-user",
69
+ groups=f"project.group_project_manager,{group_stock_user},analytic.group_analytic_accounting",
70
+ )
71
+ new_test_user(
72
+ cls.env,
73
+ login="project-task-user",
74
+ groups="project.group_project_user,stock.group_stock_user",
75
+ )
76
+
77
+ @classmethod
78
+ def _prepare_context_task(cls):
79
+ return {
80
+ "default_project_id": cls.project.id,
81
+ "default_stage_id": cls.stage_in_progress.id,
82
+ # We need to set default values according to compute store fields
83
+ "default_location_id": cls.project.location_id.id,
84
+ "default_location_dest_id": cls.project.location_dest_id.id,
85
+ "default_picking_type_id": cls.project.picking_type_id.id,
86
+ }
87
+
88
+ @classmethod
89
+ def _create_task(cls, products):
90
+ task_form = Form(
91
+ cls.env["project.task"].with_context(**cls._prepare_context_task())
92
+ )
93
+ task_form.name = "Test task"
94
+ # Save task to use default_get() correctlly in stock.moves
95
+ task_form.save()
96
+ for product in products:
97
+ with task_form.move_ids.new() as move_form:
98
+ move_form.product_id = product[0]
99
+ move_form.product_uom_qty = product[1]
100
+ return task_form.save()