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] delivery_state_manual #924

Merged
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
117 changes: 117 additions & 0 deletions delivery_state_manual/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
=====================
Delivery State Manual
=====================

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

.. |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-OCA%2Fdelivery--carrier-lightgray.png?logo=github
:target: https://github.com/OCA/delivery-carrier/tree/16.0/delivery_state_manual
:alt: OCA/delivery-carrier
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/delivery-carrier-16-0/delivery-carrier-16-0-delivery_state_manual
: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/delivery-carrier&target_branch=16.0
:alt: Try me on Runboat

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

This module extends the functionality of delivery_state to allow you to
manually edit the delivery state of pickings with specific delivery
carriers

**Table of contents**

.. contents::
:local:

Configuration
=============

To configure this module, you need to:

1. Go to Inventory / Configuration / Shipping Methods and open the
desired method to be manual.
2. Mark the "Manual" field

Usage
=====

To use this module, you need to:

1. Go to Inventory / Operations and open or create an outgoing pending
picking.
2. In the Additional Info tab, assign it a delivery carrier which is
manual.
3. Validate the picking and you’ll see in the same tab the delivery
state info with the shipping date and the shipping state. Note: The
carrier tracking state fields will not be displayed for being manual.
4. You will be able to edit the delivery_state field. If you set the
field to "Customer delivered" or "Warehouse Delivered", the "Delivery
Date" field will be automatically set. If you set the field to
"Shipping recorded in carrier", the "Shipment Date" will be
automatically set.

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/delivery-carrier/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/delivery-carrier/issues/new?body=module:%20delivery_state_manual%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
-------

* Sygel

Contributors
------------

- `Sygel <https://www.sygel.es>`__:

- Alberto Martínez
- Jaime Ruiz Maccione
- Valentin Vinagre

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.

.. |maintainer-tisho99| image:: https://github.com/tisho99.png?size=40px
:target: https://github.com/tisho99
:alt: tisho99

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-tisho99|

This module is part of the `OCA/delivery-carrier <https://github.com/OCA/delivery-carrier/tree/16.0/delivery_state_manual>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
3 changes: 3 additions & 0 deletions delivery_state_manual/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import models
21 changes: 21 additions & 0 deletions delivery_state_manual/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2024 Alberto Martínez <alberto.martinez@sygel.es>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Delivery State Manual",
"summary": "Manually edit the delivery state of pickings",
"version": "16.0.1.0.0",
"category": "Delivery",
"website": "https://github.com/OCA/delivery-carrier",
"author": "Sygel, Odoo Community Association (OCA)",
"maintainers": ["tisho99"],
"license": "AGPL-3",
"application": False,
"installable": True,
"depends": [
"delivery_state",
],
"data": [
"views/delivery_carrier_views.xml",
"views/stock_picking_views.xml",
],
}
4 changes: 4 additions & 0 deletions delivery_state_manual/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import delivery_carrier
from . import stock_picking
26 changes: 26 additions & 0 deletions delivery_state_manual/models/delivery_carrier.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright 2024 Alberto Martínez <alberto.martinez@sygel.es>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import fields, models


class DeliveryCarrier(models.Model):
_inherit = "delivery.carrier"

delivery_state_manual = fields.Boolean(
string="Manual Delivery State",
help="Setting this field will allow users to "
"manually edit the delivery state field of its pickings. "
"It will also hide the picking's tracking state fields",
)

def send_shipping(self, pickings):
res = super().send_shipping(pickings)
if self.delivery_state_manual:
pickings.write(
{
"delivery_state": False,
"date_shipped": False,
}
)
return res
30 changes: 30 additions & 0 deletions delivery_state_manual/models/stock_picking.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright 2024 Alberto Martínez <alberto.martinez@sygel.es>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

import datetime

from odoo import api, fields, models


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

delivery_state = fields.Selection(
readonly=False,
Tisho99 marked this conversation as resolved.
Show resolved Hide resolved
help="This field is set automatically unless the delivery carrier is marked as manual. "
"If manually edited, the carrier dates will be updated",
)
delivery_state_manual = fields.Boolean(related="carrier_id.delivery_state_manual")

@api.onchange("delivery_state")
def _onchange_delivery_state(self):
for rec in self.filtered("delivery_state_manual"):
rec.date_delivered = (
datetime.datetime.now()
if rec.delivery_state in ["customer_delivered", "warehouse_delivered"]
else False
)
if rec.delivery_state == "shipping_recorded_in_carrier":
rec.date_shipped = datetime.datetime.now()
elif rec.delivery_state == "canceled_shipment":
rec.date_shipped = False

Check warning on line 30 in delivery_state_manual/models/stock_picking.py

View check run for this annotation

Codecov / codecov/patch

delivery_state_manual/models/stock_picking.py#L30

Added line #L30 was not covered by tests
4 changes: 4 additions & 0 deletions delivery_state_manual/readme/CONFIGURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
To configure this module, you need to:

1. Go to Inventory / Configuration / Shipping Methods and open the desired method to be manual.
2. Mark the "Manual" field
4 changes: 4 additions & 0 deletions delivery_state_manual/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- [Sygel](https://www.sygel.es):
- Alberto Martínez
- Jaime Ruiz Maccione
- Valentin Vinagre
1 change: 1 addition & 0 deletions delivery_state_manual/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This module extends the functionality of delivery_state to allow you to manually edit the delivery state of pickings with specific delivery carriers
6 changes: 6 additions & 0 deletions delivery_state_manual/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
To use this module, you need to:

1. Go to Inventory / Operations and open or create an outgoing pending picking.
2. In the Additional Info tab, assign it a delivery carrier which is manual.
3. Validate the picking and you’ll see in the same tab the delivery state info with the shipping date and the shipping state. Note: The carrier tracking state fields will not be displayed for being manual.
4. You will be able to edit the delivery_state field. If you set the field to "Customer delivered" or "Warehouse Delivered", the "Delivery Date" field will be automatically set. If you set the field to "Shipping recorded in carrier", the "Shipment Date" will be automatically set.
Binary file added delivery_state_manual/static/description/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
79 changes: 79 additions & 0 deletions delivery_state_manual/static/description/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading