LaOsaCoop/Odoo16#12 migration pos_balance_multishop + pos_balance_epelsa

This commit is contained in:
Luis 2025-05-22 13:09:29 +02:00
parent 46ad866011
commit 7b37ed92a1
20 changed files with 1328 additions and 2 deletions

View file

@ -0,0 +1,46 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
====================
POS Balace Multishop
====================
Add multiple code for balance products for each shop
Installation
============
To install this module, you need to:
* point_of_sale
TODO
====
* Migrate to new API massive update product
Bug Tracker
===========
Bugs are tracked on `GitHub Issues
<https://github.com/acysos/odoo-addons/issues>`_. In case of trouble, please
check there if your issue has already been reported. If you spotted it first,
help us smashing it by providing a detailed and welcomed feedback.
Credits
=======
Contributors
------------
* Ignacio Ibeas <ignacio@acysos.com>
* Iñaki Santos <isantos@acysos.com>
Maintainer
----------
.. image:: https://acysos.com/logo.png
:alt: Acysos S.L.
:target: https://www.acysos.com

View file

@ -0,0 +1,3 @@
# Copyright 2014 Ignacio Ibeas <ignacio@acysos.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import models

View file

@ -0,0 +1,24 @@
# Copyright 2014 Ignacio Ibeas <ignacio@acysos.com>
# Copyright 2020 Santi Noreña <santi@criptomart.net>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "POS Balace Multishop",
"version": "16.0.1.0.0",
"category": "Point of sale",
"summary": "Add multiple code for balance products for each shop.",
"description": "Add multiple code for balance products for each shop.",
"depends": ["base", "point_of_sale"],
"author": "Acysos S.L., Criptomart S.L.L.",
"website": "http://www.acysos.com, https://criptomart.net",
"license": "AGPL-3",
"data": [
"security/ir.model.access.csv",
"views/product_view.xml",
"views/sale_view.xml",
],
"demo": [],
"test": [],
"installable": True,
"auto_install": False,
}

View file

