Merge lp:~unifield-team/unifield-wm/bklg-7b into lp:unifield-wm

Proposed by jftempo
Status: Merged
Merged at revision: 2393
Proposed branch: lp:~unifield-team/unifield-wm/bklg-7b
Merge into: lp:unifield-wm
Diff against target: 174 lines (+85/-1)
6 files modified
account_mcdb/account_analytic_line.py (+53/-0)
account_mcdb/account_mcdb.py (+5/-1)
account_mcdb/account_mcdb_view.xml (+4/-0)
account_mcdb/account_move_line.py (+20/-0)
account_mcdb/mcdb_view_end.xml (+1/-0)
analytic_distribution/analytic_line_view.xml (+2/-0)
To merge this branch: bzr merge lp:~unifield-team/unifield-wm/bklg-7b
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+249302@code.launchpad.net
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_mcdb/account_analytic_line.py'
2--- account_mcdb/account_analytic_line.py 2014-04-15 08:35:03 +0000
3+++ account_mcdb/account_analytic_line.py 2015-02-11 11:09:45 +0000
4@@ -69,6 +69,34 @@
5 # or output_currency field
6 res[ml.id]['output_currency'] = currency_id
7 return res
8+
9+ def _get_cheque_number(self, cr, uid, ids, name, args, context=None):
10+ res = {}
11+ if not ids:
12+ return res
13+ if isinstance(ids, (int, long)):
14+ ids = [ids]
15+ for self_br in self.browse(cr, uid, ids, context=context):
16+ res[self_br.id] = self_br.move_id and \
17+ self_br.move_id.cheque_number or ''
18+ return res
19+
20+ def _search_cheque_number(self, cr, uid, ids, name, args, context=None):
21+ if not len(args):
22+ return []
23+ if len(args) != 1:
24+ msg = _("Domain %s not suported") % (str(args), )
25+ raise osv.except_osv(_('Error'), msg)
26+ if args[0][1] != 'ilike':
27+ # g/l selector / analytical selector default operator not found
28+ msg = _("Operator %s not suported") % (args[0][1], )
29+ raise osv.except_osv(_('Error'), msg)
30+ if not args[0][2]:
31+ return []
32+
33+ m_ids = self.pool.get('account.move.line').search(cr, uid,
34+ [('cheque_number', 'ilike', args[0][2])], context=context)
35+ return [('move_id', 'in', m_ids)] if m_ids else [('id', 'in', [])]
36
37 _columns = {
38 'output_amount': fields.function(_get_output, string="Output amount", type='float', method=True, store=False, multi="analytic_output_currency"),
39@@ -76,6 +104,9 @@
40 'output_amount_credit': fields.function(_get_output, string="Output credit", type='float', method=True, store=False, multi="analytic_output_currency"),
41 'output_currency': fields.function(_get_output, string="Output curr.", type='many2one', relation='res.currency', method=True, store=False,
42 multi="analytic_output_currency"),
43+ 'cheque_number': fields.function(_get_cheque_number, type='char',
44+ method=True, string='Cheque Number',
45+ fnct_search=_search_cheque_number) # BKLG-7: move cheque number
46 }
47
48 def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
49@@ -91,6 +122,28 @@
50 for field in element_fields:
51 tree.remove(field)
52 view['arch'] = etree.tostring(tree)
53+
54+ if view_type == 'tree' and \
55+ context.get('selector_display_cheque_number', False):
56+ # BKLG-7: cheque_number used in analytic selector: display it
57+ view['fields']['cheque_number'] = {
58+ 'function': '_get_cheque_number',
59+ 'fnct_search': '_search_cheque_number',
60+ 'type': 'char',
61+ 'string': 'Cheque Number',
62+ }
63+
64+ tree = etree.fromstring(view['arch'])
65+
66+ cheque_number_node = etree.Element('field', attrib={
67+ 'name': 'cheque_number',
68+ })
69+ # insert it after entry sequence
70+ es_node = tree.find('.//field[@name="entry_sequence"]')
71+ tree.insert(es_node.getparent().index(es_node) + 1,
72+ cheque_number_node)
73+
74+ view['arch'] = etree.tostring(tree)
75 return view
76
77 def copy(self, cr, uid, id, default=None, context=None):
78
79=== modified file 'account_mcdb/account_mcdb.py'
80--- account_mcdb/account_mcdb.py 2014-04-15 08:15:35 +0000
81+++ account_mcdb/account_mcdb.py 2015-02-11 11:09:45 +0000
82@@ -103,6 +103,8 @@
83 'display_free1': fields.boolean('Display Free 1?'),
84 'display_free2': fields.boolean('Display Free 2?'),
85 'user': fields.many2one('res.users', "User"),
86+ 'cheque_number': fields.char('Cheque Number', size=120), # BKLG-7
87+ 'partner_txt': fields.char('Third Party', size=120), # BKLG-7
88 }
89
90 _defaults = {
91@@ -303,9 +305,11 @@
92 domain.append((m2o[1], '=', getattr(wiz, m2o[0]).id))
93 # Finally others fields
94 # LOOKS LIKE fields
95- for ll in [('ref', 'ref'), ('name', 'name')]:
96+ for ll in [('ref', 'ref'), ('name', 'name'), ('cheque_number', 'cheque_number'), ('partner_txt', 'partner_txt')]:
97 if getattr(wiz, ll[0]):
98 domain.append((ll[1], 'ilike', '%%%s%%' % getattr(wiz, ll[0])))
99+ if ll[0] == 'cheque_number':
100+ context['selector_display_cheque_number'] = True
101 # DOCUMENT CODE fields
102 if wiz.document_code and wiz.document_code != '':
103 document_code_field = 'move_id.name'
104
105=== modified file 'account_mcdb/account_mcdb_view.xml'
106--- account_mcdb/account_mcdb_view.xml 2014-04-15 08:42:57 +0000
107+++ account_mcdb/account_mcdb_view.xml 2015-02-11 11:09:45 +0000
108@@ -286,6 +286,10 @@
109 <field name="reallocated" colspan="2"/>
110 <field name="reversed" colspan="2"/>
111 &currency;
112+ <group colspan="4" col="6">
113+ <separator string="Third Party" colspan="6"/>
114+ <field name="partner_txt" colspan="2"/>
115+ </group>
116 &end;
117 </form>
118 </field>
119
120=== modified file 'account_mcdb/account_move_line.py'
121--- account_mcdb/account_move_line.py 2014-09-19 09:51:58 +0000
122+++ account_mcdb/account_move_line.py 2015-02-11 11:09:45 +0000
123@@ -122,6 +122,26 @@
124 for field in element_fields:
125 tree.remove(field)
126 view['arch'] = etree.tostring(tree)
127+
128+ if view_type == 'tree' and \
129+ context.get('selector_display_cheque_number', False):
130+ # BKLG-7: cheque_number used in G/L selector: display it
131+ view['fields']['cheque_number'] = {
132+ 'type': 'char',
133+ 'string': 'Cheque Number',
134+ }
135+
136+ tree = etree.fromstring(view['arch'])
137+
138+ cheque_number_node = etree.Element('field', attrib={
139+ 'name': 'cheque_number',
140+ })
141+ # insert it after entry sequence
142+ es_node = tree.find('.//field[@name="move_id"]')
143+ tree.insert(es_node.getparent().index(es_node) + 1,
144+ cheque_number_node)
145+
146+ view['arch'] = etree.tostring(tree)
147 return view
148
149 account_move_line()
150
151=== modified file 'account_mcdb/mcdb_view_end.xml'
152--- account_mcdb/mcdb_view_end.xml 2012-03-21 17:48:57 +0000
153+++ account_mcdb/mcdb_view_end.xml 2015-02-11 11:09:45 +0000
154@@ -1,6 +1,7 @@
155 <separator string="Others" colspan="4"/>
156 <field name="ref"/>
157 <field name="name"/>
158+ <field name="cheque_number"/>
159 <separator string=" " colspan="4"/>
160 <button name="button_clear" type="object" string="Clear" icon="gtk-clear" colspan="2"/>
161 <button name="button_validate" type="object" string="Search" icon="gtk-find" colspan="2"/>
162
163=== modified file 'analytic_distribution/analytic_line_view.xml'
164--- analytic_distribution/analytic_line_view.xml 2014-01-14 17:29:00 +0000
165+++ analytic_distribution/analytic_line_view.xml 2015-02-11 11:09:45 +0000
166@@ -37,6 +37,8 @@
167 <field name="cost_center_id" invisible="not context.get('display_fp', False)"/>
168 <field name="account_id" domain="[('category', '=', context.get('categ', False) and context.get('categ') or 'FUNDING'), ('type', '!=', 'view')]"/>
169 <field name="is_reallocated"/>
170+ <newline/>
171+ <field name="partner_txt"/>
172 </xpath>
173 <xpath expr="/search/group[1]/field[@name='name']" position='after'>
174 <field name="ref"/>

Subscribers

People subscribed via source and target branches