upgrade v16 addons valores por defecto según la categoría interna
This commit is contained in:
parent
688782abd8
commit
412d897695
88 changed files with 4 additions and 4787 deletions
|
|
@ -1,3 +0,0 @@
|
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
from . import controllers
|
||||
from . import models
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
# Copyright 2022 Criptomart
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
{
|
||||
'name': 'Website Search Products',
|
||||
'description': """
|
||||
Allows portal users to search products in a table with filters.""",
|
||||
'version': "16.0.1.0.0",
|
||||
'license': 'AGPL-3',
|
||||
'author': 'Criptomart',
|
||||
'website': 'https://criptomart.net',
|
||||
'depends': [
|
||||
"stock",
|
||||
"website"
|
||||
],
|
||||
'data': [
|
||||
"data/menu.xml",
|
||||
"data/ir_rule.xml",
|
||||
"views/web_templates.xml"
|
||||
],
|
||||
'demo': [
|
||||
],
|
||||
}
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from . import controller
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
from odoo import http
|
||||
from odoo.http import request
|
||||
from odoo.addons.website.controllers.main import Website
|
||||
|
||||
import logging
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
class IntentoryForm(http.Controller):
|
||||
|
||||
@http.route(['/inventory/search'], type='http', auth="user", website=True)
|
||||
def inventory_form(self, **post):
|
||||
if not request.env['res.users'].browse(request.uid).has_group('base.group_portal')\
|
||||
and not request.env['res.users'].browse(request.uid).has_group('base.group_user'):
|
||||
redirect = b'/web?'
|
||||
return http.redirect_with_hash(redirect)
|
||||
|
||||
products = request.env["product.template"].search([('active', '=', 'True'), ('available_in_pos', '=', 'True')])
|
||||
vals = {'products': products}
|
||||
return request.render("website_search_products.web_list_products", vals)
|
||||
|
||||
|
||||
class Website(Website):
|
||||
|
||||
@http.route(website=True, auth="public")
|
||||
def web_login(self, redirect=None, *args, **kw):
|
||||
response = super(Website, self).web_login(redirect=redirect, *args, **kw)
|
||||
if not redirect and request.params['login_success']:
|
||||
if request.env['res.users'].browse(request.uid).has_group('base.group_user'):
|
||||
redirect = b'/web?' + request.httprequest.query_string
|
||||
else:
|
||||
redirect = '/inventory/search'
|
||||
return http.redirect_with_hash(redirect)
|
||||
return response
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<record id="member_space_consult_products" model="ir.rule">
|
||||
<field name="name">Portal Consult Products</field>
|
||||
<field name="model_id" ref="product.model_product_template"/>
|
||||
<field eval="1" name="perm_read"/>
|
||||
<field eval="0" name="perm_write"/>
|
||||
<field eval="0" name="perm_create"/>
|
||||
<field eval="0" name="perm_unlink"/>
|
||||
<field eval="1" name="active"/>
|
||||
<field name="groups" eval="[(4, ref('base.group_portal'))]"/>
|
||||
</record>
|
||||
</odoo>
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data noupdate="1">
|
||||
<record id="menu_partner_form" model="website.menu">
|
||||
<field name="name">Products in Shop</field>
|
||||
<field name="url">/inventory/search</field>
|
||||
<field name="parent_id" ref="website.main_menu"/>
|
||||
<field name="sequence" type="int">22</field>
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
||||
|
|
@ -1,68 +0,0 @@
|
|||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * website_search_products
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 12.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2023-01-16 10:53+0000\n"
|
||||
"PO-Revision-Date: 2023-01-16 12:07+0100\n"
|
||||
"Last-Translator: <>\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: \n"
|
||||
"Language: es\n"
|
||||
"X-Generator: Poedit 2.3\n"
|
||||
|
||||
#. module: website_search_products
|
||||
#: model_terms:ir.ui.view,arch_db:website_search_products.web_list_products
|
||||
msgid "Category"
|
||||
msgstr "Categoría"
|
||||
|
||||
#. module: website_search_products
|
||||
#: model_terms:ir.ui.view,arch_db:website_search_products.web_list_products
|
||||
msgid "Displayed products"
|
||||
msgstr "Productos mostrados"
|
||||
|
||||
#. module: website_search_products
|
||||
#: model_terms:ir.ui.view,arch_db:website_search_products.web_list_products
|
||||
msgid "In this table you can consult all the products available in the store"
|
||||
msgstr "En esta tabla puedes consultar los productos disponibles en tienda"
|
||||
|
||||
#. module: website_search_products
|
||||
#: model_terms:ir.ui.view,arch_db:website_search_products.web_list_products
|
||||
msgid "Name"
|
||||
msgstr "Nombre"
|
||||
|
||||
#. module: website_search_products
|
||||
#: model_terms:ir.ui.view,arch_db:website_search_products.web_list_products
|
||||
msgid "Price"
|
||||
msgstr "Precio"
|
||||
|
||||
#. module: website_search_products
|
||||
#: model:website.menu,name:website_search_products.menu_partner_form
|
||||
msgid "Products in Shop"
|
||||
msgstr "Productos en tienda"
|
||||
|
||||
#. module: website_search_products
|
||||
#: model_terms:ir.ui.view,arch_db:website_search_products.web_list_products
|
||||
msgid "Products not found"
|
||||
msgstr "Productos no encontrados"
|
||||
|
||||
#. module: website_search_products
|
||||
#: model_terms:ir.ui.view,arch_db:website_search_products.web_list_products
|
||||
msgid "Quantity"
|
||||
msgstr "Cantidad"
|
||||
|
||||
#. module: website_search_products
|
||||
#: model:ir.model,name:website_search_products.model_stock_move
|
||||
msgid "Stock Move"
|
||||
msgstr "Movimiento de stock"
|
||||
|
||||
#. module: website_search_products
|
||||
#: model_terms:ir.ui.view,arch_db:website_search_products.web_list_products
|
||||
msgid "UoM"
|
||||
msgstr "UdM"
|
||||
|
|
@ -1,67 +0,0 @@
|
|||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * website_search_products
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 12.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2023-01-16 10:53+0000\n"
|
||||
"PO-Revision-Date: 2023-01-16 10:53+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: website_search_products
|
||||
#: model_terms:ir.ui.view,arch_db:website_search_products.web_list_products
|
||||
msgid "Category"
|
||||
msgstr ""
|
||||
|
||||
#. module: website_search_products
|
||||
#: model_terms:ir.ui.view,arch_db:website_search_products.web_list_products
|
||||
msgid "Displayed products"
|
||||
msgstr ""
|
||||
|
||||
#. module: website_search_products
|
||||
#: model_terms:ir.ui.view,arch_db:website_search_products.web_list_products
|
||||
msgid "In this table you can consult all the products available in the store"
|
||||
msgstr ""
|
||||
|
||||
#. module: website_search_products
|
||||
#: model_terms:ir.ui.view,arch_db:website_search_products.web_list_products
|
||||
msgid "Name"
|
||||
msgstr ""
|
||||
|
||||
#. module: website_search_products
|
||||
#: model_terms:ir.ui.view,arch_db:website_search_products.web_list_products
|
||||
msgid "Price"
|
||||
msgstr ""
|
||||
|
||||
#. module: website_search_products
|
||||
#: model:website.menu,name:website_search_products.menu_partner_form
|
||||
msgid "Products in Shop"
|
||||
msgstr ""
|
||||
|
||||
#. module: website_search_products
|
||||
#: model_terms:ir.ui.view,arch_db:website_search_products.web_list_products
|
||||
msgid "Products not found"
|
||||
msgstr ""
|
||||
|
||||
#. module: website_search_products
|
||||
#: model_terms:ir.ui.view,arch_db:website_search_products.web_list_products
|
||||
msgid "Quantity"
|
||||
msgstr ""
|
||||
|
||||
#. module: website_search_products
|
||||
#: model:ir.model,name:website_search_products.model_stock_move
|
||||
msgid "Stock Move"
|
||||
msgstr ""
|
||||
|
||||
#. module: website_search_products
|
||||
#: model_terms:ir.ui.view,arch_db:website_search_products.web_list_products
|
||||
msgid "UoM"
|
||||
msgstr ""
|
||||
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
from . import stock_move
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
from odoo import tools
|
||||
from odoo import models, fields, api
|
||||
|
||||
from datetime import date,datetime
|
||||
from dateutil.relativedelta import relativedelta
|
||||
|
||||
import logging
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
class StockMove(models.Model):
|
||||
_inherit = 'stock.move'
|
||||
|
||||
def get_stock_moves_by_product(self, date_begin, date_end, location):
|
||||
|
||||
if date_begin and date_end:
|
||||
moves = self.env['stock.move'].search([
|
||||
'|',
|
||||
('location_id','=',int(location)),
|
||||
('location_dest_id','=',int(location)),
|
||||
('state', '=', 'done'),
|
||||
('date','>=',date_begin),
|
||||
('date','<=',date_end),
|
||||
])
|
||||
else:
|
||||
return []
|
||||
|
||||
moves_grouped = {}
|
||||
data = []
|
||||
|
||||
if moves:
|
||||
for move in moves:
|
||||
if move.product_id.id and move.product_id.type == 'product':
|
||||
if not moves_grouped.get(move.product_id.id, False):
|
||||
date_end_obj = datetime.strptime(date_end, '%Y-%m-%d').date() + relativedelta(days=1)
|
||||
moves_grouped[move.product_id.id] = dict([])
|
||||
moves_grouped[move.product_id.id]['name'] = move.product_id.name
|
||||
moves_grouped[move.product_id.id]['category'] = move.product_id.categ_id.name
|
||||
moves_grouped[move.product_id.id]['list_price'] = move.product_id.list_price
|
||||
moves_grouped[move.product_id.id]['qty_init'] = move.product_id.with_context({
|
||||
'to_date':date_begin,
|
||||
'location': int(location)
|
||||
}).qty_available
|
||||
moves_grouped[move.product_id.id]['qty_end'] = move.product_id.with_context({
|
||||
'to_date':date_end_obj,
|
||||
'location': int(location)
|
||||
}).qty_available
|
||||
|
||||
if not moves_grouped[move.product_id.id].get('in'):
|
||||
moves_grouped[move.product_id.id]['in'] = 0.0
|
||||
if not moves_grouped[move.product_id.id].get('out'):
|
||||
moves_grouped[move.product_id.id]['out'] = 0.0
|
||||
if int(move.location_id) == int(location):
|
||||
moves_grouped[move.product_id.id]['out'] += move.product_qty
|
||||
elif int(move.location_dest_id) == int(location):
|
||||
moves_grouped[move.product_id.id]['in'] += move.product_qty
|
||||
|
||||
data = list(moves_grouped.values())
|
||||
return data
|
||||
|
|
@ -1,65 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright 2021 Criptomart <tech@criptomart.net>
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -->
|
||||
<odoo>
|
||||
|
||||
<template id="web_list_products" name="Product List">
|
||||
<t t-call="website.layout">
|
||||
<div id="wrap">
|
||||
<div class="container">
|
||||
<div class="col-md-12">
|
||||
<t t-if="products">
|
||||
<div class="alert alert-success">
|
||||
Displayed products
|
||||
</div>
|
||||
</t>
|
||||
<t t-if="not_found">
|
||||
<div class="alert alert-danger">
|
||||
Products not found
|
||||
</div>
|
||||
</t>
|
||||
<div class="col-md-12" style="text-align: center;"><h2>In this table you can consult all the products available in the store</h2></div>
|
||||
<div class="col-md-12" style="margin-top: 50px;">
|
||||
<table id="productTable" class="table stripe" >
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Category</th>
|
||||
<th>Price</th>
|
||||
<th>Quantity</th>
|
||||
<th>UoM</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="stockList" >
|
||||
<t t-foreach="products" t-as="product">
|
||||
<tr>
|
||||
<td><span t-esc="product.name"/></td>
|
||||
<td><span t-esc="product.categ_id.name"/></td>
|
||||
<td><span t-esc="product.list_price" t-options='{"widget": "monetary", "display_currency": res_company.currency_id}' /></td>
|
||||
<td><span t-esc="product.sudo().qty_available" t-options='{"widget": "float", "precision": 2}' /></td>
|
||||
<td><span t-esc="product.sudo().uom_id.name" /></td>
|
||||
</tr>
|
||||
</t>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="https://cdn.datatables.net/1.13.1/js/jquery.dataTables.min.js" />
|
||||
<script src="https://cdn.datatables.net/plug-ins/1.13.2/filtering/type-based/accent-neutralise.js" />
|
||||
<link rel="stylesheet" href="https://cdn.datatables.net/1.13.1/css/jquery.dataTables.min.css" />
|
||||
<script>
|
||||
$('#productTable').DataTable({
|
||||
"pageLength": 100,
|
||||
"order": [[1, "asc"], [0, "asc"], [2, "desc"]],
|
||||
"language": {
|
||||
"url": "https://cdn.datatables.net/plug-ins/1.13.1/i18n/es-ES.json"
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</t>
|
||||
</template>
|
||||
</odoo>
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue