diff --git a/spp_drims/README.rst b/spp_drims/README.rst index 35393c23..e81e4138 100644 --- a/spp_drims/README.rst +++ b/spp_drims/README.rst @@ -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 ~~~~~~~~~~ diff --git a/spp_drims/__manifest__.py b/spp_drims/__manifest__.py index e775182a..bbdbf1d2 100644 --- a/spp_drims/__manifest__.py +++ b/spp_drims/__manifest__.py @@ -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", @@ -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", diff --git a/spp_drims/models/stock_picking.py b/spp_drims/models/stock_picking.py index 703c4403..3b5c3ab7 100644 --- a/spp_drims/models/stock_picking.py +++ b/spp_drims/models/stock_picking.py @@ -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() diff --git a/spp_drims/readme/HISTORY.md b/spp_drims/readme/HISTORY.md index 41a4b4ea..0d162e0f 100644 --- a/spp_drims/readme/HISTORY.md +++ b/spp_drims/readme/HISTORY.md @@ -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) diff --git a/spp_drims/security/ir.model.access.csv b/spp_drims/security/ir.model.access.csv index 632f35dc..b274f9c1 100644 --- a/spp_drims/security/ir.model.access.csv +++ b/spp_drims/security/ir.model.access.csv @@ -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 diff --git a/spp_drims/static/description/index.html b/spp_drims/static/description/index.html index f64fb3c6..bc9ccbf3 100644 --- a/spp_drims/static/description/index.html +++ b/spp_drims/static/description/index.html @@ -565,6 +565,16 @@

Changelog

+

19.0.3.0.3

+ +
+

19.0.3.0.0

-
+

19.0.2.0.0