diff --git a/pos_multi_note/i18n/es.po b/pos_multi_note/i18n/es.po new file mode 100644 index 000000000..d4fec0024 --- /dev/null +++ b/pos_multi_note/i18n/es.po @@ -0,0 +1,157 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_multi_note +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-04-23 10:38+0000\n" +"PO-Revision-Date: 2021-04-23 12:46+0200\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.0.6\n" + +#. module: pos_multi_note +#. openerp-web +#: code:addons/pos_multi_note/static/src/xml/pos_internal_note.xml:45 +#, python-format +msgid "% discount" +msgstr "% descuento" + +#. module: pos_multi_note +#. openerp-web +#: code:addons/pos_multi_note/static/src/js/notes_pos.js:75 +#, python-format +msgid "ADD YOUR MULTIPLE ORDER NOTES" +msgstr "AGREGUE SUS NOTAS DE PEDIDO MÚLTIPLE" + +#. module: pos_multi_note +#: model:ir.model.fields,help:pos_multi_note.field_pos_order_note__pos_note +msgid "Add the description of the order note" +msgstr "Agregue la descripción de la nota del pedido" + +#. module: pos_multi_note +#: model:ir.model.fields,help:pos_multi_note.field_pos_config__iface_orderline_notes +msgid "Allow custom notes on Orderlines." +msgstr "Permite las notas del cliente en las líneas del pedido." + +#. module: pos_multi_note +#: model:ir.model.fields,help:pos_multi_note.field_pos_config__note_config +msgid "Allow to write internal note in POS interface" +msgstr "Permitir escribir notas internas en la interfaz TPV" + +#. module: pos_multi_note +#. openerp-web +#: code:addons/pos_multi_note/static/src/xml/pos_internal_note.xml:24 +#, python-format +msgid "Cancel" +msgstr "Cancelar" + +#. module: pos_multi_note +#: model_terms:ir.actions.act_window,help:pos_multi_note.action_view_order_notes +msgid "Create New Order Note" +msgstr "Crear nueva nota de pedido" + +#. module: pos_multi_note +#: model:ir.model.fields,field_description:pos_multi_note.field_pos_order_note__create_uid +msgid "Created by" +msgstr "Creado por" + +#. module: pos_multi_note +#: model:ir.model.fields,field_description:pos_multi_note.field_pos_order_note__create_date +msgid "Created on" +msgstr "Creado el" + +#. module: pos_multi_note +#: model:ir.model.fields,field_description:pos_multi_note.field_pos_order_note__display_name +msgid "Display Name" +msgstr "Nombre a mostrar" + +#. module: pos_multi_note +#: model_terms:ir.ui.view,arch_db:pos_multi_note.view_note +msgid "Enable this for the feature of multi order notes" +msgstr "Habilite esto para la función de notas de varios pedidos" + +#. module: pos_multi_note +#: model:ir.model.fields,field_description:pos_multi_note.field_pos_order_note__id +msgid "ID" +msgstr "" + +#. module: pos_multi_note +#: model:ir.model.fields,field_description:pos_multi_note.field_pos_order_note____last_update +msgid "Last Modified on" +msgstr "Última modificación en" + +#. module: pos_multi_note +#: model:ir.model.fields,field_description:pos_multi_note.field_pos_order_note__write_uid +msgid "Last Updated by" +msgstr "Última actualización por" + +#. module: pos_multi_note +#: model:ir.model.fields,field_description:pos_multi_note.field_pos_order_note__write_date +msgid "Last Updated on" +msgstr "Última actualización el" + +#. module: pos_multi_note +#. openerp-web +#: code:addons/pos_multi_note/static/src/xml/pos_internal_note.xml:6 +#, python-format +msgid "Multi Notes" +msgstr "Múltiples notas" + +#. module: pos_multi_note +#: model:ir.model.fields,field_description:pos_multi_note.field_pos_order_note__pos_note +msgid "Multiple Order Note In POS" +msgstr "Nota de orden múltiple en TPV" + +#. module: pos_multi_note +#. openerp-web +#: code:addons/pos_multi_note/static/src/xml/pos_internal_note.xml:21 +#, python-format +msgid "Ok" +msgstr "Ok" + +#. module: pos_multi_note +#: model:ir.model.fields,field_description:pos_multi_note.field_pos_config__note_config +msgid "Order Line Note" +msgstr "Nota de línea de pedido" + +#. module: pos_multi_note +#: model:ir.actions.act_window,name:pos_multi_note.action_view_order_notes +#: model_terms:ir.ui.view,arch_db:pos_multi_note.view_order_note_form +#: model_terms:ir.ui.view,arch_db:pos_multi_note.view_order_note_tree +msgid "Order Notes" +msgstr "Notas de pedido" + +#. module: pos_multi_note +#: model:ir.model.fields,field_description:pos_multi_note.field_pos_config__iface_orderline_notes +msgid "Orderline Notes" +msgstr "Notas de la Línea de Pedido" + +#. module: pos_multi_note +#: model:ir.ui.menu,name:pos_multi_note.menu_pos_order_note +msgid "POS Order Notes" +msgstr "Notas de pedido de TPV" + +#. module: pos_multi_note +#: model:ir.model,name:pos_multi_note.model_pos_config +msgid "Point of Sale Configuration" +msgstr "Configuración del TPV" + +#. module: pos_multi_note +#. openerp-web +#: code:addons/pos_multi_note/static/src/xml/pos_internal_note.xml:44 +#, python-format +msgid "With a" +msgstr "Con un" + +#. module: pos_multi_note +#: model:ir.model,name:pos_multi_note.model_pos_order_note +msgid "pos.order.note" +msgstr "" diff --git a/pos_quotation_order/README.rst b/pos_quotation_order/README.rst index b4645e3c4..ff02eb8c6 100644 --- a/pos_quotation_order/README.rst +++ b/pos_quotation_order/README.rst @@ -41,4 +41,8 @@ Credits Developer: Aswani pc @ cybrosys +Contributors +============ +* Imanol Aranburu +* Luis J. Salvatierra diff --git a/pos_quotation_order/__manifest__.py b/pos_quotation_order/__manifest__.py index 4a14ea2dc..d30052a39 100644 --- a/pos_quotation_order/__manifest__.py +++ b/pos_quotation_order/__manifest__.py @@ -19,7 +19,7 @@ ############################################################################# { 'name': "Pos Quotation Orders", - 'version': '12.0.1.0.0', + 'version': '12.0.84', 'summary': """Create & Process Quotation from POS""", 'description': """This module allows to create and process quotation orders from POS.""", 'author': "Cybrosys Techno Solutions", diff --git a/pos_quotation_order/i18n/es.po b/pos_quotation_order/i18n/es.po new file mode 100644 index 000000000..111a25e73 --- /dev/null +++ b/pos_quotation_order/i18n/es.po @@ -0,0 +1,415 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_quotation_order +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-04-23 09:50+0000\n" +"PO-Revision-Date: 2021-04-23 12:08+0200\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.0.6\n" + +#. module: pos_quotation_order +#: model_terms:ir.ui.view,arch_db:pos_quotation_order.view_pos_quotation_form +msgid "(update)" +msgstr "(actualizar)" + +#. module: pos_quotation_order +#. openerp-web +#: code:addons/pos_quotation_order/static/src/xml/pos_quotation.xml:61 +#, python-format +msgid "Back" +msgstr "Atrás" + +#. module: pos_quotation_order +#: model_terms:ir.actions.act_window,help:pos_quotation_order.action_pos_quotation_form +msgid "Click to create a new order." +msgstr "Haga clic para crear un nuevo pedido." + +#. module: pos_quotation_order +#. openerp-web +#: code:addons/pos_quotation_order/static/src/xml/pos_quotation.xml:35 +#, python-format +msgid "Close" +msgstr "Salir" + +#. module: pos_quotation_order +#: model:ir.model.fields,field_description:pos_quotation_order.field_pos_quotation__company_id +#: model:ir.model.fields,field_description:pos_quotation_order.field_pos_quotation_line__company_id +msgid "Company" +msgstr "Compañía" + +#. module: pos_quotation_order +#. openerp-web +#: code:addons/pos_quotation_order/static/src/xml/pos_quotation.xml:103 +#, python-format +msgid "Confirm" +msgstr "Confirmar" + +#. module: pos_quotation_order +#: selection:pos.quotation,state:0 +msgid "Confirmed" +msgstr "Confirmado" + +#. module: pos_quotation_order +#. openerp-web +#: code:addons/pos_quotation_order/static/src/xml/pos_quotation.xml:32 +#, python-format +msgid "Create Order" +msgstr "Crear pedido" + +#. module: pos_quotation_order +#. openerp-web +#: code:addons/pos_quotation_order/static/src/xml/pos_quotation.xml:5 +#, python-format +msgid "Create Quotation" +msgstr "Crear presupuesto" + +#. module: pos_quotation_order +#: model:ir.model.fields,field_description:pos_quotation_order.field_pos_quotation__create_uid +#: model:ir.model.fields,field_description:pos_quotation_order.field_pos_quotation_line__create_uid +msgid "Created by" +msgstr "Creado por" + +#. module: pos_quotation_order +#: model:ir.model.fields,field_description:pos_quotation_order.field_pos_quotation__create_date +msgid "Created on" +msgstr "Creado el" + +#. module: pos_quotation_order +#: model:ir.model.fields,field_description:pos_quotation_order.field_pos_quotation_line__create_date +msgid "Creation Date" +msgstr "Fecha de Creación" + +#. module: pos_quotation_order +#: model:ir.model.fields,field_description:pos_quotation_order.field_pos_quotation__partner_id +msgid "Customer" +msgstr "Cliente" + +#. module: pos_quotation_order +#. openerp-web +#: code:addons/pos_quotation_order/static/src/xml/pos_quotation.xml:80 +#, python-format +msgid "Date" +msgstr "Fecha" + +#. module: pos_quotation_order +#. openerp-web +#: code:addons/pos_quotation_order/static/src/xml/pos_quotation.xml:23 +#, python-format +msgid "Delivery Date(yyyy/mm/dd)" +msgstr "Fecha de entrega (yyyy/mm/dd)" + +#. module: pos_quotation_order +#: model:ir.model.fields,field_description:pos_quotation_order.field_pos_quotation_line__discount +msgid "Discount (%)" +msgstr "Descuento (%)" + +#. module: pos_quotation_order +#: model:ir.model.fields,field_description:pos_quotation_order.field_pos_quotation_line__notice +msgid "Discount Notice" +msgstr "Nota de descuento" + +#. module: pos_quotation_order +#: model:ir.model.fields,field_description:pos_quotation_order.field_pos_quotation__display_name +#: model:ir.model.fields,field_description:pos_quotation_order.field_pos_quotation_line__display_name +msgid "Display Name" +msgstr "Nombre mostrado" + +#. module: pos_quotation_order +#: model:ir.model.fields,field_description:pos_quotation_order.field_pos_config__enable_quotation +msgid "Enable Quotation" +msgstr "Habilitar presupuesto" + +#. module: pos_quotation_order +#. openerp-web +#: code:addons/pos_quotation_order/static/src/xml/pos_quotation.xml:28 +#, python-format +msgid "Enter your notes here..." +msgstr "Ingrese sus notas aquí ..." + +#. module: pos_quotation_order +#: model:ir.model.fields,field_description:pos_quotation_order.field_pos_quotation__fiscal_position_id +msgid "Fiscal Position" +msgstr "Posición fiscal" + +#. module: pos_quotation_order +#: model:ir.model.fields,field_description:pos_quotation_order.field_pos_quotation__id +#: model:ir.model.fields,field_description:pos_quotation_order.field_pos_quotation_line__id +msgid "ID" +msgstr "" + +#. module: pos_quotation_order +#: model:ir.model.fields,field_description:pos_quotation_order.field_pos_quotation__note +msgid "Internal Notes" +msgstr "Notas internas" + +#. module: pos_quotation_order +#. openerp-web +#: code:addons/pos_quotation_order/static/src/js/pos_quotation.js:290 +#, python-format +msgid "Invalid Order : Please Add Some Order Lines" +msgstr "Pedido no válido: agregue algunas líneas de pedido" + +#. module: pos_quotation_order +#. openerp-web +#: code:addons/pos_quotation_order/static/src/js/pos_quotation.js:285 +#, python-format +msgid "Invalid Order: Negative Quantity is Not Allowed" +msgstr "Pedido no válido: No se permite una cantidad negativa" + +#. module: pos_quotation_order +#: model:ir.model.fields,field_description:pos_quotation_order.field_pos_quotation____last_update +#: model:ir.model.fields,field_description:pos_quotation_order.field_pos_quotation_line____last_update +msgid "Last Modified on" +msgstr "Última modificación en" + +#. module: pos_quotation_order +#: model:ir.model.fields,field_description:pos_quotation_order.field_pos_quotation__write_uid +#: model:ir.model.fields,field_description:pos_quotation_order.field_pos_quotation_line__write_uid +msgid "Last Updated by" +msgstr "Última actualización por" + +#. module: pos_quotation_order +#: model:ir.model.fields,field_description:pos_quotation_order.field_pos_quotation__write_date +#: model:ir.model.fields,field_description:pos_quotation_order.field_pos_quotation_line__write_date +msgid "Last Updated on" +msgstr "Última actualización el" + +#. module: pos_quotation_order +#: model:ir.model.fields,field_description:pos_quotation_order.field_pos_quotation_line__name +msgid "Line No" +msgstr "Línea Nº" + +#. module: pos_quotation_order +#: model:ir.model,name:pos_quotation_order.model_pos_quotation_line +msgid "Lines of Point of Sale" +msgstr "Líneas de punto de venta" + +#. module: pos_quotation_order +#: model:ir.model.fields,field_description:pos_quotation_order.field_pos_quotation_line__pack_lot_ids +msgid "Lot/serial Number" +msgstr "Lote / Número de serie" + +#. module: pos_quotation_order +#: selection:pos.quotation,state:0 +msgid "New" +msgstr "Nuevo" + +#. module: pos_quotation_order +#: model_terms:ir.ui.view,arch_db:pos_quotation_order.view_pos_quotation_form +msgid "Notes" +msgstr "Notas" + +#. module: pos_quotation_order +#. openerp-web +#: code:addons/pos_quotation_order/static/src/xml/pos_quotation.xml:48 +#, python-format +msgid "OK" +msgstr "OK" + +#. module: pos_quotation_order +#: model:ir.model.fields,field_description:pos_quotation_order.field_pos_quotation__date_order +msgid "Order Date" +msgstr "Fecha de pedido" + +#. module: pos_quotation_order +#: model:ir.model.fields,field_description:pos_quotation_order.field_pos_quotation__lines +msgid "Order Lines" +msgstr "Líneas del pedido" + +#. module: pos_quotation_order +#: model:ir.model.fields,field_description:pos_quotation_order.field_pos_quotation__name +#: model:ir.model.fields,field_description:pos_quotation_order.field_pos_quotation_line__order_id +msgid "Order Ref" +msgstr "Ref. venta" + +#. module: pos_quotation_order +#: model_terms:ir.ui.view,arch_db:pos_quotation_order.view_pos_quotation_form +msgid "Order lines" +msgstr "Líneas de venta" + +#. module: pos_quotation_order +#. openerp-web +#: code:addons/pos_quotation_order/static/src/xml/pos_quotation.xml:79 +#, python-format +msgid "Partner Name" +msgstr "Nombre cliente" + +#. module: pos_quotation_order +#: model:ir.model,name:pos_quotation_order.model_pos_config +msgid "Point of Sale Configuration" +msgstr "Configuración del TPV" + +#. module: pos_quotation_order +#: model:ir.model,name:pos_quotation_order.model_pos_order +msgid "Point of Sale Orders" +msgstr "Pedidos del TPV" + +#. module: pos_quotation_order +#: model_terms:ir.ui.view,arch_db:pos_quotation_order.view_pos_quotation_form +#: model_terms:ir.ui.view,arch_db:pos_quotation_order.view_pos_quotation_tree +msgid "Point of Sale Quotations" +msgstr "Presupuestos del TPV" + +#. module: pos_quotation_order +#: model:ir.model.fields,field_description:pos_quotation_order.field_pos_quotation__pricelist_id +msgid "Pricelist" +msgstr "Tarifa" + +#. module: pos_quotation_order +#: model:ir.model.fields,field_description:pos_quotation_order.field_pos_quotation_line__product_id +msgid "Product" +msgstr "Producto" + +#. module: pos_quotation_order +#: model_terms:ir.ui.view,arch_db:pos_quotation_order.view_pos_quotation_form +msgid "Products" +msgstr "Productos" + +#. module: pos_quotation_order +#: model:ir.model.fields,field_description:pos_quotation_order.field_pos_quotation_line__qty +msgid "Quantity" +msgstr "Cantidad" + +#. module: pos_quotation_order +#: model:ir.ui.menu,name:pos_quotation_order.menu_pos_quotation +#: model_terms:ir.ui.view,arch_db:pos_quotation_order.view_pos_quotation_config_form +msgid "Quotation" +msgstr "Presupuesto" + +#. module: pos_quotation_order +#: model:ir.model.fields,field_description:pos_quotation_order.field_pos_quotation__date_quotation +msgid "Quotation Date" +msgstr "Fecha presupuesto" + +#. module: pos_quotation_order +#. openerp-web +#: code:addons/pos_quotation_order/static/src/xml/pos_quotation.xml:11 +#, python-format +msgid "Quotation List" +msgstr "Lista presupuesto" + +#. module: pos_quotation_order +#: model:ir.model.fields,field_description:pos_quotation_order.field_pos_order__quot_ref +msgid "Quotation Ref" +msgstr "Ref. presupuesto" + +#. module: pos_quotation_order +#. openerp-web +#: code:addons/pos_quotation_order/static/src/js/pos_quotation.js:114 +#, python-format +msgid "Quotation Ref: " +msgstr "Ref. presupuesto: " + +#. module: pos_quotation_order +#. openerp-web +#: code:addons/pos_quotation_order/static/src/xml/pos_quotation.xml:116 +#, python-format +msgid "Quotation Ref:" +msgstr "Ref. presupuesto:" + +#. module: pos_quotation_order +#. openerp-web +#: code:addons/pos_quotation_order/static/src/xml/pos_quotation.xml:78 +#, python-format +msgid "Quotation Reference" +msgstr "Referencia presupuesto" + +#. module: pos_quotation_order +#: model:ir.actions.act_window,name:pos_quotation_order.action_pos_quotation_form +msgid "Quotations" +msgstr "Presupuestos" + +#. module: pos_quotation_order +#. openerp-web +#: code:addons/pos_quotation_order/static/src/xml/pos_quotation.xml:65 +#, python-format +msgid "Search Quotation" +msgstr "Buscar presupuesto" + +#. module: pos_quotation_order +#: model:ir.model.fields,field_description:pos_quotation_order.field_pos_quotation__state +msgid "Status" +msgstr "Estado" + +#. module: pos_quotation_order +#: model:ir.model.fields,field_description:pos_quotation_order.field_pos_quotation_line__price_subtotal_incl +msgid "Subtotal" +msgstr "Subtotal" + +#. module: pos_quotation_order +#: model:ir.model.fields,field_description:pos_quotation_order.field_pos_quotation_line__price_subtotal +msgid "Subtotal w/o Tax" +msgstr "Subtotal neto" + +#. module: pos_quotation_order +#: model:ir.model.fields,field_description:pos_quotation_order.field_pos_quotation__amount_tax +#: model:ir.model.fields,field_description:pos_quotation_order.field_pos_quotation_line__tax_ids +#: model:ir.model.fields,field_description:pos_quotation_order.field_pos_quotation_line__tax_ids_after_fiscal_position +msgid "Taxes" +msgstr "Impuestos" + +#. module: pos_quotation_order +#: model:ir.model.fields,field_description:pos_quotation_order.field_pos_quotation__amount_total +msgid "Total" +msgstr "Total" + +#. module: pos_quotation_order +#. openerp-web +#: code:addons/pos_quotation_order/static/src/xml/pos_quotation.xml:81 +#, python-format +msgid "Total Amount" +msgstr "Cantidad total" + +#. module: pos_quotation_order +#: model:ir.model.fields,field_description:pos_quotation_order.field_pos_quotation_line__price_unit +msgid "Unit Price" +msgstr "Precio unitario" + +#. module: pos_quotation_order +#: model_terms:ir.actions.act_window,help:pos_quotation_order.action_pos_quotation_form +msgid "" +"Use this menu to browse previous quotations. To record new\n" +" quotations, you may use the menu Your Session for\n" +" the touchscreen interface." +msgstr "" +"Utilice este menú para buscar citas anteriores. Para grabar nuevas\n" +" citas, puede utilizar el menú Su sesión para\n" +" la interfaz de pantalla táctil. " + +#. module: pos_quotation_order +#: code:addons/pos_quotation_order/models/pos_quotation.py:194 +#, python-format +msgid "You have to select a pricelist in the sale form !" +msgstr "¡Tienes que seleccionar una tarifa en el formulario de venta!" + +#. module: pos_quotation_order +#: code:addons/pos_quotation_order/models/pos_quotation.py:182 +#, python-format +msgid "" +"You have to select a pricelist in the sale form !\n" +"Please set one before choosing a product." +msgstr "" +"¡Tienes que seleccionar una tarifa en el formulario de venta!\n" +"Configure uno antes de elegir un producto." + +#. module: pos_quotation_order +#: model:ir.model,name:pos_quotation_order.model_pos_quotation +msgid "pos.quotation" +msgstr "" + +#. module: pos_quotation_order +#. openerp-web +#: code:addons/pos_quotation_order/static/src/js/pos_quotation.js:22 +#, python-format +msgid "My Create Quotation" +msgstr "Crear presupuesto" diff --git a/pos_quotation_order/models/pos_quotation.py b/pos_quotation_order/models/pos_quotation.py index 940880f12..15fcef2f6 100644 --- a/pos_quotation_order/models/pos_quotation.py +++ b/pos_quotation_order/models/pos_quotation.py @@ -1,9 +1,9 @@ -# -*- coding: utf-8 -*- - +# Copyright (C) 2019-TODAY Cybrosys Technologies(). +# Copyright 2021 Binovo IT Human Project SL +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). import logging -import psycopg2 from functools import partial -from odoo import models, fields, api, tools, _ +from odoo import models, fields, api, _ from odoo.exceptions import UserError _logger = logging.getLogger(__name__) @@ -12,42 +12,14 @@ _logger = logging.getLogger(__name__) class PosOrder(models.Model): _inherit = 'pos.order' - quot_ref = fields.Many2one('pos.quotation', string='Quotation Ref') + quot_ref = fields.Many2one('pos.quotation', string='Quotation Ref', copy=False) @api.model - def create_from_ui(self, orders): - # Keep only new orders - submitted_references = [o['data']['name'] for o in orders] - pos_order = self.search([('pos_reference', 'in', submitted_references)]) - existing_orders = pos_order.read(['pos_reference']) - existing_references = set([o['pos_reference'] for o in existing_orders]) - orders_to_save = [o for o in orders if o['data']['name'] not in existing_references] - order_ids = [] - quot_ids = [] - for tmp_order in orders_to_save: - to_invoice = tmp_order['to_invoice'] - order = tmp_order['data'] - if to_invoice: - self._match_payment_to_invoice(order) - pos_order = self._process_order(order) - if pos_order.quot_ref: - pos_order.quot_ref.write({'state': 'confirmed'}) - quot_ids.append(pos_order.quot_ref.id) - order_ids.append(pos_order.id) - - try: - pos_order.action_pos_order_paid() - except psycopg2.OperationalError: - # do not hide transactional errors, the order(s) won't be saved! - raise - except Exception as e: - _logger.error('Could not fully process the POS Order: %s', tools.ustr(e)) - - if to_invoice: - pos_order.action_pos_order_invoice() - pos_order.invoice_id.sudo().action_invoice_open() - pos_order.account_move = pos_order.invoice_id.move_id - return order_ids, quot_ids + def _process_order(self, pos_order): + order = super()._process_order(pos_order) + if order.quot_ref: + order.quot_ref.state = 'confirmed' + return order @api.model def _order_fields(self, ui_order): diff --git a/pos_quotation_order/static/src/js/models.js b/pos_quotation_order/static/src/js/models.js index 68480b998..96e030dbd 100644 --- a/pos_quotation_order/static/src/js/models.js +++ b/pos_quotation_order/static/src/js/models.js @@ -1,40 +1,45 @@ +/* Copyright (C) 2019-TODAY Cybrosys Technologies(). + Copyright 2021 Binovo IT Human Project SL + License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +*/ + odoo.define('pos_quotation_order.models', function (require) { -"use strict"; + "use strict"; -var screens = require('point_of_sale.screens'); -var gui = require('point_of_sale.gui'); -var core = require('web.core'); -var rpc = require('web.rpc'); -var models = require('point_of_sale.models'); -var session = require('web.session'); -var QWeb = core.qweb; -var _t = core._t; + var screens = require('point_of_sale.screens'); + var gui = require('point_of_sale.gui'); + var core = require('web.core'); + var rpc = require('web.rpc'); + var models = require('point_of_sale.models'); + var session = require('web.session'); + var QWeb = core.qweb; + var _t = core._t; -models.load_models({ - model: 'pos.quotation', - fields: ['name', 'partner_id','date_order','amount_total','lines','state'], - domain: [['state','=','draft']], - loaded: function(self, quotations){ - self.quotations = quotations; + models.load_models({ + model: 'pos.quotation', + fields: ['name', 'partner_id', 'date_order', 'amount_total', 'lines', 'state'], + domain: [['state', '=', 'draft']], + loaded: function (self, quotations) { + self.quotations = quotations; } }); models.load_models({ - model: 'pos.quotation.line', - fields: ['product_id', 'qty'], - loaded: function(self, quotation_lines){ - self.quotation_lines = quotation_lines; + model: 'pos.quotation.line', + fields: ['product_id', 'qty'], + loaded: function (self, quotation_lines) { + self.quotation_lines = quotation_lines; } }); var _super_order = models.Order.prototype; models.Order = models.Order.extend({ - export_as_JSON: function() { + export_as_JSON: function () { var data = _super_order.export_as_JSON.apply(this, arguments); data.quotation_ref = this.quotation_ref; return data; }, - init_from_JSON: function(json) { + init_from_JSON: function (json) { this.quotation_ref = json.quotation_ref; _super_order.init_from_JSON.call(this, json); }, @@ -43,68 +48,16 @@ models.load_models({ var posmodel_super = models.PosModel.prototype; models.PosModel = models.PosModel.extend({ _save_to_server: function (orders, options) { - if (!orders || !orders.length) { - var result = $.Deferred(); - result.resolve([]); - return result; - } - options = options || {}; var self = this; - var fields = _.find(this.models,function(model){ return model.model === 'pos.quotation'; }).fields; - var timeout = typeof options.timeout === 'number' ? options.timeout : 7500 * orders.length; - var order_ids_to_sync = _.pluck(orders, 'id'); - var args = [_.map(orders, function (order) { - order.to_invoice = options.to_invoice || false; - return order; - })]; - return rpc.query({ - model: 'pos.order', - method: 'create_from_ui', - args: args, - kwargs: {context: session.user_context}, - }, { - timeout: timeout, - shadow: !options.to_invoice - }) - .then(function (server_ids) { - console.log(server_ids) - if (server_ids[1].length != 0){ - console.log("dddddddddddddd") - for (var item in server_ids[1]){ - rpc.query({ - model: 'pos.quotation', - method: 'search_read', - args: [[['id', '=', server_ids[1][item]]], fields], - limit: 1, - }).then(function (quotation){ - console.log(quotation) - var index = self.quotations.indexOf(quotation[0]); - console.log(index) - self.quotations.splice(index, 1); - }); - } + return posmodel_super._save_to_server.apply(this, arguments).then(function (server_ids) { + _.each(orders, function (o) { + if (o.data.quotation_ref) { + var index = self.quotations.indexOf(o.data.quotation_ref); + self.quotations.splice(index, 1); } - _.each(order_ids_to_sync, function (order_id) { - self.db.remove_order(order_id); - }); - self.set('failed',false); - return server_ids[0]; - }).fail(function (type, error){ - if(error.code === 200 ){ - if (error.data.exception_type == 'warning') { - delete error.data.debug; - } - if ((!self.get('failed') || options.show_error) && !options.to_invoice) { - self.gui.show_popup('error-traceback',{ - 'title': error.data.message, - 'body': error.data.debug - }); - } - self.set('failed',error); - } - console.error('Failed to send orders:', orders); }); + return server_ids; + }); } }); - -}); \ No newline at end of file +}); diff --git a/pos_quotation_order/static/src/js/pos_quotation.js b/pos_quotation_order/static/src/js/pos_quotation.js index c05cf0720..7577a8e10 100644 --- a/pos_quotation_order/static/src/js/pos_quotation.js +++ b/pos_quotation_order/static/src/js/pos_quotation.js @@ -18,6 +18,8 @@ var QuotationPopupWidget = PopupWidget.extend({ }), show: function(options){ options = options || {}; + if (options.title === undefined) + options.title = _t('My Create Quotation'); var self = this; this._super(options); this.renderElement(); @@ -111,7 +113,7 @@ var QuotationPopupWidget = PopupWidget.extend({ self.gui.close_popup(); self.pos.delete_current_order(); self.gui.show_popup('pos_quot_result',{ - 'body': _t('Quotation Ref : ')+ order['name'] , + 'body': _t('Quotation Ref: ')+ order['name'] , }); }); } @@ -301,5 +303,13 @@ screens.define_action_button({ } }); +return { + QuotationPopupWidget: QuotationPopupWidget, + QuotationResultPopupWidget: QuotationResultPopupWidget, + QuotationListScreenWidget: QuotationListScreenWidget, + QuotationListButton: QuotationListButton, + QuotationButton: QuotationButton, +}; + }); diff --git a/pos_quotation_order/static/src/xml/pos_quotation.xml b/pos_quotation_order/static/src/xml/pos_quotation.xml index 95ca0674f..6afbdc84a 100644 --- a/pos_quotation_order/static/src/xml/pos_quotation.xml +++ b/pos_quotation_order/static/src/xml/pos_quotation.xml @@ -25,7 +25,7 @@

-