Browse Source

[IMP] pos: Don't show customer balance

pull/26/merge
Rémy Taymans 7 years ago
committed by Thibault Francois
parent
commit
a8b7a80ec6
  1. 10
      beesdoo_pos/models/beesdoo_pos.py
  2. 18
      beesdoo_pos/static/src/js/beesdoo.js
  3. 8
      beesdoo_pos/static/src/xml/templates.xml

10
beesdoo_pos/models/beesdoo_pos.py

@ -72,14 +72,8 @@ class BeescoopPosPartner(models.Model):
return tuple(eaters) return tuple(eaters)
@api.multi @api.multi
def get_balance_and_eater(self):
self.ensure_one()
self = self.sudo()
account_id = self.property_account_receivable_id.id
move_lines = self.env['account.move.line'].search([('account_id', '=', account_id), ('partner_id', '=', self.id)])
credit = sum([m.credit for m in move_lines])
debit = sum([m.debit for m in move_lines])
def get_eater(self):
eater1, eater2, eater3 = self._get_eater() eater1, eater2, eater3 = self._get_eater()
return str(round(credit - debit, 2)), eater1, eater2, eater3
return eater1, eater2, eater3
last_name = fields.Char('Last Name', required=True, default="/") last_name = fields.Char('Last Name', required=True, default="/")

18
beesdoo_pos/static/src/js/beesdoo.js

@ -53,13 +53,12 @@ odoo.define('beescoop.pos', function (require) {
} }
var customer_id = this.pos.get_client().id; var customer_id = this.pos.get_client().id;
var res = new Model('res.partner').call('get_balance_and_eater',
var res = new Model('res.partner').call('get_eater',
[ customer_id ], undefined, { shadow: true, timeout: 1000}); [ customer_id ], undefined, { shadow: true, timeout: 1000});
res.then(function(result) { res.then(function(result) {
set_customer_info.call(self, '.customer-balance', result[0])
set_customer_info.call(self, '.customer-delegate1', result[1], 'Eater 1: ');
set_customer_info.call(self, '.customer-delegate2', result[2], 'Eater 2: ');
set_customer_info.call(self, '.customer-delegate3', result[3], 'Eater 3: ');
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) { }, function(err) {
loaded.reject(err); loaded.reject(err);
}); });
@ -74,13 +73,12 @@ odoo.define('beescoop.pos', function (require) {
return return
} }
var customer_id = this.pos.get_client().id; var customer_id = this.pos.get_client().id;
var res = new Model('res.partner').call('get_balance_and_eater', [ customer_id ], undefined, { shadow: true, timeout: 1000});
var res = new Model('res.partner').call('get_eater', [ customer_id ], undefined, { shadow: true, timeout: 1000});
res.then(function(result) { res.then(function(result) {
set_customer_info.call(self, '.customer-name', self.pos.get_client().name); set_customer_info.call(self, '.customer-name', self.pos.get_client().name);
set_customer_info.call(self, '.customer-balance', result[0]);
set_customer_info.call(self, '.customer-delegate1', result[1], 'Eater 1: ');
set_customer_info.call(self, '.customer-delegate2', result[2], 'Eater 2: ');
set_customer_info.call(self, '.customer-delegate3', result[3], 'Eater 3: ');
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) { }, function(err) {
loaded.reject(err); loaded.reject(err);
}); });

8
beesdoo_pos/static/src/xml/templates.xml

@ -15,10 +15,6 @@
<t t-jquery="t[t-if='widget.pos.get_client()']" t-operation="after"> <t t-jquery="t[t-if='widget.pos.get_client()']" t-operation="after">
<t t-if="widget.pos.get_client()"> <t t-if="widget.pos.get_client()">
<div class='customer-information-pay'> <div class='customer-information-pay'>
Balance:
<span class='customer-balance' />
<br />
<span class='customer-delegate1' /> <span class='customer-delegate1' />
<br /> <br />
<span class='customer-delegate2' /> <span class='customer-delegate2' />
@ -34,10 +30,6 @@
<t t-if="widget.pos.get_client()"> <t t-if="widget.pos.get_client()">
<div class="customer-information"> <div class="customer-information">
<span class='customer-name' /> <span class='customer-name' />
<br />
Balance:
<span class='customer-balance' />
<br /> <br />
<span class='customer-delegate1' /> <span class='customer-delegate1' />
<br /> <br />

Loading…
Cancel
Save