odoo-addon-sale-blanket-order 16.0.2.0.0.2__py3-none-any.whl → 18.0.1.2.1__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/sale_blanket_order/README.rst +111 -63
- odoo/addons/sale_blanket_order/__manifest__.py +8 -3
- odoo/addons/sale_blanket_order/data/ir_cron.xml +0 -2
- odoo/addons/sale_blanket_order/i18n/de.po +65 -80
- odoo/addons/sale_blanket_order/i18n/es.po +30 -59
- odoo/addons/sale_blanket_order/i18n/fr.po +30 -59
- odoo/addons/sale_blanket_order/i18n/fr_FR.po +30 -59
- odoo/addons/sale_blanket_order/i18n/it.po +68 -88
- odoo/addons/sale_blanket_order/i18n/pt.po +15 -59
- odoo/addons/sale_blanket_order/i18n/sale_blanket_order.pot +16 -60
- odoo/addons/sale_blanket_order/models/blanket_orders.py +77 -143
- odoo/addons/sale_blanket_order/models/sale_config_settings.py +0 -1
- odoo/addons/sale_blanket_order/models/sale_orders.py +8 -14
- odoo/addons/sale_blanket_order/readme/CONTEXT.md +5 -0
- odoo/addons/sale_blanket_order/readme/CONTRIBUTORS.md +17 -0
- odoo/addons/sale_blanket_order/readme/{CREDITS.rst → CREDITS.md} +2 -1
- odoo/addons/sale_blanket_order/readme/DESCRIPTION.md +5 -0
- odoo/addons/sale_blanket_order/readme/ROADMAP.md +3 -0
- odoo/addons/sale_blanket_order/readme/USAGE.md +58 -0
- odoo/addons/sale_blanket_order/report/report.xml +0 -2
- odoo/addons/sale_blanket_order/report/templates.xml +32 -35
- odoo/addons/sale_blanket_order/static/description/index.html +87 -62
- odoo/addons/sale_blanket_order/static/src/js/disable_add_order_line.esm.js +22 -0
- odoo/addons/sale_blanket_order/tests/test_blanket_orders.py +99 -50
- odoo/addons/sale_blanket_order/tests/test_sale_order.py +7 -80
- odoo/addons/sale_blanket_order/views/sale_blanket_order_line_views.xml +7 -16
- odoo/addons/sale_blanket_order/views/sale_blanket_order_views.xml +31 -57
- odoo/addons/sale_blanket_order/views/sale_config_settings.xml +11 -19
- odoo/addons/sale_blanket_order/views/sale_order_views.xml +5 -8
- odoo/addons/sale_blanket_order/wizard/create_sale_orders.py +28 -26
- odoo/addons/sale_blanket_order/wizard/create_sale_orders.xml +12 -2
- odoo_addon_sale_blanket_order-18.0.1.2.1.dist-info/METADATA +216 -0
- odoo_addon_sale_blanket_order-18.0.1.2.1.dist-info/RECORD +49 -0
- {odoo_addon_sale_blanket_order-16.0.2.0.0.2.dist-info → odoo_addon_sale_blanket_order-18.0.1.2.1.dist-info}/WHEEL +1 -1
- odoo_addon_sale_blanket_order-18.0.1.2.1.dist-info/top_level.txt +1 -0
- odoo/addons/sale_blanket_order/readme/CONTRIBUTORS.rst +0 -8
- odoo/addons/sale_blanket_order/readme/DESCRIPTION.rst +0 -4
- odoo/addons/sale_blanket_order/readme/USAGE.rst +0 -53
- odoo_addon_sale_blanket_order-16.0.2.0.0.2.dist-info/METADATA +0 -168
- odoo_addon_sale_blanket_order-16.0.2.0.0.2.dist-info/RECORD +0 -46
- odoo_addon_sale_blanket_order-16.0.2.0.0.2.dist-info/top_level.txt +0 -1
|
@@ -15,12 +15,65 @@ class TestSaleBlanketOrders(common.TransactionCase):
|
|
|
15
15
|
cls.blanket_order_line_obj = cls.env["sale.blanket.order.line"]
|
|
16
16
|
cls.blanket_order_wiz_obj = cls.env["sale.blanket.order.wizard"]
|
|
17
17
|
cls.so_obj = cls.env["sale.order"]
|
|
18
|
+
cls.product_pricelist_item_obj = cls.env["product.pricelist.item"]
|
|
19
|
+
|
|
20
|
+
settings = cls.env["res.config.settings"].with_user(cls.env.user).create({})
|
|
21
|
+
settings.group_discount_per_so_line = True
|
|
22
|
+
settings.set_values()
|
|
18
23
|
|
|
19
24
|
cls.payment_term = cls.env.ref("account.account_payment_term_immediate")
|
|
20
25
|
cls.sale_pricelist = cls.env["product.pricelist"].create(
|
|
21
26
|
{"name": "Test Pricelist", "currency_id": cls.env.ref("base.USD").id}
|
|
22
27
|
)
|
|
23
28
|
|
|
29
|
+
# Taxes
|
|
30
|
+
company_partner = cls.env["res.partner"].create(
|
|
31
|
+
{
|
|
32
|
+
"name": __name__,
|
|
33
|
+
"country_id": cls.env.company.country_id.id,
|
|
34
|
+
}
|
|
35
|
+
)
|
|
36
|
+
company2 = cls.env["res.company"].create(
|
|
37
|
+
{
|
|
38
|
+
"name": __name__,
|
|
39
|
+
"partner_id": company_partner.id,
|
|
40
|
+
},
|
|
41
|
+
)
|
|
42
|
+
cls.env.user.company_ids += company2
|
|
43
|
+
cls.env = cls.env(
|
|
44
|
+
context=dict(
|
|
45
|
+
cls.env.context, allowed_company_ids=[cls.env.company.id, company2.id]
|
|
46
|
+
)
|
|
47
|
+
)
|
|
48
|
+
tax_group1 = cls.env["account.tax.group"].create(
|
|
49
|
+
{
|
|
50
|
+
"name": cls.env.company.name,
|
|
51
|
+
"company_id": cls.env.company.id,
|
|
52
|
+
}
|
|
53
|
+
)
|
|
54
|
+
tax_group2 = cls.env["account.tax.group"].create(
|
|
55
|
+
{
|
|
56
|
+
"name": company2.name,
|
|
57
|
+
"company_id": company2.id,
|
|
58
|
+
}
|
|
59
|
+
)
|
|
60
|
+
cls.tax1 = cls.env["account.tax"].create(
|
|
61
|
+
{
|
|
62
|
+
"name": cls.env.company.name,
|
|
63
|
+
"company_id": cls.env.company.id,
|
|
64
|
+
"amount": 10,
|
|
65
|
+
"tax_group_id": tax_group1.id,
|
|
66
|
+
}
|
|
67
|
+
)
|
|
68
|
+
cls.tax2 = cls.env["account.tax"].create(
|
|
69
|
+
{
|
|
70
|
+
"name": company2.name,
|
|
71
|
+
"company_id": company2.id,
|
|
72
|
+
"amount": 20,
|
|
73
|
+
"tax_group_id": tax_group2.id,
|
|
74
|
+
}
|
|
75
|
+
)
|
|
76
|
+
|
|
24
77
|
# UoM
|
|
25
78
|
cls.categ_unit = cls.env.ref("uom.product_uom_categ_unit")
|
|
26
79
|
cls.uom_dozen = cls.env["uom.uom"].create(
|
|
@@ -48,6 +101,7 @@ class TestSaleBlanketOrders(common.TransactionCase):
|
|
|
48
101
|
"type": "consu",
|
|
49
102
|
"uom_id": cls.env.ref("uom.product_uom_unit").id,
|
|
50
103
|
"default_code": "PROD_DEL01",
|
|
104
|
+
"taxes_id": [fields.Command.set([cls.tax1.id, cls.tax2.id])],
|
|
51
105
|
}
|
|
52
106
|
)
|
|
53
107
|
cls.product2 = cls.env["product.product"].create(
|
|
@@ -63,6 +117,9 @@ class TestSaleBlanketOrders(common.TransactionCase):
|
|
|
63
117
|
|
|
64
118
|
cls.yesterday = date.today() - timedelta(days=1)
|
|
65
119
|
cls.tomorrow = date.today() + timedelta(days=1)
|
|
120
|
+
cls.analytic_distribution = {
|
|
121
|
+
str(cls.env.ref("analytic.analytic_internal").id): 100,
|
|
122
|
+
}
|
|
66
123
|
|
|
67
124
|
def test_01_create_blanket_order(self):
|
|
68
125
|
"""We create a blanket order and check constrains to confirm BO"""
|
|
@@ -73,9 +130,7 @@ class TestSaleBlanketOrders(common.TransactionCase):
|
|
|
73
130
|
"payment_term_id": self.payment_term.id,
|
|
74
131
|
"pricelist_id": self.sale_pricelist.id,
|
|
75
132
|
"line_ids": [
|
|
76
|
-
(
|
|
77
|
-
0,
|
|
78
|
-
0,
|
|
133
|
+
fields.Command.create(
|
|
79
134
|
{
|
|
80
135
|
"product_id": self.product.id,
|
|
81
136
|
"product_uom": self.product.uom_id.id,
|
|
@@ -83,9 +138,7 @@ class TestSaleBlanketOrders(common.TransactionCase):
|
|
|
83
138
|
"price_unit": 0.0, # will be updated later
|
|
84
139
|
},
|
|
85
140
|
),
|
|
86
|
-
(
|
|
87
|
-
0,
|
|
88
|
-
0,
|
|
141
|
+
fields.Command.create(
|
|
89
142
|
{
|
|
90
143
|
"name": "My section",
|
|
91
144
|
"display_type": "line_section",
|
|
@@ -95,11 +148,24 @@ class TestSaleBlanketOrders(common.TransactionCase):
|
|
|
95
148
|
}
|
|
96
149
|
)
|
|
97
150
|
blanket_order.sudo().onchange_partner_id()
|
|
98
|
-
|
|
151
|
+
|
|
152
|
+
pricelist_item = self.product_pricelist_item_obj.search(
|
|
153
|
+
[("pricelist_id", "=", blanket_order.pricelist_id.id)], limit=1
|
|
154
|
+
)
|
|
155
|
+
if not pricelist_item:
|
|
156
|
+
pricelist_item = self.product_pricelist_item_obj.create(
|
|
157
|
+
{
|
|
158
|
+
"pricelist_id": blanket_order.pricelist_id.id,
|
|
159
|
+
"fixed_price": 10.0,
|
|
160
|
+
}
|
|
161
|
+
)
|
|
162
|
+
|
|
99
163
|
blanket_order.line_ids[0].sudo().onchange_product()
|
|
100
|
-
blanket_order.
|
|
164
|
+
self.assertEqual(blanket_order.line_ids[0].taxes_id, self.tax1)
|
|
165
|
+
|
|
166
|
+
pricelist_item.write({"compute_price": "percentage"})
|
|
101
167
|
blanket_order.line_ids[0].sudo().onchange_product()
|
|
102
|
-
blanket_order.line_ids[0].sudo()._get_display_price(
|
|
168
|
+
blanket_order.line_ids[0].sudo()._get_display_price()
|
|
103
169
|
|
|
104
170
|
self.assertEqual(blanket_order.state, "draft")
|
|
105
171
|
|
|
@@ -128,9 +194,7 @@ class TestSaleBlanketOrders(common.TransactionCase):
|
|
|
128
194
|
"payment_term_id": self.payment_term.id,
|
|
129
195
|
"pricelist_id": self.sale_pricelist.id,
|
|
130
196
|
"line_ids": [
|
|
131
|
-
(
|
|
132
|
-
0,
|
|
133
|
-
0,
|
|
197
|
+
fields.Command.create(
|
|
134
198
|
{
|
|
135
199
|
"product_id": False,
|
|
136
200
|
"product_uom": False,
|
|
@@ -138,10 +202,9 @@ class TestSaleBlanketOrders(common.TransactionCase):
|
|
|
138
202
|
"display_type": "line_section",
|
|
139
203
|
},
|
|
140
204
|
),
|
|
141
|
-
(
|
|
142
|
-
0,
|
|
143
|
-
0,
|
|
205
|
+
fields.Command.create(
|
|
144
206
|
{
|
|
207
|
+
"analytic_distribution": self.analytic_distribution,
|
|
145
208
|
"product_id": self.product.id,
|
|
146
209
|
"product_uom": self.product.uom_id.id,
|
|
147
210
|
"original_uom_qty": 20.0,
|
|
@@ -178,6 +241,12 @@ class TestSaleBlanketOrders(common.TransactionCase):
|
|
|
178
241
|
for so in sos:
|
|
179
242
|
self.assertEqual(so.origin, blanket_order.name)
|
|
180
243
|
|
|
244
|
+
# Analytic distribution is propagated to the sale line
|
|
245
|
+
self.assertEqual(
|
|
246
|
+
sos[0].order_line.filtered("product_id").analytic_distribution,
|
|
247
|
+
self.analytic_distribution,
|
|
248
|
+
)
|
|
249
|
+
|
|
181
250
|
def test_03_create_sale_orders_from_blanket_order_line(self):
|
|
182
251
|
"""We create a blanket order and create two sale orders
|
|
183
252
|
from the blanket order lines"""
|
|
@@ -188,9 +257,7 @@ class TestSaleBlanketOrders(common.TransactionCase):
|
|
|
188
257
|
"payment_term_id": self.payment_term.id,
|
|
189
258
|
"pricelist_id": self.sale_pricelist.id,
|
|
190
259
|
"line_ids": [
|
|
191
|
-
(
|
|
192
|
-
0,
|
|
193
|
-
0,
|
|
260
|
+
fields.Command.create(
|
|
194
261
|
{
|
|
195
262
|
"product_id": self.product.id,
|
|
196
263
|
"product_uom": self.product.uom_id.id,
|
|
@@ -198,9 +265,7 @@ class TestSaleBlanketOrders(common.TransactionCase):
|
|
|
198
265
|
"price_unit": 30.0,
|
|
199
266
|
},
|
|
200
267
|
),
|
|
201
|
-
(
|
|
202
|
-
0,
|
|
203
|
-
0,
|
|
268
|
+
fields.Command.create(
|
|
204
269
|
{
|
|
205
270
|
"product_id": self.product2.id,
|
|
206
271
|
"product_uom": self.product2.uom_id.id,
|
|
@@ -239,9 +304,7 @@ class TestSaleBlanketOrders(common.TransactionCase):
|
|
|
239
304
|
"pricelist_id": self.sale_pricelist.id,
|
|
240
305
|
"currency_id": self.sale_pricelist.currency_id.id,
|
|
241
306
|
"line_ids": [
|
|
242
|
-
(
|
|
243
|
-
0,
|
|
244
|
-
0,
|
|
307
|
+
fields.Command.create(
|
|
245
308
|
{
|
|
246
309
|
"product_id": self.product.id,
|
|
247
310
|
"product_uom": self.product.uom_id.id,
|
|
@@ -249,9 +312,7 @@ class TestSaleBlanketOrders(common.TransactionCase):
|
|
|
249
312
|
"price_unit": 30.0,
|
|
250
313
|
},
|
|
251
314
|
),
|
|
252
|
-
(
|
|
253
|
-
0,
|
|
254
|
-
0,
|
|
315
|
+
fields.Command.create(
|
|
255
316
|
{
|
|
256
317
|
"product_id": self.product2.id,
|
|
257
318
|
"product_uom": self.product2.uom_id.id,
|
|
@@ -273,9 +334,7 @@ class TestSaleBlanketOrders(common.TransactionCase):
|
|
|
273
334
|
"payment_term_id": self.payment_term.id,
|
|
274
335
|
"pricelist_id": self.sale_pricelist.id,
|
|
275
336
|
"order_line": [
|
|
276
|
-
(
|
|
277
|
-
0,
|
|
278
|
-
0,
|
|
337
|
+
fields.Command.create(
|
|
279
338
|
{
|
|
280
339
|
"product_id": self.product.id,
|
|
281
340
|
"product_uom": self.product.uom_id.id,
|
|
@@ -283,9 +342,7 @@ class TestSaleBlanketOrders(common.TransactionCase):
|
|
|
283
342
|
"price_unit": 30.0,
|
|
284
343
|
},
|
|
285
344
|
),
|
|
286
|
-
(
|
|
287
|
-
0,
|
|
288
|
-
0,
|
|
345
|
+
fields.Command.create(
|
|
289
346
|
{
|
|
290
347
|
"product_id": self.product2.id,
|
|
291
348
|
"product_uom": self.product2.uom_id.id,
|
|
@@ -310,9 +367,7 @@ class TestSaleBlanketOrders(common.TransactionCase):
|
|
|
310
367
|
"payment_term_id": self.payment_term.id,
|
|
311
368
|
"pricelist_id": self.sale_pricelist.id,
|
|
312
369
|
"line_ids": [
|
|
313
|
-
(
|
|
314
|
-
0,
|
|
315
|
-
0,
|
|
370
|
+
fields.Command.create(
|
|
316
371
|
{
|
|
317
372
|
"product_id": self.product.id,
|
|
318
373
|
"product_uom": self.uom_dozen.id,
|
|
@@ -332,9 +387,7 @@ class TestSaleBlanketOrders(common.TransactionCase):
|
|
|
332
387
|
"payment_term_id": self.payment_term.id,
|
|
333
388
|
"pricelist_id": self.sale_pricelist.id,
|
|
334
389
|
"order_line": [
|
|
335
|
-
(
|
|
336
|
-
0,
|
|
337
|
-
0,
|
|
390
|
+
fields.Command.create(
|
|
338
391
|
{
|
|
339
392
|
"product_id": self.product.id,
|
|
340
393
|
"product_uom": self.product.uom_id.id,
|
|
@@ -361,9 +414,7 @@ class TestSaleBlanketOrders(common.TransactionCase):
|
|
|
361
414
|
"payment_term_id": self.payment_term.id,
|
|
362
415
|
"pricelist_id": self.sale_pricelist.id,
|
|
363
416
|
"line_ids": [
|
|
364
|
-
(
|
|
365
|
-
0,
|
|
366
|
-
0,
|
|
417
|
+
fields.Command.create(
|
|
367
418
|
{
|
|
368
419
|
"product_id": self.product.id,
|
|
369
420
|
"product_uom": self.product.uom_id.id,
|
|
@@ -371,9 +422,7 @@ class TestSaleBlanketOrders(common.TransactionCase):
|
|
|
371
422
|
"price_unit": 30.0,
|
|
372
423
|
},
|
|
373
424
|
),
|
|
374
|
-
(
|
|
375
|
-
0,
|
|
376
|
-
0,
|
|
425
|
+
fields.Command.create(
|
|
377
426
|
{
|
|
378
427
|
"product_id": self.product2.id,
|
|
379
428
|
"product_uom": self.product2.uom_id.id,
|
|
@@ -390,10 +439,10 @@ class TestSaleBlanketOrders(common.TransactionCase):
|
|
|
390
439
|
wizard1 = self.blanket_order_wiz_obj.with_context(
|
|
391
440
|
active_id=blanket_order.id, active_model="sale.blanket.order"
|
|
392
441
|
).create({})
|
|
393
|
-
wizard1.line_ids.filtered(lambda
|
|
442
|
+
wizard1.line_ids.filtered(lambda line: line.product_id == self.product).write(
|
|
394
443
|
{"qty": 10.0}
|
|
395
444
|
)
|
|
396
|
-
wizard1.line_ids.filtered(lambda
|
|
445
|
+
wizard1.line_ids.filtered(lambda line: line.product_id == self.product2).write(
|
|
397
446
|
{"qty": 10.0}
|
|
398
447
|
)
|
|
399
448
|
wizard1.sudo().create_sale_order()
|
|
@@ -401,10 +450,10 @@ class TestSaleBlanketOrders(common.TransactionCase):
|
|
|
401
450
|
wizard2 = self.blanket_order_wiz_obj.with_context(
|
|
402
451
|
active_id=blanket_order.id, active_model="sale.blanket.order"
|
|
403
452
|
).create({})
|
|
404
|
-
wizard2.line_ids.filtered(lambda
|
|
453
|
+
wizard2.line_ids.filtered(lambda line: line.product_id == self.product).write(
|
|
405
454
|
{"qty": 20.0}
|
|
406
455
|
)
|
|
407
|
-
wizard2.line_ids.filtered(lambda
|
|
456
|
+
wizard2.line_ids.filtered(lambda line: line.product_id == self.product2).write(
|
|
408
457
|
{"qty": 0}
|
|
409
458
|
)
|
|
410
459
|
wizard2.sudo().create_sale_order()
|
|
@@ -412,7 +461,7 @@ class TestSaleBlanketOrders(common.TransactionCase):
|
|
|
412
461
|
wizard3 = self.blanket_order_wiz_obj.with_context(
|
|
413
462
|
active_id=blanket_order.id, active_model="sale.blanket.order"
|
|
414
463
|
).create({})
|
|
415
|
-
wizard3.line_ids.filtered(lambda
|
|
464
|
+
wizard3.line_ids.filtered(lambda line: line.product_id == self.product2).write(
|
|
416
465
|
{"qty": 10.0}
|
|
417
466
|
)
|
|
418
467
|
wizard3.sudo().create_sale_order()
|
|
@@ -52,9 +52,7 @@ class TestSaleOrder(common.TransactionCase):
|
|
|
52
52
|
"payment_term_id": self.payment_term.id,
|
|
53
53
|
"pricelist_id": self.sale_pricelist.id,
|
|
54
54
|
"line_ids": [
|
|
55
|
-
(
|
|
56
|
-
0,
|
|
57
|
-
0,
|
|
55
|
+
fields.Command.create(
|
|
58
56
|
{
|
|
59
57
|
"product_id": self.product.id,
|
|
60
58
|
"product_uom": self.product.uom_id.id,
|
|
@@ -65,9 +63,7 @@ class TestSaleOrder(common.TransactionCase):
|
|
|
65
63
|
"price_unit": 30.0,
|
|
66
64
|
},
|
|
67
65
|
),
|
|
68
|
-
(
|
|
69
|
-
0,
|
|
70
|
-
0,
|
|
66
|
+
fields.Command.create(
|
|
71
67
|
{
|
|
72
68
|
"product_id": self.product.id,
|
|
73
69
|
"product_uom": self.product.uom_id.id,
|
|
@@ -92,9 +88,7 @@ class TestSaleOrder(common.TransactionCase):
|
|
|
92
88
|
"payment_term_id": self.payment_term.id,
|
|
93
89
|
"pricelist_id": self.sale_pricelist.id,
|
|
94
90
|
"line_ids": [
|
|
95
|
-
(
|
|
96
|
-
0,
|
|
97
|
-
0,
|
|
91
|
+
fields.Command.create(
|
|
98
92
|
{
|
|
99
93
|
"product_id": self.product.id,
|
|
100
94
|
"product_uom": self.product.uom_id.id,
|
|
@@ -102,9 +96,7 @@ class TestSaleOrder(common.TransactionCase):
|
|
|
102
96
|
"price_unit": 30.0,
|
|
103
97
|
},
|
|
104
98
|
),
|
|
105
|
-
(
|
|
106
|
-
0,
|
|
107
|
-
0,
|
|
99
|
+
fields.Command.create(
|
|
108
100
|
{
|
|
109
101
|
"product_id": self.product_2.id,
|
|
110
102
|
"product_uom": self.product.uom_id.id,
|
|
@@ -130,9 +122,7 @@ class TestSaleOrder(common.TransactionCase):
|
|
|
130
122
|
{
|
|
131
123
|
"partner_id": self.partner.id,
|
|
132
124
|
"order_line": [
|
|
133
|
-
(
|
|
134
|
-
0,
|
|
135
|
-
0,
|
|
125
|
+
fields.Command.create(
|
|
136
126
|
{
|
|
137
127
|
"name": self.product.name,
|
|
138
128
|
"product_id": self.product.id,
|
|
@@ -145,7 +135,6 @@ class TestSaleOrder(common.TransactionCase):
|
|
|
145
135
|
}
|
|
146
136
|
)
|
|
147
137
|
so_line = so.order_line[0]
|
|
148
|
-
so_line.with_context(from_sale_order=True).name_get()
|
|
149
138
|
so_line.onchange_product_id()
|
|
150
139
|
self.assertEqual(so_line._get_eligible_bo_lines(), bo_lines)
|
|
151
140
|
bo_line_assigned = self.blanket_order_line_obj.search(
|
|
@@ -165,9 +154,7 @@ class TestSaleOrder(common.TransactionCase):
|
|
|
165
154
|
{
|
|
166
155
|
"partner_id": self.partner.id,
|
|
167
156
|
"order_line": [
|
|
168
|
-
(
|
|
169
|
-
0,
|
|
170
|
-
0,
|
|
157
|
+
fields.Command.create(
|
|
171
158
|
{
|
|
172
159
|
"name": self.product.name,
|
|
173
160
|
"product_id": self.product.id,
|
|
@@ -180,11 +167,10 @@ class TestSaleOrder(common.TransactionCase):
|
|
|
180
167
|
}
|
|
181
168
|
)
|
|
182
169
|
so_line = so.order_line[0]
|
|
183
|
-
so_line.with_context(from_sale_order=True).name_get()
|
|
184
170
|
so_line.onchange_product_id()
|
|
185
171
|
self.assertEqual(
|
|
186
172
|
so_line._get_eligible_bo_lines(),
|
|
187
|
-
bo_lines.filtered(lambda
|
|
173
|
+
bo_lines.filtered(lambda bo_line: bo_line.product_id == self.product),
|
|
188
174
|
)
|
|
189
175
|
bo_line_assigned = self.blanket_order_line_obj.search(
|
|
190
176
|
[
|
|
@@ -194,62 +180,3 @@ class TestSaleOrder(common.TransactionCase):
|
|
|
194
180
|
]
|
|
195
181
|
)
|
|
196
182
|
self.assertEqual(so_line.blanket_order_line, bo_line_assigned)
|
|
197
|
-
|
|
198
|
-
def test_03_create_sale_order(self):
|
|
199
|
-
blanket_order = self.create_blanket_order_01()
|
|
200
|
-
blanket_order.sudo().action_confirm()
|
|
201
|
-
bo_lines = self.blanket_order_line_obj.search(
|
|
202
|
-
[("order_id", "=", blanket_order.id)]
|
|
203
|
-
)
|
|
204
|
-
self.assertEqual(len(bo_lines), 2)
|
|
205
|
-
|
|
206
|
-
so = self.sale_order_obj.create(
|
|
207
|
-
{
|
|
208
|
-
"partner_id": self.partner.id,
|
|
209
|
-
"order_line": [
|
|
210
|
-
(
|
|
211
|
-
0,
|
|
212
|
-
0,
|
|
213
|
-
{
|
|
214
|
-
"name": self.product_2.name,
|
|
215
|
-
"product_id": self.product_2.id,
|
|
216
|
-
"product_uom_qty": 5.0,
|
|
217
|
-
"product_uom": self.product_2.uom_po_id.id,
|
|
218
|
-
"price_unit": 10.0,
|
|
219
|
-
},
|
|
220
|
-
),
|
|
221
|
-
(
|
|
222
|
-
0,
|
|
223
|
-
0,
|
|
224
|
-
{
|
|
225
|
-
"name": self.product.name,
|
|
226
|
-
"product_id": self.product.id,
|
|
227
|
-
"product_uom_qty": 5.0,
|
|
228
|
-
"product_uom": self.product.uom_po_id.id,
|
|
229
|
-
"price_unit": 10.0,
|
|
230
|
-
},
|
|
231
|
-
),
|
|
232
|
-
],
|
|
233
|
-
}
|
|
234
|
-
)
|
|
235
|
-
so_line_1 = so.order_line[0]
|
|
236
|
-
so_line_2 = so.order_line[1]
|
|
237
|
-
so_line_1.with_context(from_sale_order=True).name_get()
|
|
238
|
-
so_line_1.onchange_product_id()
|
|
239
|
-
self.assertFalse(so_line_1._get_eligible_bo_lines())
|
|
240
|
-
so_line_2.with_context(from_sale_order=True).name_get()
|
|
241
|
-
so_line_2.onchange_product_id()
|
|
242
|
-
self.assertEqual(
|
|
243
|
-
so_line_2._get_eligible_bo_lines(),
|
|
244
|
-
bo_lines.filtered(lambda l: l.product_id == self.product),
|
|
245
|
-
)
|
|
246
|
-
bo_line_assigned = self.blanket_order_line_obj.search(
|
|
247
|
-
[
|
|
248
|
-
("order_id", "=", blanket_order.id),
|
|
249
|
-
("product_id", "=", self.product.id),
|
|
250
|
-
("date_schedule", "=", fields.Date.to_string(self.date_schedule_1)),
|
|
251
|
-
]
|
|
252
|
-
)
|
|
253
|
-
self.assertFalse(so_line_1.blanket_order_line)
|
|
254
|
-
self.assertEqual(so_line_2.blanket_order_line, bo_line_assigned)
|
|
255
|
-
self.assertEqual(so.blanket_order_id, blanket_order)
|
|
@@ -1,21 +1,18 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="utf-8" ?>
|
|
2
2
|
<odoo>
|
|
3
|
-
|
|
4
3
|
<!-- VIEWS -->
|
|
5
4
|
|
|
6
5
|
<record id="sale_blanket_order_line_tree" model="ir.ui.view">
|
|
7
|
-
<field name="name">sale.blanket.order.line.
|
|
6
|
+
<field name="name">sale.blanket.order.line.list</field>
|
|
8
7
|
<field name="model">sale.blanket.order.line</field>
|
|
9
8
|
<field name="arch" type="xml">
|
|
10
|
-
<
|
|
9
|
+
<list create="false">
|
|
11
10
|
<field name="sequence" widget="handle" />
|
|
12
|
-
<field name="name" invisible="1" />
|
|
13
11
|
<field name="order_id" />
|
|
14
12
|
<field
|
|
15
13
|
name="product_id"
|
|
16
14
|
context="{'partner_id':parent.partner_id, 'quantity':original_uom_qty, 'company_id': company_id}"
|
|
17
15
|
/>
|
|
18
|
-
<field name="product_uom" invisible="1" />
|
|
19
16
|
<field name="price_unit" />
|
|
20
17
|
<field name="date_schedule" />
|
|
21
18
|
<field
|
|
@@ -27,8 +24,7 @@
|
|
|
27
24
|
<field name="invoiced_uom_qty" />
|
|
28
25
|
<field name="delivered_uom_qty" />
|
|
29
26
|
<field name="remaining_uom_qty" />
|
|
30
|
-
|
|
31
|
-
</tree>
|
|
27
|
+
</list>
|
|
32
28
|
</field>
|
|
33
29
|
</record>
|
|
34
30
|
|
|
@@ -37,7 +33,7 @@
|
|
|
37
33
|
<field name="model">sale.blanket.order.line</field>
|
|
38
34
|
<field name="priority" eval="20" />
|
|
39
35
|
<field name="arch" type="xml">
|
|
40
|
-
<form string="Sale Blanket Order Line" duplicate="false">
|
|
36
|
+
<form string="Sale Blanket Order Line" duplicate="false" create="false">
|
|
41
37
|
<sheet>
|
|
42
38
|
<h1>
|
|
43
39
|
<field name="order_id" />
|
|
@@ -126,18 +122,14 @@
|
|
|
126
122
|
<page name="sale_lines" string="Sale Order Lines">
|
|
127
123
|
<field
|
|
128
124
|
name="sale_lines"
|
|
129
|
-
mode="
|
|
125
|
+
mode="list"
|
|
130
126
|
readonly="1"
|
|
131
127
|
domain="[('product_id', '=', product_id)]"
|
|
132
128
|
/>
|
|
133
129
|
</page>
|
|
134
130
|
</notebook>
|
|
135
131
|
</sheet>
|
|
136
|
-
<
|
|
137
|
-
<field name="message_follower_ids" widget="mail_followers" />
|
|
138
|
-
<field name="activity_ids" widget="mail_activity" />
|
|
139
|
-
<field name="message_ids" widget="mail_thread" />
|
|
140
|
-
</div>
|
|
132
|
+
<chatter />
|
|
141
133
|
</form>
|
|
142
134
|
</field>
|
|
143
135
|
</record>
|
|
@@ -163,7 +155,7 @@
|
|
|
163
155
|
<field name="name">Blanket Order Lines</field>
|
|
164
156
|
<field name="type">ir.actions.act_window</field>
|
|
165
157
|
<field name="res_model">sale.blanket.order.line</field>
|
|
166
|
-
<field name="view_mode">
|
|
158
|
+
<field name="view_mode">list,form</field>
|
|
167
159
|
<field name="search_view_id" ref="sale_blanket_order_line_search" />
|
|
168
160
|
</record>
|
|
169
161
|
|
|
@@ -176,5 +168,4 @@
|
|
|
176
168
|
sequence="21"
|
|
177
169
|
parent="sale.sale_order_menu"
|
|
178
170
|
/>
|
|
179
|
-
|
|
180
171
|
</odoo>
|