@ -0,0 +1,245 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * pos_balance_multishop
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-12-02 10:21+0000\n"
"PO-Revision-Date: 2021-12-02 10:21+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: pos_balance_multishop
#: model_terms:ir.ui.view,arch_db:pos_balance_multishop.product_balace_code_form_view
msgid "Balance"
msgstr "Saldo pendiente"
#. module: pos_balance_multishop
#: model:ir.model.fields,field_description:pos_balance_multishop.field_product_product__balance_code_ids
#: model:ir.model.fields,field_description:pos_balance_multishop.field_product_template__balance_code_ids
msgid "Balance Codes"
msgstr ""
#. module: pos_balance_multishop
#: model:ir.model,name:pos_balance_multishop.model_balance_model
#: model:ir.model.fields,field_description:pos_balance_multishop.field_sale_balance__model_id
msgid "Balance Model"
msgstr ""
#. module: pos_balance_multishop
#: model:ir.model,name:pos_balance_multishop.model_balance_sale_shop
msgid "Balance Sale Shop"
msgstr ""
#. module: pos_balance_multishop
#: model:ir.model.fields,field_description:pos_balance_multishop.field_balance_sale_shop__balance_ids
#: model_terms:ir.ui.view,arch_db:pos_balance_multishop.sale_balance_form_view
#: model_terms:ir.ui.view,arch_db:pos_balance_multishop.sale_balance_tree_view
#: model_terms:ir.ui.view,arch_db:pos_balance_multishop.view_shop_form_balance
msgid "Balances"
msgstr ""
#. module: pos_balance_multishop
#: model_terms:ir.actions.act_window,help:pos_balance_multishop.action_sale_tree
msgid "Click to create balance shop."
msgstr ""
#. module: pos_balance_multishop
#: model:ir.model.fields,field_description:pos_balance_multishop.field_balance_model__code
#: model:ir.model.fields,field_description:pos_balance_multishop.field_product_product__balance_name
#: model:ir.model.fields,field_description:pos_balance_multishop.field_product_template__balance_name
msgid "Code"
msgstr "Código"
#. module: pos_balance_multishop
#: model:ir.model.fields,field_description:pos_balance_multishop.field_balance_model__create_uid
#: model:ir.model.fields,field_description:pos_balance_multishop.field_balance_sale_shop__create_uid
#: model:ir.model.fields,field_description:pos_balance_multishop.field_product_balance_code__create_uid
#: model:ir.model.fields,field_description:pos_balance_multishop.field_sale_balance__create_uid
msgid "Created by"
msgstr "Creado por"
#. module: pos_balance_multishop
#: model:ir.model.fields,field_description:pos_balance_multishop.field_balance_model__create_date
#: model:ir.model.fields,field_description:pos_balance_multishop.field_balance_sale_shop__create_date
#: model:ir.model.fields,field_description:pos_balance_multishop.field_product_balance_code__create_date
#: model:ir.model.fields,field_description:pos_balance_multishop.field_sale_balance__create_date
msgid "Created on"
msgstr "Creado el"
#. module: pos_balance_multishop
#: model:ir.model.fields,field_description:pos_balance_multishop.field_balance_model__display_name
#: model:ir.model.fields,field_description:pos_balance_multishop.field_balance_sale_shop__display_name
#: model:ir.model.fields,field_description:pos_balance_multishop.field_product_balance_code__display_name
#: model:ir.model.fields,field_description:pos_balance_multishop.field_sale_balance__display_name
msgid "Display Name"
msgstr "Nombre mostrado"
#. module: pos_balance_multishop
#: model:ir.model.fields,field_description:pos_balance_multishop.field_balance_model__id
#: model:ir.model.fields,field_description:pos_balance_multishop.field_balance_sale_shop__id
#: model:ir.model.fields,field_description:pos_balance_multishop.field_product_balance_code__id
#: model:ir.model.fields,field_description:pos_balance_multishop.field_sale_balance__id
msgid "ID"
msgstr ""
#. module: pos_balance_multishop
#: model:ir.model.fields,field_description:pos_balance_multishop.field_sale_balance__ip
msgid "IP"
msgstr ""
#. module: pos_balance_multishop
#: model:ir.model.fields,field_description:pos_balance_multishop.field_product_balance_code__key
msgid "Key"
msgstr "Clave"
#. module: pos_balance_multishop
#: model:ir.model.fields,field_description:pos_balance_multishop.field_balance_model____last_update
#: model:ir.model.fields,field_description:pos_balance_multishop.field_balance_sale_shop____last_update
#: model:ir.model.fields,field_description:pos_balance_multishop.field_product_balance_code____last_update
#: model:ir.model.fields,field_description:pos_balance_multishop.field_sale_balance____last_update
msgid "Last Modified on"
msgstr "Última modificación en"
#. module: pos_balance_multishop
#: model:ir.model.fields,field_description:pos_balance_multishop.field_balance_model__write_uid
#: model:ir.model.fields,field_description:pos_balance_multishop.field_balance_sale_shop__write_uid
#: model:ir.model.fields,field_description:pos_balance_multishop.field_product_balance_code__write_uid
#: model:ir.model.fields,field_description:pos_balance_multishop.field_sale_balance__write_uid
msgid "Last Updated by"
msgstr "Última actualización por"
#. module: pos_balance_multishop
#: model:ir.model.fields,field_description:pos_balance_multishop.field_balance_model__write_date
#: model:ir.model.fields,field_description:pos_balance_multishop.field_balance_sale_shop__write_date
#: model:ir.model.fields,field_description:pos_balance_multishop.field_product_balance_code__write_date
#: model:ir.model.fields,field_description:pos_balance_multishop.field_sale_balance__write_date
msgid "Last Updated on"
msgstr "Última actualización el"
#. module: pos_balance_multishop
#: model:ir.model.fields,field_description:pos_balance_multishop.field_balance_model__name
#: model:ir.model.fields,field_description:pos_balance_multishop.field_sale_balance__name
msgid "Name"
msgstr "Nombre"
#. module: pos_balance_multishop
#: model:ir.model.fields,field_description:pos_balance_multishop.field_sale_balance__network
msgid "Network Connection"
msgstr ""
#. module: pos_balance_multishop
#: model:ir.model.fields,field_description:pos_balance_multishop.field_product_product__balance_nomenclature
#: model:ir.model.fields,field_description:pos_balance_multishop.field_product_template__balance_nomenclature
msgid "Nomenclature"
msgstr "Denominación"
#. module: pos_balance_multishop
#: model:ir.model.fields,field_description:pos_balance_multishop.field_product_product__not_weighed
#: model:ir.model.fields,field_description:pos_balance_multishop.field_product_template__not_weighed
msgid "Not weighed"
msgstr ""
#. module: pos_balance_multishop
#: model:ir.model.fields,field_description:pos_balance_multishop.field_sale_balance__port
msgid "Port"
msgstr "Puerto"
#. module: pos_balance_multishop
#: selection:product.template,balance_type:0
msgid "Price"
msgstr "Precio"
#. module: pos_balance_multishop
#: model:ir.model,name:pos_balance_multishop.model_product_product
#: model:ir.model.fields,field_description:pos_balance_multishop.field_product_balance_code__product_id
msgid "Product"
msgstr "Producto"
#. module: pos_balance_multishop
#: model:ir.model,name:pos_balance_multishop.model_product_balance_code
msgid "Product Balance Code"
msgstr ""
#. module: pos_balance_multishop
#: model_terms:ir.ui.view,arch_db:pos_balance_multishop.product_balace_code_form_view
msgid "Product Balance Codes"
msgstr ""
#. module: pos_balance_multishop
#: model:ir.model,name:pos_balance_multishop.model_product_template
msgid "Product Template"
msgstr "Plantilla de producto"
#. module: pos_balance_multishop
#: model:ir.model.fields,field_description:pos_balance_multishop.field_product_product__balance_rule
#: model:ir.model.fields,field_description:pos_balance_multishop.field_product_template__balance_rule
msgid "Rule"
msgstr ""
#. module: pos_balance_multishop
#: model:ir.model,name:pos_balance_multishop.model_sale_balance
msgid "Sale Balance"
msgstr ""
#. module: pos_balance_multishop
#: model:ir.actions.act_window,name:pos_balance_multishop.action_sale_tree
#: model:ir.ui.menu,name:pos_balance_multishop.menu_sale_tree
msgid "Sale balance shop"
msgstr "Tienda de venta de balanza"
#. module: pos_balance_multishop
#: model_terms:ir.ui.view,arch_db:pos_balance_multishop.view_shop_form_balance
msgid "Sale_shop"
msgstr ""
#. module: pos_balance_multishop
#: model:ir.model.fields,field_description:pos_balance_multishop.field_product_balance_code__shop_id
#: model:ir.model.fields,field_description:pos_balance_multishop.field_sale_balance__shop_id
msgid "Shop"
msgstr ""
#. module: pos_balance_multishop
#: model:ir.model.fields,field_description:pos_balance_multishop.field_product_balance_code__table
msgid "Table"
msgstr "Tabla"
#. module: pos_balance_multishop
#: model:ir.model.fields,field_description:pos_balance_multishop.field_product_product__tare
#: model:ir.model.fields,field_description:pos_balance_multishop.field_product_template__tare
msgid "Tare"
msgstr ""
#. module: pos_balance_multishop
#: model:ir.model.fields,help:pos_balance_multishop.field_product_product__tare
#: model:ir.model.fields,help:pos_balance_multishop.field_product_template__tare
msgid "Tare in grams of the product. Maximum 5 digits"
msgstr ""
#. module: pos_balance_multishop
#: model:ir.model.fields,field_description:pos_balance_multishop.field_product_product__balance_type
#: model:ir.model.fields,field_description:pos_balance_multishop.field_product_template__balance_type
msgid "Type"
msgstr "Tipo"
#. module: pos_balance_multishop
#: model:ir.actions.server,name:pos_balance_multishop.action_update_balance_codes_menu
msgid "Update Balances"
msgstr ""
#. module: pos_balance_multishop
#: selection:product.template,balance_type:0
msgid "Weight"
msgstr "Peso"
#. module: pos_balance_multishop
#: model:ir.model.fields,field_description:pos_balance_multishop.field_balance_sale_shop__name
msgid "name"
msgstr "nombre"

View file

@ -0,0 +1,245 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * pos_balance_multishop
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-12-02 10:20+0000\n"
"PO-Revision-Date: 2021-12-02 10:20+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: pos_balance_multishop
#: model_terms:ir.ui.view,arch_db:pos_balance_multishop.product_balace_code_form_view
msgid "Balance"
msgstr ""
#. module: pos_balance_multishop
#: model:ir.model.fields,field_description:pos_balance_multishop.field_product_product__balance_code_ids
#: model:ir.model.fields,field_description:pos_balance_multishop.field_product_template__balance_code_ids
msgid "Balance Codes"
msgstr ""
#. module: pos_balance_multishop
#: model:ir.model,name:pos_balance_multishop.model_balance_model
#: model:ir.model.fields,field_description:pos_balance_multishop.field_sale_balance__model_id
msgid "Balance Model"
msgstr ""
#. module: pos_balance_multishop
#: model:ir.model,name:pos_balance_multishop.model_balance_sale_shop
msgid "Balance Sale Shop"
msgstr ""
#. module: pos_balance_multishop
#: model:ir.model.fields,field_description:pos_balance_multishop.field_balance_sale_shop__balance_ids
#: model_terms:ir.ui.view,arch_db:pos_balance_multishop.sale_balance_form_view
#: model_terms:ir.ui.view,arch_db:pos_balance_multishop.sale_balance_tree_view
#: model_terms:ir.ui.view,arch_db:pos_balance_multishop.view_shop_form_balance
msgid "Balances"
msgstr ""
#. module: pos_balance_multishop
#: model_terms:ir.actions.act_window,help:pos_balance_multishop.action_sale_tree
msgid "Click to create balance shop."
msgstr ""
#. module: pos_balance_multishop
#: model:ir.model.fields,field_description:pos_balance_multishop.field_balance_model__code
#: model:ir.model.fields,field_description:pos_balance_multishop.field_product_product__balance_name
#: model:ir.model.fields,field_description:pos_balance_multishop.field_product_template__balance_name
msgid "Code"
msgstr ""
#. module: pos_balance_multishop
#: model:ir.model.fields,field_description:pos_balance_multishop.field_balance_model__create_uid
#: model:ir.model.fields,field_description:pos_balance_multishop.field_balance_sale_shop__create_uid
#: model:ir.model.fields,field_description:pos_balance_multishop.field_product_balance_code__create_uid
#: model:ir.model.fields,field_description:pos_balance_multishop.field_sale_balance__create_uid
msgid "Created by"
msgstr ""
#. module: pos_balance_multishop
#: model:ir.model.fields,field_description:pos_balance_multishop.field_balance_model__create_date
#: model:ir.model.fields,field_description:pos_balance_multishop.field_balance_sale_shop__create_date
#: model:ir.model.fields,field_description:pos_balance_multishop.field_product_balance_code__create_date
#: model:ir.model.fields,field_description:pos_balance_multishop.field_sale_balance__create_date
msgid "Created on"
msgstr ""
#. module: pos_balance_multishop
#: model:ir.model.fields,field_description:pos_balance_multishop.field_balance_model__display_name
#: model:ir.model.fields,field_description:pos_balance_multishop.field_balance_sale_shop__display_name
#: model:ir.model.fields,field_description:pos_balance_multishop.field_product_balance_code__display_name
#: model:ir.model.fields,field_description:pos_balance_multishop.field_sale_balance__display_name
msgid "Display Name"
msgstr ""
#. module: pos_balance_multishop
#: model:ir.model.fields,field_description:pos_balance_multishop.field_balance_model__id
#: model:ir.model.fields,field_description:pos_balance_multishop.field_balance_sale_shop__id
#: model:ir.model.fields,field_description:pos_balance_multishop.field_product_balance_code__id
#: model:ir.model.fields,field_description:pos_balance_multishop.field_sale_balance__id
msgid "ID"
msgstr ""
#. module: pos_balance_multishop
#: model:ir.model.fields,field_description:pos_balance_multishop.field_sale_balance__ip
msgid "IP"
msgstr ""
#. module: pos_balance_multishop
#: model:ir.model.fields,field_description:pos_balance_multishop.field_product_balance_code__key
msgid "Key"
msgstr ""
#. module: pos_balance_multishop
#: model:ir.model.fields,field_description:pos_balance_multishop.field_balance_model____last_update
#: model:ir.model.fields,field_description:pos_balance_multishop.field_balance_sale_shop____last_update
#: model:ir.model.fields,field_description:pos_balance_multishop.field_product_balance_code____last_update
#: model:ir.model.fields,field_description:pos_balance_multishop.field_sale_balance____last_update
msgid "Last Modified on"
msgstr ""
#. module: pos_balance_multishop
#: model:ir.model.fields,field_description:pos_balance_multishop.field_balance_model__write_uid
#: model:ir.model.fields,field_description:pos_balance_multishop.field_balance_sale_shop__write_uid
#: model:ir.model.fields,field_description:pos_balance_multishop.field_product_balance_code__write_uid
#: model:ir.model.fields,field_description:pos_balance_multishop.field_sale_balance__write_uid
msgid "Last Updated by"
msgstr ""
#. module: pos_balance_multishop
#: model:ir.model.fields,field_description:pos_balance_multishop.field_balance_model__write_date
#: model:ir.model.fields,field_description:pos_balance_multishop.field_balance_sale_shop__write_date
#: model:ir.model.fields,field_description:pos_balance_multishop.field_product_balance_code__write_date
#: model:ir.model.fields,field_description:pos_balance_multishop.field_sale_balance__write_date
msgid "Last Updated on"
msgstr ""
#. module: pos_balance_multishop
#: model:ir.model.fields,field_description:pos_balance_multishop.field_balance_model__name
#: model:ir.model.fields,field_description:pos_balance_multishop.field_sale_balance__name
msgid "Name"
msgstr ""
#. module: pos_balance_multishop
#: model:ir.model.fields,field_description:pos_balance_multishop.field_sale_balance__network
msgid "Network Connection"
msgstr ""
#. module: pos_balance_multishop
#: model:ir.model.fields,field_description:pos_balance_multishop.field_product_product__balance_nomenclature
#: model:ir.model.fields,field_description:pos_balance_multishop.field_product_template__balance_nomenclature
msgid "Nomenclature"
msgstr ""
#. module: pos_balance_multishop
#: model:ir.model.fields,field_description:pos_balance_multishop.field_product_product__not_weighed
#: model:ir.model.fields,field_description:pos_balance_multishop.field_product_template__not_weighed
msgid "Not weighed"
msgstr ""
#. module: pos_balance_multishop
#: model:ir.model.fields,field_description:pos_balance_multishop.field_sale_balance__port
msgid "Port"
msgstr ""
#. module: pos_balance_multishop
#: selection:product.template,balance_type:0
msgid "Price"
msgstr ""
#. module: pos_balance_multishop
#: model:ir.model,name:pos_balance_multishop.model_product_product
#: model:ir.model.fields,field_description:pos_balance_multishop.field_product_balance_code__product_id
msgid "Product"
msgstr ""
#. module: pos_balance_multishop
#: model:ir.model,name:pos_balance_multishop.model_product_balance_code
msgid "Product Balance Code"
msgstr ""
#. module: pos_balance_multishop
#: model_terms:ir.ui.view,arch_db:pos_balance_multishop.product_balace_code_form_view
msgid "Product Balance Codes"
msgstr ""
#. module: pos_balance_multishop
#: model:ir.model,name:pos_balance_multishop.model_product_template
msgid "Product Template"
msgstr ""
#. module: pos_balance_multishop
#: model:ir.model.fields,field_description:pos_balance_multishop.field_product_product__balance_rule
#: model:ir.model.fields,field_description:pos_balance_multishop.field_product_template__balance_rule
msgid "Rule"
msgstr ""
#. module: pos_balance_multishop
#: model:ir.model,name:pos_balance_multishop.model_sale_balance
msgid "Sale Balance"
msgstr ""
#. module: pos_balance_multishop
#: model:ir.actions.act_window,name:pos_balance_multishop.action_sale_tree
#: model:ir.ui.menu,name:pos_balance_multishop.menu_sale_tree
msgid "Sale balance shop"
msgstr ""
#. module: pos_balance_multishop
#: model_terms:ir.ui.view,arch_db:pos_balance_multishop.view_shop_form_balance
msgid "Sale_shop"
msgstr ""
#. module: pos_balance_multishop
#: model:ir.model.fields,field_description:pos_balance_multishop.field_product_balance_code__shop_id
#: model:ir.model.fields,field_description:pos_balance_multishop.field_sale_balance__shop_id
msgid "Shop"
msgstr ""
#. module: pos_balance_multishop
#: model:ir.model.fields,field_description:pos_balance_multishop.field_product_balance_code__table
msgid "Table"
msgstr ""
#. module: pos_balance_multishop
#: model:ir.model.fields,field_description:pos_balance_multishop.field_product_product__tare
#: model:ir.model.fields,field_description:pos_balance_multishop.field_product_template__tare
msgid "Tare"
msgstr ""
#. module: pos_balance_multishop
#: model:ir.model.fields,help:pos_balance_multishop.field_product_product__tare
#: model:ir.model.fields,help:pos_balance_multishop.field_product_template__tare
msgid "Tare in grams of the product. Maximum 5 digits"
msgstr ""
#. module: pos_balance_multishop
#: model:ir.model.fields,field_description:pos_balance_multishop.field_product_product__balance_type
#: model:ir.model.fields,field_description:pos_balance_multishop.field_product_template__balance_type
msgid "Type"
msgstr ""
#. module: pos_balance_multishop
#: model:ir.actions.server,name:pos_balance_multishop.action_update_balance_codes_menu
msgid "Update Balances"
msgstr ""
#. module: pos_balance_multishop
#: selection:product.template,balance_type:0
msgid "Weight"
msgstr ""
#. module: pos_balance_multishop
#: model:ir.model.fields,field_description:pos_balance_multishop.field_balance_sale_shop__name
msgid "name"
msgstr ""

