-
-
Notifications
You must be signed in to change notification settings - Fork 617
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX] pos_pricelist_show_discount: remove fragile demo data
Removing pricelist and pos configuration from the demo data because it creates issues when combined with l10n modules that modify the company's currency, due to inconsistencies in currencies. The same demo data is now created programmatically during tests instead.
- Loading branch information
Showing
6 changed files
with
107 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
57 changes: 0 additions & 57 deletions
57
pos_pricelist_show_discount/demo/product_pricelist_demo.xml
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
class PosPricelistShowDiscountCommonSetup: | ||
@classmethod | ||
def create_pricelists(cls, env): | ||
pos_pricelist = env["product.pricelist"].create( | ||
{ | ||
"name": "Pos Pricelist", | ||
"discount_policy": "without_discount", | ||
"item_ids": [ | ||
( | ||
0, | ||
0, | ||
{ | ||
"base": "list_price", | ||
"applied_on": "1_product", | ||
"product_tmpl_id": env.ref( | ||
"product.product_delivery_01_product_template" | ||
).id, | ||
"fixed_price": 75.0, | ||
}, | ||
), | ||
( | ||
0, | ||
0, | ||
{ | ||
"base": "list_price", | ||
"applied_on": "1_product", | ||
"product_tmpl_id": env.ref( | ||
"product.product_product_12_product_template" | ||
).id, | ||
"fixed_price": 60.0, | ||
}, | ||
), | ||
], | ||
} | ||
) | ||
drp = env["product.pricelist"].create( | ||
{ | ||
"name": "Discount Reference Pricelist", | ||
"item_ids": [ | ||
( | ||
0, | ||
0, | ||
{ | ||
"base": "list_price", | ||
"applied_on": "1_product", | ||
"product_tmpl_id": env.ref( | ||
"product.product_delivery_01_product_template" | ||
).id, | ||
"fixed_price": 100.0, | ||
}, | ||
), | ||
( | ||
0, | ||
0, | ||
{ | ||
"base": "list_price", | ||
"applied_on": "1_product", | ||
"product_tmpl_id": env.ref( | ||
"product.product_product_12_product_template" | ||
).id, | ||
"fixed_price": 100.0, | ||
}, | ||
), | ||
], | ||
} | ||
) | ||
return pos_pricelist, drp | ||
|
||
@classmethod | ||
def config_pos(cls, env, pricelist, discount_pricelist): | ||
pos_config = env.ref("point_of_sale.pos_config_main") | ||
pos_config.write( | ||
{ | ||
"pricelist_id": pricelist.id, | ||
"use_pricelist": True, | ||
"available_pricelist_ids": [ | ||
(6, 0, (pricelist + discount_pricelist).ids) | ||
], | ||
"display_discount_from_pricelist": True, | ||
"discount_pricelist_id": discount_pricelist.id, | ||
} | ||
) | ||
return pos_config |
14 changes: 12 additions & 2 deletions
14
pos_pricelist_show_discount/tests/test_pos_config_discount_pricelist.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 12 additions & 1 deletion
13
pos_pricelist_show_discount/tests/test_pos_pricelist_show_discount.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters