Browse Source

Merge pull request #146 from beescoop/12.0-mig-beesdoo_pos

[12.0] [MIG] beesdoo_pos
pull/148/head
Rémy Taymans 5 years ago
committed by GitHub
parent
commit
f00561a693
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      beesdoo_pos/__manifest__.py
  2. 13
      beesdoo_pos/data/cron.xml
  3. 23
      beesdoo_pos/data/email.xml
  4. 151
      beesdoo_pos/i18n/fr_BE.po
  5. 84
      beesdoo_pos/models/beesdoo_pos.py
  6. 5
      beesdoo_pos/security/ir.model.access.csv
  7. 69
      beesdoo_pos/static/src/js/beesdoo.js
  8. 13
      beesdoo_pos/static/src/xml/templates.xml
  9. 27
      beesdoo_pos/views/beesdoo_pos.xml

5
beesdoo_pos/__manifest__.py

@ -13,7 +13,7 @@
""",
'description': """
Long description of module's purpose
This module adds the eaters of the customer to the POS ActionpadWidget and PaymentScreenWidget.
""",
'author': "Beescoop - Cellule IT",
@ -25,11 +25,8 @@
'depends': ['beesdoo_base', 'beesdoo_product'],
'data': [
'security/ir.model.access.csv',
'views/beesdoo_pos.xml',
'data/email.xml',
'data/default_barcode_pattern.xml',
'data/cron.xml',
],
'qweb': ['static/src/xml/templates.xml'],

13
beesdoo_pos/data/cron.xml

@ -1,13 +0,0 @@
<odoo>
<data noupdate="1">
<record id="ir_cron_sent_pos_ticket" model="ir.cron">
<field name="name">send ticket</field>
<field name="interval_number">1</field>
<field name="interval_type">minutes</field>
<field name="numbercall">-1</field>
<field name="doall" eval="False" />
<field name="model_id" ref="model_pos_order"/>
<field name="code">model._send_order_cron()</field>
</record>
</data>
</odoo>

23
beesdoo_pos/data/email.xml

@ -1,23 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="1">
<!--Email template -->
<record id="email_send_ticket" model="mail.template">
<field name="name">Envoyer Reçu</field>
<field name="email_from">${(object.user_id.email and '%s &lt;%s&gt;' % (object.user_id.name, object.user_id.email) or '')|safe}</field>
<field name="subject">${object.pos_reference}</field>
<field name="partner_to">${object.partner_id.id}</field>
<field name="model_id" ref="point_of_sale.model_pos_order" />
<field name="auto_delete" eval="True" />
<!-- TODO: will be taken care of in separate 'pos_order_email' module -->
<!--<field name="report_template" ref="point_of_sale.action_report_pos_receipt" />-->
<field name="report_name">Ticket ${object.pos_reference}</field>
<field name="lang">${object.partner_id.lang}</field>
<field name="body_html"><![CDATA[
Votre Ticket ${object.pos_reference}
]]></field>
</record>
</data>
</odoo>

151
beesdoo_pos/i18n/fr_BE.po

@ -1,151 +0,0 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * beesdoo_pos
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-11-13 15:23+0000\n"
"PO-Revision-Date: 2016-11-13 15:23+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: beesdoo_pos
#: model:mail.template,body_html:beesdoo_pos.email_send_ticket
msgid "\n"
"Votre Ticket ${object.pos_reference}\n"
" "
msgstr "<p style=\"margin:0px 0px 10px 0px;font-size:13px;font-family:&quot;Lucida Grande&quot;, Helvetica, Verdana, Arial, sans-serif;\"></p><p style=\"margin:0px 0px 10px 0px;font-size:13px;font-family:&quot;Lucida Grande&quot;, Helvetica, Verdana, Arial, sans-serif;\">\n"
"\n"
"</p><p style=\"margin:0px 0px 10px 0px;font-size:13px;font-family:&quot;Lucida Grande&quot;, Helvetica, Verdana, Arial, sans-serif;\">\n"
"\n"
"</p><p style=\"margin:0px 0px 10px 0px;font-size:13px;font-family:&quot;Lucida Grande&quot;, Helvetica, Verdana, Arial, sans-serif;color: rgb(33, 33, 33)\"><font style=\"font-size: 12px;\">Bonjour,&nbsp;</font></p><p style=\"margin:0px 0px 10px 0px;font-size:13px;font-family:&quot;Lucida Grande&quot;, Helvetica, Verdana, Arial, sans-serif;color: rgb(33, 33, 33)\"><font style=\"font-size: 12px;\">Vous trouverez ci-joint votre ticket de caisse en version électronique.</font></p><p style=\"margin:0px 0px 10px 0px;font-size:13px;font-family:&quot;Lucida Grande&quot;, Helvetica, Verdana, Arial, sans-serif;color: rgb(33, 33, 33)\"><font style=\"font-size: 12px;\">Pour rappel, à partir d'octobre, le Labo market&nbsp;est ouvert les lundis, mardis, mercredis de 17h30 à 20h et les samedis de 10h30 à 16h.</font></p><p style=\"margin:0px 0px 10px 0px;font-size:13px;font-family:&quot;Lucida Grande&quot;, Helvetica, Verdana, Arial, sans-serif;color: rgb(33, 33, 33)\"><font style=\"font-size: 12px;\">Pour vous inscrire à des permanences BEES, rendez-vous sur&nbsp;<a href=\"http://shift.bees-coop.be/\" target=\"_blank\" style=\"cursor:pointer;text-decoration:none;color:rgb(51, 122, 183);background-color:transparent;\">http://shift.bees-coop.be/</a>&nbsp;.</font></p><p style=\"margin:0px 0px 10px 0px;font-size:13px;font-family:&quot;Lucida Grande&quot;, Helvetica, Verdana, Arial, sans-serif;color: rgb(33, 33, 33)\"><font style=\"font-size: 12px;\">Au plaisir de vous revoir au Labo market.</font></p><p style=\"margin:0px 0px 10px 0px;font-size:13px;font-family:&quot;Lucida Grande&quot;, Helvetica, Verdana, Arial, sans-serif;color: rgb(33, 33, 33)\"></p><p style=\"margin:0px 0px 10px 0px;font-size:13px;font-family:&quot;Lucida Grande&quot;, Helvetica, Verdana, Arial, sans-serif;color: rgb(33, 33, 33)\"></p><p style=\"margin:0px 0px 10px 0px;font-size:13px;font-family:&quot;Lucida Grande&quot;, Helvetica, Verdana, Arial, sans-serif;\"></p><p style=\"margin:0px 0px 10px 0px;font-size:13px;font-family:&quot;Lucida Grande&quot;, Helvetica, Verdana, Arial, sans-serif;\"></p><p style=\"margin:0px 0px 10px 0px;font-size:13px;font-family:&quot;Lucida Grande&quot;, Helvetica, Verdana, Arial, sans-serif;color: rgb(33, 33, 33)\"><font style=\"font-size: 12px;\">BEES&nbsp;&nbsp;coop,</font></p><p style=\"margin:0px 0px 10px 0px;font-size:13px;font-family:&quot;Lucida Grande&quot;, Helvetica, Verdana, Arial, sans-serif;color: rgb(33, 33, 33)\"><img src=\"/web/image/9457\" class=\"pull-left\" style=\"float:left;vertical-align:middle;border-image-repeat:initial;border-image-outset:initial;border-image-width:initial;border-image-slice:initial;border-image-source:initial;border-left-color:initial;border-bottom-color:initial;border-right-color:initial;border-top-color:initial;border-left-style:initial;border-bottom-style:initial;border-right-style:initial;border-top-style:initial;border-left-width:0px;border-bottom-width:0px;border-right-width:0px;border-top-width:0px;width: 25%;\"></p><p style=\"margin:0px 0px 10px 0px;font-size:13px;font-family:&quot;Lucida Grande&quot;, Helvetica, Verdana, Arial, sans-serif;color: rgb(33, 33, 33)\"><font style=\"font-size: 12px;\"></font></p><p style=\"margin:0px 0px 10px 0px;font-size:13px;font-family:&quot;Lucida Grande&quot;, Helvetica, Verdana, Arial, sans-serif;color: rgb(33, 33, 33)\"><font style=\"font-size: 12px;\"></font></p><p style=\"margin:0px 0px 10px 0px;font-size:13px;font-family:&quot;Lucida Grande&quot;, Helvetica, Verdana, Arial, sans-serif;\"></p>"
#. 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"

84
beesdoo_pos/models/beesdoo_pos.py

@ -1,64 +1,4 @@
from odoo 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()
from odoo import models, api
class BeescoopPosPartner(models.Model):
@ -74,25 +14,3 @@ class BeescoopPosPartner(models.Model):
def get_eater(self):
eater1, eater2, eater3 = self._get_eater()
return eater1, eater2, eater3
# TODO: will be taken care of in separate 'pos_order_email' module
# from odoo.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

5
beesdoo_pos/security/ir.model.access.csv

@ -1,5 +0,0 @@
"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"

69
beesdoo_pos/static/src/js/beesdoo.js

@ -1,7 +1,6 @@
odoo.define('beescoop.pos', function (require) {
odoo.define('beesdoo_pos.screens', function (require) {
"use strict";
var module = require("point_of_sale.screens");
var Model = require('web.DataModel');
var screens = require("point_of_sale.screens");
var set_customer_info = function(el_class, value, prefix) {
var el = this.$(el_class);
el.empty();
@ -13,38 +12,7 @@ odoo.define('beescoop.pos', function (require) {
}
}
// TODO: will be taken care of in separate 'pos_order_email' module
/* 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('<h2>' + result + '</h2>');
},function(err){
loaded.reject(err);
});
},
renderElement: function() {
var self = this;
this._super();
this.$('.button.send').click(function(){
if (!self._locked) {
self.send();
}
});
},
show: function(){
this._super();
var self = this;
this.$('.message-send').empty();
},
})*/
module.ActionpadWidget = module.ActionpadWidget.include({
screens.ActionpadWidget = screens.ActionpadWidget.include({
renderElement : function() {
var self = this;
var loaded = new $.Deferred();
@ -54,19 +22,26 @@ odoo.define('beescoop.pos', function (require) {
}
var customer_id = this.pos.get_client().id;
var res = new Model('res.partner').call('get_eater',
[ customer_id ], undefined, { shadow: true, timeout: 1000});
res.then(function(result) {
this._rpc({
model: 'res.partner',
method: 'get_eater',
args: [customer_id],
}, {
shadow: true,
}, {
timeout: 1000,
})
.then(function (result) {
set_customer_info.call(self, '.customer-delegate1', result[0], 'Eater 1: ');
set_customer_info.call(self, '.customer-delegate2', result[1], 'Eater 2: ');
set_customer_info.call(self, '.customer-delegate3', result[2], 'Eater 3: ');
}, function(err) {
}).fail(function (type, error){
loaded.reject(err);
});
},
});
module.PaymentScreenWidget.include({
screens.PaymentScreenWidget.include({
render_customer_info : function() {
var self = this;
var loaded = new $.Deferred();
@ -74,13 +49,21 @@ odoo.define('beescoop.pos', function (require) {
return
}
var customer_id = this.pos.get_client().id;
var res = new Model('res.partner').call('get_eater', [ customer_id ], undefined, { shadow: true, timeout: 1000});
res.then(function(result) {
this._rpc({
model: 'res.partner',
method: 'get_eater',
args: [customer_id],
}, {
shadow: true,
}, {
timeout: 1000,
})
.then(function (result) {
set_customer_info.call(self, '.customer-name', self.pos.get_client().name);
set_customer_info.call(self, '.customer-delegate1', result[0], 'Eater 1: ');
set_customer_info.call(self, '.customer-delegate2', result[1], 'Eater 2: ');
set_customer_info.call(self, '.customer-delegate3', result[2], 'Eater 3: ');
}, function(err) {
}).fail(function (type, error){
loaded.reject(err);
});
},

13
beesdoo_pos/static/src/xml/templates.xml

@ -1,18 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates id="template">
<!-- TODO: will be taken care of in separate 'pos_order_email' module -->
<!-- <t t-extend="ReceiptScreenWidget">
<t t-jquery='.pos-receipt-container' t-operation='before'>
<div class="button send">
<i class='fa fa-envelope'></i>
Send Receipt By Mail
</div>
<div class="message-send">
</div>
</t>
</t>
-->
<t t-extend="ActionpadWidget">
<t t-jquery="t[t-if='widget.pos.get_client()']" t-operation="after">
<t t-if="widget.pos.get_client()">

27
beesdoo_pos/views/beesdoo_pos.xml

@ -1,31 +1,4 @@
<odoo>
<record model="ir.ui.view" id="beescoop_pos_inherit">
<field name="name">bees.pos.config.form.view</field>
<field name="model">pos.config</field>
<field name="inherit_id" ref="point_of_sale.pos_config_view_form" />
<field name="arch" type="xml">
<field name="iface_tax_included" position="after">
<separator string="Bill Value" colspan="2" />
<field name="bill_value" nolabel="1" colspan="2">
<tree editable="bottom">
<field name="name" />
</tree>
</field>
</field>
</field>
</record>
<record id="view_account_bnk_stmt_cashbox" model="ir.ui.view">
<field name="name">account.bnk_stmt_cashbox.form</field>
<field name="model">account.bank.statement.cashbox</field>
<field name="inherit_id" ref="account.view_account_bnk_stmt_cashbox" />
<field name="arch" type="xml">
<field name="coin_value" position="attributes">
<attribute name="readonly">1</attribute>
</field>
</field>
</record>
<template id="assets" inherit_id="point_of_sale.assets">
<xpath expr="." position="inside">
<script type="text/javascript"

Loading…
Cancel
Save