View file

@ -0,0 +1,25 @@
########################################################################
#
# @authors: Ignacio Ibeas <ignacio@acysos.com>
# Copyright (C) 2014 Acysos S.L.
#
#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation, either version 3 of the License, or
#(at your option) any later version.
#
# This module is GPLv3 or newer and incompatible
# with OpenERP SA "AGPL + Private Use License"!
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#
#You should have received a copy of the GNU General Public License
#along with this program. If not, see http://www.gnu.org/licenses.
########################################################################
from . import product
from . import sale_balance
from . import sale

View file

@ -0,0 +1,151 @@
# Copyright 2014 Ignacio Ibeas <ignacio@acysos.com>
# Copyright 2020 Santi Noreña <santi@criptomart.net>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
import logging
from odoo import api, models, fields, _
_logger = logging.getLogger(__name__)
class ProductTemplate(models.Model):
_inherit = "product.template"
balance_code_ids = fields.One2many(
comodel_name="product.balance.code",
inverse_name="product_id",
string="Balance Codes",
)
balance_type = fields.Selection(
[("price", "Price"), ("weight", "Weight")], "Type Balance"
)
balance_name = fields.Char(string="Code", readonly=False, related="default_code")
balance_nomenclature = fields.Many2one(
comodel_name="barcode.nomenclature", string="Nomenclature"
)
balance_rule = fields.Many2one(comodel_name="barcode.rule", string="Rule")
not_weighed = fields.Boolean("Not weighed", required=False)
tare = fields.Integer(
string="Tare",
help="Tare in grams of the product. Maximum 5 digits",
default=0,
readonly=False,
)
@api.onchange("balance_name", "balance_rule")
def get_ean_code(self):
barcode = False
for product in self:
if self.balance_rule and self.balance_name:
ean = product.balance_rule.pattern[:1]
ean += product.balance_name
ean += "00000"
code = list(ean)
oddsum = evensum = total = control_digit = 0
for i in range(len(code)):
if i % 2 == 0:
# even calculation
evensum += int(code[i])
else:
# odd calculation
oddsum += int(code[i])
total = oddsum * 3 + evensum
control_digit = int((10 - total % 10) % 10)
barcode = ean + str(control_digit)
product.barcode = barcode
def update_codes(self):
# _logger.debug("updating codes")
for product in self:
if len(product.balance_code_ids) > 0:
for code in product.balance_code_ids:
if len(code.shop_id.balance_ids) > 0:
code.remove_balance()
code.update_balance()
class product_balance_code(models.Model):
_name = "product.balance.code"
_description = "Product Balance Code"
def add_balance(self):
for code in self:
for balance in code.shop_id.balance_ids:
if balance.network:
balance_con = getattr(self, "add_balance_" + balance.model_id.code)
balance_con(code, balance)
return True
def update_balance(self):
for code in self:
# _logger.debug("code : " + code )
for balance in code.shop_id.balance_ids:
_logger.debug("balance con ")
if balance.network:
# _logger.debug("balance con " + balance)
balance_con = getattr(
self, "update_balance_" + balance.model_id.code
)
# _logger.debug('update_balance_' + balance.model_id.code))
balance_con(code, balance)
return True
def remove_balance(self):
for code in self:
for balance in code.shop_id.balance_ids:
if balance.network:
balance_con = getattr(
self, "remove_balance_" + balance.model_id.code
)
balance_con(code, balance)
return True
product_id = fields.Many2one(
comodel_name="product.template", string="Product", required=True
)
key = fields.Char(string="Key")
table = fields.Char(string="Table")
shop_id = fields.Many2one(comodel_name="balance.sale.shop", string="Shop")
class ProductProduct(models.Model):
_inherit = "product.product"
@api.onchange("balance_name", "balance_rule")
def get_ean_code(self):
barcode = False
for product in self:
if self.balance_rule and self.balance_name:
ean = product.balance_rule.pattern[:1]
ean += product.balance_name
ean += "00000"
code = list(ean)
oddsum = evensum = total = control_digit = 0
for i in range(len(code)):
if i % 2 == 0:
# even calculation
evensum += int(code[i])
else:
# odd calculation
oddsum += int(code[i])
total = oddsum * 3 + evensum
control_digit = int((10 - total % 10) % 10)
barcode = ean + str(control_digit)
product.barcode = barcode
def unlink(self):
self.balance_code_ids.remove_balance()
res = super(ProductProduct, self).unlink()
return res
def update_codes(self):
for product in self:
if len(product.balance_code_ids) > 0:
for code in product.balance_code_ids:
if len(code.shop_id.balance_ids) > 0:
code.remove_balance()

View file

@ -0,0 +1,14 @@
# Copyright 2014 Ignacio Ibeas <ignacio@acysos.com>
# Copyright 2020 Santi Noreña <santi@criptomart.net>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import models, fields, _
class balance_sale_shop(models.Model):
_name = "balance.sale.shop"
_description = "Balance Sale Shop"
name = fields.Char("Name")
balance_ids = fields.One2many(
comodel_name="sale.balance", inverse_name="shop_id", string="Balances"
)

View file

@ -0,0 +1,27 @@
# Copyright 2014 Ignacio Ibeas <ignacio@acysos.com>
# Copyright 2020 Santi Noreña <santi@criptomart.net>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import models, fields, _
class balance_model(models.Model):
_name = "balance.model"
_description = "Balance Model"
name = fields.Char(string="Name", required=True, readonly=True)
code = fields.Char(string="Code", required=True, readonly=True)
class sale_balance(models.Model):
_name = "sale.balance"
_description = "Sale Balance"
name = fields.Char("Name")
shop_id = fields.Many2one(comodel_name="balance.sale.shop", string="Shop")
network = fields.Boolean("Network Connection", required=False)
model_id = fields.Many2one(
comodel_name="balance.model", string="Balance Model", required=False
)
ip = fields.Char("IP", required=False, readonly=False)
port = fields.Integer("Port")

View file

@ -0,0 +1,13 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_product_balance_code_all,product.balance.code,model_product_balance_code,base.group_user,1,0,0,0
access_product_balance_code_user,product.balance.code,model_product_balance_code,point_of_sale.group_pos_user,1,1,1,0
access_product_balance_code_manager,product.balance.code manager,model_product_balance_code,point_of_sale.group_pos_manager,1,1,1,1
access_product_balance_shop_all,balance.sale.shop user,model_balance_sale_shop,base.group_user,1,0,0,0
access_product_balance_shop_user,balance.sale.shop user,model_balance_sale_shop,point_of_sale.group_pos_user,1,1,1,0
access_product_balance_shop_manager,balance.sale.shop manager,model_balance_sale_shop,point_of_sale.group_pos_manager,1,1,1,1
access_sale_balance_all,sale.balance user,model_sale_balance,base.group_user,1,0,0,0
access_sale_balance_user,sale.balance user,model_sale_balance,point_of_sale.group_pos_user,1,1,1,0
access_sale_balance_manager,sale.balance manager,model_sale_balance,point_of_sale.group_pos_manager,1,1,1,1
access_balance_model_all,balance.model user,model_balance_model,base.group_user,1,0,0,0
access_balance_model_user,balance.model user,model_balance_model,point_of_sale.group_pos_user,1,1,1,0
access_balance_model_manager,balance.model manager,model_balance_model,point_of_sale.group_pos_manager,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_product_balance_code_all product.balance.code model_product_balance_code base.group_user 1 0 0 0
3 access_product_balance_code_user product.balance.code model_product_balance_code point_of_sale.group_pos_user 1 1 1 0
4 access_product_balance_code_manager product.balance.code manager model_product_balance_code point_of_sale.group_pos_manager 1 1 1 1
5 access_product_balance_shop_all balance.sale.shop user model_balance_sale_shop base.group_user 1 0 0 0
6 access_product_balance_shop_user balance.sale.shop user model_balance_sale_shop point_of_sale.group_pos_user 1 1 1 0
7 access_product_balance_shop_manager balance.sale.shop manager model_balance_sale_shop point_of_sale.group_pos_manager 1 1 1 1
8 access_sale_balance_all sale.balance user model_sale_balance base.group_user 1 0 0 0
9 access_sale_balance_user sale.balance user model_sale_balance point_of_sale.group_pos_user 1 1 1 0
10 access_sale_balance_manager sale.balance manager model_sale_balance point_of_sale.group_pos_manager 1 1 1 1
11 access_balance_model_all balance.model user model_balance_model base.group_user 1 0 0 0
12 access_balance_model_user balance.model user model_balance_model point_of_sale.group_pos_user 1 1 1 0
13 access_balance_model_manager balance.model manager model_balance_model point_of_sale.group_pos_manager 1 1 1 1

View file

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<data>
<record model="ir.ui.view" id="product_balace_code_form_view">
<field name="name">product.balance.code.form</field>
<field name="model">product.template</field>
<field name="type">form</field>
<field name="inherit_id" ref="product.product_template_form_view"/>
<field name="arch" type="xml">
<page name="general_information" position="after">
<page string="Balance">
<group>
<field name="balance_type"/>
<field name="balance_name"/>
<field name="balance_nomenclature"/>
<field name="balance_rule" domain="['|',('type','=','price'),('type','=','weight')]"/>
<field name="not_weighed"/>
<field name="tare"/>
</group>
<field name="balance_code_ids" nolabel="1">
<form string="Product Balance Codes">
<group>
<field name="key"/>
<field name="table"/>
<field name="shop_id"/>
</group>
</form>
<tree string="Product Balance Codes" editable="top">
<field name="key"/>
<field name="table"/>
<field name="shop_id" />
</tree>
</field>
</page>
</page>
</field>
</record>
<record id="action_update_balance_codes_menu" model="ir.actions.server">
<field name="name">Update Balances</field>
<field name="type">ir.actions.server</field>
<field name="model_id" ref="product.model_product_template" />
<field name="binding_model_id" ref="product.model_product_template"/>
<field name="state">code</field>
<field name="code">
if records:
records.update_codes()
</field>
</record>
</data>
</odoo>

