Browse Source
New module: Point of Sale Require Customer
New module: Point of Sale Require Customer
This module allows you to require a customer for each pos order. In the pos session configuration, you can choose to require the customer for pos orders. If a customer is not selected, the pos ui will display an error message. In the backend the customer field is required when needed.pull/29/head
Jos De Graeve
10 years ago
8 changed files with 250 additions and 0 deletions
-
2pos_require_customer/__init__.py
-
55pos_require_customer/__openerp__.py
-
54pos_require_customer/i18n/nl_NL.po
-
46pos_require_customer/i18n/pos_require_customer.pot
-
35pos_require_customer/pos_require_customer.py
-
20pos_require_customer/pos_require_customer_view.xml
-
26pos_require_customer/static/src/js/pos_require_customer.js
-
12pos_require_customer/static/src/xml/templates.xml
@ -0,0 +1,2 @@ |
|||
__author__ = 'josdg' |
|||
import pos_require_customer |
@ -0,0 +1,55 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Copyright (C) 2004-2014 Apertoso NV (<http://www.apertoso.be>). |
|||
# |
|||
# This program is free software: you can redistribute it and/or modify |
|||
# it under the terms of the GNU Affero General Public License as |
|||
# published by the Free Software Foundation, either version 3 of the |
|||
# License, or (at your option) any later version. |
|||
# |
|||
# 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 Affero General Public License for more details. |
|||
# |
|||
# You should have received a copy of the GNU Affero General Public License |
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################## |
|||
|
|||
{ |
|||
'name': 'Point of Sale Require Customer', |
|||
'version': '1.0.1', |
|||
'category': 'Point Of Sale', |
|||
'sequence': 6, |
|||
'summary': 'Point of Sale Require Customer', |
|||
'description': """ |
|||
Require customer for pos |
|||
======================== |
|||
|
|||
This module allows you to require a customer for each pos order. In the |
|||
pos session configuration, you can choose to require the customer for pos |
|||
orders. |
|||
|
|||
If a customer is not selected, the pos ui will display an error message. |
|||
In the backend the customer field is required when needed. |
|||
|
|||
""", |
|||
'author': 'Apertoso NV', |
|||
'images': [ ], |
|||
'depends': ['point_of_sale'], |
|||
'data': [ |
|||
'static/src/xml/templates.xml', |
|||
'pos_require_customer_view.xml', |
|||
], |
|||
'demo': [ ], |
|||
'test': [ ], |
|||
'installable': True, |
|||
'application': True, |
|||
'qweb': [ ], |
|||
'website': 'http://www.apertoso.be', |
|||
'auto_install': False, |
|||
} |
|||
|
|||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
@ -0,0 +1,54 @@ |
|||
# Translation of Odoo Server. |
|||
# This file contains the translation of the following modules: |
|||
# * pos_require_customer |
|||
# |
|||
msgid "" |
|||
msgstr "" |
|||
"Project-Id-Version: Odoo Server 8.0\n" |
|||
"Report-Msgid-Bugs-To: \n" |
|||
"POT-Creation-Date: 2015-06-02 11:36+0100\n" |
|||
"PO-Revision-Date: 2015-06-02 11:36+0100\n" |
|||
"Last-Translator: <>\n" |
|||
"Language-Team: \n" |
|||
"Language: nl_NL\n" |
|||
"MIME-Version: 1.0\n" |
|||
"Content-Type: text/plain; charset=UTF-8\n" |
|||
"Content-Transfer-Encoding: 8bit\n" |
|||
"Plural-Forms: nplurals=2; plural=(n != 1);\n" |
|||
"X-Generator: Poedit 1.8\n" |
|||
|
|||
#. module: pos_require_customer |
|||
#. openerp-web |
|||
#: code:addons/pos_require_customer/static/src/js/pos_require_customer.js:16 |
|||
#, python-format |
|||
msgid "An anonymous order cannot be confirmed" |
|||
msgstr "Een anoniem kassa order kan niet worden bevestigd" |
|||
|
|||
#. module: pos_require_customer |
|||
#: view:pos.config:pos_require_customer.view_pos_config_form |
|||
msgid "Customer" |
|||
msgstr "Klant" |
|||
|
|||
#. module: pos_require_customer |
|||
#. openerp-web |
|||
#: code:addons/pos_require_customer/static/src/js/pos_require_customer.js:17 |
|||
#, python-format |
|||
msgid "" |
|||
"Please select a client for this order. This can be done by clicking the " |
|||
"order tab" |
|||
msgstr "" |
|||
"Selecteer een klant voor dit order. Dit kan gedaan worden door te klikken op " |
|||
"de tab bestelling" |
|||
|
|||
#. module: pos_require_customer |
|||
#: field:pos.config,require_customer:0 |
|||
msgid "Require customer" |
|||
msgstr "Klant verplichten" |
|||
|
|||
#. module: pos_require_customer |
|||
#: help:pos.config,require_customer:0 |
|||
msgid "Require customer for orders in this point of sale" |
|||
msgstr "Klant verplichten voor kassa orders in deze kassa." |
|||
|
|||
#~ msgid "Require customer for pos orders in the frontend" |
|||
#~ msgstr "Klant verplichten voor kassa orders in deze kassa." |
@ -0,0 +1,46 @@ |
|||
# Translation of Odoo Server. |
|||
# This file contains the translation of the following modules: |
|||
# * pos_require_customer |
|||
# |
|||
msgid "" |
|||
msgstr "" |
|||
"Project-Id-Version: Odoo Server 8.0\n" |
|||
"Report-Msgid-Bugs-To: \n" |
|||
"POT-Creation-Date: 2015-06-02 09:24+0000\n" |
|||
"PO-Revision-Date: 2015-06-02 09:24+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_require_customer |
|||
#. openerp-web |
|||
#: code:addons/pos_require_customer/static/src/js/pos_require_customer.js:16 |
|||
#, python-format |
|||
msgid "An anonymous order cannot be confirmed" |
|||
msgstr "" |
|||
|
|||
#. module: pos_require_customer |
|||
#: view:pos.config:pos_require_customer.view_pos_config_form |
|||
msgid "Customer" |
|||
msgstr "" |
|||
|
|||
#. module: pos_require_customer |
|||
#. openerp-web |
|||
#: code:addons/pos_require_customer/static/src/js/pos_require_customer.js:17 |
|||
#, python-format |
|||
msgid "Please select a client for this order. This can be done by clicking the order tab" |
|||
msgstr "" |
|||
|
|||
#. module: pos_require_customer |
|||
#: field:pos.config,require_customer:0 |
|||
msgid "Require customer" |
|||
msgstr "" |
|||
|
|||
#. module: pos_require_customer |
|||
#: help:pos.config,require_customer:0 |
|||
msgid "Require customer for orders in this point of sale" |
|||
msgstr "" |
|||
|
@ -0,0 +1,35 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# OpenERP, Open Source Management Solution |
|||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). |
|||
# Copyright (C) 2004-2014 Apertoso NV (<http://www.apertoso.be>). |
|||
# |
|||
# This program is free software: you can redistribute it and/or modify |
|||
# it under the terms of the GNU Affero General Public License as |
|||
# published by the Free Software Foundation, either version 3 of the |
|||
# License, or (at your option) any later version. |
|||
# |
|||
# 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 Affero General Public License for more details. |
|||
# |
|||
# You should have received a copy of the GNU Affero General Public License |
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################## |
|||
|
|||
import logging |
|||
from openerp import fields |
|||
from openerp.models import Model |
|||
|
|||
class pos_config(Model): |
|||
_inherit = 'pos.config' |
|||
|
|||
require_customer = fields.Boolean( |
|||
string='Require customer', |
|||
help='Require customer for orders in this point of sale') |
|||
|
|||
|
|||
|
@ -0,0 +1,20 @@ |
|||
<?xml version="1.0"?> |
|||
<openerp> |
|||
<data> |
|||
|
|||
<record model="ir.ui.view" id="view_pos_config_form"> |
|||
<field name="name">pos.config.form.view</field> |
|||
<field name="model">pos.config</field> |
|||
<field name="inherit_id" |
|||
ref="point_of_sale.view_pos_config_form" /> |
|||
<field name="arch" type="xml"> |
|||
<xpath expr="//group[@string='Receipt']" position="after"> |
|||
<group string="Customer" col="4" > |
|||
<field name='require_customer' /> |
|||
</group> |
|||
</xpath> |
|||
</field> |
|||
</record> |
|||
|
|||
</data> |
|||
</openerp> |
@ -0,0 +1,26 @@ |
|||
openerp.pos_require_customer = function(instance){ |
|||
|
|||
var QWeb = instance.web.qweb, |
|||
_t = instance.web._t; |
|||
var module = instance.point_of_sale; |
|||
|
|||
module.PaymentScreenWidget.include({ |
|||
validate_order: function(options) { |
|||
var self = this; |
|||
options = options || {}; |
|||
|
|||
var currentOrder = this.pos.get('selectedOrder'); |
|||
|
|||
if( this.pos.config.require_customer && !currentOrder.get_client()){ |
|||
self.pos_widget.screen_selector.show_popup('error',{ |
|||
message: _t('An anonymous order cannot be confirmed'), |
|||
comment: _t('Please select a client for this order. This can be done by clicking the order tab') |
|||
}); |
|||
return; |
|||
} |
|||
// else
|
|||
return this._super(options); |
|||
} |
|||
}); |
|||
|
|||
}; |
@ -0,0 +1,12 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<openerp> |
|||
<data> |
|||
|
|||
<template id="assets_frontend" inherit_id="web.assets_common"> |
|||
<xpath expr="." position="inside"> |
|||
<script type="text/javascript" |
|||
src="/pos_require_customer/static/src/js/pos_require_customer.js"/> |
|||
</xpath> |
|||
</template> |
|||
</data> |
|||
</openerp> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue