Skip to content
Open
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.3.0.3
~~~~~~~~~~

- 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.3.0.0
~~~~~~~~~~

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.3.0.0",
"version": "19.0.3.0.3",
"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",
# Views
"views/alert_views.xml",
"views/donation_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 @@ -168,13 +168,65 @@ def action_open_gis_map(self):
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.3.0.3

- 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.3.0.0

- feat(drims): allocate stock per source warehouse. The Allocate Stock wizard now auto-splits each requested line across the DRIMS warehouses that hold stock (e.g. 70 → 50 @ WH1 + 20 @ WH2) with editable rows; the split is captured on a new per-warehouse allocation record, shown on the request's Allocations tab and summarised in a "Source Warehouse(s)" column on the Requests list; dispatch creates one picking per source warehouse. The single "Source Warehouse" field on the request has been removed — the warehouse(s) are chosen in the wizard. The allocation wizard distinguishes no-stock, stock-shortfall and deliberate partial-allocation cases with clear messages, and the request line's Fulfillment % tracks allocated ÷ requested so the bar reflects allocation progress (#1079)
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
12 changes: 11 additions & 1 deletion 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.3.0.3</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.3.0.0</h1>
<ul class="simple">
<li>feat(drims): allocate stock per source warehouse. The Allocate Stock
Expand All @@ -584,7 +594,7 @@ <h1>19.0.3.0.0</h1>
destination-type selector (#1075)</li>
</ul>
</div>
<div class="section" id="section-2">
<div class="section" id="section-3">
<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_donation
from . import test_incident
from . import test_personnel
Expand Down
Loading
Loading