mirror of
https://github.com/OCA/stock-logistics-warehouse.git
synced 2025-01-21 14:27:28 +02:00
[FIX] stock_request_picking_type
This commit is contained in:
committed by
Reed Hayashikawa
parent
58412bf4ac
commit
a96d9c3c48
@@ -4,7 +4,7 @@
|
||||
{
|
||||
'name': 'Stock Request Picking Type',
|
||||
'summary': 'Add Stock Requests to the Inventory App',
|
||||
'version': '12.0.1.1.0',
|
||||
'version': '12.0.2.0.0',
|
||||
'license': 'LGPL-3',
|
||||
'website': 'https://github.com/stock-logistics-warehouse',
|
||||
'author': 'Open Source Integrators, '
|
||||
@@ -15,7 +15,7 @@
|
||||
],
|
||||
'data': [
|
||||
'data/stock_picking_type.xml',
|
||||
'views/stock_request_views.xml',
|
||||
'views/stock_request_order_views.xml',
|
||||
'views/stock_picking_views.xml',
|
||||
],
|
||||
'development_status': 'Beta',
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
<?xml version="1.0"?>
|
||||
<odoo noupdate="1">
|
||||
|
||||
<record id="stock_request" model="stock.picking.type">
|
||||
<record id="stock_request_order" model="stock.picking.type">
|
||||
<field name="name">Stock Requests</field>
|
||||
<field name="sequence_id" ref="stock_request.seq_stock_request"/>
|
||||
<field name="code">stock_request</field>
|
||||
<field name="sequence_id" ref="stock_request.seq_stock_request_order"/>
|
||||
<field name="code">stock_request_order</field>
|
||||
<field name="sequence">0</field>
|
||||
</record>
|
||||
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
# Copyright (C) 2019 Open Source Integrators
|
||||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
|
||||
|
||||
|
||||
def migrate(env, version):
|
||||
if not version:
|
||||
return
|
||||
|
||||
env.execute("UPDATE stock_request_order "
|
||||
"SET picking_type_id = ("
|
||||
"SELECT id "
|
||||
"FROM stock_picking_type "
|
||||
"WHERE code = 'stock_request_order') "
|
||||
"WHERE picking_type_id IS NULL;")
|
||||
@@ -1,5 +1,5 @@
|
||||
# Copyright 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
|
||||
from . import stock_picking_type
|
||||
|
||||
@@ -7,8 +7,8 @@ from odoo import fields, models
|
||||
class StockPickingType(models.Model):
|
||||
_inherit = 'stock.picking.type'
|
||||
|
||||
code = fields.Selection(selection_add=[('stock_request',
|
||||
'Stock Request')])
|
||||
code = fields.Selection(selection_add=[('stock_request_order',
|
||||
'Stock Request Order')])
|
||||
count_sr_todo = fields.Integer(string="To Do",
|
||||
compute='_compute_sr_count')
|
||||
count_sr_open = fields.Integer(string="In Progress",
|
||||
@@ -17,7 +17,8 @@ class StockPickingType(models.Model):
|
||||
compute='_compute_sr_count')
|
||||
|
||||
def _compute_sr_count(self):
|
||||
types = self.filtered(lambda picking: picking.code == 'stock_request')
|
||||
types = self.filtered(
|
||||
lambda picking: picking.code == 'stock_request_order')
|
||||
if not types:
|
||||
return
|
||||
domains = {
|
||||
@@ -27,7 +28,7 @@ class StockPickingType(models.Model):
|
||||
('state', 'in', ('submitted', 'open'))],
|
||||
}
|
||||
for field in domains:
|
||||
data = self.env['stock.request'].read_group(
|
||||
data = self.env['stock.request.order'].read_group(
|
||||
domains[field] +
|
||||
[('state', 'not in', ('done', 'cancel')),
|
||||
('picking_type_id', 'in', self.ids)],
|
||||
@@ -38,6 +39,6 @@ class StockPickingType(models.Model):
|
||||
for record in types:
|
||||
record[field] = count.get(record.id, 0)
|
||||
|
||||
def get_stock_request_picking_type_action(self):
|
||||
def get_stock_request_order_picking_type_action(self):
|
||||
return self._get_action(
|
||||
'stock_request_picking_type.action_picking_dashboard')
|
||||
|
||||
@@ -4,13 +4,13 @@
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class StockRequest(models.Model):
|
||||
_inherit = 'stock.request'
|
||||
class StockRequestOrder(models.Model):
|
||||
_inherit = 'stock.request.order'
|
||||
|
||||
@api.model
|
||||
def _get_default_picking_type(self):
|
||||
return self.env['stock.picking.type'].search([
|
||||
('code', '=', 'stock_request'),
|
||||
('code', '=', 'stock_request_order'),
|
||||
('warehouse_id.company_id', 'in',
|
||||
[self.env.context.get('company_id', self.env.user.company_id.id),
|
||||
False])],
|
||||
@@ -1 +1 @@
|
||||
This module adds stock requests within the Inventory app with a new operation type.
|
||||
This module adds stock request orders within the Inventory app with a new operation type.
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
* Go to Inventory
|
||||
* Click on the Stock Requests tile to process stock requests
|
||||
* You can also go to Inventory > Operations > Stock Requests
|
||||
* Click on the Stock Request Orders tile to process stock requests
|
||||
* You can also go to Inventory > Operations > Stock Request Orders
|
||||
|
||||
@@ -13,11 +13,11 @@
|
||||
</field>
|
||||
|
||||
<xpath expr='//div[@name="stock_picking"]' position="after">
|
||||
<div t-if="record.code.raw_value == 'stock_request'" t-attf-class="#{kanban_color(record.color.raw_value)}">
|
||||
<div t-if="record.code.raw_value == 'stock_request_order'" t-attf-class="#{kanban_color(record.color.raw_value)}">
|
||||
<div>
|
||||
<div t-attf-class="o_kanban_card_header">
|
||||
<div class="o_kanban_card_header_title">
|
||||
<a type="object" name="get_stock_request_picking_type_action" class="o_primary">
|
||||
<a type="object" name="get_stock_request_order_picking_type_action" class="o_primary">
|
||||
<field name="name"/>
|
||||
</a>
|
||||
<div class="o_secondary"><field class="o_secondary" name="warehouse_id"/></div>
|
||||
@@ -30,7 +30,7 @@
|
||||
<div class="row">
|
||||
<div class="col-6 o_kanban_primary_left">
|
||||
<button class="btn btn-primary" name="%(action_picking_dashboard)d" type="action" context="{'search_default_todo': 1}">
|
||||
<span t-if="record.code.raw_value =='stock_request'"><t t-esc="record.count_sr_todo.value"/> To Process</span>
|
||||
<span t-if="record.code.raw_value =='stock_request_order'"><t t-esc="record.count_sr_todo.value"/> To Process</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="col-6 o_kanban_primary_right">
|
||||
@@ -80,7 +80,7 @@
|
||||
<span>New</span>
|
||||
</div>
|
||||
<div role="menuitem">
|
||||
<a name="%(action_stock_request_form)d" type="action">Stock Request</a>
|
||||
<a name="%(action_stock_request_order_form)d" type="action">Stock Request Order</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -100,16 +100,16 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_picking_type_form_inherit_sr" model="ir.ui.view">
|
||||
<record id="view_picking_type_form_inherit_sro" model="ir.ui.view">
|
||||
<field name="name">Operation Types</field>
|
||||
<field name="model">stock.picking.type</field>
|
||||
<field name="inherit_id" ref="stock.view_picking_type_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="show_operations" position="attributes">
|
||||
<attribute name="attrs">{"invisible": [("code", "=", "stock_request")]}</attribute>
|
||||
<attribute name="attrs">{"invisible": [("code", "=", "stock_request_order")]}</attribute>
|
||||
</field>
|
||||
<field name="show_reserved" position="attributes">
|
||||
<attribute name="attrs">{"invisible": [("code", "=", "stock_request")]}</attribute>
|
||||
<attribute name="attrs">{"invisible": [("code", "=", "stock_request_order")]}</attribute>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
<?xml version="1.0" ?>
|
||||
<odoo>
|
||||
|
||||
<record id="view_stock_request_filter" model="ir.ui.view">
|
||||
<field name="name">stock.request.select</field>
|
||||
<field name="model">stock.request</field>
|
||||
<record id="view_stock_request_order_filter" model="ir.ui.view">
|
||||
<field name="name">stock.request.order.select</field>
|
||||
<field name="model">stock.request.order</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Search Stock Request">
|
||||
<search string="Search Stock Request Orders">
|
||||
<field name="name"/>
|
||||
<field name="product_id"/>
|
||||
<filter string="To Do" name="todo" domain="[('state','=', 'submitted')]"
|
||||
help="Stock Requests To Do."/>
|
||||
<filter string="In Progress" name="inprogress" domain="[('state', '=', 'open')]"
|
||||
@@ -16,7 +14,6 @@
|
||||
name="late" help="Late Stock Requests"/>
|
||||
<filter string="Done" name="done" domain="[('state', '=', 'done')]"/>
|
||||
<group expand="0" string="Group By...">
|
||||
<filter string="Product" name="product" domain="[]" context="{'group_by':'product_id'}"/>
|
||||
<filter string="Expected Date" name="expected_date" domain="[]" context="{'group_by': 'expected_date'}" help="Expected Date by Month"/>
|
||||
<filter string="State" name="state" domain="[]" context="{'group_by': 'state'}"/>
|
||||
</group>
|
||||
@@ -25,28 +22,28 @@
|
||||
</record>
|
||||
|
||||
<record id="action_picking_dashboard" model="ir.actions.act_window">
|
||||
<field name="name">Stock Requests</field>
|
||||
<field name="name">Stock Request Orders</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">stock.request</field>
|
||||
<field name="res_model">stock.request.order</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" eval="False"/>
|
||||
<field name="search_view_id" ref="view_stock_request_filter"/>
|
||||
<field name="search_view_id" ref="view_stock_request_order_filter"/>
|
||||
<field name="domain">[('picking_type_id', '=', active_id)]</field>
|
||||
<field name="context">{'default_picking_type_id': active_id}</field>
|
||||
</record>
|
||||
|
||||
<record id="action_stock_request_form" model="ir.actions.act_window">
|
||||
<field name="name">Stock Requests</field>
|
||||
<record id="action_stock_request_order_form" model="ir.actions.act_window">
|
||||
<field name="name">Stock Request Orders</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">stock.request</field>
|
||||
<field name="res_model">stock.request.order</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
</record>
|
||||
|
||||
<menuitem id="menu_stock_request"
|
||||
action="stock_request.action_stock_request_form"
|
||||
name="Stock Requests"
|
||||
<menuitem id="menu_stock_request_order"
|
||||
action="stock_request.stock_request_order_action"
|
||||
name="Stock Request Orders"
|
||||
parent="stock.menu_stock_warehouse_mgmt"
|
||||
sequence="30"/>
|
||||
|
||||
Reference in New Issue
Block a user