Skip to content

Commit

Permalink
[FIX] point_of_sale: from pos UI print sale details only for current …
Browse files Browse the repository at this point in the history
…config

Have two pos config opened, with at least one connected to a POS box with a printer
Do some sales on both
Click on the printer icon in the pos UI to print today's sales

Before this commit, the ticket that was printed contained sales for
both point of sales

After this commit, it only contains sales of the point of sale from which
the print request has been sent

OPW 1958885
  • Loading branch information
kebeclibre committed Apr 18, 2019
1 parent d637fe4 commit 4c363d9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions addons/point_of_sale/models/pos_order.py
Expand Up @@ -1136,6 +1136,10 @@ def get_sale_details(self, date_start=False, date_stop=False, configs=False):
"""
if not configs:
configs = self.env['pos.config'].search([])
elif isinstance(configs, int):
configs = self.env['pos.config'].browse([configs])
elif isinstance(configs, list):
configs = self.env['pos.config'].browse(configs)

user_tz = pytz.timezone(self.env.context.get('tz') or self.env.user.tz or 'UTC')
today = user_tz.localize(fields.Datetime.from_string(fields.Date.context_today(self)))
Expand Down
2 changes: 2 additions & 0 deletions addons/point_of_sale/static/src/js/devices.js
Expand Up @@ -448,9 +448,11 @@ var ProxyDevice = core.Class.extend(mixins.PropertiesMixin,{

print_sale_details: function() {
var self = this;
var config_id = [this.pos.config.id];
rpc.query({
model: 'report.point_of_sale.report_saledetails',
method: 'get_sale_details',
args: [false, false, config_id],
})
.then(function(result){
var env = {
Expand Down

0 comments on commit 4c363d9

Please sign in to comment.