View file

@ -0,0 +1,71 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<data>
<record model="ir.ui.view" id="view_shop_form_balance">
<field name="name">balance.sale.shop.form</field>
<field name="model">balance.sale.shop</field>
<field name="type">form</field>
<field name="arch" type="xml">
<sheet string="Sale_shop">
<group>
<field name="name"/>
<field name="balance_ids" />
</group>
</sheet>
</field>
</record>
<record model="ir.ui.view" id="sale_balance_form_view">
<field name="name">sale.balance.form</field>
<field name="model">sale.balance</field>
<field name="type">form</field>
<field name="arch" type="xml">
<group>
<form string="Balances">
<group>
<field name="name" />
<field name="shop_id"/>
<field name="network" />
<field name="model_id" />
<field name="ip" />
<field name="port" />
</group>
</form>
</group>
</field>
</record>
<record model="ir.ui.view" id="sale_balance_tree_view">
<field name="name">sale.balance.form</field>
<field name="model">sale.balance</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Balances" editable="top">
<field name="name" />
<field name="network" />
<field name="model_id" />
<field name="ip" />
<field name="port" />
</tree>
</field>
</record>
<record id="action_sale_tree" model="ir.actions.act_window">
<field name="name">Sale balance shop</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">balance.sale.shop</field>
<field name="view_mode">tree,form</field>
<field name="view_id" eval="False"/>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to create balance shop.
</p>
</field>
</record>
<menuitem action="action_sale_tree" id="menu_sale_tree"
parent="point_of_sale.menu_point_config_product" sequence="1"
/>
</data>
</odoo>