odoo-addon-stock-request 17.0.1.1.2.1__py3-none-any.whl → 17.0.1.1.2.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.
- odoo/addons/stock_request/tests/test_stock_request.py +107 -112
- {odoo_addon_stock_request-17.0.1.1.2.1.dist-info → odoo_addon_stock_request-17.0.1.1.2.2.dist-info}/METADATA +1 -1
- {odoo_addon_stock_request-17.0.1.1.2.1.dist-info → odoo_addon_stock_request-17.0.1.1.2.2.dist-info}/RECORD +5 -5
- {odoo_addon_stock_request-17.0.1.1.2.1.dist-info → odoo_addon_stock_request-17.0.1.1.2.2.dist-info}/WHEEL +0 -0
- {odoo_addon_stock_request-17.0.1.1.2.1.dist-info → odoo_addon_stock_request-17.0.1.1.2.2.dist-info}/top_level.txt +0 -0
@@ -8,133 +8,126 @@ from datetime import datetime
|
|
8
8
|
from odoo import exceptions, fields
|
9
9
|
from odoo.tests import common, new_test_user
|
10
10
|
|
11
|
+
from odoo.addons.base.tests.common import BaseCommon
|
12
|
+
|
13
|
+
|
14
|
+
class TestStockRequest(BaseCommon):
|
15
|
+
@classmethod
|
16
|
+
def setUpClass(cls):
|
17
|
+
super().setUpClass()
|
11
18
|
|
12
|
-
class TestStockRequest(common.TransactionCase):
|
13
|
-
def setUp(self):
|
14
|
-
super().setUp()
|
15
|
-
self.env = self.env(
|
16
|
-
context=dict(
|
17
|
-
self.env.context,
|
18
|
-
mail_create_nolog=True,
|
19
|
-
mail_create_nosubscribe=True,
|
20
|
-
mail_notrack=True,
|
21
|
-
no_reset_password=True,
|
22
|
-
tracking_disable=True,
|
23
|
-
)
|
24
|
-
)
|
25
19
|
# common models
|
26
|
-
|
27
|
-
|
20
|
+
cls.stock_request = cls.env["stock.request"]
|
21
|
+
cls.request_order = cls.env["stock.request.order"]
|
28
22
|
# refs
|
29
|
-
|
23
|
+
cls.stock_request_user_group = cls.env.ref(
|
30
24
|
"stock_request.group_stock_request_user"
|
31
25
|
)
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
26
|
+
cls.main_company = cls.env.ref("base.main_company")
|
27
|
+
cls.warehouse = cls.env.ref("stock.warehouse0")
|
28
|
+
cls.categ_unit = cls.env.ref("uom.product_uom_categ_unit")
|
29
|
+
cls.virtual_loc = cls.env.ref("stock.stock_location_customers")
|
36
30
|
# common data
|
37
|
-
|
38
|
-
{"name": "Comp2", "parent_id":
|
31
|
+
cls.company_2 = cls.env["res.company"].create(
|
32
|
+
{"name": "Comp2", "parent_id": cls.main_company.id}
|
39
33
|
)
|
40
|
-
|
41
|
-
|
42
|
-
.with_context(company_id=
|
34
|
+
cls.company_2_address = (
|
35
|
+
cls.env["res.partner"]
|
36
|
+
.with_context(company_id=cls.company_2.id)
|
43
37
|
.create({"name": "Peñiscola"})
|
44
38
|
)
|
45
|
-
|
46
|
-
[("company_id", "=",
|
39
|
+
cls.wh2 = cls.env["stock.warehouse"].search(
|
40
|
+
[("company_id", "=", cls.company_2.id)], limit=1
|
47
41
|
)
|
48
|
-
|
49
|
-
|
42
|
+
cls.stock_request_user = new_test_user(
|
43
|
+
cls.env,
|
50
44
|
login="stock_request_user",
|
51
45
|
groups="stock_request.group_stock_request_user",
|
52
|
-
company_ids=[(
|
46
|
+
company_ids=[(4, cls.main_company.id), (4, cls.company_2.id)],
|
53
47
|
)
|
54
|
-
|
55
|
-
|
48
|
+
cls.stock_request_manager = new_test_user(
|
49
|
+
cls.env,
|
56
50
|
login="stock_request_manager",
|
57
51
|
groups="stock_request.group_stock_request_manager",
|
58
|
-
company_ids=[(
|
59
|
-
)
|
60
|
-
self.product = self._create_product("SH", "Shoes", False)
|
61
|
-
self.product_company_2 = self._create_product(
|
62
|
-
"SH_2", "Shoes", self.company_2.id
|
52
|
+
company_ids=[(4, cls.main_company.id), (4, cls.company_2.id)],
|
63
53
|
)
|
64
|
-
|
54
|
+
cls.product = cls._create_product("SH", "Shoes", False)
|
55
|
+
cls.product_company_2 = cls._create_product("SH_2", "Shoes", cls.company_2.id)
|
56
|
+
|
57
|
+
cls.ressuply_loc = cls._create_location(
|
65
58
|
name="Ressuply",
|
66
|
-
location_id=
|
67
|
-
company_id=
|
59
|
+
location_id=cls.warehouse.view_location_id.id,
|
60
|
+
company_id=cls.main_company.id,
|
68
61
|
)
|
69
|
-
|
62
|
+
cls.ressuply_loc_2 = cls._create_location(
|
70
63
|
name="Ressuply",
|
71
|
-
location_id=
|
72
|
-
company_id=
|
64
|
+
location_id=cls.wh2.view_location_id.id,
|
65
|
+
company_id=cls.company_2.id,
|
73
66
|
)
|
74
|
-
|
75
|
-
|
76
|
-
)
|
77
|
-
|
78
|
-
|
79
|
-
)
|
80
|
-
self.route_3 = self._create_location_route(
|
81
|
-
name="Transfer", company_id=self.main_company.id
|
82
|
-
)
|
83
|
-
self.uom_dozen = self.env["uom.uom"].create(
|
67
|
+
|
68
|
+
cls.route = cls._create_route(name="Transfer", company_id=cls.main_company.id)
|
69
|
+
cls.route_2 = cls._create_route(name="Transfer", company_id=cls.company_2.id)
|
70
|
+
cls.route_3 = cls._create_route(name="Transfer", company_id=cls.main_company.id)
|
71
|
+
cls.uom_dozen = cls.env["uom.uom"].create(
|
84
72
|
{
|
85
73
|
"name": "Test-DozenA",
|
86
|
-
"category_id":
|
74
|
+
"category_id": cls.categ_unit.id,
|
87
75
|
"factor_inv": 12,
|
88
76
|
"uom_type": "bigger",
|
89
77
|
"rounding": 0.001,
|
90
78
|
}
|
91
79
|
)
|
92
|
-
|
80
|
+
|
81
|
+
cls.env["stock.rule"].create(
|
93
82
|
{
|
94
83
|
"name": "Transfer",
|
95
|
-
"route_id":
|
96
|
-
"location_src_id":
|
97
|
-
"location_dest_id":
|
84
|
+
"route_id": cls.route.id,
|
85
|
+
"location_src_id": cls.ressuply_loc.id,
|
86
|
+
"location_dest_id": cls.warehouse.lot_stock_id.id,
|
98
87
|
"action": "pull",
|
99
|
-
"picking_type_id":
|
88
|
+
"picking_type_id": cls.warehouse.int_type_id.id,
|
100
89
|
"procure_method": "make_to_stock",
|
101
|
-
"warehouse_id":
|
102
|
-
"company_id":
|
90
|
+
"warehouse_id": cls.warehouse.id,
|
91
|
+
"company_id": cls.main_company.id,
|
103
92
|
}
|
104
93
|
)
|
105
|
-
|
94
|
+
|
95
|
+
cls.env["stock.rule"].create(
|
106
96
|
{
|
107
97
|
"name": "Transfer",
|
108
|
-
"route_id":
|
109
|
-
"location_src_id":
|
110
|
-
"location_dest_id":
|
98
|
+
"route_id": cls.route_2.id,
|
99
|
+
"location_src_id": cls.ressuply_loc_2.id,
|
100
|
+
"location_dest_id": cls.wh2.lot_stock_id.id,
|
111
101
|
"action": "pull",
|
112
|
-
"picking_type_id":
|
102
|
+
"picking_type_id": cls.wh2.int_type_id.id,
|
113
103
|
"procure_method": "make_to_stock",
|
114
|
-
"warehouse_id":
|
115
|
-
"company_id":
|
104
|
+
"warehouse_id": cls.wh2.id,
|
105
|
+
"company_id": cls.company_2.id,
|
116
106
|
}
|
117
107
|
)
|
118
|
-
|
108
|
+
|
109
|
+
cls.env["ir.config_parameter"].sudo().set_param(
|
119
110
|
"stock.no_auto_scheduler", "True"
|
120
111
|
)
|
121
112
|
|
122
|
-
|
123
|
-
|
113
|
+
@classmethod
|
114
|
+
def _create_product(cls, default_code, name, company_id, **vals):
|
115
|
+
return cls.env["product.product"].create(
|
124
116
|
dict(
|
125
117
|
name=name,
|
126
118
|
default_code=default_code,
|
127
|
-
uom_id=
|
119
|
+
uom_id=cls.env.ref("uom.product_uom_unit").id,
|
128
120
|
company_id=company_id,
|
129
|
-
|
121
|
+
type="product",
|
130
122
|
**vals,
|
131
123
|
)
|
132
124
|
)
|
133
125
|
|
126
|
+
@classmethod
|
134
127
|
def _create_product_template_attribute_line(
|
135
|
-
|
128
|
+
cls, product_tmpl_id, attribute_id, value_id
|
136
129
|
):
|
137
|
-
return
|
130
|
+
return cls.env["product.template.attribute.line"].create(
|
138
131
|
{
|
139
132
|
"product_tmpl_id": product_tmpl_id,
|
140
133
|
"attribute_id": attribute_id,
|
@@ -142,19 +135,23 @@ class TestStockRequest(common.TransactionCase):
|
|
142
135
|
}
|
143
136
|
)
|
144
137
|
|
145
|
-
|
146
|
-
|
138
|
+
@classmethod
|
139
|
+
def _create_product_attribute_value(cls, name, attribute):
|
140
|
+
return cls.env["product.attribute.value"].create(
|
147
141
|
{"name": name, "attribute_id": attribute}
|
148
142
|
)
|
149
143
|
|
150
|
-
|
151
|
-
|
144
|
+
@classmethod
|
145
|
+
def _create_product_attribute(cls, name):
|
146
|
+
return cls.env["product.attribute"].create({"name": name})
|
152
147
|
|
153
|
-
|
154
|
-
|
148
|
+
@classmethod
|
149
|
+
def _create_location(cls, **vals):
|
150
|
+
return cls.env["stock.location"].create(dict(usage="internal", **vals))
|
155
151
|
|
156
|
-
|
157
|
-
|
152
|
+
@classmethod
|
153
|
+
def _create_route(cls, **vals):
|
154
|
+
return cls.env["stock.route"].create(
|
158
155
|
dict(
|
159
156
|
product_categ_selectable=False,
|
160
157
|
product_selectable=True,
|
@@ -165,9 +162,6 @@ class TestStockRequest(common.TransactionCase):
|
|
165
162
|
|
166
163
|
|
167
164
|
class TestStockRequestBase(TestStockRequest):
|
168
|
-
def setUp(self):
|
169
|
-
super().setUp()
|
170
|
-
|
171
165
|
def _create_stock_quant(self, product, location, qty):
|
172
166
|
self.env["stock.quant"].create(
|
173
167
|
{"product_id": product.id, "location_id": location.id, "quantity": qty}
|
@@ -1252,37 +1246,38 @@ class TestStockRequestBase(TestStockRequest):
|
|
1252
1246
|
|
1253
1247
|
|
1254
1248
|
class TestStockRequestOrderState(TestStockRequest):
|
1255
|
-
|
1256
|
-
|
1257
|
-
|
1249
|
+
@classmethod
|
1250
|
+
def setUpClass(cls):
|
1251
|
+
super().setUpClass()
|
1252
|
+
cls.product_a = cls._create_product(
|
1258
1253
|
"CODEA",
|
1259
1254
|
"Product A",
|
1260
|
-
|
1255
|
+
cls.main_company.id,
|
1261
1256
|
)
|
1262
|
-
|
1263
|
-
|
1257
|
+
cls.product_a.route_ids = [(6, 0, cls.route.ids)]
|
1258
|
+
cls.product_b = cls._create_product(
|
1264
1259
|
"CODEB",
|
1265
1260
|
"Product B",
|
1266
|
-
|
1261
|
+
cls.main_company.id,
|
1267
1262
|
)
|
1268
|
-
|
1263
|
+
cls.product_b.route_ids = [(6, 0, cls.route.ids)]
|
1269
1264
|
expected_date = fields.Datetime.now()
|
1270
1265
|
vals = {
|
1271
|
-
"company_id":
|
1272
|
-
"warehouse_id":
|
1273
|
-
"location_id":
|
1266
|
+
"company_id": cls.main_company.id,
|
1267
|
+
"warehouse_id": cls.warehouse.id,
|
1268
|
+
"location_id": cls.warehouse.lot_stock_id.id,
|
1274
1269
|
"expected_date": expected_date,
|
1275
1270
|
"stock_request_ids": [
|
1276
1271
|
(
|
1277
1272
|
0,
|
1278
1273
|
0,
|
1279
1274
|
{
|
1280
|
-
"product_id":
|
1281
|
-
"product_uom_id":
|
1275
|
+
"product_id": cls.product_a.id,
|
1276
|
+
"product_uom_id": cls.product_a.uom_id.id,
|
1282
1277
|
"product_uom_qty": 1.0,
|
1283
|
-
"company_id":
|
1284
|
-
"warehouse_id":
|
1285
|
-
"location_id":
|
1278
|
+
"company_id": cls.main_company.id,
|
1279
|
+
"warehouse_id": cls.warehouse.id,
|
1280
|
+
"location_id": cls.warehouse.lot_stock_id.id,
|
1286
1281
|
"expected_date": expected_date,
|
1287
1282
|
},
|
1288
1283
|
),
|
@@ -1290,23 +1285,23 @@ class TestStockRequestOrderState(TestStockRequest):
|
|
1290
1285
|
0,
|
1291
1286
|
0,
|
1292
1287
|
{
|
1293
|
-
"product_id":
|
1294
|
-
"product_uom_id":
|
1288
|
+
"product_id": cls.product_b.id,
|
1289
|
+
"product_uom_id": cls.product_b.uom_id.id,
|
1295
1290
|
"product_uom_qty": 1.0,
|
1296
|
-
"company_id":
|
1297
|
-
"warehouse_id":
|
1298
|
-
"location_id":
|
1291
|
+
"company_id": cls.main_company.id,
|
1292
|
+
"warehouse_id": cls.warehouse.id,
|
1293
|
+
"location_id": cls.warehouse.lot_stock_id.id,
|
1299
1294
|
"expected_date": expected_date,
|
1300
1295
|
},
|
1301
1296
|
),
|
1302
1297
|
],
|
1303
1298
|
}
|
1304
|
-
|
1305
|
-
|
1306
|
-
lambda x: x.product_id ==
|
1299
|
+
cls.order = cls.request_order.create(vals)
|
1300
|
+
cls.request_a = cls.order.stock_request_ids.filtered(
|
1301
|
+
lambda x: x.product_id == cls.product_a
|
1307
1302
|
)
|
1308
|
-
|
1309
|
-
lambda x: x.product_id ==
|
1303
|
+
cls.request_b = cls.order.stock_request_ids.filtered(
|
1304
|
+
lambda x: x.product_id == cls.product_b
|
1310
1305
|
)
|
1311
1306
|
|
1312
1307
|
def test_stock_request_order_state_01(self):
|
@@ -56,7 +56,7 @@ odoo/addons/stock_request/static/description/icon.png,sha256=HZGM_z7Ta3zNQ2924BU
|
|
56
56
|
odoo/addons/stock_request/static/description/icon.svg,sha256=e3qo4KGYRy7Mfzhb_bCfVA-73Rk2Lx1z9_kz7tTjdO0,9771
|
57
57
|
odoo/addons/stock_request/static/description/index.html,sha256=7FDJM_VLmWJGwVZWi1Kpo-AlqjiruTNDQZHovA701Ek,16078
|
58
58
|
odoo/addons/stock_request/tests/__init__.py,sha256=3NQ2fafGprBbsMjR2Y__yzyvFX5Vio1r0j6tT3FTbas,33
|
59
|
-
odoo/addons/stock_request/tests/test_stock_request.py,sha256
|
59
|
+
odoo/addons/stock_request/tests/test_stock_request.py,sha256=-5F3qsypedUL8xu0FGIHzdtbGMBOwrZ0R1IXQwOmuwU,68366
|
60
60
|
odoo/addons/stock_request/views/product.xml,sha256=CJ6RE5uGQLlIMDCPKxw8nhodb_rR3jaj-mF5ozCFUKI,1517
|
61
61
|
odoo/addons/stock_request/views/res_config_settings_views.xml,sha256=kE05fmV2drjepSISURc67R7Uk_62zayWtncGSxzKTBo,6260
|
62
62
|
odoo/addons/stock_request/views/stock_move_views.xml,sha256=Z5pNG0WfYz-CTlxgB-rma0BoT08VQDHnm3J_Ksu9BxA,1072
|
@@ -65,7 +65,7 @@ odoo/addons/stock_request/views/stock_request_allocation_views.xml,sha256=NhoVR2
|
|
65
65
|
odoo/addons/stock_request/views/stock_request_menu.xml,sha256=S_3HPkmYcHC_xtPjusHiZX7RUW5CGrJW3w52ScnJFNw,1308
|
66
66
|
odoo/addons/stock_request/views/stock_request_order_views.xml,sha256=xVN0r-S1h9B4xg-duX00qNix3SM-4kTmDDP5JUzvA5s,11383
|
67
67
|
odoo/addons/stock_request/views/stock_request_views.xml,sha256=o_9aY_EOfHymmrg79uQJcVi4snCTUMt3CWacxmnIrxY,12136
|
68
|
-
odoo_addon_stock_request-17.0.1.1.2.
|
69
|
-
odoo_addon_stock_request-17.0.1.1.2.
|
70
|
-
odoo_addon_stock_request-17.0.1.1.2.
|
71
|
-
odoo_addon_stock_request-17.0.1.1.2.
|
68
|
+
odoo_addon_stock_request-17.0.1.1.2.2.dist-info/METADATA,sha256=vscaZFdxwSJxTq8i6sEIi0QTAfgzfs6VcMkN80Vvrjs,5412
|
69
|
+
odoo_addon_stock_request-17.0.1.1.2.2.dist-info/WHEEL,sha256=8Rd4enx1PCuyDWP4SABqO5Fv8rpaknqp3VzjoFFLa6c,83
|
70
|
+
odoo_addon_stock_request-17.0.1.1.2.2.dist-info/top_level.txt,sha256=QE6RBQ0QX5f4eFuUcGgU5Kbq1A_qJcDs-e_vpr6pmfU,4
|
71
|
+
odoo_addon_stock_request-17.0.1.1.2.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|