diff --git a/beesdoo_pos/__init__.py b/beesdoo_pos/__init__.py
new file mode 100644
index 0000000..0f7cb6b
--- /dev/null
+++ b/beesdoo_pos/__init__.py
@@ -0,0 +1,2 @@
+# -*- coding: utf-8 -*-
+import models
\ No newline at end of file
diff --git a/beesdoo_pos/__openerp__.py b/beesdoo_pos/__openerp__.py
new file mode 100644
index 0000000..965ae88
--- /dev/null
+++ b/beesdoo_pos/__openerp__.py
@@ -0,0 +1,35 @@
+# -*- coding: utf-8 -*-
+{
+ 'name': "Beescoop Point of sale",
+
+ 'summary': """
+ Module that extends the pos for the beescoop
+ """,
+
+ 'description': """
+ Long description of module's purpose
+ """,
+
+ 'author': "Beescoop - Cellule IT",
+ 'website': "https://github.com/beescoop/Obeesdoo",
+
+ # Categories can be used to filter modules in modules listing
+ # Check https://github.com/odoo/odoo/blob/master/openerp/addons/base/module/module_data.xml
+ # for the full list
+ 'category': 'Point Of Sale',
+ 'version': '9.0.1.1.0',
+
+ # any module necessary for this one to work correctly
+ 'depends': ['beesdoo_base', 'beesdoo_product'],
+
+ # always loaded
+ 'data': [
+ 'security/ir.model.access.csv',
+ 'views/beesdoo_pos.xml',
+ 'data/email.xml',
+ 'data/cron.xml',
+ ],
+ 'qweb': ['static/src/xml/templates.xml'],
+ # only loaded in demonstration mode
+}
+
diff --git a/beesdoo_pos/data/cron.xml b/beesdoo_pos/data/cron.xml
new file mode 100644
index 0000000..9ba9ae7
--- /dev/null
+++ b/beesdoo_pos/data/cron.xml
@@ -0,0 +1,14 @@
+
\n" +"\n" +"
\n" +"\n" +"
Bonjour,
Vous trouverez ci-joint votre ticket de caisse en version électronique.
Pour rappel, à partir d'octobre, le Labo market est ouvert les lundis, mardis, mercredis de 17h30 à 20h et les samedis de 10h30 à 16h.
Pour vous inscrire à des permanences BEES, rendez-vous sur http://shift.bees-coop.be/ .
Au plaisir de vous revoir au Labo market.
BEES coop,
" + +#. module: beesdoo_pos +#: model:mail.template,subject:beesdoo_pos.email_send_ticket +msgid "${object.pos_reference}" +msgstr "${object.pos_reference}" + +#. module: beesdoo_pos +#: model:ir.model,name:beesdoo_pos.model_account_bank_statement_cashbox +msgid "Account Bank Statement Cashbox Details" +msgstr "Détails" + +#. module: beesdoo_pos +#. openerp-web +#: code:addons/beesdoo_pos/static/src/xml/templates.xml:17 +#: code:addons/beesdoo_pos/static/src/xml/templates.xml:35 +#, python-format +msgid "Balance:" +msgstr "Balance:" + +#. module: beesdoo_pos +#: model:ir.ui.view,arch_db:beesdoo_pos.beescoop_pos_inherit +msgid "Bill Value" +msgstr "Bill Value" + +#. module: beesdoo_pos +#: model:ir.model.fields,field_description:beesdoo_pos.field_pos_config_bill_value +msgid "Bill value" +msgstr "Bill value" + +#. module: beesdoo_pos +#: code:addons/beesdoo_pos/models/beesdoo_pos.py:38 +#, python-format +msgid "Cannot send the ticket, no email address found on the client" +msgstr "Cannot send the ticket, no email address found on the client" + +#. module: beesdoo_pos +#: model:ir.model.fields,field_description:beesdoo_pos.field_bill_value_create_uid +msgid "Created by" +msgstr "Créé par" + +#. module: beesdoo_pos +#: model:ir.model.fields,field_description:beesdoo_pos.field_bill_value_create_date +msgid "Created on" +msgstr "Créé le" + +#. module: beesdoo_pos +#: model:ir.model.fields,field_description:beesdoo_pos.field_bill_value_display_name +msgid "Display Name" +msgstr "Nom affiché" + +#. module: beesdoo_pos +#: code:addons/beesdoo_pos/models/beesdoo_pos.py:36 +#, python-format +msgid "Error: no order found" +msgstr "Error: no order found" + +#. module: beesdoo_pos +#: model:ir.model.fields,field_description:beesdoo_pos.field_bill_value_id +msgid "ID" +msgstr "ID" + +#. module: beesdoo_pos +#: model:ir.model.fields,field_description:beesdoo_pos.field_bill_value___last_update +msgid "Last Modified on" +msgstr "Dernière modification le" + +#. module: beesdoo_pos +#: model:ir.model.fields,field_description:beesdoo_pos.field_bill_value_write_uid +msgid "Last Updated by" +msgstr "Mis à jour par" + +#. module: beesdoo_pos +#: model:ir.model.fields,field_description:beesdoo_pos.field_bill_value_write_date +msgid "Last Updated on" +msgstr "Mis à jour le" + +#. module: beesdoo_pos +#: model:ir.model.fields,field_description:beesdoo_pos.field_bill_value_name +msgid "Name" +msgstr "Nom" + +#. module: beesdoo_pos +#: model:ir.model,name:beesdoo_pos.model_res_partner +msgid "Partner" +msgstr "Partenaire" + +#. module: beesdoo_pos +#: model:ir.model,name:beesdoo_pos.model_pos_order +msgid "Point of Sale" +msgstr "Point de vente" + +#. module: beesdoo_pos +#: model:ir.model.fields,field_description:beesdoo_pos.field_bill_value_pos +msgid "Pos" +msgstr "Pos" + +#. module: beesdoo_pos +#. openerp-web +#: code:addons/beesdoo_pos/static/src/xml/templates.xml:6 +#, python-format +msgid "Send Receipt By Mail" +msgstr "Send Receipt By Mail" + +#. module: beesdoo_pos +#: model:mail.template,report_name:beesdoo_pos.email_send_ticket +msgid "Ticket ${object.pos_reference}" +msgstr "Ticket ${object.pos_reference}" + +#. module: beesdoo_pos +#: code:addons/beesdoo_pos/models/beesdoo_pos.py:41 +#, python-format +msgid "Ticket sent" +msgstr "Ticket sent" + +#. module: beesdoo_pos +#: model:ir.model,name:beesdoo_pos.model_bill_value +msgid "bill_value" +msgstr "bill_value" + +#. module: beesdoo_pos +#: model:ir.model,name:beesdoo_pos.model_pos_config +msgid "pos.config" +msgstr "pos.config" + diff --git a/beesdoo_pos/models/__init__.py b/beesdoo_pos/models/__init__.py new file mode 100644 index 0000000..e5c2cf4 --- /dev/null +++ b/beesdoo_pos/models/__init__.py @@ -0,0 +1 @@ +import beesdoo_pos \ No newline at end of file diff --git a/beesdoo_pos/models/beesdoo_pos.py b/beesdoo_pos/models/beesdoo_pos.py new file mode 100644 index 0000000..b02f3c7 --- /dev/null +++ b/beesdoo_pos/models/beesdoo_pos.py @@ -0,0 +1,98 @@ +# -*- coding: utf-8 -*- +from openerp import models, fields, api, _ +import logging + +_logger = logging.getLogger(__name__) + +class BeesPOS(models.Model): + _inherit = 'pos.config' + + bill_value = fields.One2many('bill_value', 'pos', copy=True) + +class BillValue(models.Model): + _name = 'bill_value' + _order = 'name asc' + + name = fields.Float(string='Name') + pos = fields.Many2one('pos.config') + +class BeesAccountBankStatement(models.Model): + _inherit = 'account.bank.statement.cashbox' + + def _get_default_line(self): + if not self.env.context.get('active_id'): + return [] + + pos_session_rec = self.env['pos.session'].browse(self.env.context['active_id']) + return [(0, 0, {'coin_value' : bill_value_rec.name, 'subtotal':0.0}) for bill_value_rec in pos_session_rec.config_id.bill_value] + + cashbox_lines_ids = fields.One2many(default=_get_default_line) + +class BeescoopPosOrder(models.Model): + + _inherit = 'pos.order' + + print_status = fields.Selection([('no_print', 'Do not Print'), + ('to_print', 'To print'), + ('printed', 'Printed')], + default="no_print", string="Print Status") + + @api.model + def send_order(self, receipt_name): + order = self.search([('pos_reference', '=', receipt_name)]) + if not order: + return _('Error: no order found') + if not order.partner_id.email: + return _('Cannot send the ticket, no email address found on the client') + order.print_status = 'to_print' + + return _("Ticket will be sent") + + @api.model + def _send_order_cron(self): + mail_template = self.env.ref("beesdoo_pos.email_send_ticket") + _logger.info("Start to send ticket") + for order in self.search([('print_status', '=', 'to_print')]): + if not order.partner_id.email: + continue + + mail_template.send_mail(order.id, force_send=True) + order.print_status = 'printed' + #Make sure we commit the change to not send ticket twice + self.env.cr.commit() + + +class BeescoopPosPartner(models.Model): + _inherit = 'res.partner' + + def _get_eater(self): + eaters = [False, False, False] + for i, eater in enumerate(self.child_eater_ids): + eaters[i] = eater.name + return tuple(eaters) + + @api.multi + def get_eater(self): + eater1, eater2, eater3 = self._get_eater() + return eater1, eater2, eater3 + +from openerp.addons.point_of_sale.report import pos_receipt + +class order_tva_included(pos_receipt.order): + + def __init__(self, cr, uid, name, context): + super(order_tva_included, self).__init__(cr, uid, name, context=context) + self.env = api.Environment(cr, uid, context) + + def netamount(self, order_line_id): + order_line = self.env['pos.order.line'].browse(order_line_id) + if order_line.order_id.config_id.iface_tax_included: + return order_line.price_subtotal_incl + else: + return order_line.price_subtotal + + +class report_order_receipt(models.AbstractModel): + _inherit = 'report.point_of_sale.report_receipt' + _template = 'point_of_sale.report_receipt' + _wrapped_report_class = order_tva_included \ No newline at end of file diff --git a/beesdoo_pos/security/ir.model.access.csv b/beesdoo_pos/security/ir.model.access.csv new file mode 100644 index 0000000..9d85762 --- /dev/null +++ b/beesdoo_pos/security/ir.model.access.csv @@ -0,0 +1,5 @@ +"id","name","model_id/id","group_id/id","perm_read","perm_write","perm_create","perm_unlink" +"bill_value_read_all","Read All","beesdoo_pos.model_bill_value","","True","False","False","False" +"bill_value_accountant_all","All Comptable","beesdoo_pos.model_bill_value","account.group_account_user","True","True","True","True" +"bill_value_pos_manager_all","All POS manager","beesdoo_pos.model_bill_value","point_of_sale.group_pos_manager","True","True","True","True" +"account_bank_statement_cashbox POS user","account.bank.statement.cashbox POS User","account.model_account_bank_statement_cashbox","point_of_sale.group_pos_user","True","True","True","False" diff --git a/beesdoo_pos/static/src/css/beesdoo.css b/beesdoo_pos/static/src/css/beesdoo.css new file mode 100644 index 0000000..66180cd --- /dev/null +++ b/beesdoo_pos/static/src/css/beesdoo.css @@ -0,0 +1,34 @@ +.message-send { + margin: 16px; + text-align: center; +} + +.customer-information { + margin: 16px 24px 16px 24px; + font-weight: bold; + font-size: 16px; +} + +.customer-name { + font-size: 18px; +} + +.pos .actionpad .button.set-customer { + height: 108px; +} + +.pos .actionpad .button .fa-user { + left: 5px; + top: 38px; +} + + +.customer-information-pay { + font-weight: normal; + font-size: 12px; + text-align: left; +} + +.pos .actionpad .button.pay { + height: 108px; +} \ No newline at end of file diff --git a/beesdoo_pos/static/src/js/beesdoo.js b/beesdoo_pos/static/src/js/beesdoo.js new file mode 100644 index 0000000..e28bbdb --- /dev/null +++ b/beesdoo_pos/static/src/js/beesdoo.js @@ -0,0 +1,95 @@ +odoo.define('beescoop.pos', function (require) { + "use strict"; + var module = require("point_of_sale.screens"); + var Model = require('web.DataModel'); + var set_customer_info = function(el_class, value, prefix) { + var el = this.$(el_class); + el.empty(); + if (prefix && value) { + value = prefix + value + } + if (value) { + el.append(value); + } + } + + module.ReceiptScreenWidget = module.ReceiptScreenWidget.include({ + send : function() { + var self = this; + var loaded = new $.Deferred(); + var order = this.pos.get_order().name; + var records = new Model('pos.order').call('send_order', [order], {}, { shadow: false, timeout: 10000}); + records.then(function(result){ + var el = self.$('.message-send') + el.empty(); + el.append('Name | +
---|