odoo-addon-stock-request 15.0.1.7.0.1__py3-none-any.whl → 16.0.1.0.0.3__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 (49) hide show
  1. odoo/addons/stock_request/README.rst +9 -9
  2. odoo/addons/stock_request/__manifest__.py +2 -2
  3. odoo/addons/stock_request/i18n/ca.po +36 -31
  4. odoo/addons/stock_request/i18n/de.po +49 -77
  5. odoo/addons/stock_request/i18n/el_GR.po +36 -31
  6. odoo/addons/stock_request/i18n/es.po +60 -38
  7. odoo/addons/stock_request/i18n/es_ES.po +36 -31
  8. odoo/addons/stock_request/i18n/eu.po +36 -31
  9. odoo/addons/stock_request/i18n/fi.po +36 -31
  10. odoo/addons/stock_request/i18n/fr.po +36 -31
  11. odoo/addons/stock_request/i18n/fr_CH.po +36 -31
  12. odoo/addons/stock_request/i18n/fr_FR.po +36 -31
  13. odoo/addons/stock_request/i18n/gl.po +36 -31
  14. odoo/addons/stock_request/i18n/hr.po +36 -31
  15. odoo/addons/stock_request/i18n/hr_HR.po +36 -31
  16. odoo/addons/stock_request/i18n/it.po +36 -31
  17. odoo/addons/stock_request/i18n/ja.po +36 -31
  18. odoo/addons/stock_request/i18n/ja_JP.po +36 -31
  19. odoo/addons/stock_request/i18n/nl.po +36 -31
  20. odoo/addons/stock_request/i18n/nl_NL.po +36 -31
  21. odoo/addons/stock_request/i18n/pt.po +36 -31
  22. odoo/addons/stock_request/i18n/pt_BR.po +36 -31
  23. odoo/addons/stock_request/i18n/ro.po +36 -31
  24. odoo/addons/stock_request/i18n/ru.po +36 -31
  25. odoo/addons/stock_request/i18n/sl.po +36 -31
  26. odoo/addons/stock_request/i18n/stock_request.pot +37 -32
  27. odoo/addons/stock_request/i18n/tr.po +36 -31
  28. odoo/addons/stock_request/i18n/tr_TR.po +36 -31
  29. odoo/addons/stock_request/i18n/vi_VN.po +36 -31
  30. odoo/addons/stock_request/i18n/zh_CN.po +52 -75
  31. odoo/addons/stock_request/models/__init__.py +1 -1
  32. odoo/addons/stock_request/models/stock_picking.py +2 -2
  33. odoo/addons/stock_request/models/stock_request.py +40 -29
  34. odoo/addons/stock_request/models/stock_request_abstract.py +5 -7
  35. odoo/addons/stock_request/models/stock_request_order.py +11 -8
  36. odoo/addons/stock_request/models/{stock_location_route.py → stock_route.py} +2 -2
  37. odoo/addons/stock_request/security/stock_request_security.xml +1 -5
  38. odoo/addons/stock_request/static/description/index.html +5 -5
  39. odoo/addons/stock_request/tests/test_stock_request.py +140 -156
  40. odoo/addons/stock_request/views/res_config_settings_views.xml +5 -2
  41. odoo/addons/stock_request/views/stock_request_order_views.xml +14 -3
  42. odoo/addons/stock_request/views/stock_request_views.xml +14 -5
  43. {odoo_addon_stock_request-15.0.1.7.0.1.dist-info → odoo_addon_stock_request-16.0.1.0.0.3.dist-info}/METADATA +14 -14
  44. odoo_addon_stock_request-16.0.1.0.0.3.dist-info/RECORD +71 -0
  45. {odoo_addon_stock_request-15.0.1.7.0.1.dist-info → odoo_addon_stock_request-16.0.1.0.0.3.dist-info}/WHEEL +1 -1
  46. odoo/addons/stock_request/migrations/15.0.1.4.0/noupdate_changes.xml +0 -14
  47. odoo/addons/stock_request/migrations/15.0.1.4.0/post-migration.py +0 -10
  48. odoo_addon_stock_request-15.0.1.7.0.1.dist-info/RECORD +0 -73
  49. {odoo_addon_stock_request-15.0.1.7.0.1.dist-info → odoo_addon_stock_request-16.0.1.0.0.3.dist-info}/top_level.txt +0 -0
@@ -1,137 +1,136 @@
1
1
  # Copyright 2017 ForgeFlow S.L.
2
- # Copyright 2022-2023 Tecnativa - Víctor Martínez
3
2
  # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl-3.0).
4
-
5
3
  from collections import Counter
6
4
  from datetime import datetime
7
5
 
8
6
  from odoo import exceptions, fields
9
- from odoo.tests import common, new_test_user
10
-
11
-
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
- )
7
+ from odoo.tests import new_test_user
8
+
9
+ from odoo.addons.base.tests.common import BaseCommon
10
+
11
+
12
+ class TestStockRequest(BaseCommon):
13
+ @classmethod
14
+ def setUpClass(cls):
15
+ super().setUpClass()
16
+
25
17
  # common models
26
- self.stock_request = self.env["stock.request"]
27
- self.request_order = self.env["stock.request.order"]
18
+ cls.stock_request = cls.env["stock.request"]
19
+ cls.request_order = cls.env["stock.request.order"]
20
+
28
21
  # refs
29
- self.stock_request_user_group = self.env.ref(
22
+ cls.stock_request_user_group = cls.env.ref(
30
23
  "stock_request.group_stock_request_user"
31
24
  )
32
- self.main_company = self.env.ref("base.main_company")
33
- self.warehouse = self.env.ref("stock.warehouse0")
34
- self.categ_unit = self.env.ref("uom.product_uom_categ_unit")
35
- self.virtual_loc = self.env.ref("stock.stock_location_customers")
25
+ cls.main_company = cls.env.ref("base.main_company")
26
+ cls.warehouse = cls.env.ref("stock.warehouse0")
27
+ cls.categ_unit = cls.env.ref("uom.product_uom_categ_unit")
28
+ cls.virtual_loc = cls.env.ref("stock.stock_location_customers")
29
+
36
30
  # common data
37
- self.company_2 = self.env["res.company"].create(
38
- {"name": "Comp2", "parent_id": self.main_company.id}
31
+ cls.company_2 = cls.env["res.company"].create(
32
+ {"name": "Comp2", "parent_id": cls.main_company.id}
39
33
  )
40
- self.company_2_address = (
41
- self.env["res.partner"]
42
- .with_context(company_id=self.company_2.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
- self.wh2 = self.env["stock.warehouse"].search(
46
- [("company_id", "=", self.company_2.id)], limit=1
39
+ cls.wh = cls.env["stock.warehouse"].search(
40
+ [("company_id", "=", cls.main_company.id)], limit=1
47
41
  )
48
- self.stock_request_user = new_test_user(
49
- self.env,
42
+ cls.wh2 = cls.env["stock.warehouse"].search(
43
+ [("company_id", "=", cls.company_2.id)], limit=1
44
+ )
45
+ cls.stock_request_user = new_test_user(
46
+ cls.env,
50
47
  login="stock_request_user",
51
48
  groups="stock_request.group_stock_request_user",
52
- company_ids=[(6, 0, [self.main_company.id, self.company_2.id])],
49
+ company_ids=[(4, cls.main_company.id), (4, cls.company_2.id)],
53
50
  )
54
- self.stock_request_manager = new_test_user(
55
- self.env,
51
+ cls.stock_request_manager = new_test_user(
52
+ cls.env,
56
53
  login="stock_request_manager",
57
54
  groups="stock_request.group_stock_request_manager",
58
- company_ids=[(6, 0, [self.main_company.id, self.company_2.id])],
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
55
+ company_ids=[(4, cls.main_company.id), (4, cls.company_2.id)],
63
56
  )
64
- self.ressuply_loc = self._create_location(
57
+ cls.product = cls._create_product("SH", "Shoes", False)
58
+ cls.product_company_2 = cls._create_product("SH_2", "Shoes", cls.company_2.id)
59
+
60
+ cls.ressuply_loc = cls._create_location(
65
61
  name="Ressuply",
66
- location_id=self.warehouse.view_location_id.id,
67
- company_id=self.main_company.id,
62
+ location_id=cls.warehouse.view_location_id.id,
63
+ company_id=cls.main_company.id,
68
64
  )
69
- self.ressuply_loc_2 = self._create_location(
65
+ cls.ressuply_loc_2 = cls._create_location(
70
66
  name="Ressuply",
71
- location_id=self.wh2.view_location_id.id,
72
- company_id=self.company_2.id,
73
- )
74
- self.route = self._create_location_route(
75
- name="Transfer", company_id=self.main_company.id
76
- )
77
- self.route_2 = self._create_location_route(
78
- name="Transfer", company_id=self.company_2.id
67
+ location_id=cls.wh2.view_location_id.id,
68
+ company_id=cls.company_2.id,
79
69
  )
80
- self.uom_dozen = self.env["uom.uom"].create(
70
+
71
+ cls.route = cls._create_route(name="Transfer", company_id=cls.main_company.id)
72
+ cls.route_2 = cls._create_route(name="Transfer", company_id=cls.company_2.id)
73
+
74
+ cls.uom_dozen = cls.env["uom.uom"].create(
81
75
  {
82
76
  "name": "Test-DozenA",
83
- "category_id": self.categ_unit.id,
77
+ "category_id": cls.categ_unit.id,
84
78
  "factor_inv": 12,
85
79
  "uom_type": "bigger",
86
80
  "rounding": 0.001,
87
81
  }
88
82
  )
89
- self.env["stock.rule"].create(
83
+
84
+ cls.env["stock.rule"].create(
90
85
  {
91
86
  "name": "Transfer",
92
- "route_id": self.route.id,
93
- "location_src_id": self.ressuply_loc.id,
94
- "location_id": self.warehouse.lot_stock_id.id,
87
+ "route_id": cls.route.id,
88
+ "location_src_id": cls.ressuply_loc.id,
89
+ "location_dest_id": cls.warehouse.lot_stock_id.id,
95
90
  "action": "pull",
96
- "picking_type_id": self.warehouse.int_type_id.id,
91
+ "picking_type_id": cls.warehouse.int_type_id.id,
97
92
  "procure_method": "make_to_stock",
98
- "warehouse_id": self.warehouse.id,
99
- "company_id": self.main_company.id,
93
+ "warehouse_id": cls.warehouse.id,
94
+ "company_id": cls.main_company.id,
100
95
  }
101
96
  )
102
- self.env["stock.rule"].create(
97
+
98
+ cls.env["stock.rule"].create(
103
99
  {
104
100
  "name": "Transfer",
105
- "route_id": self.route_2.id,
106
- "location_src_id": self.ressuply_loc_2.id,
107
- "location_id": self.wh2.lot_stock_id.id,
101
+ "route_id": cls.route_2.id,
102
+ "location_src_id": cls.ressuply_loc_2.id,
103
+ "location_dest_id": cls.wh2.lot_stock_id.id,
108
104
  "action": "pull",
109
- "picking_type_id": self.wh2.int_type_id.id,
105
+ "picking_type_id": cls.wh2.int_type_id.id,
110
106
  "procure_method": "make_to_stock",
111
- "warehouse_id": self.wh2.id,
112
- "company_id": self.company_2.id,
107
+ "warehouse_id": cls.wh2.id,
108
+ "company_id": cls.company_2.id,
113
109
  }
114
110
  )
115
- self.env["ir.config_parameter"].sudo().set_param(
111
+
112
+ cls.env["ir.config_parameter"].sudo().set_param(
116
113
  "stock.no_auto_scheduler", "True"
117
114
  )
118
115
 
119
- def _create_product(self, default_code, name, company_id, **vals):
120
- return self.env["product.product"].create(
116
+ @classmethod
117
+ def _create_product(cls, default_code, name, company_id, **vals):
118
+ return cls.env["product.product"].create(
121
119
  dict(
122
120
  name=name,
123
121
  default_code=default_code,
124
- uom_id=self.env.ref("uom.product_uom_unit").id,
122
+ uom_id=cls.env.ref("uom.product_uom_unit").id,
125
123
  company_id=company_id,
126
124
  type="product",
127
125
  **vals
128
126
  )
129
127
  )
130
128
 
129
+ @classmethod
131
130
  def _create_product_template_attribute_line(
132
- self, product_tmpl_id, attribute_id, value_id
131
+ cls, product_tmpl_id, attribute_id, value_id
133
132
  ):
134
- return self.env["product.template.attribute.line"].create(
133
+ return cls.env["product.template.attribute.line"].create(
135
134
  {
136
135
  "product_tmpl_id": product_tmpl_id,
137
136
  "attribute_id": attribute_id,
@@ -139,19 +138,23 @@ class TestStockRequest(common.TransactionCase):
139
138
  }
140
139
  )
141
140
 
142
- def _create_product_attribute_value(self, name, attribute):
143
- return self.env["product.attribute.value"].create(
141
+ @classmethod
142
+ def _create_product_attribute_value(cls, name, attribute):
143
+ return cls.env["product.attribute.value"].create(
144
144
  {"name": name, "attribute_id": attribute}
145
145
  )
146
146
 
147
- def _create_product_attribute(self, name):
148
- return self.env["product.attribute"].create({"name": name})
147
+ @classmethod
148
+ def _create_product_attribute(cls, name):
149
+ return cls.env["product.attribute"].create({"name": name})
149
150
 
150
- def _create_location(self, **vals):
151
- return self.env["stock.location"].create(dict(usage="internal", **vals))
151
+ @classmethod
152
+ def _create_location(cls, **vals):
153
+ return cls.env["stock.location"].create(dict(usage="internal", **vals))
152
154
 
153
- def _create_location_route(self, **vals):
154
- return self.env["stock.location.route"].create(
155
+ @classmethod
156
+ def _create_route(cls, **vals):
157
+ return cls.env["stock.route"].create(
155
158
  dict(
156
159
  product_categ_selectable=False,
157
160
  product_selectable=True,
@@ -162,9 +165,6 @@ class TestStockRequest(common.TransactionCase):
162
165
 
163
166
 
164
167
  class TestStockRequestBase(TestStockRequest):
165
- def setUp(self):
166
- super().setUp()
167
-
168
168
  def _create_stock_quant(self, product, location, qty):
169
169
  self.env["stock.quant"].create(
170
170
  {"product_id": product.id, "location_id": location.id, "quantity": qty}
@@ -176,30 +176,17 @@ class TestStockRequestBase(TestStockRequest):
176
176
  "product_uom_id": self.product.uom_id.id,
177
177
  "product_uom_qty": 5.0,
178
178
  }
179
- stock_request = (
180
- self.stock_request.with_user(self.stock_request_user)
181
- .with_context(company_id=self.main_company.id)
182
- .create(vals)
183
- )
184
-
179
+ request_model = self.stock_request.with_user(self.stock_request_user)
180
+ stock_request = request_model.with_company(self.main_company).create(vals)
185
181
  self.assertEqual(stock_request.requested_by, self.stock_request_user)
186
-
187
182
  self.assertEqual(stock_request.warehouse_id, self.warehouse)
188
-
189
183
  self.assertEqual(stock_request.location_id, self.warehouse.lot_stock_id)
190
184
 
191
185
  def test_defaults_order(self):
192
- vals = {}
193
- order = (
194
- self.request_order.with_user(self.stock_request_user)
195
- .with_context(company_id=self.main_company.id)
196
- .create(vals)
197
- )
198
-
186
+ request_model = self.request_order.with_user(self.stock_request_user)
187
+ order = request_model.with_company(self.main_company).create({})
199
188
  self.assertEqual(order.requested_by, self.stock_request_user)
200
-
201
189
  self.assertEqual(order.warehouse_id, self.warehouse)
202
-
203
190
  self.assertEqual(order.location_id, self.warehouse.lot_stock_id)
204
191
 
205
192
  def test_onchanges_order(self):
@@ -228,7 +215,6 @@ class TestStockRequestBase(TestStockRequest):
228
215
  order = self.request_order.with_user(self.stock_request_user).new(vals)
229
216
  self.stock_request_user.company_id = self.company_2
230
217
  order.company_id = self.company_2
231
-
232
218
  order.onchange_company_id()
233
219
 
234
220
  stock_request = order.stock_request_ids
@@ -264,6 +250,7 @@ class TestStockRequestBase(TestStockRequest):
264
250
  def test_onchanges(self):
265
251
  self.product.route_ids = [(6, 0, self.route.ids)]
266
252
  vals = {
253
+ "product_id": self.product.id,
267
254
  "product_uom_id": self.product.uom_id.id,
268
255
  "product_uom_qty": 5.0,
269
256
  "company_id": self.main_company.id,
@@ -303,7 +290,7 @@ class TestStockRequestBase(TestStockRequest):
303
290
  # Test onchange_warehouse_id
304
291
  wh2_2 = (
305
292
  self.env["stock.warehouse"]
306
- .with_context(company_id=self.company_2.id)
293
+ .with_company(self.company_2)
307
294
  .create(
308
295
  {
309
296
  "name": "C2_2",
@@ -776,14 +763,15 @@ class TestStockRequestBase(TestStockRequest):
776
763
  "warehouse_id": self.warehouse.id,
777
764
  "location_id": self.warehouse.lot_stock_id.id,
778
765
  }
779
-
780
766
  stock_request_1 = (
781
- self.env["stock.request"].with_user(self.stock_request_user).create(vals)
767
+ self.env["stock.request"]
768
+ .with_user(self.stock_request_user)
769
+ .create(vals.copy())
782
770
  )
783
771
  stock_request_2 = (
784
772
  self.env["stock.request"]
785
773
  .with_user(self.stock_request_manager.id)
786
- .create(vals)
774
+ .create(vals.copy())
787
775
  )
788
776
  stock_request_2.product_uom_qty = 6.0
789
777
  self.product.route_ids = [(6, 0, self.route.ids)]
@@ -915,10 +903,10 @@ class TestStockRequestBase(TestStockRequest):
915
903
  ],
916
904
  }
917
905
 
918
- order = self.request_order.create(vals)
906
+ order = self.request_order.with_user(self.stock_request_manager).create(vals)
919
907
  self.product.route_ids = [(6, 0, self.route.ids)]
920
908
 
921
- order.with_user(self.stock_request_manager).action_confirm()
909
+ order.action_confirm()
922
910
  stock_request = order.stock_request_ids
923
911
  self.assertTrue(stock_request.picking_ids)
924
912
  self.assertTrue(order.picking_ids)
@@ -1195,9 +1183,9 @@ class TestStockRequestBase(TestStockRequest):
1195
1183
  picking = order.picking_ids
1196
1184
  self.assertEqual(1, len(picking))
1197
1185
  picking.action_assign()
1198
- self.assertEqual(3, len(picking.move_lines))
1199
- line = picking.move_lines.filtered(lambda r: r.product_id == self.product)
1200
- line.quantity_done = 1
1186
+ self.assertEqual(3, len(picking.move_line_ids))
1187
+ line = picking.move_line_ids.filtered(lambda r: r.product_id == self.product)
1188
+ line.qty_done = 1
1201
1189
  sr1 = order.stock_request_ids.filtered(lambda r: r.product_id == self.product)
1202
1190
  sr2 = order.stock_request_ids.filtered(lambda r: r.product_id == product2)
1203
1191
  sr3 = order.stock_request_ids.filtered(lambda r: r.product_id == product3)
@@ -1207,9 +1195,9 @@ class TestStockRequestBase(TestStockRequest):
1207
1195
  self.env["stock.backorder.confirmation"].with_context(
1208
1196
  button_validate_picking_ids=[picking.id]
1209
1197
  ).create({"pick_ids": [(4, picking.id)]}).process()
1210
- sr1.refresh()
1211
- sr2.refresh()
1212
- sr3.refresh()
1198
+ sr1.env.invalidate_all()
1199
+ sr2.env.invalidate_all()
1200
+ sr3.env.invalidate_all()
1213
1201
  self.assertNotEqual(sr1.state, "done")
1214
1202
  self.assertNotEqual(sr2.state, "done")
1215
1203
  self.assertNotEqual(sr3.state, "done")
@@ -1218,62 +1206,58 @@ class TestStockRequestBase(TestStockRequest):
1218
1206
  )
1219
1207
  self.assertEqual(1, len(picking))
1220
1208
  picking.action_assign()
1221
- self.assertEqual(3, len(picking.move_lines))
1222
- line = picking.move_lines.filtered(lambda r: r.product_id == self.product)
1223
- line.quantity_done = 4
1224
- line = picking.move_lines.filtered(lambda r: r.product_id == product2)
1225
- line.quantity_done = 1
1209
+ self.assertEqual(3, len(picking.move_line_ids))
1210
+ line = picking.move_line_ids.filtered(lambda r: r.product_id == self.product)
1211
+ line.qty_done = 4
1212
+ line = picking.move_line_ids.filtered(lambda r: r.product_id == product2)
1213
+ line.qty_done = 1
1226
1214
  self.env["stock.backorder.confirmation"].with_context(
1227
1215
  button_validate_picking_ids=[picking.id]
1228
1216
  ).create({"pick_ids": [(4, picking.id)]}).process_cancel_backorder()
1229
- sr1.refresh()
1230
- sr2.refresh()
1231
- sr3.refresh()
1217
+ sr1.env.invalidate_all()
1218
+ sr2.env.invalidate_all()
1219
+ sr3.env.invalidate_all()
1232
1220
  self.assertEqual(sr1.state, "done")
1233
- self.assertEqual(sr1.qty_done, 5)
1234
1221
  self.assertEqual(sr1.qty_cancelled, 0)
1235
1222
  self.assertEqual(sr2.state, "cancel")
1236
- self.assertEqual(sr2.qty_done, 1)
1237
1223
  self.assertEqual(sr2.qty_cancelled, 4)
1238
1224
  self.assertEqual(sr3.state, "cancel")
1239
- self.assertEqual(sr3.qty_done, 0)
1240
1225
  self.assertEqual(sr3.qty_cancelled, 5)
1241
- # Set the request order to done if there are any delivered lines
1242
- self.assertEqual(order.state, "done")
1243
1226
 
1244
1227
 
1245
1228
  class TestStockRequestOrderState(TestStockRequest):
1246
- def setUp(self):
1247
- super().setUp()
1248
- self.product_a = self._create_product(
1229
+ @classmethod
1230
+ def setUpClass(cls):
1231
+ super().setUpClass()
1232
+ cls.product_a = cls._create_product(
1249
1233
  "CODEA",
1250
1234
  "Product A",
1251
- self.main_company.id,
1235
+ cls.main_company.id,
1252
1236
  )
1253
- self.product_a.route_ids = [(6, 0, self.route.ids)]
1254
- self.product_b = self._create_product(
1237
+ cls.product_a.route_ids = [(6, 0, cls.route.ids)]
1238
+ cls.product_b = cls._create_product(
1255
1239
  "CODEB",
1256
1240
  "Product B",
1257
- self.main_company.id,
1241
+ cls.main_company.id,
1258
1242
  )
1259
- self.product_b.route_ids = [(6, 0, self.route.ids)]
1243
+ cls.product_b.route_ids = [(6, 0, cls.route.ids)]
1260
1244
  expected_date = fields.Datetime.now()
1261
1245
  vals = {
1262
- "company_id": self.main_company.id,
1263
- "warehouse_id": self.warehouse.id,
1264
- "location_id": self.warehouse.lot_stock_id.id,
1246
+ "company_id": cls.main_company.id,
1247
+ "warehouse_id": cls.warehouse.id,
1248
+ "location_id": cls.warehouse.lot_stock_id.id,
1265
1249
  "expected_date": expected_date,
1266
1250
  "stock_request_ids": [
1267
1251
  (
1268
1252
  0,
1269
1253
  0,
1270
1254
  {
1271
- "product_id": self.product_a.id,
1272
- "product_uom_id": self.product_a.uom_id.id,
1255
+ "product_id": cls.product_a.id,
1256
+ "product_uom_id": cls.product_a.uom_id.id,
1273
1257
  "product_uom_qty": 1.0,
1274
- "company_id": self.main_company.id,
1275
- "warehouse_id": self.warehouse.id,
1276
- "location_id": self.warehouse.lot_stock_id.id,
1258
+ "company_id": cls.main_company.id,
1259
+ "warehouse_id": cls.warehouse.id,
1260
+ "location_id": cls.warehouse.lot_stock_id.id,
1277
1261
  "expected_date": expected_date,
1278
1262
  },
1279
1263
  ),
@@ -1281,23 +1265,23 @@ class TestStockRequestOrderState(TestStockRequest):
1281
1265
  0,
1282
1266
  0,
1283
1267
  {
1284
- "product_id": self.product_b.id,
1285
- "product_uom_id": self.product_b.uom_id.id,
1268
+ "product_id": cls.product_b.id,
1269
+ "product_uom_id": cls.product_b.uom_id.id,
1286
1270
  "product_uom_qty": 1.0,
1287
- "company_id": self.main_company.id,
1288
- "warehouse_id": self.warehouse.id,
1289
- "location_id": self.warehouse.lot_stock_id.id,
1271
+ "company_id": cls.main_company.id,
1272
+ "warehouse_id": cls.warehouse.id,
1273
+ "location_id": cls.warehouse.lot_stock_id.id,
1290
1274
  "expected_date": expected_date,
1291
1275
  },
1292
1276
  ),
1293
1277
  ],
1294
1278
  }
1295
- self.order = self.request_order.new(vals)
1296
- self.request_a = self.order.stock_request_ids.filtered(
1297
- lambda x: x.product_id == self.product_a
1279
+ cls.order = cls.request_order.create(vals)
1280
+ cls.request_a = cls.order.stock_request_ids.filtered(
1281
+ lambda x: x.product_id == cls.product_a
1298
1282
  )
1299
- self.request_b = self.order.stock_request_ids.filtered(
1300
- lambda x: x.product_id == self.product_b
1283
+ cls.request_b = cls.order.stock_request_ids.filtered(
1284
+ lambda x: x.product_id == cls.product_b
1301
1285
  )
1302
1286
 
1303
1287
  def test_stock_request_order_state_01(self):
@@ -13,6 +13,7 @@
13
13
  <div
14
14
  class="app_settings_block"
15
15
  data-string="Stock Request"
16
+ string="Stock Request"
16
17
  data-key="stock_request"
17
18
  groups="stock_request.group_stock_request_manager"
18
19
  >
@@ -42,7 +43,8 @@
42
43
  for="stock_request_allow_virtual_loc"
43
44
  />
44
45
  <div class="text-muted">
45
- By default only internal and transit locations are allowed in Stock Request and Orders.
46
+ By default only internal and transit locations are allowed in
47
+ Stock Request and Orders.
46
48
  </div>
47
49
  </div>
48
50
  </div>
@@ -56,7 +58,8 @@
56
58
  for="module_stock_request_purchase"
57
59
  />
58
60
  <div class="text-muted">
59
- Add State to Stock Request and Stock Request Orders if activated.
61
+ Add State to Stock Request and Stock Request Orders if
62
+ activated.
60
63
  </div>
61
64
  </div>
62
65
  </div>
@@ -6,6 +6,7 @@
6
6
  <field name="arch" type="xml">
7
7
  <tree>
8
8
  <field name="name" />
9
+ <field name="allow_virtual_location" invisible="1" />
9
10
  <field name="warehouse_id" groups="stock.group_stock_multi_locations" />
10
11
  <field name="location_id" groups="stock.group_stock_multi_locations" />
11
12
  <field name="state" />
@@ -17,6 +18,11 @@
17
18
  <field name="model">stock.request.order</field>
18
19
  <field name="arch" type="xml">
19
20
  <form>
21
+ <field name="allow_virtual_location" invisible="1" />
22
+ <field name="company_id" invisible="1" />
23
+ <field name="warehouse_id" invisible="1" />
24
+ <field name="location_id" invisible="1" />
25
+ <field name="procurement_group_id" invisible="1" />
20
26
  <header>
21
27
  <button
22
28
  name="action_confirm"
@@ -40,7 +46,11 @@
40
46
  </header>
41
47
  <sheet>
42
48
  <div class="oe_button_box" name="button_box">
43
- <field name="picking_ids" invisible="1" />
49
+ <field
50
+ name="picking_ids"
51
+ invisible="1"
52
+ groups="stock.group_stock_user"
53
+ />
44
54
  <button
45
55
  type="object"
46
56
  name="action_view_transfer"
@@ -51,6 +61,7 @@
51
61
  >
52
62
  <field
53
63
  name="picking_count"
64
+ groups="stock.group_stock_user"
54
65
  widget="statinfo"
55
66
  string="Transfers"
56
67
  />
@@ -91,7 +102,6 @@
91
102
  name="location_id"
92
103
  groups="stock.group_stock_multi_locations"
93
104
  />
94
- <field name="allow_virtual_location" invisible="1" />
95
105
  <field
96
106
  name="procurement_group_id"
97
107
  groups="stock.group_adv_location"
@@ -127,6 +137,7 @@
127
137
  options="{'no_open': True, 'no_create': True}"
128
138
  groups="uom.group_uom"
129
139
  />
140
+ <field name="product_uom_id" invisible="1" />
130
141
  <field
131
142
  name="route_id"
132
143
  options="{'no_create': True}"
@@ -138,11 +149,11 @@
138
149
  <field name="qty_done" />
139
150
  <field name="expected_date" invisible="1" />
140
151
  <field name="picking_policy" invisible="1" />
141
- <field name="warehouse_id" invisible="1" />
142
152
  <field
143
153
  name="allow_virtual_location"
144
154
  invisible="1"
145
155
  />
156
+ <field name="warehouse_id" invisible="1" />
146
157
  <field name="location_id" invisible="1" />
147
158
  <field name="procurement_group_id" invisible="1" />
148
159
  <field name="company_id" invisible="1" />