OCA-git-bot
5 years ago
33 changed files with 777 additions and 0 deletions
-
4pos_place/README.rst
-
2pos_place/__init__.py
-
37pos_place/__manifest__.py
-
25pos_place/demo/pos_place.xml
-
18pos_place/demo/res_groups.xml
-
154pos_place/i18n/fr.po
-
3pos_place/models/__init__.py
-
24pos_place/models/pos_config.py
-
18pos_place/models/pos_order.py
-
25pos_place/models/pos_place.py
-
9pos_place/readme/CONFIGURE.rst
-
1pos_place/readme/CONTRIBUTORS.rst
-
5pos_place/readme/DESCRIPTION.rst
-
16pos_place/readme/USAGE.rst
-
1pos_place/report/__init__.py
-
16pos_place/report/report_pos_order.py
-
3pos_place/security/ir.model.access.csv
-
14pos_place/security/ir_module_category.xml
-
18pos_place/security/ir_rule.xml
-
21pos_place/security/res_groups.xml
-
BINpos_place/static/description/pos_front_end_ui.png
-
BINpos_place/static/description/pos_order_tree.png
-
BINpos_place/static/description/pos_place_tree.png
-
BINpos_place/static/description/report_pos_order_graph.png
-
26pos_place/static/src/js/chrome.js
-
56pos_place/static/src/js/gui.js
-
51pos_place/static/src/js/models.js
-
50pos_place/static/src/js/widget.js
-
47pos_place/static/src/xml/pos_place.xml
-
11pos_place/views/templates.xml
-
26pos_place/views/view_pos_config.xml
-
29pos_place/views/view_pos_order.xml
-
67pos_place/views/view_pos_place.xml
@ -0,0 +1,4 @@ |
|||||
|
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
||||
|
!! This file is generated by oca-gen-addon-readme !! |
||||
|
!! changes will be overwritten. !! |
||||
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
@ -0,0 +1,2 @@ |
|||||
|
from . import models |
||||
|
from . import report |
@ -0,0 +1,37 @@ |
|||||
|
# Copyright (C) 2014 - 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). |
||||
|
{ |
||||
|
'name': 'Point of Sale - Places', |
||||
|
'summary': "Define places on PoS orders", |
||||
|
'version': '12.0.1.0.0', |
||||
|
'category': 'Point of Sale', |
||||
|
'author': 'GRAP,Odoo Community Association (OCA)', |
||||
|
'website': 'http://www.github.com/OCA/pos', |
||||
|
'license': 'AGPL-3', |
||||
|
'depends': [ |
||||
|
'point_of_sale', |
||||
|
], |
||||
|
'data': [ |
||||
|
'security/ir_module_category.xml', |
||||
|
'security/ir_rule.xml', |
||||
|
'security/res_groups.xml', |
||||
|
'security/ir.model.access.csv', |
||||
|
'views/templates.xml', |
||||
|
'views/view_pos_config.xml', |
||||
|
'views/view_pos_place.xml', |
||||
|
'views/view_pos_order.xml', |
||||
|
], |
||||
|
'qweb': [ |
||||
|
'static/src/xml/pos_place.xml', |
||||
|
], |
||||
|
'demo': [ |
||||
|
'demo/res_groups.xml', |
||||
|
'demo/pos_place.xml', |
||||
|
], |
||||
|
'images': [ |
||||
|
'static/description/pos_front_end_ui.png', |
||||
|
'static/description/pos_config_form.png', |
||||
|
'static/description/pos_order_search.png', |
||||
|
], |
||||
|
} |
@ -0,0 +1,25 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<!-- |
||||
|
Copyright (C) 2014 - 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). |
||||
|
--> |
||||
|
<odoo> |
||||
|
|
||||
|
<record id="pos_place_MUL" model="pos.place"> |
||||
|
<field name="code">MUL</field> |
||||
|
<field name="name">La Mulatière (69350 - France)</field> |
||||
|
</record> |
||||
|
|
||||
|
<record id="pos_place_OBS" model="pos.place"> |
||||
|
<field name="code">OBS</field> |
||||
|
<field name="name">Montée de L'observance (69009 - France)</field> |
||||
|
</record> |
||||
|
|
||||
|
<record id="pos_place_GAR" model="pos.place"> |
||||
|
<field name="code">GAR</field> |
||||
|
<field name="name">Gare de Francheville (69340 - France)</field> |
||||
|
</record> |
||||
|
|
||||
|
</odoo> |
||||
|
|
@ -0,0 +1,18 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<!-- |
||||
|
Copyright (C) 2014 - 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). |
||||
|
--> |
||||
|
<odoo> |
||||
|
|
||||
|
<record id="base.group_multi_company" model="res.groups"> |
||||
|
<field name="users" eval="[(4, ref('base.user_admin'))]"/> |
||||
|
</record> |
||||
|
|
||||
|
<record id="group_pos_place_manager" model="res.groups"> |
||||
|
<field name="users" eval="[(4, ref('base.user_admin'))]"/> |
||||
|
</record> |
||||
|
|
||||
|
</odoo> |
||||
|
|
@ -0,0 +1,154 @@ |
|||||
|
# Translation of Odoo Server. |
||||
|
# This file contains the translation of the following modules: |
||||
|
# * pos_place |
||||
|
# |
||||
|
msgid "" |
||||
|
msgstr "" |
||||
|
"Project-Id-Version: Odoo Server 12.0\n" |
||||
|
"Report-Msgid-Bugs-To: \n" |
||||
|
"POT-Creation-Date: 2019-07-31 15:58+0000\n" |
||||
|
"PO-Revision-Date: 2019-07-31 15:58+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_place |
||||
|
#: model:ir.model.fields,field_description:pos_place.field_pos_place__active |
||||
|
msgid "Active" |
||||
|
msgstr "Actif" |
||||
|
|
||||
|
#. module: pos_place |
||||
|
#: model:ir.model.fields,field_description:pos_place.field_pos_place__code |
||||
|
#: model_terms:ir.ui.view,arch_db:pos_place.view_pos_place_form |
||||
|
msgid "Code" |
||||
|
msgstr "" |
||||
|
|
||||
|
#. module: pos_place |
||||
|
#: model:ir.model.fields,field_description:pos_place.field_pos_place__company_id |
||||
|
msgid "Company" |
||||
|
msgstr "Société" |
||||
|
|
||||
|
#. module: pos_place |
||||
|
#: model:ir.model.fields,field_description:pos_place.field_pos_place__create_uid |
||||
|
msgid "Created by" |
||||
|
msgstr "Créé par" |
||||
|
|
||||
|
#. module: pos_place |
||||
|
#: model:ir.model.fields,field_description:pos_place.field_pos_place__create_date |
||||
|
msgid "Created on" |
||||
|
msgstr "Créé le" |
||||
|
|
||||
|
#. module: pos_place |
||||
|
#: model:ir.model.fields,field_description:pos_place.field_pos_place__display_name |
||||
|
msgid "Display Name" |
||||
|
msgstr "Nom affiché" |
||||
|
|
||||
|
#. module: pos_place |
||||
|
#: model:ir.model.fields,field_description:pos_place.field_pos_place__id |
||||
|
msgid "ID" |
||||
|
msgstr "" |
||||
|
|
||||
|
#. module: pos_place |
||||
|
#: model:ir.model.fields,field_description:pos_place.field_pos_place____last_update |
||||
|
msgid "Last Modified on" |
||||
|
msgstr "Dernière modification le" |
||||
|
|
||||
|
#. module: pos_place |
||||
|
#: model:ir.model.fields,field_description:pos_place.field_pos_place__write_uid |
||||
|
msgid "Last Updated by" |
||||
|
msgstr "Dernière mise à jour par" |
||||
|
|
||||
|
#. module: pos_place |
||||
|
#: model:ir.model.fields,field_description:pos_place.field_pos_place__write_date |
||||
|
msgid "Last Updated on" |
||||
|
msgstr "Dernière mise à jour le" |
||||
|
|
||||
|
#. module: pos_place |
||||
|
#: model:res.groups,name:pos_place.group_pos_place_manager |
||||
|
msgid "Manager" |
||||
|
msgstr "Gestionnaire" |
||||
|
|
||||
|
#. module: pos_place |
||||
|
#: model:ir.model.fields,field_description:pos_place.field_pos_place__name |
||||
|
#: model_terms:ir.ui.view,arch_db:pos_place.view_pos_place_form |
||||
|
msgid "Name" |
||||
|
msgstr "Nom" |
||||
|
|
||||
|
#. module: pos_place |
||||
|
#. openerp-web |
||||
|
#: code:addons/pos_place/static/src/js/widget.js:40 |
||||
|
#: model:ir.model.fields,field_description:pos_place.field_pos_order__place_id |
||||
|
#: model:ir.model.fields,field_description:pos_place.field_report_pos_order__place_id |
||||
|
#, python-format |
||||
|
msgid "Place" |
||||
|
msgstr "Emplacement" |
||||
|
|
||||
|
#. module: pos_place |
||||
|
#. openerp-web |
||||
|
#: code:addons/pos_place/static/src/xml/pos_place.xml:28 |
||||
|
#: code:addons/pos_place/static/src/xml/pos_place.xml:41 |
||||
|
#, python-format |
||||
|
msgid "Place:" |
||||
|
msgstr "Emplacements : " |
||||
|
|
||||
|
#. module: pos_place |
||||
|
#: model:ir.actions.act_window,name:pos_place.action_pos_place |
||||
|
#: model:ir.ui.menu,name:pos_place.menu_pos_place |
||||
|
msgid "Places" |
||||
|
msgstr "Emplacements" |
||||
|
|
||||
|
#. module: pos_place |
||||
|
#: model:ir.module.category,name:pos_place.module_category_pos_place |
||||
|
msgid "Point of Sale - Places" |
||||
|
msgstr "Point de vente - Emplacements" |
||||
|
|
||||
|
#. module: pos_place |
||||
|
#: model:ir.model,name:pos_place.model_pos_config |
||||
|
msgid "Point of Sale Configuration" |
||||
|
msgstr "Paramétrage du point de vente" |
||||
|
|
||||
|
#. module: pos_place |
||||
|
#: model:ir.model,name:pos_place.model_pos_order |
||||
|
msgid "Point of Sale Orders" |
||||
|
msgstr "Commandes du point de vente" |
||||
|
|
||||
|
#. module: pos_place |
||||
|
#: model:ir.model,name:pos_place.model_report_pos_order |
||||
|
msgid "Point of Sale Orders Report" |
||||
|
msgstr "" |
||||
|
|
||||
|
#. module: pos_place |
||||
|
#: model:ir.model.fields,field_description:pos_place.field_pos_config__group_pos_place_user_id |
||||
|
msgid "Point of Sale Place User Group" |
||||
|
msgstr "" |
||||
|
|
||||
|
#. module: pos_place |
||||
|
#: model:ir.model,name:pos_place.model_pos_place |
||||
|
msgid "Point of Sale Places" |
||||
|
msgstr "Emplacement du Point de vente" |
||||
|
|
||||
|
#. module: pos_place |
||||
|
#. openerp-web |
||||
|
#: code:addons/pos_place/static/src/js/gui.js:31 |
||||
|
#, python-format |
||||
|
msgid "Select a Place" |
||||
|
msgstr "Choisir un emplacement" |
||||
|
|
||||
|
#. module: pos_place |
||||
|
#: model:ir.model.fields,help:pos_place.field_pos_config__group_pos_place_user_id |
||||
|
msgid "This field is there to pass the id of the pos place user group to the point of sale client." |
||||
|
msgstr "" |
||||
|
|
||||
|
#. module: pos_place |
||||
|
#: model:ir.model.fields,field_description:pos_place.field_pos_config__use_pos_place |
||||
|
msgid "Use Point of Sale places" |
||||
|
msgstr "Utiliser les emplacements" |
||||
|
|
||||
|
#. module: pos_place |
||||
|
#: model:res.groups,name:pos_place.group_pos_place_user |
||||
|
msgid "User" |
||||
|
msgstr "Utilisateur" |
||||
|
|
@ -0,0 +1,3 @@ |
|||||
|
from . import pos_place |
||||
|
from . import pos_config |
||||
|
from . import pos_order |
@ -0,0 +1,24 @@ |
|||||
|
# Copyright (C) 2018 - 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 api, fields, models |
||||
|
|
||||
|
|
||||
|
class PosConfig(models.Model): |
||||
|
_inherit = 'pos.config' |
||||
|
|
||||
|
use_pos_place = fields.Boolean( |
||||
|
string="Use Point of Sale places", |
||||
|
default=False) |
||||
|
|
||||
|
group_pos_place_user_id = fields.Many2one( |
||||
|
'res.groups', string='Point of Sale Place User Group', |
||||
|
compute='_compute_group_pos_place_user_id', |
||||
|
help="This field is there to pass the id of the pos place user" |
||||
|
" group to the point of sale client.") |
||||
|
|
||||
|
@api.multi |
||||
|
def _compute_group_pos_place_user_id(self): |
||||
|
for config in self: |
||||
|
config.group_pos_place_user_id =\ |
||||
|
self.env.ref('pos_place.group_pos_place_user') |
@ -0,0 +1,18 @@ |
|||||
|
# Copyright (C) 2015 - 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 api, fields, models |
||||
|
|
||||
|
|
||||
|
class PosOrder(models.Model): |
||||
|
_inherit = 'pos.order' |
||||
|
|
||||
|
# Columns section |
||||
|
place_id = fields.Many2one( |
||||
|
string='Place', comodel_name='pos.place') |
||||
|
|
||||
|
@api.model |
||||
|
def _order_fields(self, ui_order): |
||||
|
res = super()._order_fields(ui_order) |
||||
|
res['place_id'] = ui_order.get('place_id', False) |
||||
|
return res |
@ -0,0 +1,25 @@ |
|||||
|
# Copyright (C) 2015 - 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 models, fields |
||||
|
|
||||
|
|
||||
|
class PosPlace(models.Model): |
||||
|
_name = 'pos.place' |
||||
|
_description = 'Point of Sale Places' |
||||
|
|
||||
|
# Default section |
||||
|
def _default_company_id(self): |
||||
|
return self.env.user.company_id.id |
||||
|
|
||||
|
# Columns section |
||||
|
code = fields.Char(required=True, size=6) |
||||
|
|
||||
|
name = fields.Char(required=True) |
||||
|
|
||||
|
active = fields.Boolean(default=True) |
||||
|
|
||||
|
company_id = fields.Many2one( |
||||
|
string='Company', comodel_name='res.company', |
||||
|
default=_default_company_id) |
@ -0,0 +1,9 @@ |
|||||
|
To configure this module, you need to: |
||||
|
|
||||
|
* Add your users to the new group 'Point of Sale - Places' (User or Manager) |
||||
|
|
||||
|
* Go to Point of Sale / Configuration / Places |
||||
|
|
||||
|
* Create your places |
||||
|
|
||||
|
.. figure:: ../static/description/pos_place_tree.png |
@ -0,0 +1 @@ |
|||||
|
* Sylvain LE GAL <https://twitter.com/legalsylvain> |
@ -0,0 +1,5 @@ |
|||||
|
This module extends the functionality of point of sale to support saling |
||||
|
in the street using the point of sale and to allow you to mention on the |
||||
|
pos order, the place where the seller is for the time being. |
||||
|
|
||||
|
For that purpose, it introduce a new model ``pos.place``. |
@ -0,0 +1,16 @@ |
|||||
|
To use this module, you need to |
||||
|
|
||||
|
* open the point of sale |
||||
|
|
||||
|
* Click on 'Place' Button and select the place where you are |
||||
|
|
||||
|
.. figure:: ../static/description/pos_front_end_ui.png |
||||
|
|
||||
|
* All the next Pos Order will be related to this place. |
||||
|
|
||||
|
.. figure:: ../static/description/pos_order_tree.png |
||||
|
|
||||
|
|
||||
|
* You can then, make statistic over best places |
||||
|
|
||||
|
.. figure:: ../static/description/report_pos_order_graph.png |
@ -0,0 +1 @@ |
|||||
|
from . import report_pos_order |
@ -0,0 +1,16 @@ |
|||||
|
# 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, models |
||||
|
|
||||
|
|
||||
|
class PosOrderReport(models.Model): |
||||
|
_inherit = 'report.pos.order' |
||||
|
|
||||
|
place_id = fields.Many2one( |
||||
|
comodel_name='pos.place', string='Place', readonly=True) |
||||
|
|
||||
|
def _select(self): |
||||
|
res = super()._select() |
||||
|
res += ', s.place_id as place_id' |
||||
|
return res |
@ -0,0 +1,3 @@ |
|||||
|
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink |
||||
|
access_pos_place_user,PoS Places User,model_pos_place,group_pos_place_user,1,,, |
||||
|
access_pos_place_manager,PoS Places Manager,model_pos_place,group_pos_place_manager,1,1,1,1 |
@ -0,0 +1,14 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<!-- |
||||
|
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). |
||||
|
--> |
||||
|
<odoo> |
||||
|
|
||||
|
<record id="module_category_pos_place" model="ir.module.category"> |
||||
|
<field name="name">Point of Sale - Places</field> |
||||
|
</record> |
||||
|
|
||||
|
</odoo> |
||||
|
|
@ -0,0 +1,18 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<!-- |
||||
|
Copyright (C) 2015 - 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). |
||||
|
--> |
||||
|
<odoo noupdate="0"> |
||||
|
|
||||
|
<record id="ir_rule_pos_place" model="ir.rule"> |
||||
|
<field name="name">Point of Sale Places</field> |
||||
|
<field name="model_id" ref="model_pos_place" /> |
||||
|
<field name="global" eval="True" /> |
||||
|
<field name="domain_force">['|', |
||||
|
('company_id', '=', False), |
||||
|
('company_id', '=', user.company_id.id)]</field> |
||||
|
</record> |
||||
|
|
||||
|
</odoo> |
@ -0,0 +1,21 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<!-- |
||||
|
Copyright (C) 2015 - 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). |
||||
|
--> |
||||
|
<odoo> |
||||
|
|
||||
|
<record id="group_pos_place_user" model="res.groups"> |
||||
|
<field name="name">User</field> |
||||
|
<field name="category_id" ref="module_category_pos_place"/> |
||||
|
</record> |
||||
|
|
||||
|
<record id="group_pos_place_manager" model="res.groups"> |
||||
|
<field name="name">Manager</field> |
||||
|
<field name="category_id" ref="module_category_pos_place"/> |
||||
|
<field name="implied_ids" eval="[(4, ref('group_pos_place_user'))]"/> |
||||
|
</record> |
||||
|
|
||||
|
</odoo> |
||||
|
|
After Width: 808 | Height: 452 | Size: 48 KiB |
After Width: 1603 | Height: 474 | Size: 89 KiB |
After Width: 954 | Height: 205 | Size: 24 KiB |
After Width: 828 | Height: 450 | Size: 30 KiB |
@ -0,0 +1,26 @@ |
|||||
|
/** |
||||
|
Copyright (C) 2015 - 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).
|
||||
|
**/ |
||||
|
|
||||
|
odoo.define('pos_place.chrome', function (require) { |
||||
|
"use strict"; |
||||
|
|
||||
|
var chrome = require('point_of_sale.chrome'); |
||||
|
var pos_place_widget = require('pos_place.widgets'); |
||||
|
|
||||
|
chrome.Chrome.include({ |
||||
|
|
||||
|
init: function () { |
||||
|
this.widgets.push({ |
||||
|
'name': 'place_name', |
||||
|
'widget': pos_place_widget.PlaceNameWidget, |
||||
|
'replace': '.placeholder-PlaceNameWidget', |
||||
|
}); |
||||
|
return this._super(arguments[0], {}); |
||||
|
}, |
||||
|
|
||||
|
}); |
||||
|
|
||||
|
}); |
@ -0,0 +1,56 @@ |
|||||
|
/** |
||||
|
Copyright (C) 2015 - 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).
|
||||
|
**/ |
||||
|
|
||||
|
odoo.define('pos_place.gui', function (require) { |
||||
|
"use strict"; |
||||
|
|
||||
|
var gui = require('point_of_sale.gui'); |
||||
|
var core = require('web.core'); |
||||
|
var _t = core._t; |
||||
|
|
||||
|
|
||||
|
gui.Gui.include({ |
||||
|
|
||||
|
select_place: function () { |
||||
|
var def = new $.Deferred(); |
||||
|
var current_place = this.pos.get_place(); |
||||
|
|
||||
|
var list = []; |
||||
|
for (var i = 0; i < this.pos.places.length; i++) { |
||||
|
var item = this.pos.places[i]; |
||||
|
list.push({ |
||||
|
'label': item.code + " - " + item.name, |
||||
|
'item': item, |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
this.show_popup('selection', { |
||||
|
title: _t("Select a Place"), |
||||
|
list: list, |
||||
|
confirm: function (place) { |
||||
|
def.resolve(place); |
||||
|
}, |
||||
|
cancel: function () { |
||||
|
def.resolve(null); |
||||
|
}, |
||||
|
is_selected: function (place) { |
||||
|
if (current_place) { |
||||
|
return place.id === current_place.id; |
||||
|
} |
||||
|
|
||||
|
return false; |
||||
|
|
||||
|
}, |
||||
|
}); |
||||
|
|
||||
|
return def.then(function (place) { |
||||
|
return place; |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
}); |
||||
|
|
||||
|
}); |
@ -0,0 +1,51 @@ |
|||||
|
/** |
||||
|
Copyright (C) 2015 - 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).
|
||||
|
**/ |
||||
|
|
||||
|
odoo.define('pos_place.models', function (require) { |
||||
|
"use strict"; |
||||
|
|
||||
|
var models = require('point_of_sale.models'); |
||||
|
var _super_order = models.Order.prototype; |
||||
|
|
||||
|
// Load pos.place model
|
||||
|
models.load_models({ |
||||
|
model: 'pos.place', |
||||
|
loaded: function (self, places) { |
||||
|
self.places = []; |
||||
|
for (var i = 0; i < places.length; i++) { |
||||
|
self.places.push(places[i]); |
||||
|
} |
||||
|
}, |
||||
|
}); |
||||
|
|
||||
|
// Make place persistent in the session
|
||||
|
models.PosModel = models.PosModel.extend({ |
||||
|
get_place: function () { |
||||
|
return this.get('current_place') || |
||||
|
this.db.load('current_place'); |
||||
|
}, |
||||
|
set_place: function (place) { |
||||
|
this.set('current_place', place); |
||||
|
this.db.save('current_place', place || null); |
||||
|
}, |
||||
|
}); |
||||
|
|
||||
|
models.Order = models.Order.extend({ |
||||
|
export_for_printing: function () { |
||||
|
var res = _super_order.export_for_printing.apply(this, arguments); |
||||
|
res.place = this.pos.get_place(); |
||||
|
return res; |
||||
|
}, |
||||
|
|
||||
|
export_as_JSON: function () { |
||||
|
var json = _super_order.export_as_JSON.apply(this, arguments); |
||||
|
var place = this.pos.get_place(); |
||||
|
json.place_id = place ? place.id : false; |
||||
|
return json; |
||||
|
}, |
||||
|
}); |
||||
|
|
||||
|
}); |
@ -0,0 +1,50 @@ |
|||||
|
/** |
||||
|
Copyright (C) 2015 - 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).
|
||||
|
**/ |
||||
|
|
||||
|
odoo.define('pos_place.widgets', function (require) { |
||||
|
"use strict"; |
||||
|
|
||||
|
var PosBaseWidget = require('point_of_sale.BaseWidget'); |
||||
|
var core = require('web.core'); |
||||
|
var _t = core._t; |
||||
|
|
||||
|
var PlaceNameWidget = PosBaseWidget.extend({ |
||||
|
template: 'PlaceNameWidget', |
||||
|
renderElement: function () { |
||||
|
var self = this; |
||||
|
this._super(); |
||||
|
|
||||
|
this.$el.click(function () { |
||||
|
self.click_place(); |
||||
|
}); |
||||
|
}, |
||||
|
click_place: function () { |
||||
|
var self = this; |
||||
|
this.gui.select_place({}).then(function (place) { |
||||
|
self.pos.set_place(place); |
||||
|
self.renderElement(); |
||||
|
}); |
||||
|
}, |
||||
|
is_visible: function () { |
||||
|
return this.pos.config.use_pos_place && |
||||
|
this.pos.user.groups_id.indexOf( |
||||
|
this.pos.config.group_pos_place_user_id[0]) !== -1; |
||||
|
}, |
||||
|
get_name: function () { |
||||
|
var place = this.pos.get_place(); |
||||
|
if (place) { |
||||
|
return place.code; |
||||
|
} |
||||
|
return _t("Place"); |
||||
|
|
||||
|
}, |
||||
|
}); |
||||
|
|
||||
|
return { |
||||
|
PlaceNameWidget: PlaceNameWidget, |
||||
|
}; |
||||
|
|
||||
|
}); |
@ -0,0 +1,47 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<!-- |
||||
|
Copyright (C) 2015 - 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). |
||||
|
--> |
||||
|
|
||||
|
<templates id="template" xml:space="preserve"> |
||||
|
|
||||
|
<t t-extend="Chrome"> |
||||
|
<t t-jquery=".pos-logo" t-operation="after"> |
||||
|
<span class="placeholder-PlaceNameWidget"></span> |
||||
|
</t> |
||||
|
</t> |
||||
|
|
||||
|
<t t-name="PlaceNameWidget"> |
||||
|
<t t-if="widget.is_visible()"> |
||||
|
<span class="username"> |
||||
|
<t t-esc="widget.get_name()" /> |
||||
|
</span> |
||||
|
</t> |
||||
|
</t> |
||||
|
|
||||
|
<!-- Non Proxy Bill --> |
||||
|
<t t-extend="PosTicket"> |
||||
|
<t t-jquery="[class='receipt-user']" t-operation="after"> |
||||
|
<t t-if="receipt.place"> |
||||
|
<div class="receipt-place"> |
||||
|
Place: <t t-esc="receipt.place.name"/><br /> |
||||
|
</div> |
||||
|
</t> |
||||
|
</t> |
||||
|
</t> |
||||
|
|
||||
|
<!-- Proxy Bill --> |
||||
|
<t t-extend="XmlReceipt"> |
||||
|
<t t-jquery="[t-if='receipt.cashier']" t-operation="after"> |
||||
|
<t t-if='receipt.place'> |
||||
|
<div class='place'> |
||||
|
<div>--------------------------------</div> |
||||
|
<div>Place: <t t-esc='receipt.place.name' /></div> |
||||
|
</div> |
||||
|
</t> |
||||
|
</t> |
||||
|
</t> |
||||
|
|
||||
|
</templates> |
@ -0,0 +1,11 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<odoo> |
||||
|
<template id="assets" inherit_id="point_of_sale.assets"> |
||||
|
<xpath expr="." position="inside"> |
||||
|
<script type="text/javascript" src="/pos_place/static/src/js/widget.js"></script> |
||||
|
<script type="text/javascript" src="/pos_place/static/src/js/chrome.js"></script> |
||||
|
<script type="text/javascript" src="/pos_place/static/src/js/models.js"></script> |
||||
|
<script type="text/javascript" src="/pos_place/static/src/js/gui.js"></script> |
||||
|
</xpath> |
||||
|
</template> |
||||
|
</odoo> |
@ -0,0 +1,26 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<!-- |
||||
|
Copyright (C) 2013 - Today: GRAP (http://www.grap.coop) |
||||
|
@author: Quentin DUPONT (https://twitter.com/pondupont) |
||||
|
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
||||
|
--> |
||||
|
<odoo> |
||||
|
|
||||
|
<record id="view_pos_config_form" model="ir.ui.view"> |
||||
|
<field name="model">pos.config</field> |
||||
|
<field name="inherit_id" ref="point_of_sale.pos_config_view_form" /> |
||||
|
<field name="arch" type="xml"> |
||||
|
<xpath expr="//field[@name='module_pos_restaurant']/../.." position="after"> |
||||
|
<div class="col-12 col-lg-6 o_setting_box"> |
||||
|
<div class="o_setting_left_pane"> |
||||
|
<field name="use_pos_place" groups="pos_place.group_pos_place_manager"/> |
||||
|
</div> |
||||
|
<div class="o_setting_right_pane"> |
||||
|
<label for="use_pos_place" groups="pos_place.group_pos_place_manager"/> |
||||
|
</div> |
||||
|
</div> |
||||
|
</xpath> |
||||
|
</field> |
||||
|
</record> |
||||
|
|
||||
|
</odoo> |
@ -0,0 +1,29 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<!-- |
||||
|
Copyright (C) 2013 - 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). |
||||
|
--> |
||||
|
<odoo> |
||||
|
|
||||
|
<record id="view_pos_order_tree" model="ir.ui.view"> |
||||
|
<field name="model">pos.order</field> |
||||
|
<field name="inherit_id" ref="point_of_sale.view_pos_order_tree" /> |
||||
|
<field name="arch" type="xml"> |
||||
|
<field name="partner_id" position="after"> |
||||
|
<field name="place_id" groups="pos_place.group_pos_place_user"/> |
||||
|
</field> |
||||
|
</field> |
||||
|
</record> |
||||
|
|
||||
|
<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="partner_id" position="after"> |
||||
|
<field name="place_id" groups="pos_place.group_pos_place_user"/> |
||||
|
</field> |
||||
|
</field> |
||||
|
</record> |
||||
|
|
||||
|
</odoo> |
@ -0,0 +1,67 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<!-- |
||||
|
Copyright (C) 2014 - 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). |
||||
|
--> |
||||
|
<odoo> |
||||
|
|
||||
|
<record id="view_pos_place_tree" model="ir.ui.view"> |
||||
|
<field name="model">pos.place</field> |
||||
|
<field name="arch" type="xml"> |
||||
|
<tree> |
||||
|
<field name="code"/> |
||||
|
<field name="name"/> |
||||
|
<field name="company_id" groups="base.group_multi_company"/> |
||||
|
</tree> |
||||
|
</field> |
||||
|
</record> |
||||
|
|
||||
|
<record id="view_pos_place_form" model="ir.ui.view"> |
||||
|
<field name="model">pos.place</field> |
||||
|
<field name="arch" type="xml"> |
||||
|
<form> |
||||
|
<sheet> |
||||
|
<div class="oe_button_box" name="button_box"> |
||||
|
<button name="toggle_active" type="object" class="oe_stat_button" icon="fa-archive"> |
||||
|
<field name="active" widget="boolean_button" options="{"terminology": "archive"}"/> |
||||
|
</button> |
||||
|
</div> |
||||
|
<div class="oe_title"> |
||||
|
<div class="oe_edit_only"> |
||||
|
<label for="code" string="Code"/> |
||||
|
</div> |
||||
|
<h1> |
||||
|
<field name="code"/> |
||||
|
</h1> |
||||
|
<div class="oe_edit_only"> |
||||
|
<label for="name" string="Name"/> |
||||
|
</div> |
||||
|
<h1> |
||||
|
<field name="name"/> |
||||
|
</h1> |
||||
|
</div> |
||||
|
<group> |
||||
|
<group> |
||||
|
<field name="company_id" groups="base.group_multi_company"/> |
||||
|
</group> |
||||
|
</group> |
||||
|
</sheet> |
||||
|
</form> |
||||
|
</field> |
||||
|
</record> |
||||
|
|
||||
|
<record id="action_pos_place" model="ir.actions.act_window"> |
||||
|
<field name="name">Places</field> |
||||
|
<field name="type">ir.actions.act_window</field> |
||||
|
<field name="res_model">pos.place</field> |
||||
|
<field name="view_type">form</field> |
||||
|
<field name="view_mode">tree,form</field> |
||||
|
</record> |
||||
|
|
||||
|
<menuitem id="menu_pos_place" |
||||
|
parent="point_of_sale.menu_point_config_product" |
||||
|
groups="group_pos_place_manager" |
||||
|
action="action_pos_place"/> |
||||
|
|
||||
|
</odoo> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue