Browse Source
[FIX] loaded orders date to local https://github.com/OCA/pos/pull/361 cortesy @chienandalu
[FIX] loaded orders date to local https://github.com/OCA/pos/pull/361 cortesy @chienandalu
[FIX] compatibility with pos_restaurant https://github.com/OCA/pos/pull/339 cortesy @carlosDomatix [FIX] add _compute_refund_order_qty [ADD] pos order view form. Add links to original returned order and refund orders. [IMP] when refunding an order via the 'Refund' button in back office, set the correct returned_order_id. [IMP] Add helper on each button [ADD] python test [REF] JS remove useless code [REF] Python remove useless code [FIX] remove bad oldname [FIX] remove gap in bill display, when it is a refund [FIX] when reprinting a bill, the returned order name is displayed, if any [FIX] JS lint, with OCA eslint file [ADD] french translationpull/416/head
Sylvain LE GAL
5 years ago
committed by
Roberto Fichera
13 changed files with 677 additions and 204 deletions
-
1pos_order_mgmt/__manifest__.py
-
249pos_order_mgmt/i18n/fr.po
-
151pos_order_mgmt/i18n/pos_order_mgmt.pot
-
4pos_order_mgmt/models/pos_config.py
-
73pos_order_mgmt/models/pos_order.py
-
1pos_order_mgmt/static/src/css/pos.css
-
36pos_order_mgmt/static/src/js/models.js
-
246pos_order_mgmt/static/src/js/widgets.js
-
16pos_order_mgmt/static/src/xml/pos.xml
-
1pos_order_mgmt/tests/__init__.py
-
80pos_order_mgmt/tests/test_module.py
-
1pos_order_mgmt/views/view_pos_config.xml
-
22pos_order_mgmt/views/view_pos_order.xml
@ -0,0 +1,249 @@ |
|||
# Translation of Odoo Server. |
|||
# This file contains the translation of the following modules: |
|||
# * pos_order_mgmt |
|||
# |
|||
msgid "" |
|||
msgstr "" |
|||
"Project-Id-Version: Odoo Server 12.0\n" |
|||
"Report-Msgid-Bugs-To: \n" |
|||
"POT-Creation-Date: 2019-07-15 20:54+0000\n" |
|||
"PO-Revision-Date: 2019-07-15 20:54+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_order_mgmt |
|||
#: model_terms:ir.ui.view,arch_db:pos_order_mgmt.view_pos_config_form |
|||
msgid "Allow to duplicate done orders in this POS" |
|||
msgstr "Autoriser à dupliquer des commandes réalisées dans l'interface tactile" |
|||
|
|||
#. module: pos_order_mgmt |
|||
#: model_terms:ir.ui.view,arch_db:pos_order_mgmt.view_pos_config_form |
|||
msgid "Allow to reprint done orders in this POS" |
|||
msgstr "Autoriser à réimprimer des commandes réalisées dans l'interface tactile" |
|||
|
|||
#. module: pos_order_mgmt |
|||
#: model_terms:ir.ui.view,arch_db:pos_order_mgmt.view_pos_config_form |
|||
msgid "Allow to return done orders in this POS" |
|||
msgstr "Autoriser à rembourser des commandes réalisées dans l'interface tactile" |
|||
|
|||
#. module: pos_order_mgmt |
|||
#: model:ir.model.fields,help:pos_order_mgmt.field_pos_config__iface_copy_done_order |
|||
msgid "Allows to duplicate already done orders in the frontend" |
|||
msgstr "Autoriser à dupliquer des commandes réalisées dans l'interface tactile" |
|||
|
|||
#. module: pos_order_mgmt |
|||
#: model:ir.model.fields,help:pos_order_mgmt.field_pos_config__iface_reprint_done_order |
|||
msgid "Allows to reprint already done orders in the frontend" |
|||
msgstr "Autoriser à réimprimer des commandes réalisées dans l'interface tactile" |
|||
|
|||
#. module: pos_order_mgmt |
|||
#: model:ir.model.fields,help:pos_order_mgmt.field_pos_config__iface_return_done_order |
|||
msgid "Allows to return already done orders in the frontend" |
|||
msgstr "Autoriser à rembourser des commandes réalisées dans l'interface tactile" |
|||
|
|||
#. module: pos_order_mgmt |
|||
#. openerp-web |
|||
#: code:addons/pos_order_mgmt/static/src/xml/pos.xml:36 |
|||
#, python-format |
|||
msgid "Amount Total" |
|||
msgstr "Total" |
|||
|
|||
#. module: pos_order_mgmt |
|||
#. openerp-web |
|||
#: code:addons/pos_order_mgmt/static/src/xml/pos.xml:17 |
|||
#, python-format |
|||
msgid "Back" |
|||
msgstr "Retour" |
|||
|
|||
#. module: pos_order_mgmt |
|||
#. openerp-web |
|||
#: code:addons/pos_order_mgmt/static/src/js/widgets.js:341 |
|||
#: code:addons/pos_order_mgmt/static/src/js/widgets.js:396 |
|||
#, python-format |
|||
msgid "Can not execute this action because the POS is currently offline" |
|||
msgstr "Vous ne pouvez pas exécuter cette action, car le Point de Vente est actuellement hors ligne" |
|||
|
|||
#. module: pos_order_mgmt |
|||
#. openerp-web |
|||
#: code:addons/pos_order_mgmt/static/src/js/widgets.js:340 |
|||
#: code:addons/pos_order_mgmt/static/src/js/widgets.js:395 |
|||
#, python-format |
|||
msgid "Connection error" |
|||
msgstr "Erreur de connexion" |
|||
|
|||
#. module: pos_order_mgmt |
|||
#. openerp-web |
|||
#: code:addons/pos_order_mgmt/static/src/xml/pos.xml:61 |
|||
#, python-format |
|||
msgid "Create a new order based on this one" |
|||
msgstr "Créer une nouvelle commande basée sur celle-ci" |
|||
|
|||
#. module: pos_order_mgmt |
|||
#. openerp-web |
|||
#: code:addons/pos_order_mgmt/static/src/xml/pos.xml:64 |
|||
#, python-format |
|||
msgid "Create a refund order of this order" |
|||
msgstr "Rembourser cette commande" |
|||
|
|||
#. module: pos_order_mgmt |
|||
#. openerp-web |
|||
#: code:addons/pos_order_mgmt/static/src/xml/pos.xml:34 |
|||
#, python-format |
|||
msgid "Customer" |
|||
msgstr "Client" |
|||
|
|||
#. module: pos_order_mgmt |
|||
#. openerp-web |
|||
#: code:addons/pos_order_mgmt/static/src/xml/pos.xml:89 |
|||
#: code:addons/pos_order_mgmt/static/src/xml/pos.xml:98 |
|||
#, python-format |
|||
msgid "DUPLICATE" |
|||
msgstr "DUPLICATA" |
|||
|
|||
#. module: pos_order_mgmt |
|||
#. openerp-web |
|||
#: code:addons/pos_order_mgmt/static/src/xml/pos.xml:35 |
|||
#, python-format |
|||
msgid "Date" |
|||
msgstr "Date" |
|||
|
|||
#. module: pos_order_mgmt |
|||
#: model:ir.model.fields,field_description:pos_order_mgmt.field_pos_config__iface_copy_done_order |
|||
#: model_terms:ir.ui.view,arch_db:pos_order_mgmt.view_pos_config_form |
|||
msgid "Duplicate Done Orders" |
|||
msgstr "Copier une commande réalisées" |
|||
|
|||
#. module: pos_order_mgmt |
|||
#: model_terms:ir.ui.view,arch_db:pos_order_mgmt.view_pos_config_form |
|||
msgid "Load Done Order Max Qty." |
|||
msgstr "Quantité maximale de commandes à charger" |
|||
|
|||
#. module: pos_order_mgmt |
|||
#: model:ir.model.fields,field_description:pos_order_mgmt.field_pos_config__iface_load_done_order_max_qty |
|||
msgid "Max. Done Orders Quantity To Load" |
|||
msgstr "Quantité maximale de commandes à charger" |
|||
|
|||
#. module: pos_order_mgmt |
|||
#: model:ir.model.fields,help:pos_order_mgmt.field_pos_config__iface_load_done_order_max_qty |
|||
msgid "Maximum number of orders to load on the PoS at its init. Set it to 0 to load none (it's still possible to load them by ticket code)." |
|||
msgstr "" |
|||
|
|||
#. module: pos_order_mgmt |
|||
#: model_terms:ir.ui.view,arch_db:pos_order_mgmt.view_pos_config_form |
|||
msgid "Maximum number orders to load" |
|||
msgstr "Nombre maximum de commande à charger" |
|||
|
|||
#. module: pos_order_mgmt |
|||
#: model:ir.model,name:pos_order_mgmt.model_pos_config |
|||
msgid "Point of Sale Configuration" |
|||
msgstr "Paramétrage du point de vente" |
|||
|
|||
#. module: pos_order_mgmt |
|||
#: model:ir.model,name:pos_order_mgmt.model_pos_order |
|||
msgid "Point of Sale Orders" |
|||
msgstr "Commandes du point de vente" |
|||
|
|||
#. module: pos_order_mgmt |
|||
#. openerp-web |
|||
#: code:addons/pos_order_mgmt/static/src/xml/pos.xml:58 |
|||
#, python-format |
|||
msgid "Print a duplicate for this order" |
|||
msgstr "Imprimer un duplicata de cette commande" |
|||
|
|||
#. module: pos_order_mgmt |
|||
#. openerp-web |
|||
#: code:addons/pos_order_mgmt/static/src/xml/pos.xml:83 |
|||
#, python-format |
|||
msgid "Rectifies:" |
|||
msgstr "Rectifie : " |
|||
|
|||
#. module: pos_order_mgmt |
|||
#. openerp-web |
|||
#: code:addons/pos_order_mgmt/static/src/xml/pos.xml:33 |
|||
#, python-format |
|||
msgid "Ref." |
|||
msgstr "Réf." |
|||
|
|||
#. module: pos_order_mgmt |
|||
#: model:ir.model.fields,field_description:pos_order_mgmt.field_pos_order__returned_order_reference |
|||
msgid "Reference of the returned Order" |
|||
msgstr "Réference de la vente retournée" |
|||
|
|||
#. module: pos_order_mgmt |
|||
#. openerp-web |
|||
#: code:addons/pos_order_mgmt/static/src/js/widgets.js:242 |
|||
#, python-format |
|||
msgid "Refund " |
|||
msgstr "Rembourse " |
|||
|
|||
#. module: pos_order_mgmt |
|||
#: model:ir.model.fields,field_description:pos_order_mgmt.field_pos_order__refund_order_ids |
|||
msgid "Refund Orders" |
|||
msgstr "Commandes remboursées" |
|||
|
|||
#. module: pos_order_mgmt |
|||
#: model:ir.model.fields,field_description:pos_order_mgmt.field_pos_order__refund_order_qty |
|||
msgid "Refund Orders Quantity" |
|||
msgstr "Nombre de remboursement" |
|||
|
|||
#. module: pos_order_mgmt |
|||
#: model_terms:ir.ui.view,arch_db:pos_order_mgmt.view_pos_order_form |
|||
msgid "Refunds" |
|||
msgstr "Remboursements" |
|||
|
|||
#. module: pos_order_mgmt |
|||
#: model:ir.model.fields,field_description:pos_order_mgmt.field_pos_config__iface_reprint_done_order |
|||
#: model_terms:ir.ui.view,arch_db:pos_order_mgmt.view_pos_config_form |
|||
msgid "Reprint Done Orders" |
|||
msgstr "Réimprimer le ticket d'une commande réalisée" |
|||
|
|||
#. module: pos_order_mgmt |
|||
#: model:ir.model.fields,field_description:pos_order_mgmt.field_pos_config__iface_return_done_order |
|||
#: model_terms:ir.ui.view,arch_db:pos_order_mgmt.view_pos_config_form |
|||
msgid "Return Done Orders" |
|||
msgstr "Retourner une commande réalisée" |
|||
|
|||
#. module: pos_order_mgmt |
|||
#: model:ir.model.fields,field_description:pos_order_mgmt.field_pos_order__returned_order_id |
|||
msgid "Returned Order" |
|||
msgstr "Commande retournée" |
|||
|
|||
#. module: pos_order_mgmt |
|||
#. openerp-web |
|||
#: code:addons/pos_order_mgmt/static/src/xml/pos.xml:74 |
|||
#, python-format |
|||
msgid "Returned order:" |
|||
msgstr "Commande retournée:" |
|||
|
|||
#. module: pos_order_mgmt |
|||
#. openerp-web |
|||
#: code:addons/pos_order_mgmt/static/src/xml/pos.xml:21 |
|||
#, python-format |
|||
msgid "Search Order" |
|||
msgstr "Recherche une commande" |
|||
|
|||
#. module: pos_order_mgmt |
|||
#. openerp-web |
|||
#: code:addons/pos_order_mgmt/static/src/js/widgets.js:358 |
|||
#, python-format |
|||
msgid "Unable to load some order lines because the products are not available in the POS cache.\n" |
|||
"\n" |
|||
"Please check that lines :\n" |
|||
"\n" |
|||
" * " |
|||
msgstr "Impossible de charger certaines lignes de ticket car les produits ne sont pas disponible dans le point de vente\n" |
|||
"Veuillez vérifier les lignes suivantes : \n" |
|||
"\n" |
|||
" * " |
|||
|
|||
#. module: pos_order_mgmt |
|||
#. openerp-web |
|||
#: code:addons/pos_order_mgmt/static/src/js/widgets.js:357 |
|||
#, python-format |
|||
msgid "Unknown Products" |
|||
msgstr "Produit inconnu" |
|||
|
@ -0,0 +1 @@ |
|||
from . import test_module |
@ -0,0 +1,80 @@ |
|||
# Copyright (C) 2019 - Today: GRAP (http://www.grap.coop) |
|||
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain) |
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|||
|
|||
from odoo import fields |
|||
from odoo.tests.common import TransactionCase |
|||
|
|||
|
|||
class TestModule(TransactionCase): |
|||
|
|||
def setUp(self): |
|||
super(TestModule, self).setUp() |
|||
|
|||
# Get Registry |
|||
self.PosOrder = self.env['pos.order'] |
|||
self.AccountPayment = self.env['account.payment'] |
|||
|
|||
# Get Object |
|||
self.pos_product = self.env.ref('point_of_sale.whiteboard_pen') |
|||
self.pricelist = self.env.ref('product.list0') |
|||
self.partner = self.env.ref('base.res_partner_12') |
|||
|
|||
# Create a new pos config and open it |
|||
self.pos_config = self.env.ref('point_of_sale.pos_config_main').copy() |
|||
self.pos_config.open_session_cb() |
|||
|
|||
# Test Section |
|||
def test_load_order(self): |
|||
order = self._create_order() |
|||
orders_data = self.PosOrder.search_done_orders_for_pos( |
|||
[], self.pos_config.current_session_id.id) |
|||
self.assertEqual(len(orders_data), 1) |
|||
self.assertEqual( |
|||
orders_data[0]['id'], order.id) |
|||
|
|||
detail_data = order.load_done_order_for_pos() |
|||
self.assertEqual( |
|||
len(detail_data.get('line_ids', [])), 1, |
|||
"Loading order detail failed") |
|||
|
|||
def _create_order(self): |
|||
# Create order |
|||
order_data = { |
|||
'id': u'0006-001-0010', |
|||
'to_invoice': True, |
|||
'data': { |
|||
'pricelist_id': self.pricelist.id, |
|||
'user_id': 1, |
|||
'name': 'Order 0006-001-0010', |
|||
'partner_id': self.partner.id, |
|||
'amount_paid': 0.9, |
|||
'pos_session_id': self.pos_config.current_session_id.id, |
|||
'lines': [[0, 0, { |
|||
'product_id': self.pos_product.id, |
|||
'price_unit': 0.9, |
|||
'qty': 1, |
|||
'price_subtotal': 0.9, |
|||
'price_subtotal_incl': 0.9, |
|||
}]], |
|||
'statement_ids': [[0, 0, { |
|||
'journal_id': self.pos_config.journal_ids[0].id, |
|||
'amount': 0.9, |
|||
'name': fields.Datetime.now(), |
|||
'account_id': |
|||
self.env.user.partner_id.property_account_receivable_id.id, |
|||
'statement_id': |
|||
self.pos_config.current_session_id.statement_ids[0].id, |
|||
}]], |
|||
'creation_date': u'2018-09-27 15:51:03', |
|||
'amount_tax': 0, |
|||
'fiscal_position_id': False, |
|||
'uid': u'00001-001-0001', |
|||
'amount_return': 0, |
|||
'sequence_number': 1, |
|||
'amount_total': 0.9, |
|||
}} |
|||
|
|||
result = self.PosOrder.create_from_ui([order_data]) |
|||
order = self.PosOrder.browse(result[0]) |
|||
return order |
@ -0,0 +1,22 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!-- Copyright 2018 GRAP - Sylvain LE GAL |
|||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|||
--> |
|||
<odoo> |
|||
|
|||
<record id="view_pos_order_form" model="ir.ui.view"> |
|||
<field name="model">pos.order</field> |
|||
<field name="inherit_id" ref="point_of_sale.view_pos_pos_form"/> |
|||
<field name="arch" type="xml"> |
|||
<field name="session_id" position="after"> |
|||
<field name="returned_order_id" attrs="{'invisible': [('returned_order_id', '=', False)]}" /> |
|||
</field> |
|||
<xpath expr="//div[@name='button_box']" position="inside"> |
|||
<button name="action_view_refund_orders" type="object" icon="fa-undo" class="oe_stat_button" attrs="{'invisible': [('refund_order_qty', '=', 0)]}"> |
|||
<field string="Refunds" name="refund_order_qty" widget="statinfo"/> |
|||
</button> |
|||
</xpath> |
|||
</field> |
|||
</record> |
|||
|
|||
</odoo> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue