Merge lp:~camptocamp/openobject-addons/7.0-fix-1245375-afe into lp:openobject-addons/7.0

Proposed by Alexandre Fayolle - camptocamp
Status: Needs review
Proposed branch: lp:~camptocamp/openobject-addons/7.0-fix-1245375-afe
Merge into: lp:openobject-addons/7.0
Diff against target: 30 lines (+9/-5)
1 file modified
point_of_sale/point_of_sale.py (+9/-5)
To merge this branch: bzr merge lp:~camptocamp/openobject-addons/7.0-fix-1245375-afe
Reviewer Review Type Date Requested Status
Nicolas Bessi - Camptocamp (community) Approve
Yannick Vaucher @ Camptocamp (community) code review, no tests Approve
OpenERP Core Team Pending
Review via email: mp+192848@code.launchpad.net

Description of the change

Add extension point to allow customization of account.bank.statement creation in 3rd party addons

To post a comment you must log in.
Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote :

LGTM

review: Approve (code review, no tests)
Revision history for this message
Nicolas Bessi - Camptocamp (nbessi-c2c-deactivatedaccount) wrote :

LGTM

review: Approve

Unmerged revisions

9547. By Alexandre Fayolle - camptocamp

[FIX] point_of_sale: add extention hook for account.bank.statement creation

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'point_of_sale/point_of_sale.py'
--- point_of_sale/point_of_sale.py 2013-10-14 12:19:59 +0000
+++ point_of_sale/point_of_sale.py 2013-10-28 09:11:28 +0000
@@ -294,6 +294,14 @@
294 (_check_pos_config, "You cannot create two active sessions related to the same point of sale!", ['config_id']),294 (_check_pos_config, "You cannot create two active sessions related to the same point of sale!", ['config_id']),
295 ]295 ]
296296
297 def _prepare_bank_statement(self, cr, uid, pos_config, journal, context=None):
298 bank_values = {
299 'journal_id' : journal.id,
300 'user_id' : uid,
301 'company_id' : pos_config.shop_id.company_id.id
302 }
303 return bank_values
304
297 def create(self, cr, uid, values, context=None):305 def create(self, cr, uid, values, context=None):
298 context = context or {}306 context = context or {}
299 config_id = values.get('config_id', False) or context.get('default_config_id', False)307 config_id = values.get('config_id', False) or context.get('default_config_id', False)
@@ -331,11 +339,7 @@
331 pos_config = jobj.browse(cr, uid, config_id, context=context)339 pos_config = jobj.browse(cr, uid, config_id, context=context)
332 bank_statement_ids = []340 bank_statement_ids = []
333 for journal in pos_config.journal_ids:341 for journal in pos_config.journal_ids:
334 bank_values = {342 bank_values = self._prepare_bank_statement(cr, uid, pos_config, journal, context)
335 'journal_id' : journal.id,
336 'user_id' : uid,
337 'company_id' : pos_config.shop_id.company_id.id
338 }
339 statement_id = self.pool.get('account.bank.statement').create(cr, uid, bank_values, context=context)343 statement_id = self.pool.get('account.bank.statement').create(cr, uid, bank_values, context=context)
340 bank_statement_ids.append(statement_id)344 bank_statement_ids.append(statement_id)
341345