mirror of
https://github.com/OCA/stock-logistics-warehouse.git
synced 2025-01-21 14:27:28 +02:00
[ADD] stock_request_direction
This commit is contained in:
committed by
ps-tubtim
parent
f88f0724a0
commit
9a55220641
21
stock_request_direction/README.rst
Normal file
21
stock_request_direction/README.rst
Normal file
@@ -0,0 +1,21 @@
|
||||
**This file is going to be generated by oca-gen-addon-readme.**
|
||||
|
||||
*Manual changes will be overwritten.*
|
||||
|
||||
Please provide content in the ``readme`` directory:
|
||||
|
||||
* **DESCRIPTION.rst** (required)
|
||||
* INSTALL.rst (optional)
|
||||
* CONFIGURE.rst (optional)
|
||||
* **USAGE.rst** (optional, highly recommended)
|
||||
* DEVELOP.rst (optional)
|
||||
* ROADMAP.rst (optional)
|
||||
* HISTORY.rst (optional, recommended)
|
||||
* **CONTRIBUTORS.rst** (optional, highly recommended)
|
||||
* CREDITS.rst (optional)
|
||||
|
||||
Content of this README will also be drawn from the addon manifest,
|
||||
from keys such as name, authors, maintainers, development_status,
|
||||
and license.
|
||||
|
||||
A good, one sentence summary in the manifest is also highly recommended.
|
||||
4
stock_request_direction/__init__.py
Normal file
4
stock_request_direction/__init__.py
Normal file
@@ -0,0 +1,4 @@
|
||||
# Copyright (c) 2019 Open Source Integrators
|
||||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
|
||||
|
||||
from . import models
|
||||
24
stock_request_direction/__manifest__.py
Normal file
24
stock_request_direction/__manifest__.py
Normal file
@@ -0,0 +1,24 @@
|
||||
# Copyright (c) 2019 Open Source Integrators
|
||||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
|
||||
|
||||
{
|
||||
"name": "Stock Requests Direction",
|
||||
"summary": "From or to your warehouse?",
|
||||
"version": "12.0.1.0.0",
|
||||
"license": "LGPL-3",
|
||||
"website": "https://github.com/OCA/stock-logistics-warehouse",
|
||||
"author": "Open Source Integrators, "
|
||||
"Odoo Community Association (OCA)",
|
||||
"category": "Warehouse Management",
|
||||
"depends": [
|
||||
"stock_request",
|
||||
],
|
||||
"data": [
|
||||
"views/res_config_settings.xml",
|
||||
"views/stock_request_views.xml",
|
||||
"views/stock_request_order_views.xml",
|
||||
],
|
||||
"application": False,
|
||||
"development_status": "Beta",
|
||||
"maintainers": ["max3903"],
|
||||
}
|
||||
5
stock_request_direction/models/__init__.py
Normal file
5
stock_request_direction/models/__init__.py
Normal file
@@ -0,0 +1,5 @@
|
||||
# Copyright (c) 2019 Open Source Integrators
|
||||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
|
||||
|
||||
from . import stock_request
|
||||
from . import stock_request_order
|
||||
23
stock_request_direction/models/stock_request.py
Normal file
23
stock_request_direction/models/stock_request.py
Normal file
@@ -0,0 +1,23 @@
|
||||
# Copyright (c) 2019 Open Source Integrators
|
||||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
|
||||
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class StockRequest(models.Model):
|
||||
_inherit = "stock.request"
|
||||
|
||||
direction = fields.Selection([('outbound', 'Outbound'),
|
||||
('inbound', 'Inbound')],
|
||||
string='Direction',
|
||||
states={'draft': [('readonly', False)]},
|
||||
readonly=True)
|
||||
|
||||
@api.onchange('direction')
|
||||
def _onchange_location_id(self):
|
||||
if self.direction == 'outbound':
|
||||
# Partner Locations/Customers
|
||||
self.location_id = self.env.ref('stock.stock_location_customers')
|
||||
else:
|
||||
# Otherwise the Stock Location of the Warehouse
|
||||
self.location_id = self.warehouse_id.lot_stock_id.id
|
||||
31
stock_request_direction/models/stock_request_order.py
Normal file
31
stock_request_direction/models/stock_request_order.py
Normal file
@@ -0,0 +1,31 @@
|
||||
# Copyright (c) 2019 Open Source Integrators
|
||||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
|
||||
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class StockRequestOrder(models.Model):
|
||||
_inherit = 'stock.request.order'
|
||||
|
||||
direction = fields.Selection([('outbound', 'Outbound'),
|
||||
('inbound', 'Inbound')],
|
||||
string='Direction',
|
||||
states={'draft': [('readonly', False)]},
|
||||
readonly=True)
|
||||
|
||||
@api.onchange('direction')
|
||||
def _onchange_direction(self):
|
||||
if self.direction == 'outbound':
|
||||
# Stock Location set to Partner Locations/Customers
|
||||
self.location_id = \
|
||||
self.company_id.partner_id.property_stock_customer.id
|
||||
else:
|
||||
# Otherwise the Stock Location of the Warehouse
|
||||
self.location_id = \
|
||||
self.warehouse_id.lot_stock_id.id
|
||||
|
||||
def change_childs(self):
|
||||
super().change_childs()
|
||||
if not self._context.get('no_change_childs', False):
|
||||
for line in self.stock_request_ids:
|
||||
line.direction = self.direction
|
||||
4
stock_request_direction/readme/CONTRIBUTORS.rst
Normal file
4
stock_request_direction/readme/CONTRIBUTORS.rst
Normal file
@@ -0,0 +1,4 @@
|
||||
* `Open Source Integrators <https://www.opensourceintegrators.com>`_
|
||||
|
||||
* Maxime Chambreuil <mchambreuil@opensourceintegrators.com>
|
||||
* Steve Campbell <scampbell@opensourceintegrators.com>
|
||||
3
stock_request_direction/readme/DESCRIPTION.rst
Normal file
3
stock_request_direction/readme/DESCRIPTION.rst
Normal file
@@ -0,0 +1,3 @@
|
||||
This module was written to allow users to request products to be transferred
|
||||
from or to your warehouses. They can specify the direction and don't have to
|
||||
bother selecting the inventory location.
|
||||
19
stock_request_direction/readme/USAGE.rst
Normal file
19
stock_request_direction/readme/USAGE.rst
Normal file
@@ -0,0 +1,19 @@
|
||||
Creation
|
||||
~~~~~~~~
|
||||
|
||||
* Go to Stock Requests > Stock Requests
|
||||
* Create or select a stock request
|
||||
* Provide a product, quantity, direction and expected date
|
||||
* Click Confirm
|
||||
|
||||
Upon confirmation, the request will be reviewed by the warehouse team who can
|
||||
define the appropriate route.
|
||||
|
||||
In case that transfers are created, the user will be able to access to them
|
||||
from the button 'Transfers' available in the Stock Request.
|
||||
|
||||
Cancel
|
||||
~~~~~~
|
||||
|
||||
When the user cancels a Stock Request, the related pending stock moves will be
|
||||
also cancelled.
|
||||
BIN
stock_request_direction/static/description/icon.png
Normal file
BIN
stock_request_direction/static/description/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.3 KiB |
15
stock_request_direction/views/res_config_settings.xml
Normal file
15
stock_request_direction/views/res_config_settings.xml
Normal file
@@ -0,0 +1,15 @@
|
||||
<odoo>
|
||||
|
||||
<!-- Copyright (c) 2019 Open Source Integrators
|
||||
License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). -->
|
||||
|
||||
<record model="res.config.settings" id="res_config_settings_direction">
|
||||
<field name="stock_request_allow_virtual_loc" eval="1"/>
|
||||
</record>
|
||||
|
||||
<function model="res.config.settings" name="execute">
|
||||
<!-- ids = --> <value eval="[ref('stock_request_direction.res_config_settings_direction')]"/>
|
||||
<!-- context = --> <value eval="{}"/>
|
||||
</function>
|
||||
|
||||
</odoo>
|
||||
43
stock_request_direction/views/stock_request_order_views.xml
Normal file
43
stock_request_direction/views/stock_request_order_views.xml
Normal file
@@ -0,0 +1,43 @@
|
||||
<odoo>
|
||||
|
||||
<!-- Copyright (c) 2019 Open Source Integrators
|
||||
License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). -->
|
||||
|
||||
<record id="stock_request_order_tree" model="ir.ui.view">
|
||||
<field name="name">stock.request.order.tree</field>
|
||||
<field name="model">stock.request.order</field>
|
||||
<field name="inherit_id" ref="stock_request.stock_request_order_tree"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="warehouse_id" position="after">
|
||||
<field name="direction"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="stock_request_order_form" model="ir.ui.view">
|
||||
<field name="name">stock.request.order.form</field>
|
||||
<field name="model">stock.request.order</field>
|
||||
<field name="inherit_id" ref="stock_request.stock_request_order_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='warehouse_id']" position="after">
|
||||
<field name="direction" required="1"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='stock_request_ids']" position="attributes">
|
||||
<attribute name="context">{
|
||||
'default_expected_date': expected_date,
|
||||
'default_picking_policy': picking_policy,
|
||||
'default_warehouse_id': warehouse_id,
|
||||
'default_direction': direction,
|
||||
'default_location_id': location_id,
|
||||
'default_procurement_group_id': procurement_group_id,
|
||||
'default_company_id': company_id,
|
||||
'default_state': state,
|
||||
}</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//tree/field[@name='warehouse_id']" position="after">
|
||||
<field name="direction" invisible="1"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
28
stock_request_direction/views/stock_request_views.xml
Normal file
28
stock_request_direction/views/stock_request_views.xml
Normal file
@@ -0,0 +1,28 @@
|
||||
<odoo>
|
||||
|
||||
<!-- Copyright (c) 2019 Open Source Integrators
|
||||
License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). -->
|
||||
|
||||
<record id="view_stock_request_tree" model="ir.ui.view">
|
||||
<field name="name">stock.request.tree</field>
|
||||
<field name="model">stock.request</field>
|
||||
<field name="inherit_id" ref="stock_request.view_stock_request_tree"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='warehouse_id']" position="after">
|
||||
<field name="direction"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_stock_request_form" model="ir.ui.view">
|
||||
<field name="name">stock.request.form</field>
|
||||
<field name="model">stock.request</field>
|
||||
<field name="inherit_id" ref="stock_request.view_stock_request_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='warehouse_id']" position="after">
|
||||
<field name="direction"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user