|
6 | 6 | from odoo.tests.common import TransactionCase
|
7 | 7 | from odoo.tools import mute_logger
|
8 | 8 |
|
9 |
| -from .common import get_test_data, get_test_data_no_ean_in_lin |
| 9 | +from .common import get_test_data, get_test_data_no_ean_in_lin, get_test_data_no_price |
10 | 10 |
|
11 | 11 |
|
12 | 12 | class TestEdifactOrderImport(TransactionCase):
|
@@ -78,3 +78,32 @@ def test_edifact_order_import_no_ean_in_lin(self):
|
78 | 78 | self.assertEqual(
|
79 | 79 | so.order_line.mapped("name")[0], "Product1 description"
|
80 | 80 | )
|
| 81 | + |
| 82 | + @mute_logger("odoo.addons.sale_order_import.wizard.sale_order_import") |
| 83 | + def test_edifact_order_import_no_price(self): |
| 84 | + tests = get_test_data_no_price(self.env) |
| 85 | + for filename, expected in tests.items(): |
| 86 | + edifact_file = expected._get_content() |
| 87 | + wiz = self.env["sale.order.import"].create( |
| 88 | + { |
| 89 | + "import_type": "edifact", |
| 90 | + "order_file": base64.b64encode(edifact_file), |
| 91 | + "order_filename": filename, |
| 92 | + } |
| 93 | + ) |
| 94 | + action = wiz.import_order_button() |
| 95 | + so = self.env["sale.order"].browse(action["res_id"]) |
| 96 | + self.assertEqual(so.partner_id, expected["partner"]) |
| 97 | + |
| 98 | + if expected.get("client_order_ref"): |
| 99 | + self.assertEqual(so.client_order_ref, expected["client_order_ref"]) |
| 100 | + |
| 101 | + if expected.get("shipping_partner"): |
| 102 | + self.assertEqual(so.partner_shipping_id, expected["shipping_partner"]) |
| 103 | + |
| 104 | + if expected.get("products"): |
| 105 | + expected_ids = sorted(expected["products"].ids) |
| 106 | + self.assertEqual( |
| 107 | + sorted(so.order_line.mapped("product_id").ids), expected_ids |
| 108 | + ) |
| 109 | + self.assertEqual(so.order_line.mapped("price_unit"), expected["price"]) |
0 commit comments