diff --git a/purchase_portal/i18n/es.po b/purchase_portal/i18n/es.po
index e7d37b5..663cc17 100644
--- a/purchase_portal/i18n/es.po
+++ b/purchase_portal/i18n/es.po
@@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2023-11-28 15:29+0000\n"
-"PO-Revision-Date: 2023-11-28 15:29+0000\n"
+"POT-Creation-Date: 2024-11-13 15:59+0000\n"
+"PO-Revision-Date: 2024-11-13 15:59+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@@ -15,6 +15,21 @@ msgstr ""
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
+#. module: purchase_portal
+#: model:mail.template,subject:purchase_portal.alda_purchase_pos
+#: model:mail.template,subject:purchase_portal.alda_purchase_remainder
+msgid ""
+"${object.property_id.name}: Pedido (Ref ${object.name or 'n/a' }) - "
+"${object.company_id.name}"
+msgstr ""
+
+#. module: purchase_portal
+#: model:mail.template,subject:purchase_portal.alda_purchase_rfq
+msgid ""
+"${object.property_id.name}: Presupuesto - Pedido (Ref ${object.name or 'n/a'"
+" }) - ${object.company_id.name}"
+msgstr ""
+
#. module: purchase_portal
#: model_terms:ir.ui.view,arch_db:purchase_portal.portal_new_purchase_request_page
#: model_terms:ir.ui.view,arch_db:purchase_portal.portal_purchase_request_page
@@ -39,6 +54,321 @@ msgstr "Revisor: "
msgid "Status: "
msgstr "Estado: "
+#. module: purchase_portal
+#: model:mail.template,body_html:purchase_portal.alda_purchase_pos
+msgid ""
+"
\n"
+" "
+msgstr ""
+
+#. module: purchase_portal
+#: model:mail.template,body_html:purchase_portal.alda_purchase_remainder
+msgid ""
+"\n"
+" "
+msgstr ""
+
+#. module: purchase_portal
+#: model:mail.template,body_html:purchase_portal.alda_purchase_rfq
+msgid ""
+"\n"
+" "
+msgstr ""
+
#. module: purchase_portal
#: model_terms:ir.ui.view,arch_db:purchase_portal.portal_my_home_menu_purchase_request
msgid "Draft purchase request "
@@ -206,7 +536,7 @@ msgstr ""
"class=\"d-none d-md-inline\"> Rechazado"
#. module: purchase_portal
-#: model_terms:ir.ui.view,arch_db:purchase_portal.portal_saved_cart_page
+#: model_terms:ir.ui.view,arch_db:purchase_portal.portal_saved_cart_info
msgid ""
" Add to cart and delete "
@@ -215,7 +545,7 @@ msgstr ""
"cart-arrow-down\"/> Utilizar y borrar"
#. module: purchase_portal
-#: model_terms:ir.ui.view,arch_db:purchase_portal.portal_saved_cart_page
+#: model_terms:ir.ui.view,arch_db:purchase_portal.portal_saved_cart_info
msgid ""
" Add to cart "
@@ -224,7 +554,8 @@ msgstr ""
"cart-plus\"/> Utilizar"
#. module: purchase_portal
-#: model_terms:ir.ui.view,arch_db:purchase_portal.portal_saved_cart_page
+#: model_terms:ir.ui.view,arch_db:purchase_portal.portal_my_saved_items
+#: model_terms:ir.ui.view,arch_db:purchase_portal.portal_saved_cart_info
msgid ""
" Delete "
@@ -236,7 +567,7 @@ msgstr ""
#: model_terms:ir.ui.view,arch_db:purchase_portal.portal_new_purchase_request_page
#: model_terms:ir.ui.view,arch_db:purchase_portal.portal_purchase_request_page
msgid "Save "
-msgstr ""
+msgstr "Guardar "
#. module: purchase_portal
#: model_terms:ir.ui.view,arch_db:purchase_portal.portal_purchase_request_page
@@ -290,8 +621,8 @@ msgstr "Una línea será añadida por cada producto no recibido"
#. module: purchase_portal
#: code:addons/purchase_portal/models/purchase_request.py:0
#, python-format
-msgid "A new review %s has been asigned to you."
-msgstr "Una nueva revisión %s te ha sido asignada."
+msgid "A new review {review} has been asigned to you."
+msgstr "Una nueva revisión {review} te ha sido asignada."
#. module: purchase_portal
#: code:addons/purchase_portal/models/purchase_request.py:0
@@ -318,15 +649,20 @@ msgstr "Activo"
msgid "Add"
msgstr "Añadir"
+#. module: purchase_portal
+#: model_terms:ir.ui.view,arch_db:purchase_portal.pms_property_views_form
+msgid "Add all seller's products"
+msgstr "Añadir todos los productos de los vendedores"
+
#. module: purchase_portal
#: model:ir.model.fields,field_description:purchase_portal.field_purchase_request_saved_cart__add_to_cart_url
msgid "Add to cart URL"
-msgstr ""
+msgstr "Añadir al carrito URL"
#. module: purchase_portal
#: model:ir.model.fields,field_description:purchase_portal.field_purchase_request_saved_cart__add_to_cart_and_delete_url
msgid "Add to cart and delete URL"
-msgstr ""
+msgstr "Añadir al carrito y borrar URL"
#. module: purchase_portal
#: code:addons/purchase_portal/controllers/main.py:0
@@ -345,7 +681,9 @@ msgstr "Permitido en propiedades"
#. module: purchase_portal
#: model:ir.model.fields,field_description:purchase_portal.field_channel_wubook_pms_property_availability__product_ids
+#: model:ir.model.fields,field_description:purchase_portal.field_channel_wubook_pms_property_availability__product_seller_ids
#: model:ir.model.fields,field_description:purchase_portal.field_pms_property__product_ids
+#: model:ir.model.fields,field_description:purchase_portal.field_pms_property__product_seller_ids
msgid "Allowed products"
msgstr "Productos permitidos"
@@ -383,19 +721,24 @@ msgstr "Cerrar"
msgid "Contact"
msgstr "Contacto"
+#. module: purchase_portal
+#: model_terms:ir.ui.view,arch_db:purchase_portal.portal_new_purchase_request_page
+msgid "Create"
+msgstr "Crear"
+
#. module: purchase_portal
#: model:ir.model.fields,field_description:purchase_portal.field_import_supplier_data_wizard__create_uid
#: model:ir.model.fields,field_description:purchase_portal.field_purchase_request_saved_cart__create_uid
#: model:ir.model.fields,field_description:purchase_portal.field_purchase_request_saved_cart_item__create_uid
msgid "Created by"
-msgstr ""
+msgstr "Creado por"
#. module: purchase_portal
#: model:ir.model.fields,field_description:purchase_portal.field_import_supplier_data_wizard__create_date
#: model:ir.model.fields,field_description:purchase_portal.field_purchase_request_saved_cart__create_date
#: model:ir.model.fields,field_description:purchase_portal.field_purchase_request_saved_cart_item__create_date
msgid "Created on"
-msgstr ""
+msgstr "Creado el"
#. module: purchase_portal
#: model:ir.model.fields,help:purchase_portal.field_purchase_request__access_url
@@ -419,7 +762,7 @@ msgstr "Fecha"
#: model:ir.model.fields,field_description:purchase_portal.field_purchase_request_saved_cart__delete_url
#: model:ir.model.fields,field_description:purchase_portal.field_purchase_request_saved_cart_item__delete_url
msgid "Delete URL"
-msgstr ""
+msgstr "Borrar URL"
#. module: purchase_portal
#: model:ir.model.fields,field_description:purchase_portal.field_purchase_request_saved_cart_item__description
@@ -443,6 +786,7 @@ msgstr "Descripción"
#: model:ir.model.fields,field_description:purchase_portal.field_res_partner__display_name
#: model:ir.model.fields,field_description:purchase_portal.field_res_users__display_name
#: model:ir.model.fields,field_description:purchase_portal.field_stock_backorder_confirmation__display_name
+#: model:ir.model.fields,field_description:purchase_portal.field_stock_move__display_name
#: model:ir.model.fields,field_description:purchase_portal.field_stock_picking__display_name
msgid "Display Name"
msgstr "Nombre"
@@ -482,11 +826,6 @@ msgid ""
" siendo reference el código del proovedor para el producto."
msgstr ""
-#. module: purchase_portal
-#: model_terms:ir.ui.view,arch_db:purchase_portal.portal_new_purchase_request_page
-msgid "Estimated stock"
-msgstr "Stock estimado"
-
#. module: purchase_portal
#: model_terms:ir.ui.view,arch_db:purchase_portal.purchase_order_form
msgid "Force Confirm Order"
@@ -501,8 +840,13 @@ msgstr "Hola,"
#. module: purchase_portal
#: code:addons/purchase_portal/models/stock_picking.py:0
#, python-format
-msgid "Hi {}, "
-msgstr "Hola {}, "
+msgid "Hi {}, {} {}"
+msgstr "Hola {}, {} {}"
+
+#. module: purchase_portal
+#: model:ir.model.fields,field_description:purchase_portal.field_res_users__hide_menus
+msgid "Hide menus"
+msgstr "Ocultar menús"
#. module: purchase_portal
#: model_terms:ir.ui.view,arch_db:purchase_portal.portal_purchase_request_page
@@ -527,6 +871,7 @@ msgstr "Historial"
#: model:ir.model.fields,field_description:purchase_portal.field_res_partner__id
#: model:ir.model.fields,field_description:purchase_portal.field_res_users__id
#: model:ir.model.fields,field_description:purchase_portal.field_stock_backorder_confirmation__id
+#: model:ir.model.fields,field_description:purchase_portal.field_stock_move__id
#: model:ir.model.fields,field_description:purchase_portal.field_stock_picking__id
msgid "ID"
msgstr "Identificación"
@@ -556,7 +901,7 @@ msgstr "Inactivo"
#. module: purchase_portal
#: model:ir.model.fields,field_description:purchase_portal.field_purchase_request_saved_cart__item_ids
msgid "Items"
-msgstr ""
+msgstr "Elementos"
#. module: purchase_portal
#: model:ir.model.fields,field_description:purchase_portal.field_import_supplier_data_wizard____last_update
@@ -575,6 +920,7 @@ msgstr ""
#: model:ir.model.fields,field_description:purchase_portal.field_res_partner____last_update
#: model:ir.model.fields,field_description:purchase_portal.field_res_users____last_update
#: model:ir.model.fields,field_description:purchase_portal.field_stock_backorder_confirmation____last_update
+#: model:ir.model.fields,field_description:purchase_portal.field_stock_move____last_update
#: model:ir.model.fields,field_description:purchase_portal.field_stock_picking____last_update
msgid "Last Modified on"
msgstr "Última modificación en"
@@ -584,14 +930,14 @@ msgstr "Última modificación en"
#: model:ir.model.fields,field_description:purchase_portal.field_purchase_request_saved_cart__write_uid
#: model:ir.model.fields,field_description:purchase_portal.field_purchase_request_saved_cart_item__write_uid
msgid "Last Updated by"
-msgstr ""
+msgstr "Módificado por última vez por"
#. module: purchase_portal
#: model:ir.model.fields,field_description:purchase_portal.field_import_supplier_data_wizard__write_date
#: model:ir.model.fields,field_description:purchase_portal.field_purchase_request_saved_cart__write_date
#: model:ir.model.fields,field_description:purchase_portal.field_purchase_request_saved_cart_item__write_date
msgid "Last Updated on"
-msgstr ""
+msgstr "Última modificación en"
#. module: purchase_portal
#: code:addons/purchase_portal/models/purchase_request.py:0
@@ -609,6 +955,17 @@ msgstr ""
"Línea editada por {user}: {product} ({old_quantity} -> "
"{quantity}) "
+#. module: purchase_portal
+#: code:addons/purchase_portal/controllers/saved_cart_json.py:0
+#: code:addons/purchase_portal/controllers/saved_cart_json.py:0
+#: code:addons/purchase_portal/controllers/saved_cart_json.py:0
+#: code:addons/purchase_portal/controllers/saved_cart_json.py:0
+#: code:addons/purchase_portal/controllers/stock_picking_json.py:0
+#: code:addons/purchase_portal/controllers/stock_picking_json.py:0
+#, python-format
+msgid "Line not found"
+msgstr "Línea no encontrada"
+
#. module: purchase_portal
#: code:addons/purchase_portal/models/purchase_request.py:0
#, python-format
@@ -678,11 +1035,33 @@ msgstr "Opciones"
msgid "Origin"
msgstr "Origen"
+#. module: purchase_portal
+#: model_terms:ir.ui.view,arch_db:purchase_portal.portal_stock_picking_page
+msgid "Original Quantity"
+msgstr "Cantidad original"
+
+#. module: purchase_portal
+#: model:ir.model.fields,field_description:purchase_portal.field_stock_move__product_original_qty
+msgid "Original quantity"
+msgstr "Cantidad original"
+
+#. module: purchase_portal
+#: model:ir.model.fields,field_description:purchase_portal.field_stock_move__product_original_qty_uom
+msgid "Original quantity uom"
+msgstr "UdM cantidad original"
+
#. module: purchase_portal
#: model:ir.model.fields,field_description:purchase_portal.field_purchase_request_saved_cart__partner_id
msgid "Partner"
msgstr "Cliente"
+#. module: purchase_portal
+#: code:addons/purchase_portal/controllers/stock_picking_json.py:0
+#: code:addons/purchase_portal/controllers/stock_picking_json.py:0
+#, python-format
+msgid "Picking not found"
+msgstr "Albarán no encontrado"
+
#. module: purchase_portal
#: model:ir.model,name:purchase_portal.model_pos_config
msgid "Point of Sale Configuration"
@@ -717,9 +1096,9 @@ msgstr "Precio"
#: model_terms:ir.ui.view,arch_db:purchase_portal.portal_product_product
#: model_terms:ir.ui.view,arch_db:purchase_portal.portal_purchase_request_page
#: model_terms:ir.ui.view,arch_db:purchase_portal.portal_saved_cart_page
-#: model_terms:ir.ui.view,arch_db:purchase_portal.portal_stock_picking_page
#: model_terms:ir.ui.view,arch_db:purchase_portal.purchase_request_details_table
#: model_terms:ir.ui.view,arch_db:purchase_portal.purchase_request_product_table
+#: model_terms:ir.ui.view,arch_db:purchase_portal.stock_picking_lines_table
msgid "Product"
msgstr "Producto"
@@ -731,7 +1110,7 @@ msgstr "Producto #"
#. module: purchase_portal
#: model:ir.model.fields,field_description:purchase_portal.field_import_supplier_data_wizard__product_errors
msgid "Product Errors"
-msgstr ""
+msgstr "Errores de producto"
#. module: purchase_portal
#: model:ir.model.fields,field_description:purchase_portal.field_purchase_request_saved_cart_item__product_qty
@@ -743,6 +1122,12 @@ msgstr "Cantidad"
msgid "Product Unit of Measure"
msgstr "Unidad de medida"
+#. module: purchase_portal
+#: code:addons/purchase_portal/models/stock_picking.py:0
+#, python-format
+msgid "Product: {} , quantity: {} "
+msgstr "Producto: {} , cantidad: {} "
+
#. module: purchase_portal
#: model_terms:ir.ui.view,arch_db:purchase_portal.portal_my_home_purchase_request
#: model_terms:ir.ui.view,arch_db:purchase_portal.portal_new_purchase_request_page
@@ -788,7 +1173,7 @@ msgstr "Línea de solicitud de compra"
#. module: purchase_portal
#: model:ir.model,name:purchase_portal.model_purchase_request_line_make_purchase_order
msgid "Purchase Request Line Make Purchase Order"
-msgstr ""
+msgstr "Línea de solicitud de compra para pedido"
#. module: purchase_portal
#: model_terms:ir.ui.view,arch_db:purchase_portal.portal_my_purchase_requests
@@ -829,6 +1214,11 @@ msgstr ""
msgid "Reference"
msgstr "Referencia"
+#. module: purchase_portal
+#: model_terms:ir.ui.view,arch_db:purchase_portal.pms_property_views_form
+msgid "Remove Products Not In Sellers"
+msgstr "Eliminar todos los productos que no sean de los vendedores"
+
#. module: purchase_portal
#: model_terms:ir.ui.view,arch_db:purchase_portal.portal_new_purchase_request_page
msgid "Request validation"
@@ -848,7 +1238,7 @@ msgstr "Guardar carrito. "
#: model_terms:ir.ui.view,arch_db:purchase_portal.portal_new_purchase_request_page
#: model_terms:ir.ui.view,arch_db:purchase_portal.portal_purchase_request_page
msgid "Save request"
-msgstr ""
+msgstr "Guardar solicitud"
#. module: purchase_portal
#: model_terms:ir.ui.view,arch_db:purchase_portal.portal_my_saved_carts
@@ -856,7 +1246,7 @@ msgid "Saved Cart #"
msgstr "Carrito guardado #"
#. module: purchase_portal
-#: model_terms:ir.ui.view,arch_db:purchase_portal.portal_saved_cart_page
+#: model_terms:ir.ui.view,arch_db:purchase_portal.portal_saved_cart_info
msgid "Saved Cart -"
msgstr "Carrito guardado -"
@@ -866,7 +1256,7 @@ msgstr "Carrito guardado -"
#: model:ir.model.fields,field_description:purchase_portal.field_res_partner__saved_cart_count
#: model:ir.model.fields,field_description:purchase_portal.field_res_users__saved_cart_count
msgid "Saved Cart Count"
-msgstr ""
+msgstr "Contador de carritos guardados"
#. module: purchase_portal
#: model:ir.actions.act_window,name:purchase_portal.act_res_partner_2_saved_cart
@@ -930,27 +1320,6 @@ msgstr "Token de seguridad"
msgid "Seller"
msgstr "Proveedor"
-#. module: purchase_portal
-#: model:ir.model.fields,field_description:purchase_portal.field_import_supplier_data_wizard__smart_search
-#: model:ir.model.fields,field_description:purchase_portal.field_pms_property__smart_search
-#: model:ir.model.fields,field_description:purchase_portal.field_pos_config__smart_search
-#: model:ir.model.fields,field_description:purchase_portal.field_pos_order__smart_search
-#: model:ir.model.fields,field_description:purchase_portal.field_pos_session__smart_search
-#: model:ir.model.fields,field_description:purchase_portal.field_product_product__smart_search
-#: model:ir.model.fields,field_description:purchase_portal.field_product_supplierinfo__smart_search
-#: model:ir.model.fields,field_description:purchase_portal.field_purchase_order__smart_search
-#: model:ir.model.fields,field_description:purchase_portal.field_purchase_request__smart_search
-#: model:ir.model.fields,field_description:purchase_portal.field_purchase_request_line__smart_search
-#: model:ir.model.fields,field_description:purchase_portal.field_purchase_request_line_make_purchase_order__smart_search
-#: model:ir.model.fields,field_description:purchase_portal.field_purchase_request_saved_cart__smart_search
-#: model:ir.model.fields,field_description:purchase_portal.field_purchase_request_saved_cart_item__smart_search
-#: model:ir.model.fields,field_description:purchase_portal.field_res_partner__smart_search
-#: model:ir.model.fields,field_description:purchase_portal.field_res_users__smart_search
-#: model:ir.model.fields,field_description:purchase_portal.field_stock_backorder_confirmation__smart_search
-#: model:ir.model.fields,field_description:purchase_portal.field_stock_picking__smart_search
-msgid "Smart Search"
-msgstr "Búsqueda inteligente"
-
#. module: purchase_portal
#: code:addons/purchase_portal/controllers/main.py:0
#: code:addons/purchase_portal/controllers/main.py:0
@@ -958,6 +1327,11 @@ msgstr "Búsqueda inteligente"
msgid "Status"
msgstr "Estado"
+#. module: purchase_portal
+#: model:ir.model,name:purchase_portal.model_stock_move
+msgid "Stock Move"
+msgstr "Movimiento de stock"
+
#. module: purchase_portal
#: model_terms:ir.ui.view,arch_db:purchase_portal.portal_my_stock_pickings
msgid "Stock picking #"
@@ -1040,6 +1414,18 @@ msgstr "Todavía no hay carritos guardados."
msgid "There are no reference or stock row, check the file."
msgstr "No hay columna de referencia o stock, comprueba el archivo."
+#. module: purchase_portal
+#: code:addons/purchase_portal/models/purchase_request.py:0
+#, python-format
+msgid "There are no sellers allowed for this request."
+msgstr "No hay proveedores para esta solicitud."
+
+#. module: purchase_portal
+#: code:addons/purchase_portal/models/purchase_request.py:0
+#, python-format
+msgid "There are no sellers for this product in the current company."
+msgstr "No hay proveedores para este producto en la compañía actual."
+
#. module: purchase_portal
#: model:ir.model,name:purchase_portal.model_stock_picking
msgid "Transfer"
@@ -1048,12 +1434,12 @@ msgstr "Albarán"
#. module: purchase_portal
#: model_terms:ir.ui.view,arch_db:purchase_portal.portal_new_purchase_request_page
msgid "UOM"
-msgstr ""
+msgstr "UdM"
#. module: purchase_portal
#: model:ir.model.fields,field_description:purchase_portal.field_purchase_request_saved_cart__user_id
msgid "User"
-msgstr ""
+msgstr "Usuario"
#. module: purchase_portal
#: model:ir.model.fields,field_description:purchase_portal.field_res_users__banned_product_ids
@@ -1066,7 +1452,14 @@ msgid "Users"
msgstr "Usuarios"
#. module: purchase_portal
+#: model_terms:ir.ui.view,arch_db:purchase_portal.portal_stock_picking_page
+msgid "Validate"
+msgstr "Validar"
+
+#. module: purchase_portal
+#: model:ir.model.fields,field_description:purchase_portal.field_channel_wubook_pms_property_availability__seller_commercial_ids
#: model:ir.model.fields,field_description:purchase_portal.field_channel_wubook_pms_property_availability__seller_ids
+#: model:ir.model.fields,field_description:purchase_portal.field_pms_property__seller_commercial_ids
#: model:ir.model.fields,field_description:purchase_portal.field_pms_property__seller_ids
msgid "Vendors allowed in this property"
msgstr "Proveedores permitidos en este hotel"
@@ -1091,7 +1484,7 @@ msgstr ""
#. module: purchase_portal
#: model_terms:ir.ui.view,arch_db:purchase_portal.import_supplier_data_wizard_form
msgid "or"
-msgstr ""
+msgstr "o"
#. module: purchase_portal
#: model_terms:ir.ui.view,arch_db:purchase_portal.portal_product_product
@@ -1117,15 +1510,3 @@ msgstr ""
#: model_terms:ir.ui.view,arch_db:purchase_portal.portal_my_stock_pickings
msgid "stock_pickings"
msgstr ""
-
-#. module: purchase_portal
-#: code:addons/purchase_portal/models/purchase_request.py:0
-#, python-format
-msgid "There are no sellers allowed for this request."
-msgstr "No hay proveedores para esta solicitud."
-
-#. module: purchase_portal
-#: code:addons/purchase_portal/models/purchase_request.py:0
-#, python-format
-msgid "There are no sellers for this product in the current company."
-msgstr "No hay proveedores para este producto en la compañía actual."
diff --git a/purchase_portal/models/__init__.py b/purchase_portal/models/__init__.py
index 9c7b368..296bcc4 100755
--- a/purchase_portal/models/__init__.py
+++ b/purchase_portal/models/__init__.py
@@ -29,3 +29,4 @@
from . import product_supplierinfo
from . import res_partner
from . import request_saved_cart
+from . import stock_move
diff --git a/purchase_portal/models/pms_property.py b/purchase_portal/models/pms_property.py
index be3eafc..f4c702a 100644
--- a/purchase_portal/models/pms_property.py
+++ b/purchase_portal/models/pms_property.py
@@ -17,13 +17,22 @@
# along with this program. If not, see .
#
##############################################################################
-from odoo import fields, models, api, _
-from odoo.exceptions import AccessDenied
+from odoo import fields, models, api
class PMSProperty(models.Model):
_inherit = 'pms.property'
-
+ seller_ids = fields.Many2many('res.partner', string='Vendors allowed in this property')
+ seller_commercial_ids = fields.Many2many(
+ 'res.partner',
+ string='Vendors commercial allowed in this property',
+ relation="pms_property_seller_commercial_rel",
+ column1="seller_id",
+ column2="commercial_id",
+ compute="_compute_seller_commercial_ids",
+ store=True
+ )
+
product_ids = fields.Many2many(
'product.product',
string='Allowed products',
@@ -31,13 +40,43 @@ class PMSProperty(models.Model):
column1="product_id",
column2="property_id",
)
- seller_ids = fields.Many2many('res.partner', string='Vendors allowed in this property')
+
+ product_seller_ids = fields.Many2many(
+ 'product.product',
+ string='Allowed products by seller',
+ relation="pms_property_product_product_seller_rel",
+ column1="product_id",
+ column2="property_id",
+ )
+
wharehouse_id = fields.Many2one('stock.warehouse', 'Warehouse')
- @api.onchange("seller_ids")
+ @api.depends('seller_ids')
+ def _compute_seller_commercial_ids(self):
+ for record in self:
+ record.seller_commercial_ids = record.seller_ids.mapped('commercial_partner_id')
+
+ @api.onchange("seller_ids", "seller_commercial_ids")
def onchange_seller_ids(self):
- if self.seller_ids:
- seller_products = self.env['product.supplierinfo'].search([('name', 'in', self.seller_ids.ids)])
- seller_product_product = seller_products.mapped('product_tmpl_id.product_variant_ids')
- seller_product_product += seller_products.mapped('product_id')
- self.product_ids = [(6, 0, seller_product_product.ids)]
+ for hotel in self:
+ if hotel.seller_ids:
+ seller_products = self.env['product.supplierinfo'].search([
+ '|',
+ ('name', 'in', hotel.seller_ids.ids),
+ ('name', 'in', hotel.seller_commercial_ids.ids)
+ ])
+ seller_product_product = seller_products.mapped('product_tmpl_id.product_variant_ids')
+ seller_product_product += seller_products.mapped('product_id')
+ hotel.product_seller_ids = [(6, 0, seller_product_product.ids)]
+ else:
+ hotel.product_seller_ids = [(5,)]
+
+ def action_load_all_seller_products(self):
+ for prop in self:
+ prop.onchange_seller_ids()
+ prop.product_ids = prop.product_seller_ids
+
+ def action_remove_products_not_in_sellers(self):
+ for prop in self:
+ prop.onchange_seller_ids()
+ prop.product_ids = [(6, 0, prop.product_ids.filtered(lambda x: x.id in prop.product_seller_ids.ids).ids)]
diff --git a/purchase_portal/models/pos_config.py b/purchase_portal/models/pos_config.py
index 66093eb..9532c99 100644
--- a/purchase_portal/models/pos_config.py
+++ b/purchase_portal/models/pos_config.py
@@ -18,12 +18,7 @@
#
##############################################################################
-from datetime import datetime
-from uuid import uuid4
-import pytz
-
-from odoo import api, fields, models, tools, _
-from odoo.exceptions import ValidationError, UserError
+from odoo import models
class PosConfig(models.Model):
diff --git a/purchase_portal/models/pos_order.py b/purchase_portal/models/pos_order.py
index 3315e09..c985a16 100644
--- a/purchase_portal/models/pos_order.py
+++ b/purchase_portal/models/pos_order.py
@@ -17,17 +17,17 @@
# along with this program. If not, see .
#
##############################################################################
-from odoo import fields, models, api, _
+from odoo import models, api, _
from odoo.exceptions import AccessDenied
class PosOrder(models.Model):
_inherit = 'pos.order'
-
+
@api.model
def _process_order(self, order, draft, existing_order):
order_data = order['data']
pos_session = self.env['pos.session'].browse(order_data['pos_session_id'])
if pos_session.state == 'closing_control' or pos_session.state == 'closed':
raise AccessDenied(_("NO PUEDES CREAR SESIONES DE RESCATE"))
- return super()._process_order(order, draft, existing_order)
+ return super()._process_order(order, draft, existing_order)
diff --git a/purchase_portal/models/pos_session.py b/purchase_portal/models/pos_session.py
index 4047872..d4c8c32 100644
--- a/purchase_portal/models/pos_session.py
+++ b/purchase_portal/models/pos_session.py
@@ -16,14 +16,9 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see .
#
-##############################################################################.
+###############################################################################
-from collections import defaultdict
-from datetime import timedelta
-
-from odoo import api, fields, models, _
-from odoo.exceptions import AccessError, UserError, ValidationError
-from odoo.tools import float_is_zero, float_compare
+from odoo import api, models
class PosSession(models.Model):
@@ -41,4 +36,4 @@ def create(self, values):
'statement_ids': [(6, 0, statement_ids)],
})
res._compute_cash_all()
- return res
+ return res
diff --git a/purchase_portal/models/product_product.py b/purchase_portal/models/product_product.py
index caf60d2..7cd6d85 100644
--- a/purchase_portal/models/product_product.py
+++ b/purchase_portal/models/product_product.py
@@ -17,13 +17,12 @@
# along with this program. If not, see .
#
##############################################################################
-from odoo import fields, models, api, _
-from odoo.exceptions import AccessDenied
+from odoo import fields, models
class ProductProduct(models.Model):
_inherit = 'product.product'
-
+
purchase_property_ids = fields.Many2many(
'pms.property',
string='Allowed in properties',
@@ -40,14 +39,14 @@ def get_supplier_stock(self, purchase_request):
if seller:
supplier_stock = seller.supplier_stock
return supplier_stock
-
+
def get_supplier_lowest_price(self):
self.ensure_one()
lowest_price = self.standard_price
if self.seller_ids:
lowest_price = self.seller_ids.sorted(key=lambda r: r.price)[0].price
return lowest_price
-
+
def get_first_attachment(self):
self.ensure_one()
return self.env['ir.attachment'].search([('res_model', '=', 'product.template'), ('res_id', '=', self.product_tmpl_id.id)], limit=1)
diff --git a/purchase_portal/models/product_supplierinfo.py b/purchase_portal/models/product_supplierinfo.py
index 3b58f8d..58a90c2 100644
--- a/purchase_portal/models/product_supplierinfo.py
+++ b/purchase_portal/models/product_supplierinfo.py
@@ -17,20 +17,36 @@
# along with this program. If not, see .
#
##############################################################################
-from odoo import fields, models, api, _
-from odoo.exceptions import AccessDenied
+from odoo import fields, models, api
class ProductSupplierinfo(models.Model):
_inherit = 'product.supplierinfo'
-
+
supplier_stock = fields.Float('Supplier stock')
@api.model
def create(self, values):
ctx = self.env.context.copy()
res = super(ProductSupplierinfo, self.with_context(ctx).sudo()).create(values)
- properties = self.env['pms.property'].search([('seller_ids', 'in', res.name.ids)])
+ properties = self.env['pms.property'].search([
+ '|',
+ ('seller_ids', 'in', res.name.ids),
+ ('seller_commercial_ids', 'in', res.name.ids)
+ ])
+ if properties:
+ properties.onchange_seller_ids()
+ return res
+
+ @api.model
+ def unlink(self):
+ partner_ids = self.mapped('name')
+ properties = self.env['pms.property'].search([
+ '|',
+ ('seller_ids', 'in', partner_ids.ids),
+ ('seller_commercial_ids', 'in', partner_ids.ids)
+ ])
+ res = super(ProductSupplierinfo, self).unlink()
if properties:
properties.onchange_seller_ids()
- return res
\ No newline at end of file
+ return res
diff --git a/purchase_portal/models/purchase_order.py b/purchase_portal/models/purchase_order.py
index f7a839d..b4c7c4d 100644
--- a/purchase_portal/models/purchase_order.py
+++ b/purchase_portal/models/purchase_order.py
@@ -18,12 +18,8 @@
#
##############################################################################
-from datetime import datetime
-from uuid import uuid4
-import pytz
-
-from odoo import api, fields, models, tools, _
-from odoo.exceptions import ValidationError, UserError
+from odoo import api, fields, models, _
+from odoo.exceptions import UserError
class PurchaseOrder(models.Model):
@@ -38,9 +34,9 @@ def create(self, values):
if wharehouse_id:
values['picking_type_id'] = self.env['stock.picking.type'].search([('warehouse_id', '=', wharehouse_id), ('code', '=', 'incoming')]).id
return super().create(values)
-
+
def button_confirm(self):
force_confirm = self.env.context.get('force_confirm', False)
if not force_confirm and self.partner_id.min_purchase_amount and self.amount_total < self.partner_id.min_purchase_amount:
- raise UserError(_('The minimum purchase amount for {} is {}'.format(self.partner_id.name, self.partner_id.min_purchase_amount)))
+ raise UserError(_('The minimum purchase amount for {} is {}').format(self.partner_id.name, self.partner_id.min_purchase_amount))
return super().button_confirm()
diff --git a/purchase_portal/models/purchase_request.py b/purchase_portal/models/purchase_request.py
index d421934..35652e1 100644
--- a/purchase_portal/models/purchase_request.py
+++ b/purchase_portal/models/purchase_request.py
@@ -20,18 +20,16 @@
import logging
-from datetime import datetime
-from uuid import uuid4
-import pytz
from lxml import etree
from lxml.html import builder as html
-from odoo import api, fields, models, tools, _
-from odoo.exceptions import ValidationError, UserError
+from odoo import api, fields, models, _
+from odoo.exceptions import UserError
from odoo.addons.base.models.ir_mail_server import MailDeliveryException
_logger = logging.getLogger(__name__)
+
class PurchaseRequest(models.Model):
_name = 'purchase.request'
_inherit = ['purchase.request', 'portal.mixin']
@@ -49,9 +47,9 @@ def request_validation(self):
res = super(PurchaseRequest, self).request_validation()
if res.reviewer_ids:
base_url = self.env["ir.config_parameter"].sudo().get_param("web.base.url")
- text = _("A new review {review} has been asigned to you.".format(
+ text = _("A new review {review} has been asigned to you.").format(
review=self.display_name, link=base_url + '/web#id=%s&model=purchase.request&view_type=form' % self.id
- ))
+ )
message = html.DIV(
html.P(_('Hello,')),
html.P(text)
@@ -68,11 +66,11 @@ def request_validation(self):
mail_fattura.send(raise_exception=True)
self.message_post(
body=(_("Mail sent for requested review on %s by %s") % (fields.Datetime.now(), self.env.user.display_name))
- )
+ )
except MailDeliveryException as error:
self.message_post(
body=(_("Error when sending mail for requested review: %s") % (error.args[0]))
- )
+ )
return res
@@ -99,13 +97,13 @@ def create(self, values):
if not min_cost_productinfo:
raise UserError(_('There are no sellers allowed for this request.'))
values['suggested_supplier_id'] = min_cost_productinfo.name.id
- #min_qty = product.seller_ids.filtered(lambda x: x.name.id == request.property_id.seller_id.id).min_qty
+ # min_qty = product.seller_ids.filtered(lambda x: x.name.id == request.property_id.seller_id.id).min_qty
min_qty = min_cost_productinfo.min_qty
if product_qty < min_qty:
- raise UserError(_('The minimum quantity for this product is %s' % min_qty))
+ raise UserError(_('The minimum quantity for this product is %s') % min_qty)
if request.review_ids:
- request.message_post(body=_('New line added by {user}: {product} ({quantity}) '.format(user=self.env.user.name, product=product.name, quantity=product_qty)))
+ request.message_post(body=_('New line added by {user}: {product} ({quantity}) ').format(user=self.env.user.name, product=product.name, quantity=product_qty))
return super().create(values)
def write(self, vals):
@@ -116,17 +114,17 @@ def write(self, vals):
if portal and product_qty:
min_cost_productinfo = self.product_id.seller_ids.filtered(lambda x: x.name.id in self.request_id.property_id.seller_ids.ids).sorted(key=lambda r: r.price)[0]
vals['suggested_supplier_id'] = min_cost_productinfo.name.id
- #min_qty = self.product_id.seller_ids.filtered(lambda x: x.name.id == self.request_id.property_id.seller_id.id).min_qty
+ # min_qty = self.product_id.seller_ids.filtered(lambda x: x.name.id == self.request_id.property_id.seller_id.id).min_qty
min_qty = min_cost_productinfo.min_qty
if product_qty < min_qty:
- raise UserError(_('The minimum quantity for this product is %s' % min_qty))
+ raise UserError(_('The minimum quantity for this product is %s') % min_qty)
if self.request_id.review_ids and not no_msg:
- self.request_id.message_post(body=_('Line edited by {user}: {product} ({old_quantity} -> {quantity}) '.format(user=self.env.user.name, product=self.product_id.name, old_quantity=self.product_qty, quantity=product_qty)))
+ self.request_id.message_post(body=_('Line edited by {user}: {product} ({old_quantity} -> {quantity}) ').format(user=self.env.user.name, product=self.product_id.name, old_quantity=self.product_qty, quantity=product_qty))
return super().write(vals)
def unlink(self):
if self.request_id.review_ids:
- self.request_id.message_post(body=_('Line deleted by {user}: {product} '.format(user=self.env.user.name, product=self.product_id.name)))
+ self.request_id.message_post(body=_('Line deleted by {user}: {product} ').format(user=self.env.user.name, product=self.product_id.name))
return super().unlink()
def _autocreate_purchase_orders_from_lines(self):
diff --git a/purchase_portal/models/request_saved_cart.py b/purchase_portal/models/request_saved_cart.py
index 5a8f783..7b97913 100644
--- a/purchase_portal/models/request_saved_cart.py
+++ b/purchase_portal/models/request_saved_cart.py
@@ -1,13 +1,13 @@
# © 2023 Comunitea
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-from odoo import api, fields, models
+from odoo import fields, models
class WebsiteSavedCart(models.Model):
_name = "purchase.request.saved.cart"
_inherit = "portal.mixin"
-
+
name = fields.Char()
partner_id = fields.Many2one(
'res.partner',
@@ -24,7 +24,7 @@ class WebsiteSavedCart(models.Model):
def _compute_access_url(self):
for cart in self:
cart.access_url = '/my/saved_carts/{}'.format(cart.id)
-
+
def _compute_add_to_cart_url(self):
for cart in self:
cart.add_to_cart_url = '/shop/add_saved_cart/{}'.format(cart.id)
@@ -32,7 +32,7 @@ def _compute_add_to_cart_url(self):
def _compute_add_to_cart_and_delete_url(self):
for cart in self:
cart.add_to_cart_and_delete_url = '/shop/add_and_delete_saved_cart/{}'.format(cart.id)
-
+
def _compute_delete_url(self):
for cart in self:
cart.delete_url = '/shop/delete_saved_cart/{}'.format(cart.id)
@@ -41,7 +41,7 @@ def _compute_delete_url(self):
class WebsiteSavedCartItems(models.Model):
_name = "purchase.request.saved.cart.item"
-
+
cart_id = fields.Many2one(
'purchase.request.saved.cart',
)
@@ -56,4 +56,3 @@ class WebsiteSavedCartItems(models.Model):
def _compute_delete_url(self):
for cart in self:
cart.delete_url = '/shop/delete_saved_cart_item/{}'.format(cart.id)
-
diff --git a/purchase_portal/models/res_partner.py b/purchase_portal/models/res_partner.py
index a0c9231..c049109 100644
--- a/purchase_portal/models/res_partner.py
+++ b/purchase_portal/models/res_partner.py
@@ -17,9 +17,7 @@
# along with this program. If not, see .
#
##############################################################################
-import uuid
-from datetime import date, datetime, timedelta
-from odoo import SUPERUSER_ID, _, api, exceptions, models, fields
+from odoo import models, fields
class ResPartner(models.Model):
diff --git a/purchase_portal/models/res_users.py b/purchase_portal/models/res_users.py
index 640c7a5..1cf951c 100644
--- a/purchase_portal/models/res_users.py
+++ b/purchase_portal/models/res_users.py
@@ -17,9 +17,7 @@
# along with this program. If not, see .
#
##############################################################################
-import uuid
-from datetime import date, datetime, timedelta
-from odoo import SUPERUSER_ID, _, api, exceptions, models, fields
+from odoo import models, fields
class ResUsers(models.Model):
diff --git a/purchase_portal/models/stock_move.py b/purchase_portal/models/stock_move.py
new file mode 100644
index 0000000..9f4e214
--- /dev/null
+++ b/purchase_portal/models/stock_move.py
@@ -0,0 +1,16 @@
+from odoo import models, fields
+
+
+class StockMove(models.Model):
+ _inherit = 'stock.move'
+
+ product_original_qty = fields.Float(
+ 'Original quantity',
+ related='purchase_line_id.product_qty',
+ )
+
+ product_original_qty_uom = fields.Many2one(
+ 'uom.uom',
+ 'Original quantity uom',
+ related='purchase_line_id.product_uom',
+ )
diff --git a/purchase_portal/models/stock_picking.py b/purchase_portal/models/stock_picking.py
index bc89713..7e4a139 100644
--- a/purchase_portal/models/stock_picking.py
+++ b/purchase_portal/models/stock_picking.py
@@ -18,32 +18,28 @@
#
##############################################################################
-from datetime import datetime
-from uuid import uuid4
-import pytz
-from lxml import etree
-from lxml.html import builder as html
-
-from odoo import api, fields, models, tools, _
-from odoo.exceptions import ValidationError, UserError
+from odoo import models, _
class StockPicking(models.Model):
_name = 'stock.picking'
_inherit = ['stock.picking', 'portal.mixin']
- def get_portal_url(self):
- res = super(StockPicking, self).get_portal_url()
- return '/my/stock_pickings/%s' % (self.id) + res
+ def _compute_access_url(self):
+ super(StockPicking, self)._compute_access_url()
+ for picking in self:
+ picking.access_url = '/my/stock_pickings/%s' % (picking.id)
def _create_backorder(self):
res = super(StockPicking, self)._create_backorder()
- if self.env.context.get('backorder_message', False):
- text = self.env.context.get('backorder_message', False)
+ text = self.env.context.get('backorder_message', False)
+ if text:
+ text = str(text)
lines = ""
- for line in res.move_lines:
- lines+= ("Product: {} , quantity: {} ".format(line.product_id.display_name, line.product_qty))
- message = _("Hi {}, ".format(res.partner_id.name)) + text + lines
+
+ for line in res.move_ids:
+ lines += _("Product: {} , quantity: {} ").format(line.product_id.display_name, line.product_qty)
+ message = _("Hi {}, {} {}").format(res.partner_id.name, text, lines)
res.message_post(
body=message, subtype_id=self.env.ref("mail.mt_comment").id
diff --git a/purchase_portal/templates/purchase_request.xml b/purchase_portal/templates/purchase_request.xml
index 78b551e..e6eb486 100644
--- a/purchase_portal/templates/purchase_request.xml
+++ b/purchase_portal/templates/purchase_request.xml
@@ -220,7 +220,8 @@
-
+ Create
+
@@ -278,7 +279,6 @@
Category
Quantity
UOM
- Estimated stock
Seller
@@ -320,9 +320,6 @@
-
-
-
diff --git a/purchase_portal/templates/stock_picking.xml b/purchase_portal/templates/stock_picking.xml
index 8147b2c..97a9af4 100644
--- a/purchase_portal/templates/stock_picking.xml
+++ b/purchase_portal/templates/stock_picking.xml
@@ -81,6 +81,11 @@
+
+
+
+
+