[MIG] stock_inventory_preparation_filter: Migration to 14.0

[IMP] Improve stock inventory view

[IMP] Keep 'domain' filter last in the list (ux)
This commit is contained in:
Ivàn Todorovich
2020-12-28 16:11:29 -03:00
parent b5b89d5072
commit 5e0e1e9812
8 changed files with 27 additions and 23 deletions

View File

@@ -0,0 +1 @@
../../../../stock_inventory_preparation_filter

View File

@@ -0,0 +1,6 @@
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)

View File

@@ -5,11 +5,11 @@
{ {
"name": "Extended Inventory Preparation Filters", "name": "Extended Inventory Preparation Filters",
"version": "13.0.1.0.0", "version": "14.0.1.0.0",
"depends": ["stock"], "depends": ["stock"],
"author": "AvanzOSC," "Tecnativa," "Odoo Community Association (OCA)", "author": "AvanzOSC," "Tecnativa," "Odoo Community Association (OCA)",
"category": "Inventory, Logistic, Storage", "category": "Inventory, Logistic, Storage",
"website": "http://github.com/OCA/stock-logistics-warehouse", "website": "https://github.com/OCA/stock-logistics-warehouse",
"summary": "More filters for inventory adjustments", "summary": "More filters for inventory adjustments",
"data": ["views/stock_inventory_view.xml"], "data": ["views/stock_inventory_view.xml"],
"installable": True, "installable": True,

View File

@@ -12,15 +12,15 @@ class StockInventory(models.Model):
@api.model @api.model
def _selection_filter(self): def _selection_filter(self):
""" Get the list of filter allowed according to the options checked """Get the list of filter allowed according to the options checked
in 'Settings / Warehouse'. """ in 'Settings / Warehouse'."""
res_filter = [ res_filter = [
("products", _("All products")), ("products", _("All products")),
("categories", _("Selected Categories")), ("categories", _("Selected Categories")),
("domain", _("Filtered Products")), ("domain", _("Filtered Products")),
] ]
if self.user_has_groups("stock.group_production_lot"): if self.user_has_groups("stock.group_production_lot"):
res_filter.append(("lots", _("Selected Lots"))) res_filter.insert(-1, ("lots", _("Selected Lots")))
return res_filter return res_filter
filter = fields.Selection( filter = fields.Selection(

View File

@@ -6,3 +6,4 @@
* Sergio Teruel * Sergio Teruel
* Xavier Jimenez <xavier.jimenez@qubiq.es> * Xavier Jimenez <xavier.jimenez@qubiq.es>
* Iván Todorovich <ivan.todorovich@gmail.com>

View File

@@ -1,3 +0,0 @@
* The widget domain is not displayed correctly, but this issue is related to
Odoo. To avoid this malfunction, use the keyboard arrows to properly work
with the domain option.

View File

@@ -1,12 +1,12 @@
# Copyright 2015 AvanzOSC - Oihane Crucelaegi # Copyright 2015 AvanzOSC - Oihane Crucelaegi
# Copyright 2015 Tecnativa - Pedro M. Baeza # Copyright 2015 Tecnativa - Pedro M. Baeza
# Copyright 2020 Iván Todorovich
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo.tests import common from odoo.tests import common
@common.at_install(False) @common.tagged("-at_install", "post_install")
@common.post_install(True)
class TestStockInventoryPreparationFilterCategories(common.TransactionCase): class TestStockInventoryPreparationFilterCategories(common.TransactionCase):
def setUp(self): def setUp(self):
super(TestStockInventoryPreparationFilterCategories, self).setUp() super(TestStockInventoryPreparationFilterCategories, self).setUp()

View File

@@ -10,8 +10,8 @@
>{'invisible': [('filter', '!=', 'products')]}</attribute> >{'invisible': [('filter', '!=', 'products')]}</attribute>
</field> </field>
<xpath expr="//field[@name='location_ids']/../.." position="before"> <xpath expr="//field[@name='location_ids']/../.." position="before">
<group> <group name="preparation_filter">
<group> <group name="preparation_filter_left">
<field <field
name="filter" name="filter"
string="Inventory of" string="Inventory of"
@@ -19,30 +19,29 @@
attrs="{'readonly': [('state', '!=', 'draft')]}" attrs="{'readonly': [('state', '!=', 'draft')]}"
/> />
</group> </group>
<group name="preparation_filter_right">
<field
name="product_domain"
nolabel="1"
widget="domain"
attrs="{'invisible': [('filter', '!=', 'domain')]}"
options="{'model': 'product.product'}"
/>
</group>
</group> </group>
</xpath> </xpath>
<field name="location_ids" position="before"> <field name="product_ids" position="after">
<field <field
name="categ_ids" name="categ_ids"
widget="many2many_tags" widget="many2many_tags"
attrs="{'invisible':[('filter','!=','categories')]}" attrs="{'invisible':[('filter','!=','categories')]}"
/> />
</field>
<field name="location_ids" position="before">
<field <field
name="lot_ids" name="lot_ids"
widget="many2many_tags" widget="many2many_tags"
attrs="{'invisible':[('filter','!=','lots')]}" attrs="{'invisible':[('filter','!=','lots')]}"
/> />
</field> </field>
<xpath expr="//field[@name='location_ids']/../.." position="after">
<field
name="product_domain"
widget="domain"
attrs="{'invisible': [('filter', '!=', 'domain')]}"
options="{'model': 'product.product'}"
/>
</xpath>
</field> </field>
</record> </record>
</odoo> </odoo>