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 on 2013-10-28

[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
1=== modified file 'point_of_sale/point_of_sale.py'
2--- point_of_sale/point_of_sale.py 2013-10-14 12:19:59 +0000
3+++ point_of_sale/point_of_sale.py 2013-10-28 09:11:28 +0000
4@@ -294,6 +294,14 @@
5 (_check_pos_config, "You cannot create two active sessions related to the same point of sale!", ['config_id']),
6 ]
7
8+ def _prepare_bank_statement(self, cr, uid, pos_config, journal, context=None):
9+ bank_values = {
10+ 'journal_id' : journal.id,
11+ 'user_id' : uid,
12+ 'company_id' : pos_config.shop_id.company_id.id
13+ }
14+ return bank_values
15+
16 def create(self, cr, uid, values, context=None):
17 context = context or {}
18 config_id = values.get('config_id', False) or context.get('default_config_id', False)
19@@ -331,11 +339,7 @@
20 pos_config = jobj.browse(cr, uid, config_id, context=context)
21 bank_statement_ids = []
22 for journal in pos_config.journal_ids:
23- bank_values = {
24- 'journal_id' : journal.id,
25- 'user_id' : uid,
26- 'company_id' : pos_config.shop_id.company_id.id
27- }
28+ bank_values = self._prepare_bank_statement(cr, uid, pos_config, journal, context)
29 statement_id = self.pool.get('account.bank.statement').create(cr, uid, bank_values, context=context)
30 bank_statement_ids.append(statement_id)
31