Skip to content

Commit

Permalink
[MIG] pos_customer_required: Migration to 12.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Iván Todorovich authored and ivantodorovich committed Jan 31, 2020
1 parent 4d08a16 commit bc3c4d1
Show file tree
Hide file tree
Showing 21 changed files with 117 additions and 175 deletions.
92 changes: 0 additions & 92 deletions pos_customer_required/README.rst

This file was deleted.

1 change: 0 additions & 1 deletion pos_customer_required/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
# -*- coding: utf-8 -*-
from . import models
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2004-Today Apertoso NV (<http://www.apertoso.be>)
# Copyright (C) 2016-Today: La Louve (<http://www.lalouve.net/>)
# Copyright (C) 2019-Today: Druidoo (<https://www.druidoo.io>)
# @author: Jos DE GRAEVE (<Jos.DeGraeve@apertoso.be>)
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html

{
'name': 'Point of Sale Require Customer',
'version': '9.0.1.0.0',
'version': '12.0.1.0.0',
'category': 'Point Of Sale',
'summary': 'Point of Sale Require Customer',
'author': 'Apertoso NV, La Louve, Odoo Community Association (OCA)',
'author': '''
Apertoso NV, La Louve, Odoo Community Association (OCA), Druidoo''',
'website': 'http://www.apertoso.be',
'license': 'AGPL-3',
'depends': [
'point_of_sale',
],
Expand All @@ -21,7 +23,7 @@
'views/pos_order_view.xml',
],
'demo': [
'demo/pos_config.yml',
'demo/pos_config.xml',
],
'installable': True,
}
14 changes: 14 additions & 0 deletions pos_customer_required/demo/pos_config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0"?>
<!--
Copyright (C) 2016-Today: La Louve (<http://www.lalouve.net/>)
Copyright (C) 2019-Today: Druidoo (<https://www.druidoo.io>)
@author: Sylvain LE GAL (https://twitter.com/legalsylvain)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
-->

<odoo>
<!-- POS Config: Require Customer(Required before starting the order) -->
<record id="point_of_sale.pos_config_main" model="pos.config">
<field name="require_customer">order</field>
</record>
</odoo>
7 changes: 0 additions & 7 deletions pos_customer_required/demo/pos_config.yml

This file was deleted.

19 changes: 0 additions & 19 deletions pos_customer_required/migrations/9.0.1.0.0/post-migration.py

This file was deleted.

18 changes: 0 additions & 18 deletions pos_customer_required/migrations/9.0.1.0.0/pre-migration.py

This file was deleted.

1 change: 0 additions & 1 deletion pos_customer_required/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from . import pos_config
from . import pos_order
from . import pos_make_payment
4 changes: 2 additions & 2 deletions pos_customer_required/models/pos_config.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2004-Today Apertoso NV (<http://www.apertoso.be>)
# Copyright (C) 2016-Today: La Louve (<http://www.lalouve.net/>)
# Copyright (C) 2019-Today: Druidoo (<https://www.druidoo.io>)
# @author: Jos DE GRAEVE (<Jos.DeGraeve@apertoso.be>)
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from openerp import fields, models
from odoo import fields, models


class PosConfig(models.Model):
Expand Down
6 changes: 3 additions & 3 deletions pos_customer_required/models/pos_make_payment.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2016-Today: La Louve (<http://www.lalouve.net/>)
# Copyright (C) 2019-Today: Druidoo (<https://www.druidoo.io>)
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).


from openerp import models, api, _
from openerp.exceptions import UserError
from odoo import models, api, _
from odoo.exceptions import UserError


class PosMakePayment(models.TransientModel):
Expand Down
6 changes: 2 additions & 4 deletions pos_customer_required/models/pos_order.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2004-Today Apertoso NV (<http://www.apertoso.be>)
# Copyright (C) 2016-Today: La Louve (<http://www.lalouve.net/>)
# Copyright (C) 2019-Today: Druidoo (<https://www.druidoo.io>)
# @author: Jos DE GRAEVE (<Jos.DeGraeve@apertoso.be>)
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from openerp import fields, models, exceptions, api
from openerp.tools.translate import _
from odoo import fields, models, exceptions, api, _


class PosOrder(models.Model):
Expand All @@ -24,7 +23,6 @@ def compute_require_customer(self):
help="True if a customer is required to begin the order.\n"
"See the PoS Config to change this setting")

@api.one
@api.constrains('partner_id', 'require_customer')
def _check_partner(self):
if (self.session_id.config_id.require_customer == 'order' and
Expand Down
8 changes: 8 additions & 0 deletions pos_customer_required/readme/CONFIGURE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
To configure this module, you need to:

* go to point of sale -> configuration -> point of sales
* select the point of sales you want configure
* search for the "Require Customer" and choose between the following values:
* 'Optional'; (this module has no effect on this PoS config)
* 'Required before paying';
* 'Required before starting the order';
4 changes: 4 additions & 0 deletions pos_customer_required/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
* Jos De Graeve <Jos.DeGraeve@apertoso.be>
* Sylvain LE GAL <https://twitter.com/legalsylvain>
* Pedro M. Baeza <pedro.baeza@gmail.com> ( reviews & feedback )
* Druidoo <https://www.druidoo.io>
28 changes: 28 additions & 0 deletions pos_customer_required/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
This module was written to extend the functionality of odoo pos
and 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.

Two new options are available:

* Customer 'Required before starting the order';
* Customer 'Required before paying';

'Required before starting the order' Option
-------------------------------------------
In the frontend PoS, the default screen is the screen to select customers.

* Users are not allowed to start selling before having selected a customer;
* Users can not 'deselect a customer', only select an other one;

'Required before paying' Option
-------------------------------
In the frontend PoS, the user can start selling, but if the user tries to
make payment and if a customer is not selected, the pos ui will display an
error message.


.. image:: /pos_customer_required/static/description/frontend_pos_error_message.png
3 changes: 3 additions & 0 deletions pos_customer_required/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/184/9.0
6 changes: 3 additions & 3 deletions pos_customer_required/static/src/js/pos_customer_required.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
@author: Jos DE GRAEVE (<Jos.DeGraeve@apertoso.be>)
@author: Sylvain LE GAL (https://twitter.com/legalsylvain)
The licence is in the file __openerp__.py
The licence is in the file __manifest__.py
*/


Expand All @@ -20,7 +20,7 @@ odoo.define('pos_customer_required.pos_customer_required', function (require) {
screens.PaymentScreenWidget.include({
validate_order: function(options) {
if(this.pos.config.require_customer != 'no'
&& !this.pos.get('selectedOrder').get_client()){
&& !this.pos.get_order().get_client()){
this.gui.show_popup('error',{
'title': _t('An anonymous order cannot be confirmed'),
'body': _t('Please select a customer for this order.'),
Expand All @@ -45,7 +45,7 @@ odoo.define('pos_customer_required.pos_customer_required', function (require) {
var _show_screen_ = gui.Gui.prototype.show_screen;
gui.Gui.prototype.show_screen = function(screen_name, params, refresh){
if(this.pos.config.require_customer == 'order'
&& !this.pos.get('selectedOrder').get_client()
&& !this.pos.get_order().get_client()
&& screen_name != 'clientlist'){
// We call first the original screen, to avoid to break the
// 'previous screen' mecanism
Expand Down
6 changes: 3 additions & 3 deletions pos_customer_required/static/src/xml/templates.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
@author: Jos DE GRAEVE (<Jos.DeGraeve@apertoso.be>)
@author: Sylvain LE GAL (https://twitter.com/legalsylvain)
The licence is in the file __openerp__.py
The licence is in the file __manifest__.py
-->

<openerp>
<odoo>
<data>
<template id="assets_frontend" inherit_id="point_of_sale.assets">
<xpath expr="." position="inside">
<script type="text/javascript" src="/pos_customer_required/static/src/js/pos_customer_required.js"/>
</xpath>
</template>
</data>
</openerp>
</odoo>
1 change: 0 additions & 1 deletion pos_customer_required/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
# -*- coding: utf-8 -*-
from . import test_pos

0 comments on commit bc3c4d1

Please sign in to comment.