Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][ADD] stock_orderpoint_first_dates: In Invetory - Operations - … #2903

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions setup/stock_orderpoint_first_dates/setup.py
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,
)
29 changes: 29 additions & 0 deletions stock_orderpoint_first_dates/README.rst
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>
1 change: 1 addition & 0 deletions stock_orderpoint_first_dates/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
15 changes: 15 additions & 0 deletions stock_orderpoint_first_dates/__manifest__.py
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,
}
41 changes: 41 additions & 0 deletions stock_orderpoint_first_dates/i18n/ca_ES.po
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"
41 changes: 41 additions & 0 deletions stock_orderpoint_first_dates/i18n/en_GB.po
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 ""
41 changes: 41 additions & 0 deletions stock_orderpoint_first_dates/i18n/es.po
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"
41 changes: 41 additions & 0 deletions stock_orderpoint_first_dates/i18n/fr.po
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 stock_orderpoint_first_dates/i18n/stock_orderpoint_first_dates.pot
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 ""
1 change: 1 addition & 0 deletions stock_orderpoint_first_dates/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import stock_warehouse_orderpoint
38 changes: 38 additions & 0 deletions stock_orderpoint_first_dates/models/stock_warehouse_orderpoint.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# 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.state not in ("draft", "cancel", "done")
)
if moves:
first_reception_date = min(moves.mapped("date"))
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.state not in ("draft", "cancel", "done")
)
if moves:
first_shipping_date = min(moves.mapped("date"))
orderpoint.first_shipping_date = first_shipping_date
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>
Loading