mirror of
https://github.com/OCA/stock-logistics-warehouse.git
synced 2025-01-21 14:27:28 +02:00
[IMP] stock_location_empty: black, isort, prettier
This commit is contained in:
1
setup/stock_location_empty/odoo/addons/stock_location_empty
Symbolic link
1
setup/stock_location_empty/odoo/addons/stock_location_empty
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../../../../stock_location_empty
|
||||||
6
setup/stock_location_empty/setup.py
Normal file
6
setup/stock_location_empty/setup.py
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
import setuptools
|
||||||
|
|
||||||
|
setuptools.setup(
|
||||||
|
setup_requires=['setuptools-odoo'],
|
||||||
|
odoo_addon=True,
|
||||||
|
)
|
||||||
@@ -1,18 +1,19 @@
|
|||||||
# Copyright 2019 Camptocamp SA
|
# Copyright 2019 Camptocamp SA
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
|
||||||
|
|
||||||
{'name': 'Stock Location Empty',
|
{
|
||||||
'version': '12.0.1.0.0',
|
"name": "Stock Location Empty",
|
||||||
'author': 'Camptocamp, Odoo Community Association (OCA)',
|
"version": "12.0.1.0.0",
|
||||||
'license': 'AGPL-3',
|
"author": "Camptocamp, Odoo Community Association (OCA)",
|
||||||
'category': 'stock',
|
"license": "AGPL-3",
|
||||||
'depends': [
|
"category": "stock",
|
||||||
'stock',
|
"depends": [
|
||||||
],
|
"stock",
|
||||||
"website": "https://github.com/OCA/stock-logistics-warehouse",
|
],
|
||||||
'data': [
|
"website": "https://github.com/OCA/stock-logistics-warehouse",
|
||||||
'views/stock.xml',
|
"data": [
|
||||||
],
|
"views/stock.xml",
|
||||||
'installable': True,
|
],
|
||||||
'application': False,
|
"installable": True,
|
||||||
}
|
"application": False,
|
||||||
|
}
|
||||||
|
|||||||
@@ -6,15 +6,15 @@ from odoo import api, fields, models
|
|||||||
|
|
||||||
|
|
||||||
class StockLocation(models.Model):
|
class StockLocation(models.Model):
|
||||||
_inherit = 'stock.location'
|
_inherit = "stock.location"
|
||||||
|
|
||||||
stock_amount = fields.Integer(
|
stock_amount = fields.Integer(
|
||||||
compute='_compute_location_amount', search='_search_location_amount'
|
compute="_compute_location_amount", search="_search_location_amount"
|
||||||
)
|
)
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def _search_location_amount(self, operator, value):
|
def _search_location_amount(self, operator, value):
|
||||||
if operator not in ('=', '!=', '<', '<=', '>', '>='):
|
if operator not in ("=", "!=", "<", "<=", ">", ">="):
|
||||||
return []
|
return []
|
||||||
# pylint: disable=sql-injection
|
# pylint: disable=sql-injection
|
||||||
self.env.cr.execute(
|
self.env.cr.execute(
|
||||||
@@ -27,7 +27,7 @@ class StockLocation(models.Model):
|
|||||||
(value,),
|
(value,),
|
||||||
)
|
)
|
||||||
ids = [row[0] for row in self.env.cr.fetchall()]
|
ids = [row[0] for row in self.env.cr.fetchall()]
|
||||||
return [('id', 'in', ids)]
|
return [("id", "in", ids)]
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def _compute_location_amount(self):
|
def _compute_location_amount(self):
|
||||||
|
|||||||
@@ -1,16 +1,20 @@
|
|||||||
<?xml version="1.0"?>
|
<?xml version="1.0" ?>
|
||||||
<odoo>
|
<odoo>
|
||||||
|
|
||||||
<record id="view_location_tree3" model="ir.ui.view">
|
<record id="view_location_tree3" model="ir.ui.view">
|
||||||
<field name="name">stock.location.tree</field>
|
<field name="name">stock.location.tree</field>
|
||||||
<field name="model">stock.location</field>
|
<field name="model">stock.location</field>
|
||||||
<field name="priority" eval="2"/>
|
<field name="priority" eval="2" />
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<tree string="Stock Location" decoration-info="usage=='view'" decoration-danger="usage=='internal'">
|
<tree
|
||||||
<field name="display_name"/>
|
string="Stock Location"
|
||||||
<field name="usage"/>
|
decoration-info="usage=='view'"
|
||||||
<field name="company_id" groups="base.group_multi_company"/>
|
decoration-danger="usage=='internal'"
|
||||||
<field name="stock_amount"/>
|
>
|
||||||
|
<field name="display_name" />
|
||||||
|
<field name="usage" />
|
||||||
|
<field name="company_id" groups="base.group_multi_company" />
|
||||||
|
<field name="stock_amount" />
|
||||||
</tree>
|
</tree>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
@@ -21,8 +25,13 @@
|
|||||||
<field name="inherit_id" ref="stock.view_location_search" />
|
<field name="inherit_id" ref="stock.view_location_search" />
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<field name="location_id" position="after">
|
<field name="location_id" position="after">
|
||||||
<separator/>
|
<separator />
|
||||||
<filter name="stock_amount" string="Empty" domain="[('stock_amount', '=', 0)]" help="Empty stock"/>
|
<filter
|
||||||
|
name="stock_amount"
|
||||||
|
string="Empty"
|
||||||
|
domain="[('stock_amount', '=', 0)]"
|
||||||
|
help="Empty stock"
|
||||||
|
/>
|
||||||
</field>
|
</field>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
@@ -32,13 +41,33 @@
|
|||||||
<field name="model">stock.location</field>
|
<field name="model">stock.location</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<search string="Stock Locations">
|
<search string="Stock Locations">
|
||||||
<field name="name" string="Stock Locations"/>
|
<field name="name" string="Stock Locations" />
|
||||||
<field name="location_id" string="Parent Location"/>
|
<field name="location_id" string="Parent Location" />
|
||||||
<filter name="in_location" string="Internal" domain="[('usage', '=', 'internal')]" help="Internal Locations"/>
|
<filter
|
||||||
<filter name="customer" string="Customer" domain="[('usage', '=', 'customer')]" help="Customer Locations"/>
|
name="in_location"
|
||||||
<filter name="supplier" string="Vendor" domain="[('usage', '=', 'supplier')]" help="Vendor Locations"/>
|
string="Internal"
|
||||||
|
domain="[('usage', '=', 'internal')]"
|
||||||
|
help="Internal Locations"
|
||||||
|
/>
|
||||||
|
<filter
|
||||||
|
name="customer"
|
||||||
|
string="Customer"
|
||||||
|
domain="[('usage', '=', 'customer')]"
|
||||||
|
help="Customer Locations"
|
||||||
|
/>
|
||||||
|
<filter
|
||||||
|
name="supplier"
|
||||||
|
string="Vendor"
|
||||||
|
domain="[('usage', '=', 'supplier')]"
|
||||||
|
help="Vendor Locations"
|
||||||
|
/>
|
||||||
<separator />
|
<separator />
|
||||||
<filter name="stock_amount" string="Empty" domain="[('stock_amount', '=', 0)]" help="Empty stock"/>
|
<filter
|
||||||
|
name="stock_amount"
|
||||||
|
string="Empty"
|
||||||
|
domain="[('stock_amount', '=', 0)]"
|
||||||
|
help="Empty stock"
|
||||||
|
/>
|
||||||
</search>
|
</search>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
@@ -48,15 +77,18 @@
|
|||||||
<field name="res_model">stock.location</field>
|
<field name="res_model">stock.location</field>
|
||||||
<field name="type">ir.actions.act_window</field>
|
<field name="type">ir.actions.act_window</field>
|
||||||
<field name="view_type">form</field>
|
<field name="view_type">form</field>
|
||||||
<field name="view_id" ref="view_location_tree3"/>
|
<field name="view_id" ref="view_location_tree3" />
|
||||||
<field name="search_view_id" ref="view_location_search_empty_2"/>
|
<field name="search_view_id" ref="view_location_search_empty_2" />
|
||||||
<field name="context">{'search_default_in_location':1, 'search_default_stock_amount': 1}</field>
|
<field
|
||||||
|
name="context"
|
||||||
|
>{'search_default_in_location':1, 'search_default_stock_amount': 1}</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<menuitem
|
<menuitem
|
||||||
id="stock_location_empty_menu"
|
id="stock_location_empty_menu"
|
||||||
name="Empty stock"
|
name="Empty stock"
|
||||||
parent="stock.menu_stock_inventory_control"
|
parent="stock.menu_stock_inventory_control"
|
||||||
action="action_stock_location_empty"/>
|
action="action_stock_location_empty"
|
||||||
|
/>
|
||||||
|
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|||||||
Reference in New Issue
Block a user