Skip to content
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
59 changes: 59 additions & 0 deletions sale_order_dispatch_date/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
========================
Sale Order Dispatch Date
========================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:2ed602e9766ef25c55461894ef3717670464035127f3891e05363d9f74c25964
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-qrtl%2Fhls--custom-lightgray.png?logo=github
:target: https://github.com/qrtl/hls-custom/tree/18.0/sale_order_dispatch_date
:alt: qrtl/hls-custom

|badge1| |badge2| |badge3|

This module does the following:

- Adds Expected Dispatch Date to sale order.
- Adjusts Scheduled Date proposal logic, propose Expected Dispatch Date
as Scheduled Date.

**Table of contents**

.. contents::
:local:

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/qrtl/hls-custom/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/qrtl/hls-custom/issues/new?body=module:%20sale_order_dispatch_date%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
-------

* Quartile

Maintainers
-----------

This module is part of the `qrtl/hls-custom <https://github.com/qrtl/hls-custom/tree/18.0/sale_order_dispatch_date>`_ project on GitHub.

You are welcome to contribute.
1 change: 1 addition & 0 deletions sale_order_dispatch_date/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
13 changes: 13 additions & 0 deletions sale_order_dispatch_date/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright 2020 Quartile (https://www.quartile.co)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Sale Order Dispatch Date",
"version": "18.0.1.0.0",
"author": "Quartile",
"website": "https://www.quartile.co",
"category": "Sale",
"license": "AGPL-3",
"depends": ["sale_stock"],
"data": ["views/sale_order_views.xml"],
"installable": True,
}
36 changes: 36 additions & 0 deletions sale_order_dispatch_date/i18n/ja.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_order_dispatch_date
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 18.0+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-02-18 09:00+0000\n"
"PO-Revision-Date: 2026-02-18 09:00+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: sale_order_dispatch_date
#: model:ir.model.fields,field_description:sale_order_dispatch_date.field_sale_order__dispatch_expected_date
msgid "Expected Dispatch Date"
msgstr "出荷予定日"

#. module: sale_order_dispatch_date
#: model:ir.model,name:sale_order_dispatch_date.model_sale_order
msgid "Sales Order"
msgstr "販売オーダ"

#. module: sale_order_dispatch_date
#: model:ir.model,name:sale_order_dispatch_date.model_sale_order_line
msgid "Sales Order Line"
msgstr "販売オーダ明細"

#. module: sale_order_dispatch_date
#: model:ir.model.fields,help:sale_order_dispatch_date.field_sale_order__dispatch_expected_date
msgid "The input date will be passed over to the delivery as Scheduled Date."
msgstr "入力した日付は配送の予定日時となります。"
14 changes: 14 additions & 0 deletions sale_order_dispatch_date/migrations/18.0.1.0.0/pre-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
def migrate(cr, version):
cr.execute("""
SELECT 1 FROM information_schema.columns
WHERE table_name='stock_picking' AND column_name='delivery_due_date'
LIMIT 1
""")
if not cr.fetchone():
return
cr.execute("""
UPDATE stock_picking
SET date_deadline = delivery_due_date
WHERE delivery_due_date IS NOT NULL
AND state NOT IN ('done','cancel')
""")
2 changes: 2 additions & 0 deletions sale_order_dispatch_date/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import sale_order_line
from . import sale_order
16 changes: 16 additions & 0 deletions sale_order_dispatch_date/models/sale_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2020 Quartile Limited
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import fields, models


class SaleOrder(models.Model):
_inherit = "sale.order"

dispatch_expected_date = fields.Date(
"Expected Dispatch Date",
copy=False,
readonly=True,
default=fields.Date.context_today,
help="The input date will be passed over to the delivery as Scheduled Date.",
)
22 changes: 22 additions & 0 deletions sale_order_dispatch_date/models/sale_order_line.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright 2020 Quartile (https://www.quartile.co)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from datetime import datetime, time

from pytz import UTC, timezone

from odoo import fields, models


class SaleOrderLine(models.Model):
_inherit = "sale.order.line"

def _prepare_procurement_values(self, group_id=False):
values = super()._prepare_procurement_values(group_id)
if self.order_id.dispatch_expected_date:
user_tz = timezone(self.env.user.tz or "UTC")
local_date = self.order_id.dispatch_expected_date
local_dt = user_tz.localize(datetime.combine(local_date, time(12, 0)))
utc_dt = local_dt.astimezone(UTC).replace(tzinfo=None)
values["date_planned"] = fields.Datetime.to_string(utc_dt)
return values
3 changes: 3 additions & 0 deletions sale_order_dispatch_date/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
5 changes: 5 additions & 0 deletions sale_order_dispatch_date/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
This module does the following:

- Adds Expected Dispatch Date to sale order.
- Adjusts Scheduled Date proposal logic, propose Expected Dispatch Date
as Scheduled Date.
Loading