Add module stock_my_operations_filter

This commit is contained in:
Alexis de Lattre
2015-10-05 00:00:03 +02:00
parent 3e5af98552
commit f967e0007b
5 changed files with 151 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-
from . import stock

View File

@@ -0,0 +1,44 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Stock My Operations Filter module for Odoo
# Copyright (C) 2015 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
{
'name': 'Stock My Operations Filter',
'version': '8.0.0.1.0',
'category': 'Inventory, Logistic, Storage',
'license': 'AGPL-3',
'summary': "Adds a filter 'My Operations'",
'description': """
When you have several warehouses, you have a lot of Stock Operations Types, and the menu *Warehouse > All Operations* becomes difficult to use because there are too many types of operations. This module solves this problem: it adds a filter 'My Operations' on stock.picking.type, which is active by default when you go to Warehouse > All Operations. This filter is configurable for each user.
This module has been written by Alexis de Lattre from Akretion
<alexis.delattre@akretion.com>.
""",
'author': 'Akretion',
'website': 'http://www.akretion.com',
'depends': ['stock'],
'data': [
'stock_view.xml',
'users_view.xml',
],
'installable': True,
}

View File

@@ -0,0 +1,40 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Stock My Operations Filter module for Odoo
# Copyright (C) 2015 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from openerp import models, fields
class ResUsers(models.Model):
_inherit = 'res.users'
default_picking_type_ids = fields.Many2many(
'stock.picking.type', 'stock_picking_type_users_rel',
'user_id', 'picking_type_id', string='Default Stock Operations')
class StockPickingType(models.Model):
_inherit = 'stock.picking.type'
default_user_ids = fields.Many2many(
'res.users', 'stock_picking_type_users_rel',
'picking_type_id', 'user_id', string='Visible by Default by')

View File

@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2015 Akretion France (www.akretion.com)
@author: Alexis de Lattre <alexis.delattre@akretion.com>
The licence is in the file __openerp__.py
-->
<openerp>
<data>
<record id="view_picking_type_form" model="ir.ui.view">
<field name="name">my.operations.stock.picking.type.form</field>
<field name="model">stock.picking.type</field>
<field name="inherit_id" ref="stock.view_picking_type_form"/>
<field name="arch" type="xml">
<sheet position="inside">
<group name="users" string="Users">
<field name="default_user_ids" widget="many2many_tags"/>
</group>
</sheet>
</field>
</record>
<record id="view_pickingtype_filter" model="ir.ui.view">
<field name="name">my.operations.stock.picking.type.search</field>
<field name="model">stock.picking.type</field>
<field name="inherit_id" ref="stock.view_pickingtype_filter"/>
<field name="arch" type="xml">
<field name="warehouse_id" position="after">
<filter name="my_operations" string="My Operations"
domain="[('default_user_ids', '=', uid)]" />
</field>
</field>
</record>
<record id="stock.action_picking_type_form" model="ir.actions.act_window">
<field name="context">{'search_default_my_operations': True}</field>
</record>
</data>
</openerp>

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2015 Akretion France (www.akretion.com)
@author: Alexis de Lattre <alexis.delattre@akretion.com>
The licence is in the file __openerp__.py
-->
<openerp>
<data>
<record id="view_users_form" model="ir.ui.view">
<field name="name">usability.default_warehouse.res.users.form</field>
<field name="model">res.users</field>
<field name="inherit_id" ref="base.view_users_form"/>
<field name="arch" type="xml">
<group string="Menus Customization" position="inside">
<field name="default_picking_type_ids" widget="many2many_tags"/>
</group>
</field>
</record>
</data>
</openerp>