-
-
Notifications
You must be signed in to change notification settings - Fork 190
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MIG] product_sold_by_delivery_week: Migration to 15.0
- Loading branch information
1 parent
e36744f
commit 53fd708
Showing
10 changed files
with
106 additions
and
19 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
from . import models | ||
from .hooks import post_init_hook | ||
from . import tests |
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 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 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 |
---|---|---|
@@ -1,12 +1,12 @@ | ||
We can configure some variables with config parameter keys: | ||
Some variables can be configured using config parameter keys: | ||
|
||
- For the hint characters: | ||
- For hint characters: | ||
|
||
- For the sold char: `product_sold_by_delivery_week.sold_char` | ||
- For the not sold: `product_sold_by_delivery_week.not_sold_char` | ||
- For weeks length: `product_sold_by_delivery_week.weeks_to_consider` | ||
- For weeks length: `product_sold_by_delivery_week.weeks_to_consider` | ||
|
||
Assign the security group 'Weekly selling info in order lines' and/or | ||
'Weekly selling info in product list' to users that should see weekly | ||
selling info in order lines or product list. (Is is not necessary if | ||
you want view the info in other views as product recommendation) | ||
sales info in product lists or in order lines. (If you want to see the | ||
info in other views like product recommendations, this is not needed.) |
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 |
---|---|---|
|
@@ -2,3 +2,5 @@ | |
|
||
* David Vidal | ||
* Carlos Dauden | ||
* César A. Sánchez | ||
* Luis D. Lafaurie |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
This module allows to compute a graphical hint stored in the product itself to display | ||
whether or not that product was sold and delivered in the past weeks. | ||
This module allows to compute a graphical hint, stored in the product itself, | ||
to display whether that product was sold and delivered in recent weeks. | ||
|
||
.. image:: ../static/description/sold_by_week_hint.png |
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
* Services aren't taken into consideration. | ||
* A widget could be done on top of the main field to have nicer icons or even colors. | ||
* For the future, maybe a configurable granularity could be made, so we could | ||
change the behaviour to months, days, years as the period of choice. To simplify | ||
the module, for the moment only the week will be considered. | ||
* Services are not taken into consideration. | ||
* A widget could be created on top of the main field to have nicer icons and | ||
probably colors. | ||
* For the near future, a configurable granularity would be desirable, so | ||
behaviour could be changed to years, months or days as the period of choice. | ||
To simplify this module, only weekly periods will be considered for now. |
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 |
---|---|---|
@@ -1,7 +1,8 @@ | ||
Once configured, you can view the hints as an optional column in sale order lines or | ||
in the tree of the products. | ||
Once configured, hints will apperar as an optional column in sale order | ||
lines or in products tree. | ||
|
||
In the general products view, the general sales info is shown while in the sale lines | ||
field we can see the field in context filtering only the partner sales. | ||
In the general products view, general sales info is shown. Meanwhile, in the | ||
sale lines field we can see this field in context by simply filtering partner | ||
sales. | ||
|
||
Only salesmen can access to this information. | ||
Only salespeople can access this information. |
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 @@ | ||
from . import test_product_sold_by_delivery_week |
81 changes: 81 additions & 0 deletions
81
product_sold_by_delivery_week/tests/test_product_sold_by_delivery_week.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
# Copyright 2021 Camptocamp SA | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl) | ||
from odoo.tests import TransactionCase | ||
|
||
|
||
class TestProductSoldByDeliveryWeek(TransactionCase): | ||
@classmethod | ||
def setUpClass(cls): | ||
super().setUpClass() | ||
cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True)) | ||
|
||
cls.partner = cls.env.ref("base.res_partner_12") | ||
cls.product = cls.env.ref("product.product_product_9") | ||
cls.product_expense_product = cls.env.ref("product.expense_product") | ||
cls.product.weekly_sold_delivered = "Sold delivered" | ||
cls.product_expense_product.weekly_sold_delivered = "Sold delivered service" | ||
cls.order = cls.env["sale.order"].create( | ||
{ | ||
"partner_id": cls.partner.id, | ||
"order_line": [ | ||
( | ||
0, | ||
0, | ||
{ | ||
"product_id": cls.product.id, | ||
"product_uom": cls.product.uom_id.id, | ||
"product_uom_qty": 3.0, | ||
}, | ||
), | ||
(0, 0, {"display_type": "line_section", "name": "Section"}), | ||
( | ||
0, | ||
0, | ||
{ | ||
"product_id": cls.product_expense_product.id, | ||
"product_uom": cls.product_expense_product.uom_id.id, | ||
"product_uom_qty": 3.0, | ||
}, | ||
), | ||
], | ||
} | ||
) | ||
|
||
def test_01_check_delivered_message_without_parameters(self): | ||
"""Test the return message deppending on the type of the product.""" | ||
self.assertEqual(self.order.order_line[0].weekly_sold_delivered_shown, "◌◌◌◌◌◌") | ||
self.assertEqual(self.order.order_line[1].weekly_sold_delivered_shown, False) | ||
|
||
def test_02_check_delivered_message_with_parameters(self): | ||
"""Test the definition of config parameters.""" | ||
self.env["ir.config_parameter"].create( | ||
{ | ||
"key": "product_sold_by_delivery_week.sold_char", | ||
"value": "R", | ||
} | ||
) | ||
self.env["ir.config_parameter"].create( | ||
{ | ||
"key": "product_sold_by_delivery_week.not_sold_char", | ||
"value": "M", | ||
} | ||
) | ||
self.assertEqual(self.order.order_line[0].weekly_sold_delivered_shown, "MMMMMM") | ||
self.assertEqual(self.order.order_line[1].weekly_sold_delivered_shown, False) | ||
|
||
def test_03_sale_stock_delivery_partial(self): | ||
""" | ||
Test a SO with a product on delivery. | ||
""" | ||
# intial order | ||
self.order.action_confirm() | ||
self.assertTrue( | ||
self.order.picking_ids, | ||
'Sale Stock: no picking created for "invoice on delivery" storable products', | ||
) | ||
pick = self.order.picking_ids | ||
pick.move_lines.write({"quantity_done": 3}) | ||
pick.button_validate() | ||
for line in pick.move_lines: | ||
line._action_done() | ||
self.assertEqual(line.product_id.weekly_sold_delivered, "Sold delivered") |