-
Notifications
You must be signed in to change notification settings - Fork 9
[18.0][5928][MIG] sale_order_dispatch_date: Migration to 18.0 #236
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
Merged
Merged
Changes from 8 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
6a0ddc0
[1470][ADD] sale_order_delivery_date (#116)
357b2bc
[FIX] date_delivered key error (#118)
6cc4d97
[1470][FIX] dispatch_expected_date and picking view (#119)
f92e119
[IMP] Add default attribute to dispatch_expected_date (#126)
a32f4a5
st2[1870][IMP]display-date_delivered-only-by-delivery (#138)
TomohiroAbe-Quartile c59a292
[UPD] dotfiles (#212)
AungKoKoLin1997 2a595f6
[IMP] sale_order_delivery_date: pre-commit auto fixes
AungKoKoLin1997 6b0157e
[MIG] sale_order_expected_date: Migration to 18.0
AungKoKoLin1997 7a70f91
adj
AungKoKoLin1997 8ad0246
upd translation
AungKoKoLin1997 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,59 @@ | ||
| ======================== | ||
| Sale Order Delivery 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-LGPL--3-blue.png | ||
| :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html | ||
| :alt: License: LGPL-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_expected_date | ||
| :alt: qrtl/hls-custom | ||
|
|
||
| |badge1| |badge2| |badge3| | ||
|
|
||
| This module does the following: | ||
|
|
||
| - Adds Expected Delivery Date to sale order. | ||
| - Adjusts Scheduled Date proposal logic, propose Expected Delivery 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_expected_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_expected_date>`_ project on GitHub. | ||
|
|
||
| You are welcome to contribute. |
This file contains hidden or 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 hidden or 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,13 @@ | ||
| # Copyright 2020 Quartile (https://www.quartile.co) | ||
| # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). | ||
| { | ||
| "name": "Sale Order Delivery Date", | ||
| "version": "18.0.1.0.0", | ||
| "author": "Quartile", | ||
| "website": "https://www.quartile.co", | ||
| "category": "Sale", | ||
| "license": "LGPL-3", | ||
| "depends": ["sale_stock"], | ||
| "data": ["views/sale_order_views.xml"], | ||
| "installable": True, | ||
| } | ||
This file contains hidden or 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,67 @@ | ||
| # Translation of Odoo Server. | ||
| # This file contains the translation of the following modules: | ||
| # * sale_order_delivery_date | ||
| # | ||
| msgid "" | ||
| msgstr "" | ||
| "Project-Id-Version: Odoo Server 12.0\n" | ||
| "Report-Msgid-Bugs-To: \n" | ||
| "POT-Creation-Date: 2020-12-01 07:04+0000\n" | ||
| "PO-Revision-Date: 2020-12-01 07:04+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_delivery_date | ||
| #: model:ir.model.fields,field_description:sale_order_delivery_date.field_stock_picking__date_delivered | ||
| msgid "Delivered Date" | ||
| msgstr "納入日" | ||
|
|
||
| #. module: sale_order_delivery_date | ||
| #: model:ir.model.fields,field_description:sale_order_delivery_date.field_stock_picking__delivery_due_date | ||
| msgid "Delivery Due Date" | ||
| msgstr "納期" | ||
|
|
||
| #. module: sale_order_delivery_date | ||
| #: model:ir.model.fields,field_description:sale_order_delivery_date.field_sale_order__dispatch_expected_date | ||
| msgid "Expected Dispatch Date" | ||
| msgstr "出荷予定日" | ||
|
|
||
| #. module: sale_order_delivery_date | ||
| #: model:ir.model,name:sale_order_delivery_date.model_sale_order | ||
| msgid "Sale Order" | ||
| msgstr "販売オーダ" | ||
|
|
||
| #. module: sale_order_delivery_date | ||
| #: model:ir.model,name:sale_order_delivery_date.model_sale_order_line | ||
| msgid "Sales Order Line" | ||
| msgstr "販売オーダ明細" | ||
|
|
||
| #. module: sale_order_delivery_date | ||
| #: model:ir.model,name:sale_order_delivery_date.model_stock_move | ||
| msgid "Stock Move" | ||
| msgstr "在庫移動" | ||
|
|
||
| #. module: sale_order_delivery_date | ||
| #: model:ir.model.fields,help:sale_order_delivery_date.field_stock_picking__delivery_due_date | ||
| msgid "The date the customer is expected to receive the delivery." | ||
| msgstr "取引先が商品を受け取るべき日。" | ||
|
|
||
| #. module: sale_order_delivery_date | ||
| #: model:ir.model.fields,help:sale_order_delivery_date.field_sale_order__dispatch_expected_date | ||
| msgid "The input date will be passed over to the delivery as Scheduled Date." | ||
| msgstr "入力した日付は配送の予定日時となります。" | ||
|
|
||
| #. module: sale_order_delivery_date | ||
| #: model:ir.model,name:sale_order_delivery_date.model_stock_picking | ||
| msgid "Transfer" | ||
| msgstr "運送" | ||
|
|
||
| #. module: sale_order_delivery_date | ||
| #: model:ir.model.fields,help:sale_order_delivery_date.field_stock_picking__date_delivered | ||
| msgid "Used to indicate the date on which the delivery was actually received by customer. Manually adjust the date for completed deliveries as necessary. This date is used to find target deliveries in invoice print." | ||
| msgstr "実際に納入された日付を示します。必要に応じて、完了済の配送にて日付を更新してください。この日付は請求書印刷での出力対象の配送の特定に使われます。" | ||
|
|
14 changes: 14 additions & 0 deletions
14
sale_order_expected_date/migrations/18.0.1.0.0/pre-migration.py
This file contains hidden or 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,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') | ||
| """) |
This file contains hidden or 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,2 @@ | ||
| from . import sale_order_line | ||
| from . import sale_order |
This file contains hidden or 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,16 @@ | ||
| # Copyright 2020 Quartile Limited | ||
| # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). | ||
|
|
||
| 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.", | ||
| ) |
This file contains hidden or 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,25 @@ | ||
| # Copyright 2020 Quartile (https://www.quartile.co) | ||
| # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). | ||
|
|
||
| from dateutil.relativedelta import relativedelta | ||
| 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) | ||
| tz = self.env.user.tz | ||
| if self.order_id.dispatch_expected_date: | ||
| expect_datetime = fields.Datetime.from_string( | ||
| self.order_id.dispatch_expected_date | ||
| ) | ||
| expect_datetime = expect_datetime + relativedelta(hours=12) | ||
| date_planned = fields.Datetime.to_string( | ||
| timezone(tz).localize(expect_datetime).astimezone(UTC) | ||
| ) | ||
| values.update({"date_planned": date_planned}) | ||
AungKoKoLin1997 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| return values | ||
This file contains hidden or 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,3 @@ | ||
| [build-system] | ||
| requires = ["whool"] | ||
| build-backend = "whool.buildapi" |
This file contains hidden or 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,5 @@ | ||
| This module does the following: | ||
|
|
||
| - Adds Expected Delivery Date to sale order. | ||
| - Adjusts Scheduled Date proposal logic, propose Expected Delivery Date | ||
| as Scheduled Date. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.