diff --git a/addons/point_of_sale/pos.py b/addons/point_of_sale/pos.py
index 1d92820c71a..fd6bda2bf32 100644
--- a/addons/point_of_sale/pos.py
+++ b/addons/point_of_sale/pos.py
@@ -585,7 +585,7 @@ class pos_order(osv.osv):
account_def = property_obj.get(cr, uid, 'property_account_receivable', 'res.partner', context=context)
args['account_id'] = order.partner_id and order.partner_id.property_account_receivable and order.partner_id.property_account_receivable.id or account_def.id or curr_c.account_receivable.id
if data.get('is_acc',False):
- args['is_acc']=data['is_acc']
+ args['is_acc'] = data['is_acc']
args['account_id']= prod_obj.browse(cr,uid, data['product_id']).property_account_income and prod_obj.browse(cr,uid, data['product_id']).property_account_income.id
if not args['account_id']:
raise osv.except_osv(_('Error'), _('Please provide an account for the product: %s')%(prod_obj.browse(cr,uid, data['product_id']).name))
@@ -635,7 +635,7 @@ class pos_order(osv.osv):
wf_service = netsvc.LocalService("workflow")
wf_service.trg_write(uid, 'pos.order', order_id, cr)
- return order_line_id
+ return order_line_id, price
def refund(self, cr, uid, ids, context=None):
"""Create a copy of order for refund order"""
diff --git a/addons/point_of_sale/wizard/pos_box_entries.xml b/addons/point_of_sale/wizard/pos_box_entries.xml
index f04c4232ace..e4986ec75ad 100644
--- a/addons/point_of_sale/wizard/pos_box_entries.xml
+++ b/addons/point_of_sale/wizard/pos_box_entries.xml
@@ -17,7 +17,7 @@
-
diff --git a/addons/point_of_sale/wizard/pos_box_out.xml b/addons/point_of_sale/wizard/pos_box_out.xml
index 2e48a560823..aa0402869ea 100644
--- a/addons/point_of_sale/wizard/pos_box_out.xml
+++ b/addons/point_of_sale/wizard/pos_box_out.xml
@@ -17,7 +17,7 @@
-
diff --git a/addons/point_of_sale/wizard/pos_payment.py b/addons/point_of_sale/wizard/pos_payment.py
index 8d7e515928e..4e59657f192 100644
--- a/addons/point_of_sale/wizard/pos_payment.py
+++ b/addons/point_of_sale/wizard/pos_payment.py
@@ -127,6 +127,18 @@ class pos_make_payment(osv.osv_memory):
"""
return result
+ def onchange_product_id(self, cr, uid, ids, product_id, amount):
+ """ Changes amount if product_id changes.
+ @param product_id: Changed product_id
+ @param amount: Amount to be paid
+ @return: Dictionary of changed values
+ """
+ prod_obj = self.pool.get('product.product')
+ if product_id:
+ product = prod_obj.browse(cr, uid, product_id)
+ amount = amount + product.list_price
+ return {'value': {'amount': amount}}
+
def check(self, cr, uid, ids, context):
"""Check the order:
@@ -139,8 +151,12 @@ class pos_make_payment(osv.osv_memory):
amount = order.amount_total - order.amount_paid
data = self.read(cr, uid, ids)[0]
invoice_wanted = data['invoice_wanted']
+ is_accompte = data['is_acc']
# Todo need to check ...
-
+ if is_accompte:
+ line_id, price = order_obj.add_product(cr, uid, order.id, data['product_id'], 1.0, context)
+ amount = order.amount_total - order.amount_paid + price
+
if amount != 0.0:
order_obj.write(cr, uid, [active_id], {'invoice_wanted': invoice_wanted, 'partner_id': data['partner_id']})
order_obj.add_payment(cr, uid, active_id, data, context=context)
@@ -209,7 +225,7 @@ class pos_make_payment(osv.osv_memory):
_columns = {
'journal':fields.selection(pos_box_entries.get_journal, "Cash Register",required=True),
- 'product_id': fields.many2one('product.product', "Acompte"),
+ 'product_id': fields.many2one('product.product', "Accompte"),
'amount':fields.float('Amount', digits=(16,2) ,required= True),
'payment_name': fields.char('Payment name', size=32, required=True),
'payment_date': fields.date('Payment date', required=True),
diff --git a/addons/point_of_sale/wizard/pos_payment.xml b/addons/point_of_sale/wizard/pos_payment.xml
index 910cf2df0b3..141c29776fd 100644
--- a/addons/point_of_sale/wizard/pos_payment.xml
+++ b/addons/point_of_sale/wizard/pos_payment.xml
@@ -19,9 +19,10 @@
-
+
-
+