From 2199fe86fccb9a70fc844387fbb3898e17d8dca6 Mon Sep 17 00:00:00 2001 From: Suherdy Yacob Date: Thu, 12 Feb 2026 10:41:18 +0700 Subject: [PATCH] feat: Enable creation of WH to Prep inventory transfers from approval requests and introduce 'WH Sent' status. --- .gitignore | 16 +++++++++++ README.md | 26 ++++++++++++++++++ .../approval_request.cpython-312.pyc | Bin 5018 -> 5692 bytes models/approval_request.py | 11 ++++++++ views/approval_request_views.xml | 25 +++++++++++++++++ 5 files changed, 78 insertions(+) create mode 100644 .gitignore create mode 100644 README.md diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e104038 --- /dev/null +++ b/.gitignore @@ -0,0 +1,16 @@ +# Python +__pycache__/ +*.py[cod] +*$py.class + +# Odoo +*.hot-update.js +*.hot-update.json +.odoo/ + +# VS Code +.vscode/ + +# System +.DS_Store +Thumbs.db diff --git a/README.md b/README.md new file mode 100644 index 0000000..96e9f41 --- /dev/null +++ b/README.md @@ -0,0 +1,26 @@ +# Approval Create WH to Prep Move + +This module creates an Inventory Transfer from an Approval Request. + +## Features + +- **Create Inventory Transfer**: adds a button "Create WH to Prep Move" to the Approval Request form (visible when approved). +- **Automatic Transfer Creation**: Creates a delivery order with operation type "Brigjend Katamso: WH to Prep (Send)" and destination "Physical Locations/Inter-warehouse transit". +- **Status Tracking**: + - Adds a new status "WH Sent" to the Approval Request. + - Automatically updates the status to "WH Sent" when the inventory transfer is created. + - Displays "WH Sent" status in the statusbar and with a distinct color in the list view. +- **Link to Transfer**: Adds a smart button to view the created transfer(s). + +## Configuration + +Ensure the following are configured in your database: +- Operation Type: "Brigjend Katamso: WH to Prep (Send)" +- Destination Location: "Physical Locations/Inter-warehouse transit" + +## Usage + +1. Create a new Approval Request with the appropriate category. +2. Submit and get it approved. +3. One approved, click the "Create WH to Prep Move" button. +4. The system will create the inventory transfer and change the approval status to "WH Sent". diff --git a/models/__pycache__/approval_request.cpython-312.pyc b/models/__pycache__/approval_request.cpython-312.pyc index 027366790fc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Y^2{}4K8L@a1kD7{G&x)6qBCUzU%p&Ry*kX5i9XrnBu5bSs5DA3_bui zr3S8mE|>7;s4k~7c2xV<4n<@fxf5_zZB9Gm^Zve}J~PI%Vl+UG2`|-d*5V3gjvAVU zu>lvzb>q0m2x}%>n8pFmNvCAR3iZQ2qpiTFtSatofkSXwpD!jpb$*UjmxgWT^&&6u z*$H@{&)IpA*Vbtmu61au7le_cu}S!|_BNJbUA?!^K zC(A4-8fRutiA+`?>6a5xGQ@&VrPw6j;_O;m^xpr!O{0ky;GMB7SNQ#+Q-CS+Tp{^) z`HCOW4rQzgJ7&3lNf<72JVi`sSy@0GLv#*ralkio1}O?~&VBH640_bmS~ mTNdj7#lLcA*8{iTrE}~CNcJ)78pig{?T6iA_XiSjBK-q!FNr$< diff --git a/models/approval_request.py b/models/approval_request.py index 7384ae2..d0603bc 100644 --- a/models/approval_request.py +++ b/models/approval_request.py @@ -8,6 +8,8 @@ class ApprovalRequest(models.Model): picking_ids = fields.Many2many('stock.picking',compute='_compute_picking_ids', string='Transfers') picking_count = fields.Integer(compute='_compute_picking_count') + wh_move_created = fields.Boolean("WH Move Created", copy=False) + request_status = fields.Selection(selection_add=[('wh_sent', 'WH Sent')]) def _compute_picking_ids(self): for request in self: @@ -18,6 +20,12 @@ class ApprovalRequest(models.Model): for request in self: request.picking_count = len(request.picking_ids) + def _compute_request_status(self): + super()._compute_request_status() + for request in self: + if request.request_status == 'approved' and request.wh_move_created: + request.request_status = 'wh_sent' + def action_create_wh_prep_move(self): self.ensure_one() if self.picking_count > 0: @@ -70,6 +78,8 @@ class ApprovalRequest(models.Model): picking = self.env['stock.picking'].create(picking_vals) picking.action_confirm() # Confirm the picking to reserve stock if possible + self.wh_move_created = True + msg = Markup(_("Created Inventory Transfer: %s")) % (picking.id, picking.name) self.message_post(body=msg) @@ -84,3 +94,4 @@ class ApprovalRequest(models.Model): 'context': clean_context(self.env.context), } return action + diff --git a/views/approval_request_views.xml b/views/approval_request_views.xml index ca76e3c..c8ad7b5 100644 --- a/views/approval_request_views.xml +++ b/views/approval_request_views.xml @@ -23,4 +23,29 @@ + + + approval.wh.prep.move.request.view.tree.inherit + approval.request + + + + request_status == 'new' or request_status == 'wh_sent' + request_status == 'pending' + request_status == 'approved' + request_status == 'refused' + + + + + + approval.wh.prep.move.request.view.form.inherit.statusbar + approval.request + + + + new,pending,approved,wh_sent,refused + + +