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][MIG] stock_picking_group_by_partner_by_carrier_by_date: Migration to 16.0 #1528

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
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,
)
98 changes: 98 additions & 0 deletions stock_picking_group_by_partner_by_carrier_by_date/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
==============================================================
Stock Picking: group by partner and carrier and scheduled date
==============================================================

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

.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png
:target: https://odoo-community.org/page/development-status
:alt: Alpha
.. |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-OCA%2Fstock--logistics--workflow-lightgray.png?logo=github
:target: https://github.com/OCA/stock-logistics-workflow/tree/16.0/stock_picking_group_by_partner_by_carrier_by_date
:alt: OCA/stock-logistics-workflow
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/stock-logistics-workflow-16-0/stock-logistics-workflow-16-0-stock_picking_group_by_partner_by_carrier_by_date
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/stock-logistics-workflow&target_branch=16.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

Group delivery orders by partner, carrier and scheduled date.

.. IMPORTANT::
This is an alpha version, the data model and design can change at any time without warning.
Only for development or testing purpose, do not use in production.
`More details on development status <https://odoo-community.org/page/development-status>`_

**Table of contents**

.. contents::
:local:

Usage
=====

See `stock_picking_group_by_partner_by_carrier` configuration.

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-workflow/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/OCA/stock-logistics-workflow/issues/new?body=module:%20stock_picking_group_by_partner_by_carrier_by_date%0Aversion:%2016.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
~~~~~~~

* Camptocamp

Contributors
~~~~~~~~~~~~

* Simone Orsi <simahawk@gmail.com>

* Camptocamp:
* Joël Grand-Guillaume <joel.grandguillaume@camptocamp.com>

* Phuc Tran Thanh <phuc@trobz.com>

Other credits
~~~~~~~~~~~~~

The development of this module has been financially supported by:

* Camptocamp

Maintainers
~~~~~~~~~~~

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/stock-logistics-workflow <https://github.com/OCA/stock-logistics-workflow/tree/16.0/stock_picking_group_by_partner_by_carrier_by_date>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
20 changes: 20 additions & 0 deletions stock_picking_group_by_partner_by_carrier_by_date/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2020 Camptocamp
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

{
"name": "Stock Picking: group by partner and carrier and scheduled date",
"Summary": """Delivery orders will be matched by date too.
""",
"version": "16.0.1.0.0",
"development_status": "Alpha",
"author": "Camptocamp, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/stock-logistics-workflow",
"category": "Warehouse Management",
# TODO: consider splitting the hook for `_assign_picking` defined in
# `stock_picking_group_by_partner_by_carrier`
# to avoid depending on `stock_picking_group_by_partner_by_carrier`.
"depends": ["partner_tz", "stock_picking_group_by_partner_by_carrier"],
"data": ["views/stock_picking_type.xml"],
"installable": True,
"license": "AGPL-3",
}
55 changes: 55 additions & 0 deletions stock_picking_group_by_partner_by_carrier_by_date/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_picking_group_by_partner_by_carrier_by_date
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-12-26 14:33+0000\n"
"Last-Translator: mymage <stefano.consolaro@mymage.it>\n"
"Language-Team: none\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\n"

#. module: stock_picking_group_by_partner_by_carrier_by_date
#: model:ir.model.fields,field_description:stock_picking_group_by_partner_by_carrier_by_date.field_stock_move__display_name
#: model:ir.model.fields,field_description:stock_picking_group_by_partner_by_carrier_by_date.field_stock_picking_type__display_name
msgid "Display Name"
msgstr "Nome visualizzato"

#. module: stock_picking_group_by_partner_by_carrier_by_date
#: model:ir.model.fields,field_description:stock_picking_group_by_partner_by_carrier_by_date.field_stock_picking_type__group_pickings_by_date
msgid "Group pickings by date"
msgstr "Raggruppa prelievi per data"

#. module: stock_picking_group_by_partner_by_carrier_by_date
#: model:ir.model.fields,field_description:stock_picking_group_by_partner_by_carrier_by_date.field_stock_move__id
#: model:ir.model.fields,field_description:stock_picking_group_by_partner_by_carrier_by_date.field_stock_picking_type__id
msgid "ID"
msgstr "ID"

#. module: stock_picking_group_by_partner_by_carrier_by_date
#: model:ir.model.fields,help:stock_picking_group_by_partner_by_carrier_by_date.field_stock_picking_type__group_pickings_by_date
msgid "If `Group pickings` is enabled they will be grouped by date too."
msgstr "Se `Raggruppa prelievi`è abilitato verranno raggruppati ancheper data."

#. module: stock_picking_group_by_partner_by_carrier_by_date
#: model:ir.model.fields,field_description:stock_picking_group_by_partner_by_carrier_by_date.field_stock_move____last_update
#: model:ir.model.fields,field_description:stock_picking_group_by_partner_by_carrier_by_date.field_stock_picking_type____last_update
msgid "Last Modified on"
msgstr "Ultima modifica il"

