Skip to content

Commit

Permalink
TA#61864 [ADD] stock_orderpoint_scheduled_date
Browse files Browse the repository at this point in the history
  • Loading branch information
majouda committed Apr 16, 2024
1 parent c878ac1 commit 4b7579f
Show file tree
Hide file tree
Showing 18 changed files with 273 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .docker_files/main/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"category": "Other",
"summary": "Install all addons required for testing.",
"depends": [
"purchase", # For testing stock_orderpoint_scheduled_date
"product_category_safe_change",
"product_packaging_dimension_decimal",
"stock_account_visibility",
Expand All @@ -22,6 +23,7 @@
"stock_move_location_domain_improved",
"stock_move_origin_link",
"stock_move_valuation_adjustment",
"stock_orderpoint_scheduled_date",
"stock_orderpoint_secondary_unit",
"stock_picking_groupby_parent_affiliate",
"stock_picking_responsible_editable",
Expand Down
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ COPY stock_location_position_alphanum /mnt/extra-addons/stock_location_position_
COPY stock_move_location_domain_improved /mnt/extra-addons/stock_move_location_domain_improved
COPY stock_move_origin_link /mnt/extra-addons/stock_move_origin_link
COPY stock_move_valuation_adjustment /mnt/extra-addons/stock_move_valuation_adjustment
COPY stock_orderpoint_scheduled_date /mnt/extra-addons/stock_orderpoint_scheduled_date
COPY stock_orderpoint_secondary_unit /mnt/extra-addons/stock_orderpoint_secondary_unit
COPY stock_picking_groupby_parent_affiliate /mnt/extra-addons/stock_picking_groupby_parent_affiliate
COPY stock_picking_responsible_editable /mnt/extra-addons/stock_picking_responsible_editable
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ services:
environment:
- LOG_ODOO=/var/log/odoo
db:
image: postgres:9.6
image: postgres:16.0
environment:
- POSTGRES_PASSWORD=odoo
- POSTGRES_USER=odoo
Expand Down
25 changes: 25 additions & 0 deletions stock_orderpoint_scheduled_date/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Stock Orderpoint Scheduled Date
===============================

.. contents:: Table of Contents

Context
-------

This module allows user to set a scheduled date manuelly to replanish stock.

Description
-----------
As a user with access right to `Inventory > Operations > Replanishment`, I can see a new field in the list view:

.. image:: static/description/replanishment_tree_view.png

You can assign in mass the Scheduled Date to a selection of records using the server action `Set Scheduled Date`:

.. image:: static/description/set_scheduled_date_action.png

.. image:: static/description/set_schedule_date_wizard.png

Contributors
------------
* Numigi (tm) and all its contributors (https://bit.ly/numigiens)
5 changes: 5 additions & 0 deletions stock_orderpoint_scheduled_date/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# © 2024 - today Numigi (tm) and all its contributors (https://bit.ly/numigiens)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import models
from . import wizard
19 changes: 19 additions & 0 deletions stock_orderpoint_scheduled_date/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# © 2024 - today Numigi (tm) and all its contributors (https://bit.ly/numigiens)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Stock Orderpoint Scheduled Date",
"summary": "Force Scheduled Date in Stock Orderpoint",
"version": "14.0.1.0.0",
"category": "stock",
"website": "https://bit.ly/numigi-com",
"author": "Numigi",
"license": "AGPL-3",
"application": False,
"installable": True,
"depends": ["stock"],
"data": [
"security/ir.model.access.csv",
"views/stock_orderpoint_views.xml",
"wizard/stock_warehouse_orderpoint_schedule_date.xml"
],
}
97 changes: 97 additions & 0 deletions stock_orderpoint_scheduled_date/i18n/fr.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_orderpoint_scheduled_date
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-04-02 20:21+0000\n"
"PO-Revision-Date: 2024-04-02 20:21+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: stock_orderpoint_scheduled_date
#: model_terms:ir.ui.view,arch_db:stock_orderpoint_scheduled_date.stock_warehouse_orderpoint_schedule_date_form
msgid "Cancel"
msgstr "Annuler"

#. module: stock_orderpoint_scheduled_date
#: model:ir.model.fields,field_description:stock_orderpoint_scheduled_date.field_stock_warehouse_orderpoint_schedule_date__create_uid
msgid "Created by"
msgstr "Créé par"

#. module: stock_orderpoint_scheduled_date
#: model:ir.model.fields,field_description:stock_orderpoint_scheduled_date.field_stock_warehouse_orderpoint_schedule_date__create_date
msgid "Created on"
msgstr "Créé le"

#. module: stock_orderpoint_scheduled_date
#: model:ir.model.fields,field_description:stock_orderpoint_scheduled_date.field_stock_warehouse_orderpoint__display_name
#: model:ir.model.fields,field_description:stock_orderpoint_scheduled_date.field_stock_warehouse_orderpoint_schedule_date__display_name
msgid "Display Name"
msgstr "Nom d'affichage"

#. module: stock_orderpoint_scheduled_date
#: model:ir.model.fields,field_description:stock_orderpoint_scheduled_date.field_stock_warehouse_orderpoint__id
#: model:ir.model.fields,field_description:stock_orderpoint_scheduled_date.field_stock_warehouse_orderpoint_schedule_date__id
msgid "ID"
msgstr ""

#. module: stock_orderpoint_scheduled_date
#: model:ir.model.fields,field_description:stock_orderpoint_scheduled_date.field_stock_warehouse_orderpoint____last_update
#: model:ir.model.fields,field_description:stock_orderpoint_scheduled_date.field_stock_warehouse_orderpoint_schedule_date____last_update
msgid "Last Modified on"
msgstr "Dernière modification le"

#. module: stock_orderpoint_scheduled_date
#: model:ir.model.fields,field_description:stock_orderpoint_scheduled_date.field_stock_warehouse_orderpoint_schedule_date__write_uid
msgid "Last Updated by"
msgstr ""

#. module: stock_orderpoint_scheduled_date
#: model:ir.model.fields,field_description:stock_orderpoint_scheduled_date.field_stock_warehouse_orderpoint_schedule_date__write_date
msgid "Last Updated on"
msgstr ""

#. module: stock_orderpoint_scheduled_date
#: model:ir.model,name:stock_orderpoint_scheduled_date.model_stock_warehouse_orderpoint
msgid "Minimum Inventory Rule"
msgstr "Règle de stock minimum."

#. module: stock_orderpoint_scheduled_date
#: model:ir.model.fields,field_description:stock_orderpoint_scheduled_date.field_stock_warehouse_orderpoint_schedule_date__orderpoint_ids
msgid "Order Points"
msgstr ""

#. module: stock_orderpoint_scheduled_date
#: model:ir.model,name:stock_orderpoint_scheduled_date.model_stock_warehouse_orderpoint_schedule_date
msgid "Replanishment Schedule Date wizard"
msgstr ""

#. module: stock_orderpoint_scheduled_date
#: model:ir.model.fields,field_description:stock_orderpoint_scheduled_date.field_stock_warehouse_orderpoint__scheduled_date
#: model:ir.model.fields,field_description:stock_orderpoint_scheduled_date.field_stock_warehouse_orderpoint_schedule_date__scheduled_date
msgid "Scheduled Date"
msgstr "Date prévue"

#. module: stock_orderpoint_scheduled_date
#: code:addons/stock_orderpoint_scheduled_date/models/stock_warehouse_orderpoint.py:0
#: model_terms:ir.ui.view,arch_db:stock_orderpoint_scheduled_date.stock_warehouse_orderpoint_schedule_date_form
#, python-format
msgid "Set Schedule Date"
msgstr "Définir la date prévue"

#. module: stock_orderpoint_scheduled_date
#: model:ir.actions.server,name:stock_orderpoint_scheduled_date.action_set_scheduled_date
msgid "Set Scheduled Date"
msgstr "Définir la date prévue"

#. module: stock_orderpoint_scheduled_date
#: model_terms:ir.ui.view,arch_db:stock_orderpoint_scheduled_date.stock_warehouse_orderpoint_schedule_date_form
msgid "Validate"
msgstr "Valider"
4 changes: 4 additions & 0 deletions stock_orderpoint_scheduled_date/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# © 2024 - today Numigi (tm) and all its contributors (https://bit.ly/numigiens)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import stock_warehouse_orderpoint
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# © 2024 - today Numigi (tm) and all its contributors (https://bit.ly/numigiens)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import api, models, fields, _


class stockWarehouseOrderpoint(models.Model):
_inherit = "stock.warehouse.orderpoint"

scheduled_date = fields.Date("Scheduled Date")

@api.depends('rule_ids', 'product_id.seller_ids',
'product_id.seller_ids.delay', 'scheduled_date')
def _compute_lead_days(self):
for orderpoint in self.with_context(bypass_delay_description=True):
if not orderpoint.scheduled_date:
return super(stockWarehouseOrderpoint, orderpoint)._compute_lead_days()
else:
orderpoint.lead_days_date = orderpoint.scheduled_date

def open_set_schedule_date_wizard(self):
wizard = self.env['stock.warehouse.orderpoint.schedule.date'].create({})
wizard.orderpoint_ids = self
action = wizard.get_formview_action()
action['target'] = 'new'
action['name'] = _('Set Schedule Date')
return action
2 changes: 2 additions & 0 deletions stock_orderpoint_scheduled_date/security/ir.model.access.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_stock_warehouse_orderpoint_schedule_date,access_stock_warehouse_orderpoint_schedule_date,model_stock_warehouse_orderpoint_schedule_date,stock.group_stock_manager,1,1,1,1
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 37 additions & 0 deletions stock_orderpoint_scheduled_date/views/stock_orderpoint_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_warehouse_orderpoint_tree_sheduled_date" model="ir.ui.view">
<field name="name">stock.warehouse.orderpoint.tree.scheduled.date</field>
<field name="model">stock.warehouse.orderpoint</field>
<field name="inherit_id" ref="stock.view_warehouse_orderpoint_tree_editable"/>
<field name="arch" type="xml">
<field name="product_uom_name" position="after">
<field name="scheduled_date"/>
</field>
</field>
</record>
<record id="view_warehouse_orderpoint_form_sheduled_date" model="ir.ui.view">
<field name="name">stock.warehouse.orderpoint.form.scheduled.date</field>
<field name="model">stock.warehouse.orderpoint</field>
<field name="inherit_id" ref="stock.view_warehouse_orderpoint_form"/>
<field name="arch" type="xml">
<field name="qty_multiple" position="after">
<field name="scheduled_date"/>
</field>
</field>
</record>

<!-- Server action to assign in bulk the scheduled date -->
<record id="action_set_scheduled_date" model="ir.actions.server">
<field name="name">Set Scheduled Date</field>
<field name="model_id" ref="stock.model_stock_warehouse_orderpoint"/>
<field name="groups_id" eval="[(4, ref('stock.group_stock_manager'))]"/>
<field name="binding_model_id" ref="stock.model_stock_warehouse_orderpoint"/>
<field name="type">ir.actions.server</field>
<field name="state">code</field>
<field name="code">
action = records.open_set_schedule_date_wizard()
</field>
</record>

</odoo>
4 changes: 4 additions & 0 deletions stock_orderpoint_scheduled_date/wizard/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# © 2024 Numigi (tm) and all its contributors (https://bit.ly/numigiens)
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from . import stock_warehouse_orderpoint_schedule_date
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# © 2019 Numigi (tm) and all its contributors (https://bit.ly/numigiens)
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from odoo import fields, models


class OrderpointScheduleDate(models.TransientModel):
_name = 'stock.warehouse.orderpoint.schedule.date'
_description = "Replanishment Schedule Date wizard"

orderpoint_ids = fields.Many2many(
'stock.warehouse.orderpoint',
'stock_warehouse_orderpoint_schedule_date_rel',
'wizard_id',
'orderpoint_id',
string='Order Points',
)
scheduled_date = fields.Date("Scheduled Date")

def validate(self):
self.ensure_one()
self.orderpoint_ids.write({
'scheduled_date': self.scheduled_date
})
return True
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>

<record id="stock_warehouse_orderpoint_schedule_date_form" model="ir.ui.view">
<field name="name">Set Schedule Date Wizard</field>
<field name="model">stock.warehouse.orderpoint.schedule.date</field>
<field name="arch" type="xml">
<form string="Set Schedule Date">
<sheet>
<group>
<group>
<field name="scheduled_date"/>
</group>
</group>
</sheet>
<footer>
<button name="validate" class="oe_highlight" string="Validate" type="object"/>
<button string="Cancel" class="btn-secondary" special="cancel"/>
</footer>
</form>
</field>
</record>

</odoo>

0 comments on commit 4b7579f

Please sign in to comment.