Browse Source

[FIX] session total is now based on the sum of all orders total, to avoid to take into account take money in / out moves;

pull/77/head
Sylvain LE GAL 9 years ago
parent
commit
a7aeaa3a6b
  1. 18
      pos_session_summary/models/pos_session.py

18
pos_session_summary/models/pos_session.py

@ -10,23 +10,17 @@ class PosSession(models.Model):
_inherit = 'pos.session' _inherit = 'pos.session'
@api.multi @api.multi
@api.depends('statement_ids.balance_end')
def _compute_total_amount(self):
for session in self:
session.total_amount =\
sum(session.mapped('statement_ids.balance_end')) -\
sum(session.mapped('statement_ids.balance_start'))
@api.multi
@api.depends('order_ids')
def _compute_order_qty(self):
@api.depends('order_ids.lines.price_subtotal_incl')
def _compute_orders(self):
for session in self: for session in self:
session.order_qty = len(session.order_ids) session.order_qty = len(session.order_ids)
session.total_amount = sum(
session.mapped('order_ids.amount_total'))
total_amount = fields.Monetary( total_amount = fields.Monetary(
compute='_compute_total_amount', string='Transactions Total',
compute='_compute_orders', string='Transactions Total', multi='orders',
store=True) store=True)
order_qty = fields.Integer( order_qty = fields.Integer(
compute='_compute_order_qty', string='Orders Qty',
compute='_compute_orders', string='Orders Qty', multi='orders',
store=True) store=True)
Loading…
Cancel
Save