#. module: stock_picking_group_by_partner_by_carrier_by_date
#: model:ir.model,name:stock_picking_group_by_partner_by_carrier_by_date.model_stock_picking_type
msgid "Picking Type"
msgstr "Tipologia prelievo"

#. module: stock_picking_group_by_partner_by_carrier_by_date
#: model:ir.model,name:stock_picking_group_by_partner_by_carrier_by_date.model_stock_move
msgid "Stock Move"
msgstr "Movimento di magazzino"
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_picking_group_by_partner_by_carrier_by_date
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \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_picking_group_by_partner_by_carrier_by_date
#: model:ir.model.fields,field_description:stock_picking_group_by_partner_by_carrier_by_date.field_stock_move__display_name
#: model:ir.model.fields,field_description:stock_picking_group_by_partner_by_carrier_by_date.field_stock_picking_type__display_name
msgid "Display Name"
msgstr ""

#. module: stock_picking_group_by_partner_by_carrier_by_date
#: model:ir.model.fields,field_description:stock_picking_group_by_partner_by_carrier_by_date.field_stock_picking_type__group_pickings_by_date
msgid "Group pickings by date"
msgstr ""

#. module: stock_picking_group_by_partner_by_carrier_by_date
#: model:ir.model.fields,field_description:stock_picking_group_by_partner_by_carrier_by_date.field_stock_move__id
#: model:ir.model.fields,field_description:stock_picking_group_by_partner_by_carrier_by_date.field_stock_picking_type__id
msgid "ID"
msgstr ""

#. module: stock_picking_group_by_partner_by_carrier_by_date
#: model:ir.model.fields,help:stock_picking_group_by_partner_by_carrier_by_date.field_stock_picking_type__group_pickings_by_date
msgid "If `Group pickings` is enabled they will be grouped by date too."
msgstr ""

#. module: stock_picking_group_by_partner_by_carrier_by_date
#: model:ir.model.fields,field_description:stock_picking_group_by_partner_by_carrier_by_date.field_stock_move____last_update
#: model:ir.model.fields,field_description:stock_picking_group_by_partner_by_carrier_by_date.field_stock_picking_type____last_update
msgid "Last Modified on"
msgstr ""

#. module: stock_picking_group_by_partner_by_carrier_by_date
#: model:ir.model,name:stock_picking_group_by_partner_by_carrier_by_date.model_stock_picking_type
msgid "Picking Type"
msgstr ""

#. module: stock_picking_group_by_partner_by_carrier_by_date
#: model:ir.model,name:stock_picking_group_by_partner_by_carrier_by_date.model_stock_move
msgid "Stock Move"
msgstr ""
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import stock_move
from . import stock_picking_type
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Copyright 2020 Camptocamp (https://www.camptocamp.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from datetime import timedelta

from odoo import models

from odoo.addons.partner_tz.tools.tz_utils import (
tz_to_utc_naive_datetime,
utc_to_tz_naive_datetime,
)


class StockMove(models.Model):
_inherit = "stock.move"

def _assign_picking_group_domain(self):
domain = super()._assign_picking_group_domain()
by_date_domain = self._assign_picking_group_domain_by_date()
domain.extend(by_date_domain)
return domain

def _skip_assign_picking_group_domain_by_date(self):
return (
not self.picking_type_id.group_pickings_by_date
or not self.picking_type_id.group_pickings
or self.group_id.sale_id.picking_policy == "one"
or self.env.context.get("picking_manual_merge")
)

def _assign_picking_group_domain_by_date(self):
domain = []
if self._skip_assign_picking_group_domain_by_date():
return domain
tz = (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tuantrantg Is there a test for timezones ?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tuantrantg little ping, any news here ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a little bit busy right now, I will come back soon

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi @rousseldenis the test is added, could you please take a look

self.warehouse_id.partner_id.tz
or self.env.company.partner_id.tz
or self.env.user.tz
)
date_tz = utc_to_tz_naive_datetime(tz, self.date)
dt_start_tz = date_tz.replace(
hour=0,
minute=0,
second=0,
microsecond=0,
)
dt_start = tz_to_utc_naive_datetime(tz, dt_start_tz)
dt_end = dt_start + timedelta(days=1)
domain = [
("scheduled_date", "<", dt_end),
("scheduled_date", ">=", dt_start),
]
return domain
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from odoo import fields, models


class StockPickingType(models.Model):
_inherit = "stock.picking.type"

group_pickings_by_date = fields.Boolean(
"Group pickings by date",
help="If `Group pickings` is enabled they will be grouped by date too.",
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
* Simone Orsi <simahawk@gmail.com>

* Camptocamp:
* Joël Grand-Guillaume <joel.grandguillaume@camptocamp.com>

* Phuc Tran Thanh <phuc@trobz.com>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
The development of this module has been financially supported by:

* Camptocamp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Group delivery orders by partner, carrier and scheduled date.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
See `stock_picking_group_by_partner_by_carrier` configuration.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading