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

Proposed by Alexandre Fayolle - camptocamp
Status: Needs review
Proposed branch: lp:~camptocamp/openobject-addons/trunk-fix-1245375-afe
Merge into: lp:openobject-addons
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/trunk-fix-1245375-afe
Reviewer Review Type Date Requested Status
Yannick Vaucher @ Camptocamp (community) code review, no tests Approve
Nicolas Bessi - Camptocamp (community) code review, no test Approve
Guewen Baconnier @ Camptocamp (community) code review Approve
OpenERP Core Team Pending
Review via email: mp+192849@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
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

LGTM

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

LGTM

review: Approve (code review, no test)
Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote :

LGTM

review: Approve (code review, no tests)

Unmerged revisions

8959. 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-18 12:58:18 +0000
3+++ point_of_sale/point_of_sale.py 2013-10-28 09:11:38 +0000
4@@ -303,6 +303,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.warehouse_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@@ -340,11 +348,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.warehouse_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

Subscribers

People subscribed via source and target branches

to all changes: