summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexis de Lattre <alexis@via.ecp.fr>2014-10-27 23:52:43 +0100
committerAlexis de Lattre <alexis@via.ecp.fr>2014-10-27 23:52:43 +0100
commit6dcb8232ebc0f17c890d0516040977ec87f7ae9e (patch)
treef9f0a256bd860baa23c3c0441525faa021bd9de0
parent3e07eaa308a4e0b352bea38c6331c62e53821f55 (diff)
point_of_sale: Add _prepare_analytic_account method to easily set analytic account from custom module
-rw-r--r--addons/point_of_sale/point_of_sale.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/addons/point_of_sale/point_of_sale.py b/addons/point_of_sale/point_of_sale.py
index 87e4bf5ecb1..99c73fdda34 100644
--- a/addons/point_of_sale/point_of_sale.py
+++ b/addons/point_of_sale/point_of_sale.py
@@ -1006,6 +1006,10 @@ class pos_order(osv.osv):
def create_account_move(self, cr, uid, ids, context=None):
return self._create_account_move_line(cr, uid, ids, None, None, context=context)
+ def _prepare_analytic_account(self, cr, uid, line, context=None):
+ '''This method is designed to be inherited in a custom module'''
+ return False
+
def _create_account_move_line(self, cr, uid, ids, session=None, move_id=None, context=None):
# Tricky, via the workflow, we only have one id in the ids variable
"""Create a account move line of order grouped by products or not."""
@@ -1154,6 +1158,7 @@ class pos_order(osv.osv):
'quantity': line.qty,
'product_id': line.product_id.id,
'account_id': income_account,
+ 'analytic_account_id': self._prepare_analytic_account(cr, uid, line, context=context),
'credit': ((amount>0) and amount) or 0.0,
'debit': ((amount<0) and -amount) or 0.0,
'tax_code_id': tax_code_id,