-
-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ADD] stock_release_channel_plan_process_end_time
- Loading branch information
Showing
14 changed files
with
161 additions
and
0 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
...ase_channel_plan_process_end_time/odoo/addons/stock_release_channel_plan_process_end_time
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 @@ | ||
../../../../stock_release_channel_plan_process_end_time |
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,6 @@ | ||
import setuptools | ||
|
||
setuptools.setup( | ||
setup_requires=['setuptools-odoo'], | ||
odoo_addon=True, | ||
) |
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 @@ | ||
wait 4 da boat |
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 wizards |
24 changes: 24 additions & 0 deletions
24
stock_release_channel_plan_process_end_time/__manifest__.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,24 @@ | ||
# Copyright 2023 Jacques-Etienne Baudoux (BCIM) <je@bcim.be> | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
{ | ||
"name": "Stock Release Channel Plan Process End Time", | ||
"summary": "Glue module between release channel plan and process end time", | ||
"version": "16.0.1.0.0", | ||
"development_status": "Beta", | ||
"license": "AGPL-3", | ||
"author": "BCIM,Odoo Community Association (OCA)", | ||
"maintainers": ["jbaudoux"], | ||
"website": "https://github.com/OCA/wms", | ||
"depends": [ | ||
"stock_release_channel_plan", | ||
"stock_release_channel_process_end_time", | ||
], | ||
"data": [ | ||
"wizards/launch_plan.xml", | ||
], | ||
"demo": [ | ||
"demo/stock_release_channel.xml", | ||
], | ||
"auto_install": True, | ||
} |
31 changes: 31 additions & 0 deletions
31
stock_release_channel_plan_process_end_time/demo/stock_release_channel.xml
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,31 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<!-- Copyright 2023 Jacques-Etienne Baudoux (BCIM) <je@bcim.be> | ||
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). --> | ||
<odoo noupdate="1"> | ||
|
||
<record model="stock.release.channel" id="stock_release_channel_plan.stock_release_channel_mon_thu1"> | ||
<field name="warehouse_id" ref="stock.warehouse0" /> | ||
<field name="process_end_time">10.0</field> | ||
</record> | ||
<record model="stock.release.channel" id="stock_release_channel_plan.stock_release_channel_mon_thu2"> | ||
<field name="warehouse_id" ref="stock.warehouse0" /> | ||
<field name="process_end_time">14.0</field> | ||
</record> | ||
<record model="stock.release.channel" id="stock_release_channel_plan.stock_release_channel_tue_fri1"> | ||
<field name="warehouse_id" ref="stock.warehouse0" /> | ||
<field name="process_end_time">10.0</field> | ||
</record> | ||
<record model="stock.release.channel" id="stock_release_channel_plan.stock_release_channel_tue_fri2"> | ||
<field name="warehouse_id" ref="stock.warehouse0" /> | ||
<field name="process_end_time">14.0</field> | ||
</record> | ||
<record model="stock.release.channel" id="stock_release_channel_plan.stock_release_channel_wed1"> | ||
<field name="warehouse_id" ref="stock.warehouse0" /> | ||
<field name="process_end_time">10.0</field> | ||
</record> | ||
<record model="stock.release.channel" id="stock_release_channel_plan.stock_release_channel_wed2"> | ||
<field name="warehouse_id" ref="stock.warehouse0" /> | ||
<field name="process_end_time">14.0</field> | ||
</record> | ||
|
||
</odoo> |
1 change: 1 addition & 0 deletions
1
stock_release_channel_plan_process_end_time/readme/CONTRIBUTORS.rst
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 @@ | ||
* Jacques-Etienne Baudoux <je@bcim.be> |
3 changes: 3 additions & 0 deletions
3
stock_release_channel_plan_process_end_time/readme/CREDITS.rst
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,3 @@ | ||
**Financial support** | ||
|
||
* Alcyon Belux |
3 changes: 3 additions & 0 deletions
3
stock_release_channel_plan_process_end_time/readme/DESCRIPTION.rst
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,3 @@ | ||
At launching a plan, a process end date is set on each release channel of the | ||
plan. It is then up to you to process the content of the release channel and at | ||
then end, close it and make it asleep. |
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_stock_release_channel_plan |
35 changes: 35 additions & 0 deletions
35
stock_release_channel_plan_process_end_time/tests/test_stock_release_channel_plan.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,35 @@ | ||
# Copyright 2023 Jacques-Etienne Baudoux (BCIM) <je@bcim.be> | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from datetime import datetime | ||
import pytz | ||
|
||
from odoo import fields | ||
from odoo.addons.partner_tz.tools.tz_utils import tz_to_utc_naive_datetime | ||
from odoo.addons.stock_release_channel_plan.tests import test_stock_release_channel_plan | ||
from odoo.addons.stock_release_channel_process_end_time.utils import float_to_time | ||
|
||
|
||
class TestStockReleaseChannelPlan( | ||
test_stock_release_channel_plan.TestStockReleaseChannelPlan | ||
): | ||
def test_launch_plan(self): | ||
channel = self.plan1_channel1 | ||
channel.process_end_date = False | ||
tz_name = "Europe/Brussels" | ||
channel.warehouse_id.partner_id.tz = tz_name | ||
super().test_launch_plan() | ||
end_time = float_to_time(channel.process_end_time) # in TZ | ||
end_date = datetime.combine(fields.Date.context_today(channel), end_time) # in TZ | ||
end_date_utc = tz_to_utc_naive_datetime(channel.process_end_time_tz, end_date) | ||
self.assertEqual( | ||
channel.process_end_date, | ||
end_date_utc, | ||
) | ||
# Local Time is 10 | ||
offset = pytz.timezone(tz_name).utcoffset(datetime.now()).total_seconds() /3600 | ||
self.assertEqual( | ||
channel.process_end_date.hour, | ||
10 - offset, | ||
) | ||
return |
1 change: 1 addition & 0 deletions
1
stock_release_channel_plan_process_end_time/wizards/__init__.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 @@ | ||
from . import launch_plan |
32 changes: 32 additions & 0 deletions
32
stock_release_channel_plan_process_end_time/wizards/launch_plan.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,32 @@ | ||
# Copyright 2023 Jacques-Etienne Baudoux (BCIM) <je@bcim.be> | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from datetime import datetime | ||
|
||
from odoo import api, fields, models | ||
|
||
from odoo.addons.partner_tz.tools.tz_utils import tz_to_utc_naive_datetime | ||
from odoo.addons.stock_release_channel_process_end_time.utils import float_to_time | ||
|
||
|
||
class StockReleaseChannelPlanWizardLaunch(models.TransientModel): | ||
_inherit = "stock.release.channel.plan.wizard.launch" | ||
|
||
process_end_date = fields.Date( | ||
required=True, | ||
default=fields.Date.context_today, | ||
) | ||
|
||
@api.model | ||
def _action_launch(self, channels): | ||
channels_to_wakeup = channels.filtered("is_action_wake_up_allowed") | ||
# Wake up the channels | ||
super()._action_launch(channels) | ||
# Override the process end date | ||
for channel in channels_to_wakeup: | ||
end_time = float_to_time(channel.process_end_time) # in TZ | ||
end_date = datetime.combine(self.process_end_date, end_time) # in TZ | ||
tz = channel.process_end_time_tz or 'UTC' | ||
end_date_utc = tz_to_utc_naive_datetime(tz, end_date) | ||
channel.write({"process_end_date": end_date_utc}) | ||
return |
21 changes: 21 additions & 0 deletions
21
stock_release_channel_plan_process_end_time/wizards/launch_plan.xml
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,21 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<!-- Copyright 2023 Jacques-Etienne Baudoux (BCIM) <je@bcim.be> | ||
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). --> | ||
<odoo> | ||
|
||
<record model="ir.ui.view" id="stock_release_channel_plan_wizard_launch_form_view"> | ||
<field name="model">stock.release.channel.plan.wizard.launch</field> | ||
<field | ||
name="inherit_id" | ||
ref="stock_release_channel_plan.stock_release_channel_plan_wizard_launch_form_view" | ||
/> | ||
<field name="arch" type="xml"> | ||
<form> | ||
<field name="preparation_plan_id" position="after"> | ||
<field name="process_end_date" default_focus="1" /> | ||
</field> | ||
</form> | ||
</field> | ||
</record> | ||
|
||
</odoo> |