Criptomart/red-supermercados-coop#2 stock_inventory_category_concurrency: store product_category_id in stock.quants. Add search and group_by categories
This commit is contained in:
parent
54e7755197
commit
91641c7c88
5 changed files with 64 additions and 8 deletions
|
|
@ -7,6 +7,8 @@
|
|||
"license": "AGPL-3",
|
||||
"author": "Criptomart",
|
||||
"depends": ["stock_inventory"],
|
||||
"data": [],
|
||||
"data": [
|
||||
"views/stock_quant_view.xml",
|
||||
],
|
||||
"installable": True,
|
||||
}
|
||||
|
|
|
|||
18
stock_inventory_category_concurrency/i18n/es.po
Normal file
18
stock_inventory_category_concurrency/i18n/es.po
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
# Traducciones para stock_inventory_category_concurrency
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 16.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2025-10-07 00:00+0000\n"
|
||||
"PO-Revision-Date: 2025-10-07 00:00+0000\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: \n"
|
||||
|
||||
#. module: stock_inventory_category_concurrency
|
||||
#: model_terms:ir.ui.view,arch_db:stock_inventory_category_concurrency.stock_quant_search_category_filter
|
||||
msgid "Product Category"
|
||||
msgstr "Categoría de producto"
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
# Translation template for stock_inventory_category_concurrency
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 16.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2025-10-07 00:00+0000\n"
|
||||
"PO-Revision-Date: 2025-10-07 00:00+0000\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: \n"
|
||||
|
||||
#. module: stock_inventory_category_concurrency
|
||||
#: model_terms:ir.ui.view,arch_db:stock_inventory_category_concurrency.stock_quant_search_category_filter
|
||||
msgid "Product Category"
|
||||
msgstr ""
|
||||
|
|
@ -1,18 +1,23 @@
|
|||
from odoo import _, models
|
||||
from odoo import _, models, fields
|
||||
from odoo.exceptions import ValidationError
|
||||
|
||||
|
||||
class StockQuant(models.Model):
|
||||
_inherit = "stock.quant"
|
||||
|
||||
product_categ_id = fields.Many2one(
|
||||
related="product_tmpl_id.categ_id",
|
||||
store=True,
|
||||
index=True,
|
||||
string="Product Category",
|
||||
)
|
||||
|
||||
|
||||
class InventoryAdjustmentsGroup(models.Model):
|
||||
_inherit = "stock.inventory"
|
||||
|
||||
def action_state_to_in_progress(self):
|
||||
"""
|
||||
Relaja el bloqueo por categoría: si el ajuste actual es por categoría,
|
||||
solo bloquea otros ajustes en progreso que afecten a la MISMA categoría exacta,
|
||||
no a categorías hermanas distintas ni a todas sus hijas.
|
||||
"""
|
||||
self.ensure_one()
|
||||
# Reusar la lógica original, pero parchear el caso de category
|
||||
search_filter = [
|
||||
(
|
||||
"location_id",
|
||||
|
|
|
|||
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<odoo>
|
||||
<record id="stock_quant_search_category_filter" model="ir.ui.view">
|
||||
<field name="name">stock.quant.search.category.filter</field>
|
||||
<field name="model">stock.quant</field>
|
||||
<field name="inherit_id" ref="stock.quant_search_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//search/group[filter[@name='productgroup']]" position="inside">
|
||||
<filter name="product_categ_group" string="Product Category" context="{'group_by':'product_categ_id'}"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
Loading…
Add table
Add a link
Reference in a new issue