summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Martinelli <nim@odoo.com>2017-06-14 16:13:22 +0200
committerNicolas Martinelli <nim@odoo.com>2017-06-15 10:13:53 +0200
commit261aa927b679b7e84a28b8b4e149d5625bfe4afd (patch)
tree2e695aad2dba3f10bdf942dc60cb5272e8b836f7
parentdf4a81c697f81e9ca4fd4533ae72769e2bc501f4 (diff)
[FIX] point_of_sale: add_payment
Ease the extension of `add_payment`. From work of @benwillig Closes #17598 opw-747348
-rw-r--r--addons/point_of_sale/models/pos_order.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/addons/point_of_sale/models/pos_order.py b/addons/point_of_sale/models/pos_order.py
index 0454cbf203c..2742e708790 100644
--- a/addons/point_of_sale/models/pos_order.py
+++ b/addons/point_of_sale/models/pos_order.py
@@ -703,7 +703,7 @@ class PosOrder(models.Model):
qty_done = pack_operation.product_qty
pack_operation.write({'pack_lot_ids': map(lambda x: (0, 0, x), pack_lots), 'qty_done': qty_done})
- def add_payment(self, data):
+ def _prepare_bank_statement_line_payment_values(self, data):
"""Create a new payment for the order"""
args = {
'amount': data['amount'],
@@ -748,8 +748,16 @@ class PosOrder(models.Model):
'journal_id': journal_id,
'ref': self.session_id.name,
})
+
+ return args
+
+ def add_payment(self, data):
+ """Create a new payment for the order"""
+ args = self._prepare_bank_statement_line_payment_values(data)
+ context = dict(self.env.context)
+ context.pop('pos_session_id', False)
self.env['account.bank.statement.line'].with_context(context).create(args)
- return statement_id
+ return args.get('statement_id', False)
@api.multi
def refund(self):