Merge lp:~openerp-dev/openobject-addons/trunk-account_check_writing_jam-journal-fix-sgo into lp:~openerp-dev/openobject-addons/trunk-account_check_writing_jam

Proposed by Sanjay Gohel (Open ERP)
Status: Merged
Approved by: Jigar A.
Approved revision: 8370
Merged at revision: 8370
Proposed branch: lp:~openerp-dev/openobject-addons/trunk-account_check_writing_jam-journal-fix-sgo
Merge into: lp:~openerp-dev/openobject-addons/trunk-account_check_writing_jam
Diff against target: 51 lines (+19/-1)
3 files modified
account_check_writing/account.py (+15/-0)
account_check_writing/account_check_writing_data.xml (+1/-1)
account_check_writing/account_view.xml (+3/-0)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/trunk-account_check_writing_jam-journal-fix-sgo
Reviewer Review Type Date Requested Status
Jigar A. Pending
Review via email: mp+186489@code.launchpad.net

Description of the change

Hello,

  If journal type is bank when installed account_check_writing set allow_check_writing as true. and if type is equal to bank allow_check_writing set as true on onchange of type.

Thanks.
Sanjay Gohel.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account_check_writing/account.py'
2--- account_check_writing/account.py 2013-09-17 10:25:00 +0000
3+++ account_check_writing/account.py 2013-09-19 09:24:09 +0000
4@@ -33,6 +33,21 @@
5 'check_sequence_id': fields.many2one('ir.sequence', 'Check Sequence', help="This field contains the information related to the numbering of the Check of this journal."),
6 }
7
8+ def configure_check_journal(self, cr, uid, context=None):
9+ '''
10+ This function set up bank journal to be used on check payment by
11+ setting allow check writing on bank type journals this function will
12+ be triggered while installing module.
13+ '''
14+ journal_ids = self.search(cr, uid, [('type', '=', 'bank')], context=context)
15+ if journal_ids:
16+ self.write(cr, uid, journal_ids, {'allow_check_writing' : True}, context=context)
17+ return True
18+
19+ def onchange_journal_type(self, cr, uid, ids, type, context=None):
20+ allow_check_writing = type == "bank" and True or False
21+ return {'value': {'allow_check_writing' : allow_check_writing}}
22+
23 def create_check_sequence(self, cr, uid, vals, context=None):
24 """
25 Create new no_gap entry sequence for check Journal using given vals.
26
27=== modified file 'account_check_writing/account_check_writing_data.xml'
28--- account_check_writing/account_check_writing_data.xml 2013-06-13 10:24:45 +0000
29+++ account_check_writing/account_check_writing_data.xml 2013-09-19 09:24:09 +0000
30@@ -18,6 +18,6 @@
31 <field name="code">check.number</field>
32 <field eval="4" name="padding"/>
33 </record>
34-
35+ <function model="account.journal" name="configure_check_journal"/>
36 </data>
37 </openerp>
38
39=== modified file 'account_check_writing/account_view.xml'
40--- account_check_writing/account_view.xml 2013-06-13 10:24:45 +0000
41+++ account_check_writing/account_view.xml 2013-09-19 09:24:09 +0000
42@@ -15,6 +15,9 @@
43 <field name="sequence_id" position="after">
44 <field name="check_sequence_id" attrs="{'invisible': [('allow_check_writing', '!=', True)]}"/>
45 </field>
46+ <field name="type" position="attributes">
47+ <attribute name="on_change">onchange_journal_type(type)</attribute>
48+ </field>
49 <field name="entry_posted" position="after">
50 <field name="allow_check_writing" attrs="{'readonly':[('type','!=','bank')]}" />
51 <field name="use_preprint_check" attrs="{'readonly':[('type','!=','bank')]}" />

Subscribers

People subscribed via source and target branches