Skip to content

Commit

Permalink
Add preparation weekdays to stock.release.channel
Browse files Browse the repository at this point in the history
  • Loading branch information
grindtildeath committed Jan 24, 2024
1 parent 47944ce commit d72404a
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 4 deletions.
6 changes: 5 additions & 1 deletion stock_release_channel_plan/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,15 @@
"author": "ACSONE SA/NV,BCIM,Odoo Community Association (OCA)",
"maintainers": ["jbaudoux"],
"website": "https://github.com/OCA/wms",
"depends": ["stock_release_channel"],
"depends": [
"base_time_window",
"stock_release_channel",
],
"data": [
"security/stock_release_channel_preparation_plan.xml",
"security/stock_release_channel_plan_launch.xml",
"wizards/launch_plan.xml",
"views/res_partner.xml",
"views/stock_release_channel_preparation_plan.xml",
"views/stock_release_channel.xml",
],
Expand Down
1 change: 1 addition & 0 deletions stock_release_channel_plan/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
from . import res_partner
from . import stock_release_channel
from . import stock_release_channel_preparation_plan
21 changes: 21 additions & 0 deletions stock_release_channel_plan/models/res_partner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2024 Camptocamp SA
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
from odoo import api, fields, models


class ResPartner(models.Model):
_inherit = "res.partner"

stock_release_channel_delivery_weekday_ids = fields.Many2many(
"time.weekday",
compute="_compute_stock_release_channel_delivery_weekday_ids",
readonly=True,
store=True,
)

@api.depends("stock_release_channel_ids.preparation_weekday_ids")
def _compute_stock_release_channel_delivery_weekday_ids(self):
for partner in self:
partner.stock_release_channel_delivery_weekday_ids = (
partner.stock_release_channel_ids.preparation_weekday_ids
)
6 changes: 6 additions & 0 deletions stock_release_channel_plan/models/stock_release_channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,9 @@ class StockReleaseChannel(models.Model):
column2="plan_id",
string="Preparation Plans",
)
preparation_weekday_ids = fields.Many2many(
"time.weekday",
"release_channel_preparation_weekday_rel",
"channel_id",
"weekday_id",
)
12 changes: 12 additions & 0 deletions stock_release_channel_plan/views/res_partner.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record model="ir.ui.view" id="res_partner_form_view">
<field name="model">res.partner</field>
<field name="inherit_id" ref="stock_release_channel.res_partner_form_view" />
<field name="arch" type="xml">
<field name="stock_release_channel_ids" position="after">
<field name="stock_release_channel_delivery_weekday_ids" />
</field>
</field>
</record>
</odoo>
3 changes: 1 addition & 2 deletions stock_release_channel_plan/views/stock_release_channel.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@
<field name="arch" type="xml">
<xpath expr="//notebook" position="before">
<group>
<field name="preparation_weekday_ids" widget="many2many_tags" />
<field name="preparation_plan_ids" widget="many2many_tags" />
</group>
</xpath>
</field>
</record>



</odoo>
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,13 @@
</h1>
<field name="active" invisible="1" />
</div>
<field name="release_channel_ids" />
<field name="release_channel_ids">
<tree>
<field name="name" />
<field name="state" />
<field name="preparation_weekday_ids" />
</tree>
</field>
</sheet>
</form>
</field>
Expand Down

0 comments on commit d72404a

Please sign in to comment.