Browse Source

[ADD] feedback on the screen

pull/6/head
Thibault Francois 9 years ago
parent
commit
0176c1fa30
  1. 4
      beescoop_pos/static/src/css/beescoop.css
  2. 10
      beescoop_pos/static/src/js/beescoop.js
  3. 3
      beescoop_pos/static/src/xml/templates.xml
  4. 8
      beesdoo_pos/models/beesdoo_pos.py
  5. 1
      beesdoo_pos/views/beesdoo_pos.xml

4
beescoop_pos/static/src/css/beescoop.css

@ -0,0 +1,4 @@
.message-send {
margin: 16px;
text-align: center;
}

10
beescoop_pos/static/src/js/beescoop.js

@ -5,10 +5,13 @@ odoo.define('beescoop.pos', function (require) {
module.ReceiptScreenWidget = module.ReceiptScreenWidget.include({
send : function() {
var self = this;
var order = this.pos.get_order().name;
var records = new Model('pos.order').call('send_order', [order], {});
records.then(function(result){
console.log(result)
var el = self.$('.message-send')
el.empty();
el.append('<h2>' + result + '</h2>');
},function(err){
loaded.reject(err);
});
@ -22,5 +25,10 @@ odoo.define('beescoop.pos', function (require) {
}
});
},
show: function(){
this._super();
var self = this;
this.$('.message-send').empty();
},
})
});

3
beescoop_pos/static/src/xml/templates.xml

@ -5,6 +5,9 @@
<div class="button send">
<i class='fa fa-envelope'></i> Send Receipt By Mail
</div>
<div class="message-send">
</div>
</t>
</t>
</templates>

8
beesdoo_pos/models/beesdoo_pos.py

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from openerp import models, fields, api
from openerp import models, fields, api, _
class BeesPOS(models.Model):
_inherit = 'pos.config'
@ -32,8 +32,10 @@ class BeescoopPosOrder(models.Model):
@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 False
return _('Cannot send the ticket, no email address found on the client')
mail_template = self.env.ref("beescoop_pos.email_send_ticket")
mail_template.send_mail(order.id)
return True
return _("Ticket sent")

1
beesdoo_pos/views/beesdoo_pos.xml

@ -19,6 +19,7 @@
<template id="assets" inherit_id="point_of_sale.assets">
<xpath expr="." position="inside">
<script type="text/javascript" src="/beescoop_pos/static/src/js/beescoop.js"></script>
<link rel='stylesheet' href="/beescoop_pos/static/src/css/beescoop.css"/>
</xpath>
</template>
</data>
Loading…
Cancel
Save