Matriz de precios: catálogo por sucursales en una sola pantalla
Las dos pantallas anteriores miran el mismo dato desde un extremo o el otro y obligan a ir y venir para comparar plazas. La matriz pone las diferencias una al lado de la otra. Va como pantalla propia con componente OWL porque Odoo no tiene vista de matriz editable: las columnas son las sucursales y no se conocen hasta ejecutar. Se guarda al SALIR de la celda y no en cada tecla —un tecleo accidental no puede cambiar lo que cobra una sucursal sin confirmar— y la celda marca en verde que quedó guardada. El precio heredado del base se pinta distinto del propio, porque si todo se viera igual no se sabría qué está configurado; vaciar una celda borra el precio propio y vuelve a heredar, que es la forma de deshacer. Columna de artículo fija al desplazar, búsqueda por nombre y tope por tabla con aviso de cuántos se muestran. Los permisos no se reimplementan: el guardado corre sin sudo para que corte la ir.rule de ADR-009, y la interfaz solo se anticipa. Con test de que el gerente ve todas las columnas —comparar precios es parte de su trabajo— y solo puede escribir la suya, ejercitado en vez de asumido.
This commit is contained in:
1 parent
1b443e22c1
commit
2bf3071a3c
10 files changed
+499
No files matched your search
@@ -30,8 +30,16 @@ Fase 1 — Arquitectura base (BRIEF §5.3 y §4):
|
||||
'views/beyond_branch_views.xml',
|
||||
'views/res_users_views.xml',
|
||||
'views/product_views.xml',
|
||||
'views/matriz_views.xml',
|
||||
'data/backfill.xml',
|
||||
],
|
||||
'assets': {
|
||||
'web.assets_backend': [
|
||||
'beyond_branch/static/src/matriz_precios/matriz_precios.js',
|
||||
'beyond_branch/static/src/matriz_precios/matriz_precios.xml',
|
||||
'beyond_branch/static/src/matriz_precios/matriz_precios.scss',
|
||||
],
|
||||
},
|
||||
'demo': [
|
||||
'demo/demo_branches.xml',
|
||||
],
|
||||
|
||||
@@ -3,6 +3,7 @@ from . import beyond_branch
|
||||
from . import beyond_pricelist_copy
|
||||
from . import hr_models
|
||||
from . import pos_models
|
||||
from . import product_matriz
|
||||
from . import product_models
|
||||
from . import res_groups
|
||||
from . import res_users
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
# Part of Beyond. Collina Systems proprietary module.
|
||||
from odoo import _, api, models
|
||||
from odoo.exceptions import ValidationError
|
||||
|
||||
# Con 4 sucursales y 50 artículos son 200 celdas; el tope evita que un
|
||||
# catálogo grande dibuje miles de campos en el navegador. La búsqueda es la
|
||||
# que acota de verdad.
|
||||
LIMITE_ARTICULOS = 200
|
||||
|
||||
|
||||
class ProductTemplate(models.Model):
|
||||
_inherit = 'product.template'
|
||||
|
||||
@api.model
|
||||
def beyond_matriz_datos(self, tipo, busqueda=''):
|
||||
"""Catálogo × sucursales, para comparar plazas de un vistazo.
|
||||
|
||||
Distingue precio PROPIO de precio HEREDADO: un artículo sin ítem en
|
||||
la lista de una sucursal se vende al precio base de red (ADR-009), y
|
||||
eso es una característica. Si ambas cosas se pintaran igual no se
|
||||
sabría cuáles están configuradas.
|
||||
|
||||
La lectura está abierta a todos los roles a propósito —comparar
|
||||
precios entre plazas es trabajo de un gerente—; lo que se puede
|
||||
EDITAR lo recorta la ir.rule, y aquí solo se anticipa para que la
|
||||
interfaz no ofrezca lo que el servidor va a rechazar.
|
||||
"""
|
||||
sucursales = self.env['beyond.branch'].sudo().search(
|
||||
[('pricelist_id', '!=', False)])
|
||||
general = self.env.user.has_group('beyond_base.beyond_group_admin_general')
|
||||
propias = self.env.user.branch_ids.ids
|
||||
|
||||
dominio = [('type', '=', tipo), ('sale_ok', '=', True)]
|
||||
if busqueda:
|
||||
dominio.append(('name', 'ilike', busqueda))
|
||||
articulos = self.search(dominio, order='name', limit=LIMITE_ARTICULOS)
|
||||
total = self.search_count(dominio)
|
||||
|
||||
items = self.env['product.pricelist.item'].search([
|
||||
('product_tmpl_id', 'in', articulos.ids),
|
||||
('pricelist_id', 'in', sucursales.pricelist_id.ids),
|
||||
])
|
||||
propios = {(i.product_tmpl_id.id, i.pricelist_id.branch_id.id): i.fixed_price
|
||||
for i in items}
|
||||
|
||||
return {
|
||||
'sucursales': [{
|
||||
'id': branch.id,
|
||||
'nombre': branch.name,
|
||||
'editable': general or branch.id in propias,
|
||||
} for branch in sucursales],
|
||||
'articulos': [{
|
||||
'id': articulo.id,
|
||||
'nombre': articulo.name,
|
||||
'base': articulo.list_price,
|
||||
'celdas': [{
|
||||
'branch_id': branch.id,
|
||||
'precio': propios.get((articulo.id, branch.id), articulo.list_price),
|
||||
'propio': (articulo.id, branch.id) in propios,
|
||||
} for branch in sucursales],
|
||||
} for articulo in articulos],
|
||||
'total': total,
|
||||
'mostrados': len(articulos),
|
||||
'simbolo': self.env.company.currency_id.symbol,
|
||||
}
|
||||
|
||||
@api.model
|
||||
def beyond_matriz_guardar(self, tmpl_id, branch_id, precio):
|
||||
"""Guarda una celda. Vaciarla borra el precio propio y el artículo
|
||||
vuelve a heredar el base, que es la forma de deshacer.
|
||||
|
||||
Sin sudo a propósito: la ir.rule de ADR-009 es la que decide si esta
|
||||
persona puede tocar esta sucursal, y su AccessError es la respuesta
|
||||
correcta.
|
||||
"""
|
||||
branch = self.env['beyond.branch'].sudo().browse(branch_id)
|
||||
lista = branch.pricelist_id
|
||||
if not lista:
|
||||
raise ValidationError(_('%s no tiene lista de precios.', branch.name))
|
||||
Item = self.env['product.pricelist.item']
|
||||
item = Item.search([('pricelist_id', '=', lista.id),
|
||||
('product_tmpl_id', '=', tmpl_id)], limit=1)
|
||||
articulo = self.browse(tmpl_id)
|
||||
|
||||
if precio in (None, False, ''):
|
||||
item.unlink()
|
||||
return {'precio': articulo.list_price, 'propio': False}
|
||||
|
||||
precio = float(precio)
|
||||
if precio < 0:
|
||||
raise ValidationError(_('El precio no puede ser negativo.'))
|
||||
if item:
|
||||
item.write({'fixed_price': precio})
|
||||
else:
|
||||
Item.create({
|
||||
'pricelist_id': lista.id,
|
||||
'applied_on': '1_product',
|
||||
'product_tmpl_id': tmpl_id,
|
||||
'compute_price': 'fixed',
|
||||
'fixed_price': precio,
|
||||
})
|
||||
return {'precio': precio, 'propio': True}
|
||||
@@ -0,0 +1,90 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import { Component, onWillStart, useState } from "@odoo/owl";
|
||||
import { registry } from "@web/core/registry";
|
||||
import { useService } from "@web/core/utils/hooks";
|
||||
import { _t } from "@web/core/l10n/translation";
|
||||
|
||||
/**
|
||||
* Catálogo × sucursales en una sola pantalla.
|
||||
*
|
||||
* Las dos pantallas que ya existían miran el mismo dato desde un artículo o
|
||||
* desde una sucursal, y para comparar plazas hay que ir y venir. La matriz
|
||||
* pone las diferencias una al lado de la otra, que es lo que se revisa.
|
||||
*
|
||||
* El guardado ocurre al SALIR de la celda (t-on-change), nunca en cada
|
||||
* tecla: un tecleo accidental no puede cambiar lo que cobra una sucursal sin
|
||||
* que la persona salga del campo.
|
||||
*/
|
||||
export class BeyondMatrizPrecios extends Component {
|
||||
static template = "beyond_branch.MatrizPrecios";
|
||||
static props = ["*"];
|
||||
|
||||
setup() {
|
||||
this.orm = useService("orm");
|
||||
this.notification = useService("notification");
|
||||
this.state = useState({
|
||||
busqueda: "",
|
||||
tablas: null,
|
||||
guardadas: {}, // clave celda → marca de confirmación
|
||||
});
|
||||
onWillStart(() => this.cargar());
|
||||
}
|
||||
|
||||
async cargar() {
|
||||
const [productos, servicios] = await Promise.all([
|
||||
this.orm.call("product.template", "beyond_matriz_datos",
|
||||
["consu", this.state.busqueda]),
|
||||
this.orm.call("product.template", "beyond_matriz_datos",
|
||||
["service", this.state.busqueda]),
|
||||
]);
|
||||
this.state.tablas = [
|
||||
{ titulo: _t("Productos"), datos: productos },
|
||||
{ titulo: _t("Servicios"), datos: servicios },
|
||||
];
|
||||
}
|
||||
|
||||
onBuscar(ev) {
|
||||
clearTimeout(this._buscando);
|
||||
this.state.busqueda = ev.target.value;
|
||||
this._buscando = setTimeout(() => this.cargar(), 250);
|
||||
}
|
||||
|
||||
clave(articulo, celda) {
|
||||
return `${articulo.id}-${celda.branch_id}`;
|
||||
}
|
||||
|
||||
formato(valor, simbolo) {
|
||||
return `${simbolo}${valor.toLocaleString("es-MX", {
|
||||
minimumFractionDigits: 2, maximumFractionDigits: 2 })}`;
|
||||
}
|
||||
|
||||
async onGuardarCelda(articulo, celda, simbolo, ev) {
|
||||
const bruto = ev.target.value.trim().replace(/[^0-9.,-]/g, "").replace(",", ".");
|
||||
const valor = bruto === "" ? false : Number.parseFloat(bruto);
|
||||
if (bruto !== "" && Number.isNaN(valor)) {
|
||||
this.notification.add(_t("Ese precio no se entendió."), { type: "warning" });
|
||||
ev.target.value = this.formato(celda.precio, simbolo);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const resultado = await this.orm.call(
|
||||
"product.template", "beyond_matriz_guardar",
|
||||
[articulo.id, celda.branch_id, valor]);
|
||||
celda.precio = resultado.precio;
|
||||
celda.propio = resultado.propio;
|
||||
ev.target.value = this.formato(celda.precio, simbolo);
|
||||
// Confirmación visible: la celda queda marcada un momento, para
|
||||
// que no quede duda de que se guardó.
|
||||
this.state.guardadas[this.clave(articulo, celda)] = true;
|
||||
setTimeout(() => {
|
||||
delete this.state.guardadas[this.clave(articulo, celda)];
|
||||
}, 2000);
|
||||
} catch (error) {
|
||||
ev.target.value = this.formato(celda.precio, simbolo);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
registry.category("actions").add("beyond_matriz_precios", BeyondMatrizPrecios);
|
||||
@@ -0,0 +1,58 @@
|
||||
// Matriz de precios: la columna del artículo se queda fija al desplazarse en
|
||||
// horizontal, porque con varias sucursales se pierde de vista qué se está
|
||||
// editando.
|
||||
.o_beyond_matriz {
|
||||
.beyond_matriz_buscar { max-width: 22rem; }
|
||||
|
||||
.beyond_matriz_scroll {
|
||||
overflow-x: auto;
|
||||
max-height: 70vh;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.beyond_matriz_tabla {
|
||||
min-width: max-content;
|
||||
|
||||
thead th {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 2;
|
||||
background: #f0ede6;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.beyond_matriz_fija {
|
||||
position: sticky;
|
||||
left: 0;
|
||||
z-index: 1;
|
||||
background: #fff;
|
||||
min-width: 16rem;
|
||||
box-shadow: 1px 0 0 #dee2e6;
|
||||
}
|
||||
|
||||
thead .beyond_matriz_fija { z-index: 3; background: #f0ede6; }
|
||||
}
|
||||
|
||||
.beyond_matriz_celda {
|
||||
position: relative;
|
||||
min-width: 9rem;
|
||||
|
||||
// Heredado del precio base: se ve distinto para no confundirlo con un
|
||||
// precio configurado a propósito.
|
||||
&.beyond_heredado input,
|
||||
&.beyond_heredado span { color: #8a8a8a; font-style: italic; }
|
||||
|
||||
// Confirmación de guardado
|
||||
&.beyond_guardada input { background: #e6f4ea; border-color: #1e5631; }
|
||||
|
||||
.beyond_marca {
|
||||
position: absolute;
|
||||
right: .35rem;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
pointer-events: none;
|
||||
}
|
||||
}
|
||||
|
||||
.beyond_heredado { color: #8a8a8a; font-style: italic; }
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<templates xml:space="preserve">
|
||||
<t t-name="beyond_branch.MatrizPrecios">
|
||||
<div class="o_beyond_matriz p-3">
|
||||
<div class="d-flex flex-wrap align-items-center gap-2 mb-2">
|
||||
<h2 class="me-auto mb-0">Precios por sucursal</h2>
|
||||
<input type="search" class="form-control beyond_matriz_buscar"
|
||||
placeholder="Buscar artículo…" t-on-input="onBuscar"/>
|
||||
</div>
|
||||
<div class="alert alert-info py-2" role="status">
|
||||
Los precios son <b>con IVA incluido</b>: lo que paga el cliente.
|
||||
Un precio <span class="beyond_heredado">(en gris)</span> es el
|
||||
base de red, que la sucursal hereda porque no tiene uno propio.
|
||||
Vacía una celda para volver a heredarlo.
|
||||
</div>
|
||||
|
||||
<t t-if="!state.tablas">
|
||||
<div class="text-muted">Cargando…</div>
|
||||
</t>
|
||||
<t t-else="">
|
||||
<t t-foreach="state.tablas" t-as="tabla" t-key="tabla.titulo">
|
||||
<h3 class="mt-3" t-esc="tabla.titulo"/>
|
||||
<t t-if="!tabla.datos.articulos.length">
|
||||
<p class="text-muted">Sin artículos que mostrar.</p>
|
||||
</t>
|
||||
<t t-else="">
|
||||
<div class="beyond_matriz_scroll">
|
||||
<table class="table table-sm table-hover beyond_matriz_tabla">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="beyond_matriz_fija">Artículo</th>
|
||||
<th class="text-end">Base de red</th>
|
||||
<t t-foreach="tabla.datos.sucursales" t-as="sucursal"
|
||||
t-key="sucursal.id">
|
||||
<th class="text-end">
|
||||
<t t-esc="sucursal.nombre"/>
|
||||
<i t-if="!sucursal.editable"
|
||||
class="fa fa-lock ms-1 text-muted"
|
||||
title="Solo la dirección o su gerente editan esta sucursal"/>
|
||||
</th>
|
||||
</t>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<t t-foreach="tabla.datos.articulos" t-as="articulo"
|
||||
t-key="articulo.id">
|
||||
<tr>
|
||||
<td class="beyond_matriz_fija" t-esc="articulo.nombre"/>
|
||||
<td class="text-end text-muted"
|
||||
t-esc="formato(articulo.base, tabla.datos.simbolo)"/>
|
||||
<t t-foreach="articulo.celdas" t-as="celda"
|
||||
t-key="celda.branch_id">
|
||||
<t t-set="editable"
|
||||
t-value="tabla.datos.sucursales.find(s => s.id === celda.branch_id).editable"/>
|
||||
<td class="beyond_matriz_celda"
|
||||
t-att-class="{
|
||||
'beyond_guardada': state.guardadas[clave(articulo, celda)],
|
||||
'beyond_heredado': !celda.propio }">
|
||||
<input t-if="editable" type="text"
|
||||
class="form-control form-control-sm text-end"
|
||||
t-att-value="formato(celda.precio, tabla.datos.simbolo)"
|
||||
t-on-change="(ev) => this.onGuardarCelda(articulo, celda, tabla.datos.simbolo, ev)"/>
|
||||
<span t-else="" class="d-block text-end pe-2"
|
||||
t-esc="formato(celda.precio, tabla.datos.simbolo)"/>
|
||||
<i t-if="state.guardadas[clave(articulo, celda)]"
|
||||
class="fa fa-check text-success beyond_marca"/>
|
||||
</td>
|
||||
</t>
|
||||
</tr>
|
||||
</t>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<p t-if="tabla.datos.mostrados < tabla.datos.total"
|
||||
class="text-muted small mt-1">
|
||||
Se muestran <t t-esc="tabla.datos.mostrados"/> de
|
||||
<t t-esc="tabla.datos.total"/> artículos. Usa la
|
||||
búsqueda para acotar.
|
||||
</p>
|
||||
</t>
|
||||
</t>
|
||||
</t>
|
||||
</div>
|
||||
</t>
|
||||
</templates>
|
||||
@@ -6,3 +6,4 @@ from . import test_catalogo
|
||||
from . import test_catalogo_tipo
|
||||
from . import test_iva
|
||||
from . import test_alta_catalogo
|
||||
from . import test_matriz_precios
|
||||
@@ -0,0 +1,114 @@
|
||||
# Part of Beyond. Collina Systems proprietary module.
|
||||
from odoo.exceptions import AccessError
|
||||
from odoo.tests import TransactionCase, tagged
|
||||
|
||||
from .common import BeyondBranchCase
|
||||
|
||||
|
||||
@tagged('post_install', '-at_install')
|
||||
class TestBeyondMatrizPrecios(BeyondBranchCase):
|
||||
"""Catálogo × sucursales en una pantalla: comparar plazas de un vistazo,
|
||||
distinguiendo precio propio de precio heredado."""
|
||||
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
self.servicio = self.env['product.template'].create({
|
||||
'name': 'Corte matriz', 'type': 'service', 'list_price': 200.0})
|
||||
self.producto = self.env['product.template'].create({
|
||||
'name': 'Shampoo matriz', 'type': 'consu', 'list_price': 390.0})
|
||||
|
||||
def _celda(self, datos, articulo, branch):
|
||||
fila = next(a for a in datos['articulos'] if a['id'] == articulo.id)
|
||||
return next(c for c in fila['celdas'] if c['branch_id'] == branch.id)
|
||||
|
||||
def test_la_matriz_distingue_precio_propio_de_heredado(self):
|
||||
datos = self.env['product.template'].beyond_matriz_datos('service')
|
||||
celda = self._celda(datos, self.servicio, self.branch_a)
|
||||
self.assertFalse(celda['propio'], 'sin ítem propio: hereda el base')
|
||||
self.assertEqual(celda['precio'], 200.0,
|
||||
'y lo que se muestra es el base que realmente cobra')
|
||||
|
||||
self.env['product.template'].beyond_matriz_guardar(
|
||||
self.servicio.id, self.branch_a.id, 250.0)
|
||||
datos = self.env['product.template'].beyond_matriz_datos('service')
|
||||
celda = self._celda(datos, self.servicio, self.branch_a)
|
||||
self.assertTrue(celda['propio'])
|
||||
self.assertEqual(celda['precio'], 250.0)
|
||||
# la otra plaza sigue heredando: es justo la diferencia que se revisa
|
||||
self.assertFalse(self._celda(datos, self.servicio, self.branch_b)['propio'])
|
||||
|
||||
def test_cada_tabla_trae_solo_lo_suyo(self):
|
||||
servicios = self.env['product.template'].beyond_matriz_datos('service')
|
||||
productos = self.env['product.template'].beyond_matriz_datos('consu')
|
||||
nombres = lambda d: [a['nombre'] for a in d['articulos']]
|
||||
self.assertIn('Corte matriz', nombres(servicios))
|
||||
self.assertNotIn('Corte matriz', nombres(productos))
|
||||
self.assertIn('Shampoo matriz', nombres(productos))
|
||||
|
||||
def test_vaciar_la_celda_devuelve_el_precio_base(self):
|
||||
"""La forma de deshacer: sin precio propio se vuelve a heredar."""
|
||||
self.env['product.template'].beyond_matriz_guardar(
|
||||
self.servicio.id, self.branch_a.id, 250.0)
|
||||
resultado = self.env['product.template'].beyond_matriz_guardar(
|
||||
self.servicio.id, self.branch_a.id, False)
|
||||
self.assertEqual(resultado, {'precio': 200.0, 'propio': False})
|
||||
self.assertFalse(self.env['product.pricelist.item'].search_count([
|
||||
('pricelist_id', '=', self.branch_a.pricelist_id.id),
|
||||
('product_tmpl_id', '=', self.servicio.id)]))
|
||||
|
||||
def test_la_busqueda_acota_por_nombre(self):
|
||||
datos = self.env['product.template'].beyond_matriz_datos('service', 'corte')
|
||||
self.assertIn('Corte matriz', [a['nombre'] for a in datos['articulos']])
|
||||
vacio = self.env['product.template'].beyond_matriz_datos('service', 'zzzz')
|
||||
self.assertFalse(vacio['articulos'])
|
||||
|
||||
def test_el_gerente_ve_todas_las_plazas_pero_solo_edita_la_suya(self):
|
||||
"""No se asume el recorte: se ejercita. La lectura queda abierta a
|
||||
propósito (ADR-009) para poder comparar; la escritura la corta la
|
||||
ir.rule, y la interfaz solo se anticipa a eso."""
|
||||
Matriz = self.env['product.template'].with_user(self.admin_a)
|
||||
datos = Matriz.beyond_matriz_datos('service')
|
||||
editables = {s['id']: s['editable'] for s in datos['sucursales']}
|
||||
self.assertTrue(editables[self.branch_a.id], 'la suya sí')
|
||||
self.assertFalse(editables[self.branch_b.id], 'la ajena no')
|
||||
self.assertIn(self.branch_b.id, editables,
|
||||
'pero la ve: comparar precios es parte de su trabajo')
|
||||
|
||||
Matriz.beyond_matriz_guardar(self.servicio.id, self.branch_a.id, 260.0)
|
||||
self.assertEqual(
|
||||
self._celda(Matriz.beyond_matriz_datos('service'),
|
||||
self.servicio, self.branch_a)['precio'], 260.0)
|
||||
|
||||
with self.assertRaises(AccessError, msg='no toca la sucursal ajena'):
|
||||
Matriz.beyond_matriz_guardar(self.servicio.id, self.branch_b.id, 999.0)
|
||||
|
||||
def test_el_admin_general_edita_cualquier_plaza(self):
|
||||
Matriz = self.env['product.template'].with_user(self.admin_general)
|
||||
datos = Matriz.beyond_matriz_datos('service')
|
||||
self.assertTrue(all(s['editable'] for s in datos['sucursales']))
|
||||
Matriz.beyond_matriz_guardar(self.servicio.id, self.branch_b.id, 310.0)
|
||||
self.assertEqual(
|
||||
self._celda(Matriz.beyond_matriz_datos('service'),
|
||||
self.servicio, self.branch_b)['precio'], 310.0)
|
||||
|
||||
|
||||
@tagged('post_install', '-at_install')
|
||||
class TestBeyondMatrizPantalla(TransactionCase):
|
||||
"""La pantalla se arma en el navegador: se verifica que sus piezas estén
|
||||
registradas y compilen, ya que aquí no hay navegador."""
|
||||
|
||||
def test_la_accion_y_el_menu_existen(self):
|
||||
accion = self.env.ref('beyond_branch.action_beyond_matriz_precios')
|
||||
self.assertEqual(accion.tag, 'beyond_matriz_precios')
|
||||
menu = self.env.ref('beyond_branch.menu_beyond_matriz_precios')
|
||||
self.assertEqual(menu.parent_id, self.env.ref('beyond_branch.menu_beyond_catalogo'))
|
||||
|
||||
def test_las_piezas_llegan_al_paquete_del_backend(self):
|
||||
paquete = self.env['ir.qweb']._get_asset_bundle('web.assets_backend')
|
||||
archivos = [f['url'] for f in paquete.files if 'matriz_precios' in f['url']]
|
||||
self.assertEqual(len(archivos), 3, f'faltan piezas: {archivos}')
|
||||
css = paquete.css()
|
||||
self.assertTrue(css, 'el SCSS de la matriz debe compilar')
|
||||
contenido = self.env['ir.attachment'].browse(css.id).raw.decode('utf-8', 'ignore')
|
||||
for clase in ('beyond_matriz_fija', 'beyond_heredado', 'beyond_guardada'):
|
||||
self.assertIn(clase, contenido, f'{clase} no llegó al CSS')
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<!-- La matriz es una pantalla propia (cliente OWL) porque Odoo no tiene
|
||||
vista de matriz editable: las columnas son las sucursales, que no se
|
||||
conocen hasta ejecutar. -->
|
||||
<record id="action_beyond_matriz_precios" model="ir.actions.client">
|
||||
<field name="name">Precios por sucursal</field>
|
||||
<field name="tag">beyond_matriz_precios</field>
|
||||
</record>
|
||||
|
||||
<menuitem id="menu_beyond_matriz_precios" name="Precios por sucursal"
|
||||
parent="menu_beyond_catalogo"
|
||||
action="action_beyond_matriz_precios" sequence="20"
|
||||
groups="beyond_base.beyond_group_admin_sucursal"/>
|
||||
</odoo>
|
||||
Reference in new issue
Block a user