-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[16.0][ADD] stock_orderpoint_first_dates: In Invetory - Operations - …
…Replenishment, new fields "First Reception Date", and "First Shipping Date".
- Loading branch information
1 parent
4575dd8
commit 68b34dc
Showing
13 changed files
with
321 additions
and
0 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
setup/stock_orderpoint_first_dates/odoo/addons/stock_orderpoint_first_dates
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_orderpoint_first_dates |
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,29 @@ | ||
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg | ||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html | ||
:alt: License: AGPL-3 | ||
|
||
============================ | ||
Stock orderpoint first dates | ||
============================ | ||
|
||
* In Invetory - Operations - Replenishment, new fields "First Reception Date", | ||
and "First Shipping Date". | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues | ||
<https://github.com/avanzosc/odoo-addons/issues>`_. In case of trouble, | ||
please check there if your issue has already been reported. If you spotted | ||
it first, help us smash it by providing detailed and welcomed feedback. | ||
|
||
Do not contact contributors directly about support or help with technical issues. | ||
|
||
Credits | ||
======= | ||
|
||
Contributors | ||
------------ | ||
|
||
* Ana Juaristi <anajuaristi@avanzosc.es> | ||
* Alfredo de la Fuente <alfredodelafuente@avanzosc.es> |
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 models |
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,15 @@ | ||
# Copyright 2024 Alfredo de la Fuente - AvanzOSC | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). | ||
{ | ||
"name": "Stock Orderpoint First Dates", | ||
"version": "16.0.1.0.0", | ||
"license": "AGPL-3", | ||
"author": "Avanzosc", | ||
"category": "Inventory/Inventory", | ||
"website": "https://github.com/avanzosc/odoo-addons", | ||
"depends": ["stock"], | ||
"data": [ | ||
"views/stock_warehouse_orderpoint_views.xml", | ||
], | ||
"installable": 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,41 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * stock_orderpoint_first_dates | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 16.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2024-10-07 07:02+0000\n" | ||
"PO-Revision-Date: 2024-10-07 07:02+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_first_dates | ||
#: model:ir.model.fields,field_description:stock_orderpoint_first_dates.field_stock_move__date_deadline_without_hour | ||
msgid "Date Deadline Without Hour" | ||
msgstr "" | ||
|
||
#. module: stock_orderpoint_first_dates | ||
#: model:ir.model.fields,field_description:stock_orderpoint_first_dates.field_stock_warehouse_orderpoint__first_reception_date | ||
msgid "First Reception Date" | ||
msgstr "" | ||
|
||
#. module: stock_orderpoint_first_dates | ||
#: model:ir.model.fields,field_description:stock_orderpoint_first_dates.field_stock_warehouse_orderpoint__first_shipping_date | ||
msgid "First Shipping Date" | ||
msgstr "" | ||
|
||
#. module: stock_orderpoint_first_dates | ||
#: model:ir.model,name:stock_orderpoint_first_dates.model_stock_warehouse_orderpoint | ||
msgid "Minimum Inventory Rule" | ||
msgstr "Regla d'inventari mínim" | ||
|
||
#. module: stock_orderpoint_first_dates | ||
#: model:ir.model,name:stock_orderpoint_first_dates.model_stock_move | ||
msgid "Stock Move" | ||
msgstr "Moviment d'estoc" |
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,41 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * stock_orderpoint_first_dates | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 16.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2024-10-07 07:03+0000\n" | ||
"PO-Revision-Date: 2024-10-07 07:03+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_first_dates | ||
#: model:ir.model.fields,field_description:stock_orderpoint_first_dates.field_stock_move__date_deadline_without_hour | ||
msgid "Date Deadline Without Hour" | ||
msgstr "" | ||
|
||
#. module: stock_orderpoint_first_dates | ||
#: model:ir.model.fields,field_description:stock_orderpoint_first_dates.field_stock_warehouse_orderpoint__first_reception_date | ||
msgid "First Reception Date" | ||
msgstr "" | ||
|
||
#. module: stock_orderpoint_first_dates | ||
#: model:ir.model.fields,field_description:stock_orderpoint_first_dates.field_stock_warehouse_orderpoint__first_shipping_date | ||
msgid "First Shipping Date" | ||
msgstr "" | ||
|
||
#. module: stock_orderpoint_first_dates | ||
#: model:ir.model,name:stock_orderpoint_first_dates.model_stock_warehouse_orderpoint | ||
msgid "Minimum Inventory Rule" | ||
msgstr "" | ||
|
||
#. module: stock_orderpoint_first_dates | ||
#: model:ir.model,name:stock_orderpoint_first_dates.model_stock_move | ||
msgid "Stock Move" | ||
msgstr "" |
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,41 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * stock_orderpoint_first_dates | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 16.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2024-10-07 07:03+0000\n" | ||
"PO-Revision-Date: 2024-10-07 07:03+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_first_dates | ||
#: model:ir.model.fields,field_description:stock_orderpoint_first_dates.field_stock_move__date_deadline_without_hour | ||
msgid "Date Deadline Without Hour" | ||
msgstr "Fecha límite sin hora" | ||
|
||
#. module: stock_orderpoint_first_dates | ||
#: model:ir.model.fields,field_description:stock_orderpoint_first_dates.field_stock_warehouse_orderpoint__first_reception_date | ||
msgid "First Reception Date" | ||
msgstr "Fecha primera recepción" | ||
|
||
#. module: stock_orderpoint_first_dates | ||
#: model:ir.model.fields,field_description:stock_orderpoint_first_dates.field_stock_warehouse_orderpoint__first_shipping_date | ||
msgid "First Shipping Date" | ||
msgstr "Fecha primer envío" | ||
|
||
#. module: stock_orderpoint_first_dates | ||
#: model:ir.model,name:stock_orderpoint_first_dates.model_stock_warehouse_orderpoint | ||
msgid "Minimum Inventory Rule" | ||
msgstr "Regla de inventario mínimo" | ||
|
||
#. module: stock_orderpoint_first_dates | ||
#: model:ir.model,name:stock_orderpoint_first_dates.model_stock_move | ||
msgid "Stock Move" | ||
msgstr "Movimiento de existencias" |
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,41 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * stock_orderpoint_first_dates | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 16.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2024-10-07 07:03+0000\n" | ||
"PO-Revision-Date: 2024-10-07 07:03+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_first_dates | ||
#: model:ir.model.fields,field_description:stock_orderpoint_first_dates.field_stock_move__date_deadline_without_hour | ||
msgid "Date Deadline Without Hour" | ||
msgstr "" | ||
|
||
#. module: stock_orderpoint_first_dates | ||
#: model:ir.model.fields,field_description:stock_orderpoint_first_dates.field_stock_warehouse_orderpoint__first_reception_date | ||
msgid "First Reception Date" | ||
msgstr "" | ||
|
||
#. module: stock_orderpoint_first_dates | ||
#: model:ir.model.fields,field_description:stock_orderpoint_first_dates.field_stock_warehouse_orderpoint__first_shipping_date | ||
msgid "First Shipping Date" | ||
msgstr "" | ||
|
||
#. module: stock_orderpoint_first_dates | ||
#: model:ir.model,name:stock_orderpoint_first_dates.model_stock_warehouse_orderpoint | ||
msgid "Minimum Inventory Rule" | ||
msgstr "Règle de stock minimum" | ||
|
||
#. module: stock_orderpoint_first_dates | ||
#: model:ir.model,name:stock_orderpoint_first_dates.model_stock_move | ||
msgid "Stock Move" | ||
msgstr "Mouvement de stock" |
41 changes: 41 additions & 0 deletions
41
stock_orderpoint_first_dates/i18n/stock_orderpoint_first_dates.pot
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,41 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * stock_orderpoint_first_dates | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 16.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2024-10-07 07:02+0000\n" | ||
"PO-Revision-Date: 2024-10-07 07:02+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_first_dates | ||
#: model:ir.model.fields,field_description:stock_orderpoint_first_dates.field_stock_move__date_deadline_without_hour | ||
msgid "Date Deadline Without Hour" | ||
msgstr "" | ||
|
||
#. module: stock_orderpoint_first_dates | ||
#: model:ir.model.fields,field_description:stock_orderpoint_first_dates.field_stock_warehouse_orderpoint__first_reception_date | ||
msgid "First Reception Date" | ||
msgstr "" | ||
|
||
#. module: stock_orderpoint_first_dates | ||
#: model:ir.model.fields,field_description:stock_orderpoint_first_dates.field_stock_warehouse_orderpoint__first_shipping_date | ||
msgid "First Shipping Date" | ||
msgstr "" | ||
|
||
#. module: stock_orderpoint_first_dates | ||
#: model:ir.model,name:stock_orderpoint_first_dates.model_stock_warehouse_orderpoint | ||
msgid "Minimum Inventory Rule" | ||
msgstr "" | ||
|
||
#. module: stock_orderpoint_first_dates | ||
#: model:ir.model,name:stock_orderpoint_first_dates.model_stock_move | ||
msgid "Stock Move" | ||
msgstr "" |
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 stock_warehouse_orderpoint |
40 changes: 40 additions & 0 deletions
40
stock_orderpoint_first_dates/models/stock_warehouse_orderpoint.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,40 @@ | ||
# Copyright 2024 Alfredo de la Fuente - AvanzOSC | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). | ||
from odoo import fields, models | ||
|
||
|
||
class StockWarehouseOrderpoint(models.Model): | ||
_inherit = "stock.warehouse.orderpoint" | ||
|
||
first_reception_date = fields.Datetime( | ||
compute="_compute_moves_reception_first_date" | ||
) | ||
first_shipping_date = fields.Datetime(compute="_compute_moves_shipping_first_date") | ||
|
||
def _compute_moves_reception_first_date(self): | ||
for orderpoint in self: | ||
first_reception_date = False | ||
moves = orderpoint.product_id.stock_move_ids.filtered( | ||
lambda x: x.location_dest_id == orderpoint.location_id | ||
and x.location_id.usage != "internal" | ||
and x.location_dest_id.usage == "internal" | ||
and x.date_deadline | ||
and x.state not in ("draft", "cancel", "done") | ||
) | ||
if moves: | ||
first_reception_date = min(moves.mapped("date_deadline")) | ||
orderpoint.first_reception_date = first_reception_date | ||
|
||
def _compute_moves_shipping_first_date(self): | ||
for orderpoint in self: | ||
first_shipping_date = False | ||
moves = orderpoint.product_id.stock_move_ids.filtered( | ||
lambda x: x.location_id == orderpoint.location_id | ||
and x.location_id.usage == "internal" | ||
and x.location_dest_id.usage != "internal" | ||
and x.date_deadline | ||
and x.state not in ("draft", "cancel", "done") | ||
) | ||
if moves: | ||
first_shipping_date = min(moves.mapped("date_deadline")) | ||
orderpoint.first_shipping_date = first_shipping_date |
23 changes: 23 additions & 0 deletions
23
stock_orderpoint_first_dates/views/stock_warehouse_orderpoint_views.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,23 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<odoo> | ||
<record id="view_warehouse_orderpoint_tree_editable" model="ir.ui.view"> | ||
<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="location_id" position="after"> | ||
<field | ||
name="first_reception_date" | ||
widget="date" | ||
optional="show" | ||
readonly="1" | ||
/> | ||
<field | ||
name="first_shipping_date" | ||
widget="date" | ||
optional="show" | ||
readonly="1" | ||
/> | ||
</field> | ||
</field> | ||
</record> | ||
</odoo> |