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
9 changes: 9 additions & 0 deletions spp_drims/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,15 @@ Dependencies
Changelog
=========

19.0.4.0.2
~~~~~~~~~~

- feat(drims): confirm a delivery through a popup rather than the
dispatch form. Confirm Delivery now collects the receiver, signature,
photos and GPS together with what actually arrived per line, and
records the delivered quantities against the request so fulfilment
reflects what was received rather than what was sent (#1088)

19.0.4.0.1
~~~~~~~~~~

Expand Down
3 changes: 2 additions & 1 deletion spp_drims/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"and distribution tracking. Links to hazard incidents with multi-tier "
"approval workflows and warehouse operations.",
"category": "OpenSPP/Inventory",
"version": "19.0.4.0.1",
"version": "19.0.4.0.2",
"sequence": 1,
"author": "OpenSPP.org",
"website": "https://github.com/OpenSPP/OpenSPP2",
Expand Down Expand Up @@ -60,6 +60,7 @@
"wizard/allocation_preview_wizard_views.xml",
"wizard/create_return_wizard_views.xml",
"wizard/inspection_wizard_views.xml",
"wizard/delivery_confirmation_wizard_views.xml",
"wizard/receive_wizard_views.xml",
# Views
"views/alert_views.xml",
Expand Down
54 changes: 53 additions & 1 deletion spp_drims/models/stock_picking.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,13 +223,65 @@ def _get_waybill_barcode_data_uri(self, width=300, height=50):
def action_confirm_departure(self):
"""Confirm dispatch departure."""
for rec in self:
if rec.is_pod_confirmed:
raise UserError(
_("Dispatch %s is already marked delivered; its departure cannot be re-recorded.") % rec.name
)
rec.date_departed = fields.Datetime.now()

def action_open_delivery_confirmation(self):
"""Open the delivery confirmation popup (OP#1088).

Replaces typing the receiver's details into the form and then pressing a
button that refused if they were missing. The wizard collects proof of
delivery and what actually arrived per line, then writes both back here.
"""
self.ensure_one()
if self.drims_type != "request_dispatch":
raise UserError(_("Deliveries can only be confirmed on dispatch pickings."))
if not self.date_departed:
raise UserError(
_("Dispatch %s has not departed yet. Confirm departure before confirming delivery.") % self.name
)
if self.state != "done":
# The wizard's lines come from *done* moves, so on a departed but
# unvalidated transfer it would open empty — and confirming an empty
# wizard writes the POD block, sets is_pod_confirmed and records no
# delivered quantities at all, after which the guard above prevents
# ever recording them. Reachable by following the documented flow of
# OP#1087, which confirms departure before validating (OP#1088
# review).
raise UserError(
_("Dispatch %s has not been validated yet. Validate the transfer before confirming delivery.")
% self.name
)
if self.is_pod_confirmed:
raise UserError(_("Delivery for dispatch %s is already confirmed.") % self.name)

return {
"type": "ir.actions.act_window",
"name": _("Confirm Delivery"),
"res_model": "spp.drims.delivery.confirmation.wizard",
"view_mode": "form",
"target": "new",
"context": {"default_picking_id": self.id},
}

def action_confirm_pod(self):
"""Confirm proof of delivery."""
"""Confirm proof of delivery directly, without the wizard.

Kept for programmatic callers; the form routes through
``action_open_delivery_confirmation`` instead (OP#1088). The departure
check is enforced here too, so no path can record an arrival for goods
that never left.
"""
for rec in self:
if not rec.pod_received_by:
raise UserError(_("Please enter the receiver's name."))
if not rec.date_departed:
raise UserError(
_("Dispatch %s has not departed yet. Confirm departure before confirming delivery.") % rec.name
)
rec.is_pod_confirmed = True
rec.date_arrived = fields.Datetime.now()

Expand Down
4 changes: 4 additions & 0 deletions spp_drims/readme/HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### 19.0.4.0.2

- feat(drims): confirm a delivery through a popup rather than the dispatch form. Confirm Delivery now collects the receiver, signature, photos and GPS together with what actually arrived per line, and records the delivered quantities against the request so fulfilment reflects what was received rather than what was sent (#1088)

### 19.0.4.0.1

- fix(drims): only let a dispatch ship what its request approved. Products cannot be added to a request dispatch and quantities cannot be raised past what was allocated — enforced on the model, so imports and API callers are covered too, with the Operations tab's Add a line and delete affordances hidden to match (#1057)
Expand Down
8 changes: 8 additions & 0 deletions spp_drims/security/ir.model.access.csv
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,14 @@ access_spp_drims_create_return_wizard_coordinator,DRIMS Create Return Wizard Coo
access_spp_drims_create_return_wizard_line_coordinator,DRIMS Create Return Wizard Line Coordinator,model_spp_drims_create_return_wizard_line,group_drims_coordinator_supervisor,1,1,1,0
access_spp_drims_create_return_wizard_field_officer,DRIMS Create Return Wizard Field Officer,model_spp_drims_create_return_wizard,group_drims_field_officer,1,1,1,0
access_spp_drims_create_return_wizard_line_field_officer,DRIMS Create Return Wizard Line Field Officer,model_spp_drims_create_return_wizard_line,group_drims_field_officer,1,1,1,0
access_spp_drims_delivery_confirmation_wizard_manager,DRIMS Delivery Confirmation Wizard Manager,model_spp_drims_delivery_confirmation_wizard,group_drims_manager,1,1,1,1
access_spp_drims_delivery_confirmation_wizard_line_manager,DRIMS Delivery Confirmation Wizard Line Manager,model_spp_drims_delivery_confirmation_wizard_line,group_drims_manager,1,1,1,1
access_spp_drims_delivery_confirmation_wizard_officer,DRIMS Delivery Confirmation Wizard Officer,model_spp_drims_delivery_confirmation_wizard,group_drims_officer,1,1,1,0
access_spp_drims_delivery_confirmation_wizard_line_officer,DRIMS Delivery Confirmation Wizard Line Officer,model_spp_drims_delivery_confirmation_wizard_line,group_drims_officer,1,1,1,0
access_spp_drims_delivery_confirmation_wizard_warehouse_staff,DRIMS Delivery Confirmation Wizard Warehouse Staff,model_spp_drims_delivery_confirmation_wizard,group_drims_warehouse_worker,1,1,1,0
access_spp_drims_delivery_confirmation_wizard_line_warehouse_staff,DRIMS Delivery Confirmation Wizard Line Warehouse Staff,model_spp_drims_delivery_confirmation_wizard_line,group_drims_warehouse_worker,1,1,1,0
access_spp_drims_delivery_confirmation_wizard_coordinator,DRIMS Delivery Confirmation Wizard Coordinator,model_spp_drims_delivery_confirmation_wizard,group_drims_coordinator_supervisor,1,1,1,0
access_spp_drims_delivery_confirmation_wizard_line_coordinator,DRIMS Delivery Confirmation Wizard Line Coordinator,model_spp_drims_delivery_confirmation_wizard_line,group_drims_coordinator_supervisor,1,1,1,0
access_spp_drims_allocation_preview_wizard_manager,DRIMS Allocation Preview Wizard Manager,model_spp_drims_allocation_preview_wizard,group_drims_manager,1,1,1,1
access_spp_drims_allocation_preview_wizard_line_manager,DRIMS Allocation Preview Wizard Line Manager,model_spp_drims_allocation_preview_wizard_line,group_drims_manager,1,1,1,1
access_spp_drims_allocation_preview_wizard_officer,DRIMS Allocation Preview Wizard Officer,model_spp_drims_allocation_preview_wizard,group_drims_officer,1,1,1,0
Expand Down
22 changes: 16 additions & 6 deletions spp_drims/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,16 @@ <h2><a class="toc-backref" href="#toc-entry-1">Changelog</a></h2>
</div>
</div>
<div class="section" id="section-1">
<h1>19.0.4.0.2</h1>
<ul class="simple">
<li>feat(drims): confirm a delivery through a popup rather than the
dispatch form. Confirm Delivery now collects the receiver, signature,
photos and GPS together with what actually arrived per line, and
records the delivered quantities against the request so fulfilment
reflects what was received rather than what was sent (#1088)</li>
</ul>
</div>
<div class="section" id="section-2">
<h1>19.0.4.0.1</h1>
<ul class="simple">
<li>fix(drims): only let a dispatch ship what its request approved.
Expand All @@ -574,7 +584,7 @@ <h1>19.0.4.0.1</h1>
and delete affordances hidden to match (#1057)</li>
</ul>
</div>
<div class="section" id="section-2">
<div class="section" id="section-3">
<h1>19.0.4.0.0</h1>
<ul class="simple">
<li>feat(drims): Donations review — creation, receipt, inspection and
Expand All @@ -594,7 +604,7 @@ <h1>19.0.4.0.0</h1>
but no longer readable through the ORM or shown in any view (#1076)</li>
</ul>
</div>
<div class="section" id="section-3">
<div class="section" id="section-4">
<h1>19.0.3.1.0</h1>
<ul class="simple">
<li>feat(drims): Incident Management review — incidents are entered as a
Expand All @@ -611,7 +621,7 @@ <h1>19.0.3.1.0</h1>
refresh cron skips (#1100)</li>
</ul>
</div>
<div class="section" id="section-4">
<div class="section" id="section-5">
<h1>19.0.3.0.4</h1>
<ul class="simple">
<li>feat(drims): rework the dispatch page and correct the waybill.
Expand All @@ -631,7 +641,7 @@ <h1>19.0.3.0.4</h1>
barcode (#1151)</li>
</ul>
</div>
<div class="section" id="section-5">
<div class="section" id="section-6">
<h1>19.0.3.0.1</h1>
<ul class="simple">
<li>fix(drims): a dispatch validated short no longer leaves the request
Expand All @@ -643,7 +653,7 @@ <h1>19.0.3.0.1</h1>
API (#1087)</li>
</ul>
</div>
<div class="section" id="section-6">
<div class="section" id="section-7">
<h1>19.0.3.0.0</h1>
<ul class="simple">
<li>feat(drims): allocate stock per source warehouse. The Allocate Stock
Expand All @@ -663,7 +673,7 @@ <h1>19.0.3.0.0</h1>
destination-type selector (#1075)</li>
</ul>
</div>
<div class="section" id="section-7">
<div class="section" id="section-8">
<h1>19.0.2.0.0</h1>
<ul class="simple">
<li>Initial migration to OpenSPP2</li>
Expand Down
1 change: 1 addition & 0 deletions spp_drims/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from . import test_allocation_preview_wizard
from . import test_approval
from . import test_coordination
from . import test_delivery_confirmation_wizard
from . import test_dispatch_line_lock
from . import test_dispatch_page
from . import test_dispatch_backorder
Expand Down
Loading
Loading