Merge lp:~mikel-martin/openobject-addons/extra-account_payment_extension-wizard-migration into lp:openobject-addons/extra-trunk
- extra-account_payment_extension-wizard-migration
- Merge into trunk-extra-addons
Proposed by
mikel
Status: | Needs review |
---|---|
Proposed branch: | lp:~mikel-martin/openobject-addons/extra-account_payment_extension-wizard-migration |
Merge into: | lp:openobject-addons/extra-trunk |
Diff against target: |
1123 lines (+381/-433) 20 files modified
account_payment_extension/__init__.py (+2/-0) account_payment_extension/__openerp__.py (+7/-6) account_payment_extension/account_invoice.py (+2/-0) account_payment_extension/account_move_line.py (+2/-0) account_payment_extension/i18n/bg.po (+2/-2) account_payment_extension/i18n/ca.po (+2/-2) account_payment_extension/i18n/es.po (+2/-2) account_payment_extension/i18n/hu.po (+2/-2) account_payment_extension/i18n/pt.po (+2/-2) account_payment_extension/i18n/pt_BR.po (+2/-2) account_payment_extension/i18n/sv.po (+2/-2) account_payment_extension/payment.py (+8/-21) account_payment_extension/payment_view.xml (+61/-22) account_payment_extension/payment_wizard.xml (+0/-7) account_payment_extension/wizard/__init__.py (+3/-2) account_payment_extension/wizard/account_payment_order.py (+174/-0) account_payment_extension/wizard/account_payment_order_view.xml (+66/-0) account_payment_extension/wizard/wizard_payment_order.py (+0/-209) account_payment_extension/wizard/wizard_payment_order_view.xml (+42/-0) account_payment_extension/wizard/wizard_populate_statement.py (+0/-152) |
To merge this branch: | bzr merge lp:~mikel-martin/openobject-addons/extra-account_payment_extension-wizard-migration |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Numérigraphe | needs new project? | Abstain | |
Review via email: mp+119927@code.launchpad.net |
Commit message
Description of the change
Migrate to new wizard system account_
To post a comment you must log in.
Revision history for this message
Numérigraphe (numerigraphe) wrote : | # |
review:
Abstain
(needs new project?)
Unmerged revisions
- 5785. By mikel <mikel@pcl2>
-
Migrate to new wizard system account_
payment_ extension
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'account_payment_extension/__init__.py' |
2 | --- account_payment_extension/__init__.py 2011-11-17 21:02:14 +0000 |
3 | +++ account_payment_extension/__init__.py 2012-08-16 13:33:08 +0000 |
4 | @@ -4,6 +4,8 @@ |
5 | # OpenERP, Open Source Management Solution |
6 | # Copyright (c) 2008 Zikzakmedia S.L. (http://zikzakmedia.com) All Rights Reserved. |
7 | # Jordi Esteve <jesteve@zikzakmedia.com> |
8 | +# AvanzOSC, Avanzed Open Source Consulting |
9 | +# Copyright (C) 2011-2012 Iker Coranti (www.avanzosc.com). All Rights Reserved |
10 | # $Id$ |
11 | # |
12 | # This program is free software: you can redistribute it and/or modify |
13 | |
14 | === modified file 'account_payment_extension/__openerp__.py' |
15 | --- account_payment_extension/__openerp__.py 2011-11-18 09:54:18 +0000 |
16 | +++ account_payment_extension/__openerp__.py 2012-08-16 13:33:08 +0000 |
17 | @@ -4,6 +4,8 @@ |
18 | # OpenERP, Open Source Management Solution |
19 | # Copyright (c) 2008 Zikzakmedia S.L. (http://zikzakmedia.com) All Rights Reserved. |
20 | # Jordi Esteve <jesteve@zikzakmedia.com> |
21 | +# AvanzOSC, Avanzed Open Source Consulting |
22 | +# Copyright (C) 2011-2012 Iker Coranti (www.avanzosc.com). All Rights Reserved |
23 | # $Id$ |
24 | # |
25 | # This program is free software: you can redistribute it and/or modify |
26 | @@ -50,12 +52,11 @@ |
27 | "init_xml" : [], |
28 | "demo_xml" : [], |
29 | "update_xml" : [ |
30 | - 'security/ir.model.access.csv', |
31 | - "payment_wizard.xml", |
32 | - "payment_view.xml", |
33 | - "payment_sequence.xml", |
34 | - ], |
35 | + "security/ir.model.access.csv", |
36 | + "wizard/account_payment_order_view.xml", |
37 | + "payment_view.xml", |
38 | + "payment_sequence.xml", |
39 | + ], |
40 | "active": False, |
41 | "installable": True, |
42 | } |
43 | - |
44 | |
45 | === modified file 'account_payment_extension/account_invoice.py' |
46 | --- account_payment_extension/account_invoice.py 2011-11-17 21:02:14 +0000 |
47 | +++ account_payment_extension/account_invoice.py 2012-08-16 13:33:08 +0000 |
48 | @@ -4,6 +4,8 @@ |
49 | # OpenERP, Open Source Management Solution |
50 | # Copyright (c) 2008 Zikzakmedia S.L. (http://zikzakmedia.com) All Rights Reserved. |
51 | # Jordi Esteve <jesteve@zikzakmedia.com> |
52 | +# AvanzOSC, Avanzed Open Source Consulting |
53 | +# Copyright (C) 2011-2012 Iker Coranti (www.avanzosc.com). All Rights Reserved |
54 | # $Id$ |
55 | # |
56 | # This program is free software: you can redistribute it and/or modify |
57 | |
58 | === modified file 'account_payment_extension/account_move_line.py' |
59 | --- account_payment_extension/account_move_line.py 2011-11-17 21:02:14 +0000 |
60 | +++ account_payment_extension/account_move_line.py 2012-08-16 13:33:08 +0000 |
61 | @@ -4,6 +4,8 @@ |
62 | # OpenERP, Open Source Management Solution |
63 | # Copyright (c) 2008 Zikzakmedia S.L. (http://zikzakmedia.com) All Rights Reserved. |
64 | # Jordi Esteve <jesteve@zikzakmedia.com> |
65 | +# AvanzOSC, Avanzed Open Source Consulting |
66 | +# Copyright (C) 2011-2012 Iker Coranti (www.avanzosc.com). All Rights Reserved |
67 | # $Id$ |
68 | # |
69 | # This program is free software: you can redistribute it and/or modify |
70 | |
71 | === modified file 'account_payment_extension/i18n/bg.po' |
72 | --- account_payment_extension/i18n/bg.po 2012-08-14 04:59:14 +0000 |
73 | +++ account_payment_extension/i18n/bg.po 2012-08-16 13:33:08 +0000 |
74 | @@ -14,8 +14,8 @@ |
75 | "MIME-Version: 1.0\n" |
76 | "Content-Type: text/plain; charset=UTF-8\n" |
77 | "Content-Transfer-Encoding: 8bit\n" |
78 | -"X-Launchpad-Export-Date: 2012-08-14 04:58+0000\n" |
79 | -"X-Generator: Launchpad (build 15791)\n" |
80 | +"X-Launchpad-Export-Date: 2012-08-02 04:57+0000\n" |
81 | +"X-Generator: Launchpad (build 15719)\n" |
82 | |
83 | #. module: account_payment_extension |
84 | #: selection:payment.order,type:0 |
85 | |
86 | === modified file 'account_payment_extension/i18n/ca.po' |
87 | --- account_payment_extension/i18n/ca.po 2012-08-14 04:59:14 +0000 |
88 | +++ account_payment_extension/i18n/ca.po 2012-08-16 13:33:08 +0000 |
89 | @@ -15,8 +15,8 @@ |
90 | "MIME-Version: 1.0\n" |
91 | "Content-Type: text/plain; charset=UTF-8\n" |
92 | "Content-Transfer-Encoding: 8bit\n" |
93 | -"X-Launchpad-Export-Date: 2012-08-14 04:58+0000\n" |
94 | -"X-Generator: Launchpad (build 15791)\n" |
95 | +"X-Launchpad-Export-Date: 2012-08-02 04:57+0000\n" |
96 | +"X-Generator: Launchpad (build 15719)\n" |
97 | "Language: ca\n" |
98 | |
99 | #. module: account_payment_extension |
100 | |
101 | === modified file 'account_payment_extension/i18n/es.po' |
102 | --- account_payment_extension/i18n/es.po 2012-08-14 04:59:14 +0000 |
103 | +++ account_payment_extension/i18n/es.po 2012-08-16 13:33:08 +0000 |
104 | @@ -15,8 +15,8 @@ |
105 | "MIME-Version: 1.0\n" |
106 | "Content-Type: text/plain; charset=UTF-8\n" |
107 | "Content-Transfer-Encoding: 8bit\n" |
108 | -"X-Launchpad-Export-Date: 2012-08-14 04:58+0000\n" |
109 | -"X-Generator: Launchpad (build 15791)\n" |
110 | +"X-Launchpad-Export-Date: 2012-08-02 04:57+0000\n" |
111 | +"X-Generator: Launchpad (build 15719)\n" |
112 | "Language: ca\n" |
113 | |
114 | #. module: account_payment_extension |
115 | |
116 | === modified file 'account_payment_extension/i18n/hu.po' |
117 | --- account_payment_extension/i18n/hu.po 2012-08-14 04:59:14 +0000 |
118 | +++ account_payment_extension/i18n/hu.po 2012-08-16 13:33:08 +0000 |
119 | @@ -14,8 +14,8 @@ |
120 | "MIME-Version: 1.0\n" |
121 | "Content-Type: text/plain; charset=UTF-8\n" |
122 | "Content-Transfer-Encoding: 8bit\n" |
123 | -"X-Launchpad-Export-Date: 2012-08-14 04:58+0000\n" |
124 | -"X-Generator: Launchpad (build 15791)\n" |
125 | +"X-Launchpad-Export-Date: 2012-08-02 04:57+0000\n" |
126 | +"X-Generator: Launchpad (build 15719)\n" |
127 | |
128 | #. module: account_payment_extension |
129 | #: selection:payment.order,type:0 |
130 | |
131 | === modified file 'account_payment_extension/i18n/pt.po' |
132 | --- account_payment_extension/i18n/pt.po 2012-08-14 04:59:14 +0000 |
133 | +++ account_payment_extension/i18n/pt.po 2012-08-16 13:33:08 +0000 |
134 | @@ -14,8 +14,8 @@ |
135 | "MIME-Version: 1.0\n" |
136 | "Content-Type: text/plain; charset=UTF-8\n" |
137 | "Content-Transfer-Encoding: 8bit\n" |
138 | -"X-Launchpad-Export-Date: 2012-08-14 04:58+0000\n" |
139 | -"X-Generator: Launchpad (build 15791)\n" |
140 | +"X-Launchpad-Export-Date: 2012-08-02 04:57+0000\n" |
141 | +"X-Generator: Launchpad (build 15719)\n" |
142 | |
143 | #. module: account_payment_extension |
144 | #: selection:payment.order,type:0 |
145 | |
146 | === modified file 'account_payment_extension/i18n/pt_BR.po' |
147 | --- account_payment_extension/i18n/pt_BR.po 2012-08-14 04:59:14 +0000 |
148 | +++ account_payment_extension/i18n/pt_BR.po 2012-08-16 13:33:08 +0000 |
149 | @@ -14,8 +14,8 @@ |
150 | "MIME-Version: 1.0\n" |
151 | "Content-Type: text/plain; charset=UTF-8\n" |
152 | "Content-Transfer-Encoding: 8bit\n" |
153 | -"X-Launchpad-Export-Date: 2012-08-14 04:58+0000\n" |
154 | -"X-Generator: Launchpad (build 15791)\n" |
155 | +"X-Launchpad-Export-Date: 2012-08-02 04:57+0000\n" |
156 | +"X-Generator: Launchpad (build 15719)\n" |
157 | |
158 | #. module: account_payment_extension |
159 | #: selection:payment.order,type:0 |
160 | |
161 | === modified file 'account_payment_extension/i18n/sv.po' |
162 | --- account_payment_extension/i18n/sv.po 2012-08-14 04:59:14 +0000 |
163 | +++ account_payment_extension/i18n/sv.po 2012-08-16 13:33:08 +0000 |
164 | @@ -13,8 +13,8 @@ |
165 | "MIME-Version: 1.0\n" |
166 | "Content-Type: text/plain; charset=UTF-8\n" |
167 | "Content-Transfer-Encoding: 8bit\n" |
168 | -"X-Launchpad-Export-Date: 2012-08-14 04:58+0000\n" |
169 | -"X-Generator: Launchpad (build 15791)\n" |
170 | +"X-Launchpad-Export-Date: 2012-08-02 04:57+0000\n" |
171 | +"X-Generator: Launchpad (build 15719)\n" |
172 | |
173 | #. module: account_payment_extension |
174 | #: selection:payment.order,type:0 |
175 | |
176 | === modified file 'account_payment_extension/payment.py' |
177 | --- account_payment_extension/payment.py 2011-11-17 21:02:14 +0000 |
178 | +++ account_payment_extension/payment.py 2012-08-16 13:33:08 +0000 |
179 | @@ -4,6 +4,8 @@ |
180 | # OpenERP, Open Source Management Solution |
181 | # Copyright (c) 2008 Zikzakmedia S.L. (http://zikzakmedia.com) All Rights Reserved. |
182 | # Jordi Esteve <jesteve@zikzakmedia.com> |
183 | +# AvanzOSC, Avanzed Open Source Consulting |
184 | +# Copyright (C) 2011-2012 Iker Coranti (www.avanzosc.com). All Rights Reserved |
185 | # $Id$ |
186 | # |
187 | # This program is free software: you can redistribute it and/or modify |
188 | @@ -33,14 +35,12 @@ |
189 | _columns= { |
190 | 'name': fields.char('Name', size=64, required=True, help='Payment Type', translate=True), |
191 | 'code': fields.char('Code', size=64, required=True, help='Specify the Code for Payment Type'), |
192 | - 'suitable_bank_types': fields.many2many('res.partner.bank.type', |
193 | - 'bank_type_payment_type_rel', |
194 | - 'pay_type_id','bank_type_id', |
195 | - 'Suitable bank types'), |
196 | + 'suitable_bank_types': fields.many2many('res.partner.bank.type','bank_type_payment_type_rel','pay_type_id','bank_type_id','Suitable bank types'), |
197 | 'active': fields.boolean('Active', select=True), |
198 | 'note': fields.text('Description', translate=True, help="Description of the payment type that will be shown in the invoices"), |
199 | 'company_id': fields.many2one('res.company', 'Company', required=True), |
200 | } |
201 | + |
202 | _defaults = { |
203 | 'active': lambda *a: 1, |
204 | 'company_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id |
205 | @@ -66,27 +66,14 @@ |
206 | class res_partner(osv.osv): |
207 | _inherit='res.partner' |
208 | _columns={ |
209 | - 'payment_type_customer': fields.property( |
210 | - 'payment.type', |
211 | - type='many2one', |
212 | - relation='payment.type', |
213 | - string ='Customer Payment Type', |
214 | - method=True, |
215 | - view_load=True, |
216 | - help="Payment type of the customer"), |
217 | - 'payment_type_supplier': fields.property( |
218 | - 'payment.type', |
219 | - type='many2one', |
220 | - relation='payment.type', |
221 | - string ='Supplier Payment Type', |
222 | - method=True, |
223 | - view_load=True, |
224 | - help="Payment type of the supplier"), |
225 | + 'payment_type_customer': fields.property('payment.type', type='many2one', relation='payment.type', string ='Customer Payment Type', method=True, view_load=True, help="Payment type of the customer"), |
226 | + 'payment_type_supplier': fields.property('payment.type', type='many2one', relation='payment.type', string ='Supplier Payment Type', method=True, view_load=True, help="Payment type of the supplier"), |
227 | } |
228 | res_partner() |
229 | |
230 | |
231 | class res_partner_bank(osv.osv): |
232 | + _inherit="res.partner.bank" |
233 | |
234 | def create(self, cr, uid, vals, context=None): |
235 | if vals.get('default_bank') and vals.get('partner_id') and vals.get('state'): |
236 | @@ -106,7 +93,7 @@ |
237 | cr.execute(sql) |
238 | return super(res_partner_bank, self).write(cr, uid, ids, vals, context=context) |
239 | |
240 | - _inherit="res.partner.bank" |
241 | + |
242 | _columns = { |
243 | 'default_bank' : fields.boolean('Default'), |
244 | } |
245 | |
246 | === modified file 'account_payment_extension/payment_view.xml' |
247 | --- account_payment_extension/payment_view.xml 2012-01-26 22:41:04 +0000 |
248 | +++ account_payment_extension/payment_view.xml 2012-08-16 13:33:08 +0000 |
249 | @@ -2,7 +2,11 @@ |
250 | <openerp> |
251 | <data> |
252 | |
253 | - <!--************************** PARTNERS - default bank **************************--> |
254 | + <!-- |
255 | + ======================================================================================================== |
256 | + PARTNERS - default bank |
257 | + ======================================================================================================== |
258 | + --> |
259 | <record model="ir.ui.view" id="view_partner_form"> |
260 | <field name="model">res.partner</field> |
261 | <field name="inherit_id" ref="account.view_partner_property_form"/> |
262 | @@ -46,7 +50,11 @@ |
263 | </record> |
264 | |
265 | |
266 | - <!--************************** PARTNERS - payment type **************************--> |
267 | + <!-- |
268 | + ==================================================================================================== |
269 | + PARTNERS - payment type |
270 | + ==================================================================================================== |
271 | + --> |
272 | <record model="ir.ui.view" id="view_payment_type_res_partner_form1"> |
273 | <field name="name">res.partner.form.payment_type1</field> |
274 | <field name="model">res.partner</field> |
275 | @@ -74,7 +82,11 @@ |
276 | </record> |
277 | |
278 | |
279 | - <!--****************************** PAYMENT TYPE ******************************--> |
280 | + <!-- |
281 | + ===================================================================================================== |
282 | + PAYMENT TYPE |
283 | + ===================================================================================================== |
284 | + --> |
285 | <record model="ir.ui.view" id="view_payment_type_tree"> |
286 | <field name="name">payment.type.tree</field> |
287 | <field name="model">payment.type</field> |
288 | @@ -116,7 +128,11 @@ |
289 | <menuitem action="action_payment_type" id="menu_action_payment_type" parent="account.menu_configuration_misc"/> |
290 | |
291 | |
292 | - <!--****************************** PAYMENT MODE ******************************--> |
293 | + <!-- |
294 | + ======================================================================================================= |
295 | + PAYMENT MODE |
296 | + ======================================================================================================= |
297 | + --> |
298 | <record id="view_payment_mode_form_require_bank_account" model="ir.ui.view"> |
299 | <field name="name">payment.mode.form.require_bank_account</field> |
300 | <field name="model">payment.mode</field> |
301 | @@ -131,7 +147,11 @@ |
302 | </record> |
303 | |
304 | |
305 | - <!--****************************** INVOICES ******************************--> |
306 | + <!-- |
307 | + ================================================================================================= |
308 | + INVOICES |
309 | + ================================================================================================= |
310 | + --> |
311 | <!--Field partner_bank_id in client invoices has a strange domain: domain="[('partner_id.ref_companies', 'in', [company_id])]"--> |
312 | <record model="ir.ui.view" id="invoice_form3"> |
313 | <field name="name">account.invoice.form3.payment_type</field> |
314 | @@ -205,7 +225,12 @@ |
315 | </record> |
316 | |
317 | |
318 | - <!--***************************** BANK STATEMENT *********************************--> |
319 | + <!-- |
320 | + ======================================================================================================== |
321 | + BANK STATEMENT |
322 | + ======================================================================================================== |
323 | + |
324 | + |
325 | <record id="view_bank_statement_form_ext" model="ir.ui.view"> |
326 | <field name="name">account.bank.statement.form.ext</field> |
327 | <field name="model">account.bank.statement</field> |
328 | @@ -213,13 +238,16 @@ |
329 | <field name="inherit_id" ref="account_payment.view_bank_statement_form"/> |
330 | <field name="arch" type="xml"> |
331 | <button name="%(account_payment.action_account_populate_statement_confirm)d" position="replace"> |
332 | - <button name="%(wizard_populate_statement_ext)d" string="Import payment lines" type="action" attrs="{'invisible':[('state','=','confirm')]}" icon="gtk-execute"/> |
333 | - </button> |
334 | + <button name="%(act_wizard_populate_statement)d" string="Import payment lines" type="action" attrs="{'invisible':[('state','=','confirm')]}" icon="gtk-execute"/> |
335 | + </button> |
336 | </field> |
337 | </record> |
338 | - |
339 | - |
340 | - <!--***************************** PAYMENT ORDER *********************************--> |
341 | + --> |
342 | + <!-- |
343 | + ==================================================================================================== |
344 | + PAYMENT ORDER |
345 | + ==================================================================================================== |
346 | + --> |
347 | <!-- Filter invoices by payment type. Allow negative payment amounts --> |
348 | <record id="view_payment_order_form_ext1" model="ir.ui.view"> |
349 | <field name="name">payment.order.form.ext1</field> |
350 | @@ -234,7 +262,7 @@ |
351 | <group colspan="2" col="1" attrs="{'invisible': [('create_account_moves', '=', 'bank-statement')]}"> |
352 | <field name="period_id" attrs="{'required': [('create_account_moves', '!=', 'bank-statement')]}"/> |
353 | </group> |
354 | - <button colspan="2" name="%(wizard_populate_payment_ext)d" string="Select invoices to pay/receive payment" type="action" attrs="{'invisible':[('state','=','done')]}" icon="gtk-find"/> |
355 | + <button colspan="2" name="%(action_create_payment_extension_order)d" string="Select invoices to pay/receive payment" type="action" attrs="{'invisible':[('state','=','done')]}" icon="gtk-find"/> |
356 | </button> |
357 | </field> |
358 | </record> |
359 | @@ -274,18 +302,21 @@ |
360 | <field name="inherit_id" ref="account_payment.view_payment_line_form"/> |
361 | <field name="arch" type="xml"> |
362 | <field name="move_line_id" position="replace"> |
363 | - <!--<field name="move_line_id" on_change="onchange_move_line(move_line_id,parent.mode,parent.date_prefered,parent.date_scheduled,currency,company_currency,context)" select="1"/>--> |
364 | - <group col="6" colspan="4"> |
365 | - <field name="move_line_id" on_change="onchange_move_line(move_line_id, False, currency, company_currency)" select="1"/> |
366 | - <field name="account_id"/> |
367 | - <field name="payment_move_id"/> |
368 | - </group> |
369 | + <group col="6" colspan="4"> |
370 | + <field name="move_line_id" on_change="onchange_move_line(move_line_id, False, currency, company_currency)" select="1"/> |
371 | + <field name="account_id"/> |
372 | + <field name="payment_move_id"/> |
373 | + </group> |
374 | </field> |
375 | </field> |
376 | </record> |
377 | |
378 | |
379 | - <!--**************************** PAYABLE PAYMENT ORDER ********************************--> |
380 | + <!-- |
381 | + ==================================================================================================== |
382 | + PAYABLE PAYMENT ORDER |
383 | + ==================================================================================================== |
384 | + --> |
385 | <record id="account_payment.action_payment_order_tree" model="ir.actions.act_window"> |
386 | <field name="name">Pay. payment order</field> |
387 | <field name="res_model">payment.order</field> |
388 | @@ -295,7 +326,11 @@ |
389 | <field name="context">{'type':'payable'}</field> |
390 | </record> |
391 | |
392 | - <!--**************************** RECEIVABLE PAYMENT ORDER ********************************--> |
393 | + <!-- |
394 | + ====================================================================================================== |
395 | + RECEIVABLE PAYMENT ORDER |
396 | + ====================================================================================================== |
397 | + --> |
398 | <record id="action_rec_payment_order_tree" model="ir.actions.act_window"> |
399 | <field name="name">Rec. payment order</field> |
400 | <field name="res_model">payment.order</field> |
401 | @@ -306,7 +341,11 @@ |
402 | </record> |
403 | <menuitem action="action_rec_payment_order_tree" id="menu_action_rec_payment_order_form" parent="account_payment.menu_main_payment" sequence="2"/> |
404 | |
405 | - <!--****************************** PAYMENTS ***********************************--> |
406 | + <!-- |
407 | + ========================================================================================= |
408 | + PAYMENTS |
409 | + ========================================================================================= |
410 | + --> |
411 | <record id="view_payments_tree" model="ir.ui.view"> |
412 | <field name="name">Payments</field> |
413 | <field name="model">account.move.line</field> |
414 | @@ -382,4 +421,4 @@ |
415 | <menuitem name="Done payments" parent="account_payment.menu_main_payment" action="action_done_payments" id="menu_action_done_payments" sequence="5"/> |
416 | |
417 | </data> |
418 | -</openerp> |
419 | +</openerp> |
420 | \ No newline at end of file |
421 | |
422 | === removed file 'account_payment_extension/payment_wizard.xml' |
423 | --- account_payment_extension/payment_wizard.xml 2010-12-18 19:41:11 +0000 |
424 | +++ account_payment_extension/payment_wizard.xml 1970-01-01 00:00:00 +0000 |
425 | @@ -1,7 +0,0 @@ |
426 | -<?xml version="1.0" encoding="utf-8"?> |
427 | -<openerp> |
428 | - <data> |
429 | - <wizard id="wizard_populate_payment_ext" menu="False" model="payment.order" name="populate_payment_ext" string="Populate payment to pay"/> |
430 | - <wizard id="wizard_populate_statement_ext" menu="False" model="account.bank.statement" name="populate_statement_ext" string="Populate Statement with Payment lines"/> |
431 | - </data> |
432 | -</openerp> |
433 | |
434 | === modified file 'account_payment_extension/wizard/__init__.py' |
435 | --- account_payment_extension/wizard/__init__.py 2011-11-17 21:02:14 +0000 |
436 | +++ account_payment_extension/wizard/__init__.py 2012-08-16 13:33:08 +0000 |
437 | @@ -4,6 +4,8 @@ |
438 | # OpenERP, Open Source Management Solution |
439 | # Copyright (c) 2008 Zikzakmedia S.L. (http://zikzakmedia.com) All Rights Reserved. |
440 | # Jordi Esteve <jesteve@zikzakmedia.com> |
441 | +# AvanzOSC, Avanzed Open Source Consulting |
442 | +# Copyright (C) 2011-2012 Iker Coranti (www.avanzosc.com). All Rights Reserved |
443 | # $Id$ |
444 | # |
445 | # This program is free software: you can redistribute it and/or modify |
446 | @@ -21,8 +23,7 @@ |
447 | # |
448 | ############################################################################## |
449 | |
450 | -import wizard_payment_order |
451 | -import wizard_populate_statement |
452 | +import account_payment_order |
453 | |
454 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
455 | |
456 | |
457 | === added file 'account_payment_extension/wizard/account_payment_order.py' |
458 | --- account_payment_extension/wizard/account_payment_order.py 1970-01-01 00:00:00 +0000 |
459 | +++ account_payment_extension/wizard/account_payment_order.py 2012-08-16 13:33:08 +0000 |
460 | @@ -0,0 +1,174 @@ |
461 | +# -*- encoding: utf-8 -*- |
462 | +############################################################################## |
463 | +# |
464 | +# OpenERP, Open Source Management Solution |
465 | +# Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved |
466 | +# AvanzOSC, Avanzed Open Source Consulting |
467 | +# Copyright (C) 2011-2012 Iker Coranti (www.avanzosc.com). All Rights Reserved |
468 | +# $Id$ |
469 | +# |
470 | +# This program is free software: you can redistribute it and/or modify |
471 | +# it under the terms of the GNU Affero General Public License as published by |
472 | +# the Free Software Foundation, either version 3 of the License, or |
473 | +# (at your option) any later version. |
474 | +# |
475 | +# This program is distributed in the hope that it will be useful, |
476 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
477 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
478 | +# GNU Affero General Public License for more details. |
479 | +# |
480 | +# You should have received a copy of the GNU Affero General Public License |
481 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
482 | +# |
483 | +############################################################################## |
484 | + |
485 | +import time |
486 | +from lxml import etree |
487 | +from osv import osv, fields |
488 | + |
489 | +import pooler |
490 | + |
491 | + |
492 | + |
493 | +class payment_order_create(osv.osv_memory): |
494 | + """ |
495 | + Create a payment object with lines corresponding to the account move line |
496 | + to pay according to the date provided by the user and the mode-type payment of the order. |
497 | + Hypothesis: |
498 | + - Small number of non-reconcilied move line , payment mode and bank account type, |
499 | + - Big number of partner and bank account. |
500 | + |
501 | + If a type is given, unsuitable account move lines are ignored. |
502 | + """ |
503 | + _inherit = 'payment.order.create' |
504 | + _description = '' |
505 | + |
506 | + _columns={ |
507 | + 'communication2':fields.char ('Communication 2',size = 64, help ='The successor message of payment communication.'), |
508 | + 'amount':fields.float ('Amount', help ='Next step will automatically select payments up to this amount as long as account moves have bank account if that is required by the selected payment mode.'), |
509 | + 'show_refunds':fields.boolean('Show Refunds', help = 'Indicates if search should include refunds.'), |
510 | + } |
511 | + |
512 | + _defaults={ |
513 | + 'show_refunds': lambda *a: False, |
514 | + } |
515 | + |
516 | + def default_get(self, cr, uid, fields, context=None): |
517 | + """ |
518 | + This function gets default values |
519 | + @param self: The object pointer |
520 | + @param cr: the current row, from the database cursor, |
521 | + @param uid: the current user’s ID for security checks, |
522 | + @param fields: List of fields for default value |
523 | + @param context: A standard dictionary for contextual values |
524 | + |
525 | + @return : default values of fields. |
526 | + """ |
527 | + line_obj = self.pool.get('account.move.line') |
528 | + res = super(payment_order_create, self).default_get(cr, uid, fields, context=context) |
529 | + if 'entries' in fields: |
530 | + if context and 'line_ids' in context and context['line_ids']: |
531 | + res.update({'entries': context['line_ids']}) |
532 | + |
533 | + return res |
534 | + |
535 | + def search_entries(self, cr, uid, ids, context): |
536 | + pool = pooler.get_pool(cr.dbname) |
537 | + order_obj = self.pool.get('payment.order') |
538 | + line_obj = self.pool.get('account.move.line') |
539 | + mod_obj = self.pool.get('ir.model.data') |
540 | + if context is None: |
541 | + context = {} |
542 | + data = self.browse(cr, uid, ids, context=context)[0] |
543 | + search_due_date = data.duedate |
544 | + show_refunds = data.show_refunds |
545 | + amount = data.amount |
546 | + |
547 | + payment = order_obj.browse(cr, uid, context.get('active_id'), context=context) |
548 | + |
549 | + # Search for move line to pay: |
550 | + domain = [('reconcile_id', '=', False),('account_id.type', '=', payment.type),('amount_to_pay', '<>', 0)] |
551 | + |
552 | + if payment.type =='payable' and not show_refunds: |
553 | + domain += [ ('credit','>',0) ] |
554 | + |
555 | + elif not show_refunds: |
556 | + domain += [ ('debit','>',0) ] |
557 | + |
558 | + if payment.mode: |
559 | + domain += [ ('payment_type','=',payment.mode.type.id) ] |
560 | + |
561 | + domain += ['|',('date_maturity','<',search_due_date),('date_maturity','=',False)] |
562 | + line_ids = line_obj.search(cr, uid, domain, order='date_maturity', context=context) |
563 | + |
564 | + selected_ids = [] |
565 | + if amount: |
566 | + if payment.mode and payment.mode.require_bank_account: |
567 | + line2bank = pool.get('account.move.line').line2bank(cr, uid, line_ids, payment.mode.id, context) |
568 | + else: |
569 | + line2bank = None |
570 | + # If user specified an amount, search what moves match the criteria taking into account |
571 | + # if payment mode allows bank account to be null. |
572 | + for line in pool.get('account.move.line').browse(cr, uid, line_ids, context): |
573 | + if abs(line.amount_to_pay) <= amount: |
574 | + amount -= abs(line.amount_to_pay) |
575 | + selected_ids.append( line.id ) |
576 | + |
577 | + context.update({'line_ids': selected_ids}) |
578 | + model_data_ids = mod_obj.search(cr, uid,[('model', '=', 'ir.ui.view'), ('name', '=', 'view_create_payment_order_lines')], context=context) |
579 | + resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id'] |
580 | + return {'name': ('Entrie Lines'), |
581 | + 'context': context, |
582 | + 'view_type': 'form', |
583 | + 'view_mode': 'form', |
584 | + 'res_model': 'payment.order.create', |
585 | + 'views': [(resource_id,'form')], |
586 | + 'type': 'ir.actions.act_window', |
587 | + 'target': 'new', |
588 | + } |
589 | + |
590 | + def create_payment(self, cr, uid, ids, context=None): |
591 | + order_obj = self.pool.get('payment.order') |
592 | + line_obj = self.pool.get('account.move.line') |
593 | + payment_obj = self.pool.get('payment.line') |
594 | + if context is None: |
595 | + context = {} |
596 | + data = self.browse(cr, uid, ids, context=context)[0] |
597 | + line_ids = [entry.id for entry in data.entries] |
598 | + if not line_ids: |
599 | + return {'type': 'ir.actions.act_window_close'} |
600 | + |
601 | + payment = order_obj.browse(cr, uid, context['active_id'], context=context) |
602 | + t = None |
603 | + line2bank = line_obj.line2bank(cr, uid, line_ids, t, context) |
604 | + ## Finally populate the current payment with new lines: |
605 | + for line in line_obj.browse(cr, uid, line_ids, context=context): |
606 | + if payment.date_prefered == "now": |
607 | + #no payment date => immediate payment |
608 | + date_to_pay = False |
609 | + elif payment.date_prefered == 'due': |
610 | + date_to_pay = line.date_maturity |
611 | + elif payment.date_prefered == 'fixed': |
612 | + date_to_pay = payment.date_scheduled |
613 | + if payment.type == 'payable': |
614 | + amount_to_pay = line.amount_to_pay |
615 | + else: |
616 | + amount_to_pay = -line.amount_to_pay |
617 | + |
618 | + payment_obj.create(cr, uid,{ |
619 | + 'move_line_id': line.id, |
620 | + 'amount_currency': amount_to_pay, |
621 | + 'bank_id': line2bank.get(line.id), |
622 | + 'order_id': payment.id, |
623 | + 'partner_id': line.partner_id and line.partner_id.id or False, |
624 | + 'communication': (line.ref and line.name!='/' and line.ref+'. '+line.name) or line.ref or line.name or '/', |
625 | + 'communication2': data.communication2, |
626 | + 'date': date_to_pay, |
627 | + 'currency': line.invoice and line.invoice.currency_id.id or False, |
628 | + 'account_id': line.account_id.id, |
629 | + }, context=context) |
630 | + return {'type': 'ir.actions.act_window_close'} |
631 | + |
632 | +payment_order_create() |
633 | + |
634 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
635 | |
636 | === added file 'account_payment_extension/wizard/account_payment_order_view.xml' |
637 | --- account_payment_extension/wizard/account_payment_order_view.xml 1970-01-01 00:00:00 +0000 |
638 | +++ account_payment_extension/wizard/account_payment_order_view.xml 2012-08-16 13:33:08 +0000 |
639 | @@ -0,0 +1,66 @@ |
640 | +<?xml version="1.0" encoding="utf-8"?> |
641 | +<openerp> |
642 | + <data> |
643 | + <!-- FORM SEARCH--> |
644 | + |
645 | + <record id="view_payment_order_form_ext1" model="ir.ui.view"> |
646 | + <field name="name">payment.order.form.ext1</field> |
647 | + <field name="model">payment.order</field> |
648 | + <field name="type">form</field> |
649 | + <field name="inherit_id" ref="account_payment.view_payment_order_form"/> |
650 | + <field name="arch" type="xml"> |
651 | + <button name="%(account_payment.action_create_payment_order)d" position="replace"> |
652 | + <field name="payment_type_name" invisible="1"/> |
653 | + <field name="type"/> |
654 | + <field name="create_account_moves"/> |
655 | + <group colspan="2" col="1" attrs="{'invisible': [('create_account_moves', '=', 'bank-statement')]}"> |
656 | + <field name="period_id" attrs="{'required': [('create_account_moves', '!=', 'bank-statement')]}"/> |
657 | + </group> |
658 | + <button colspan="2" name="%(action_create_payment_extension_order)d" string="Select invoices to pay/receive payment" type="action" attrs="{'invisible':[('state','=','done')]}" icon="gtk-find"/> |
659 | + </button> |
660 | + </field> |
661 | + </record> |
662 | + |
663 | + |
664 | + <record id="view_create_payment_extension_order" model="ir.ui.view"> |
665 | + <field name="name">payment.extension.order.create.form</field> |
666 | + <field name="model">payment.order.create</field> |
667 | + <field name="type">form</field> |
668 | + <field name="inherit_id" ref="account_payment.view_create_payment_order"/> |
669 | + <field name="arch" type="xml"> |
670 | + <field name="duedate" position="after"> |
671 | + <field name="amount" /> |
672 | + <field name="show_refunds" /> |
673 | + </field> |
674 | + </field> |
675 | + </record> |
676 | + <!-- FORM LIST--> |
677 | + <record id="view_create_payment_extension_order_lines" model="ir.ui.view"> |
678 | + <field name="name">payment.extension.order.create.form</field> |
679 | + <field name="model">payment.order.create</field> |
680 | + <field name="type">form</field> |
681 | + <field name="inherit_id" ref="account_payment.view_create_payment_order_lines"/> |
682 | + <field name="arch" type="xml"> |
683 | + <xpath expr="//field[@name='entries']/.." position="replace"> |
684 | + <group col="4" colspan="4"> |
685 | + <separator colspan="4" string="Entries"/> |
686 | + <field name="entries" nolabel="1"/> |
687 | + </group> |
688 | + <separator string="Extra message of payment communication" colspan="4"/> |
689 | + <field name="communication2" colspan="4"/> |
690 | + </xpath> |
691 | + </field> |
692 | + </record> |
693 | + |
694 | + <!-- ACCION --> |
695 | + <record id="action_create_payment_extension_order" model="ir.actions.act_window"> |
696 | + <field name="name">Seleccionar facturas a Pagar/Cobrar</field> |
697 | + <field name="type">ir.actions.act_window</field> |
698 | + <field name="res_model">payment.order.create</field> |
699 | + <field name="view_type">form</field> |
700 | + <field name="view_mode">form</field> |
701 | + <field name="view_id" ref="view_create_payment_extension_order"/> |
702 | + <field name="target">new</field> |
703 | + </record> |
704 | + </data> |
705 | +</openerp> |
706 | |
707 | === removed file 'account_payment_extension/wizard/wizard_payment_order.py' |
708 | --- account_payment_extension/wizard/wizard_payment_order.py 2011-11-17 21:02:14 +0000 |
709 | +++ account_payment_extension/wizard/wizard_payment_order.py 1970-01-01 00:00:00 +0000 |
710 | @@ -1,209 +0,0 @@ |
711 | -# -*- encoding: utf-8 -*- |
712 | -############################################################################## |
713 | -# |
714 | -# OpenERP, Open Source Management Solution |
715 | -# Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved |
716 | -# $Id$ |
717 | -# |
718 | -# This program is free software: you can redistribute it and/or modify |
719 | -# it under the terms of the GNU Affero General Public License as published by |
720 | -# the Free Software Foundation, either version 3 of the License, or |
721 | -# (at your option) any later version. |
722 | -# |
723 | -# This program is distributed in the hope that it will be useful, |
724 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
725 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
726 | -# GNU Affero General Public License for more details. |
727 | -# |
728 | -# You should have received a copy of the GNU Affero General Public License |
729 | -# along with this program. If not, see <http://www.gnu.org/licenses/>. |
730 | -# |
731 | -############################################################################## |
732 | -import wizard |
733 | -import pooler |
734 | -from tools.misc import UpdateableStr |
735 | -import time |
736 | - |
737 | - |
738 | -FORM = UpdateableStr() |
739 | - |
740 | -FIELDS = { |
741 | - 'entries': {'string':'Entries', 'type':'many2many', 'relation':'account.move.line',}, |
742 | - 'communication2': {'string':'Communication 2', 'type':'char', 'size': 64, 'help':'The successor message of payment communication.'}, |
743 | -} |
744 | - |
745 | -field_duedate={ |
746 | - 'duedate': {'string':'Due Date', 'type':'date','required':True, 'default': lambda *a: time.strftime('%Y-%m-%d'),}, |
747 | - 'amount': {'string':'Amount', 'type':'float', 'help': 'Next step will automatically select payments up to this amount as long as account moves have bank account if that is required by the selected payment mode.'}, |
748 | - 'show_refunds': {'string':'Show Refunds','type':'boolean', 'help':'Indicates if search should include refunds.', 'default': lambda *a: False}, |
749 | - } |
750 | -arch_duedate='''<?xml version="1.0" encoding="utf-8"?> |
751 | -<form string="Search Payment lines" col="2"> |
752 | - <field name="duedate" /> |
753 | - <field name="amount" /> |
754 | - <field name="show_refunds" /> |
755 | -</form>''' |
756 | - |
757 | - |
758 | -def search_entries(self, cr, uid, data, context): |
759 | - search_due_date = data['form']['duedate'] |
760 | - show_refunds = data['form']['show_refunds'] |
761 | - |
762 | - pool = pooler.get_pool(cr.dbname) |
763 | - order_obj = pool.get('payment.order') |
764 | - line_obj = pool.get('account.move.line') |
765 | - |
766 | - payment = order_obj.browse(cr, uid, data['id'], |
767 | - context=context) |
768 | - ctx = '' |
769 | - if payment.mode: |
770 | - ctx = '''context="{'journal_id': %d}"''' % payment.mode.journal.id |
771 | - |
772 | - # Search for move line to pay: |
773 | - domain = [('reconcile_id', '=', False),('account_id.type', '=', payment.type),('amount_to_pay', '<>', 0)] |
774 | - |
775 | - if payment.type =='payable' and not show_refunds: |
776 | - domain += [ ('credit','>',0) ] |
777 | - elif not show_refunds: |
778 | - domain += [ ('debit','>',0) ] |
779 | - |
780 | - if payment.mode: |
781 | - domain += [('payment_type','=',payment.mode.type.id)] |
782 | - |
783 | - domain += ['|',('date_maturity','<',search_due_date),('date_maturity','=',False)] |
784 | - line_ids = line_obj.search(cr, uid, domain, order='date_maturity', context=context) |
785 | - |
786 | - |
787 | - FORM.string = '''<?xml version="1.0" encoding="utf-8"?> |
788 | -<form string="Populate Payment:"> |
789 | - <field name="entries" colspan="4" height="300" width="800" nolabel="1" |
790 | - domain="[('id', 'in', [%s])]" %s/> |
791 | - <separator string="Extra message of payment communication" colspan="4"/> |
792 | - <field name="communication2" colspan="4"/> |
793 | -</form>''' % (','.join([str(x) for x in line_ids]), ctx) |
794 | - |
795 | - selected_ids = [] |
796 | - |
797 | - |
798 | -# if payment.mode.require_bank_account and not line.partner_bank_id: |
799 | -# continue |
800 | -# if payment.mode.require_same_bank_account: |
801 | -# if not line.partner_bank_id: |
802 | -# continue |
803 | -# mode_account = payment.mode.bank_id.acc_number or payment.mode.bank_id.iban |
804 | -# line_account = line.partner_bank_id.acc_number or line.partner_bank_id.iban |
805 | -# if mode_account != line_account: |
806 | -# continue |
807 | -# if payment.mode.require_received_check: |
808 | -# if not line.received_check: |
809 | -# continue |
810 | - |
811 | - amount = data['form']['amount'] |
812 | - if amount: |
813 | - if payment.mode and payment.mode.require_bank_account: |
814 | - line2bank = pool.get('account.move.line').line2bank(cr, uid, line_ids, payment.mode.id, context) |
815 | - else: |
816 | - line2bank = None |
817 | - # If user specified an amount, search what moves match the criteria taking into account |
818 | - # if payment mode allows bank account to be null. |
819 | - for line in pool.get('account.move.line').browse(cr, uid, line_ids, context): |
820 | - if abs(line.amount_to_pay) <= amount: |
821 | - amount -= abs(line.amount_to_pay) |
822 | - selected_ids.append( line.id ) |
823 | - return { |
824 | - 'entries': selected_ids, |
825 | - } |
826 | - |
827 | - |
828 | -def create_payment(self, cr, uid, data, context): |
829 | - line_ids= data['form']['entries'][0][2] |
830 | - if not line_ids: return {} |
831 | - |
832 | - pool= pooler.get_pool(cr.dbname) |
833 | - order_obj = pool.get('payment.order') |
834 | - line_obj = pool.get('account.move.line') |
835 | - |
836 | - payment = order_obj.browse(cr, uid, data['id'], |
837 | - context=context) |
838 | - t = payment.mode and payment.mode.type.id or None |
839 | - line2bank = pool.get('account.move.line').line2bank(cr, uid, |
840 | - line_ids, t, context) |
841 | - |
842 | - ## Finally populate the current payment with new lines: |
843 | - for line in line_obj.browse(cr, uid, line_ids, context=context): |
844 | - if payment.date_prefered == "now": |
845 | - #no payment date => immediate payment |
846 | - date_to_pay = False |
847 | - elif payment.date_prefered == 'due': |
848 | - date_to_pay = line.date_maturity |
849 | - elif payment.date_prefered == 'fixed': |
850 | - date_to_pay = payment.date_scheduled |
851 | - |
852 | - if payment.type == 'payable': |
853 | - amount_to_pay = line.amount_to_pay |
854 | - else: |
855 | - amount_to_pay = -line.amount_to_pay |
856 | - pool.get('payment.line').create(cr,uid,{ |
857 | - 'move_line_id': line.id, |
858 | - 'amount_currency': amount_to_pay, |
859 | - 'bank_id': line2bank.get(line.id), |
860 | - 'order_id': payment.id, |
861 | - 'partner_id': line.partner_id and line.partner_id.id or False, |
862 | - 'communication': (line.ref and line.name!='/' and line.ref+'. '+line.name) or line.ref or line.name or '/', |
863 | - 'communication2': data['form']['communication2'], |
864 | - 'date': date_to_pay, |
865 | - 'currency': line.invoice and line.invoice.currency_id.id or False, |
866 | - 'account_id': line.account_id.id, |
867 | - }, context=context) |
868 | - return {} |
869 | - |
870 | - |
871 | -class wizard_payment_order(wizard.interface): |
872 | - """ |
873 | - Create a payment object with lines corresponding to the account move line |
874 | - to pay according to the date provided by the user and the mode-type payment of the order. |
875 | - Hypothesis: |
876 | - - Small number of non-reconcilied move line , payment mode and bank account type, |
877 | - - Big number of partner and bank account. |
878 | - |
879 | - If a type is given, unsuitable account move lines are ignored. |
880 | - """ |
881 | - states = { |
882 | - |
883 | - 'init': { |
884 | - 'actions': [], |
885 | - 'result': { |
886 | - 'type': 'form', |
887 | - 'arch': arch_duedate, |
888 | - 'fields':field_duedate, |
889 | - 'state': [ |
890 | - ('end','_Cancel'), |
891 | - ('search','_Search', '', True) |
892 | - ] |
893 | - }, |
894 | - }, |
895 | - |
896 | - 'search': { |
897 | - 'actions': [search_entries], |
898 | - 'result': { |
899 | - 'type': 'form', |
900 | - 'arch': FORM, |
901 | - 'fields': FIELDS, |
902 | - 'state': [ |
903 | - ('end','_Cancel'), |
904 | - ('create','_Add to payment order', '', True) |
905 | - ] |
906 | - }, |
907 | - }, |
908 | - 'create': { |
909 | - 'actions': [], |
910 | - 'result': { |
911 | - 'type': 'action', |
912 | - 'action': create_payment, |
913 | - 'state': 'end'} |
914 | - }, |
915 | - } |
916 | - |
917 | -wizard_payment_order('populate_payment_ext') |
918 | - |
919 | -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
920 | |
921 | === added file 'account_payment_extension/wizard/wizard_payment_order_view.xml' |
922 | --- account_payment_extension/wizard/wizard_payment_order_view.xml 1970-01-01 00:00:00 +0000 |
923 | +++ account_payment_extension/wizard/wizard_payment_order_view.xml 2012-08-16 13:33:08 +0000 |
924 | @@ -0,0 +1,42 @@ |
925 | +<?xml version="1.0" encoding="utf-8"?> |
926 | +<openerp> |
927 | + <data> |
928 | + |
929 | + <!-- |
930 | + =============================================================================================================== |
931 | + WIZAR.PAYMENT.ORDER |
932 | + =============================================================================================================== |
933 | + --> |
934 | + |
935 | + <!-- FORM --> |
936 | + <record model="ir.ui.view" id="wizard_payment_order_form_view"> |
937 | + <field name="name">wizard.payment.order.form.view</field> |
938 | + <field name="model">wizard.payment.order</field> |
939 | + <field name="type">form</field> |
940 | + <field name="arch" type="xml"> |
941 | + <form string="Buscar Lineas de Pago"> |
942 | + <group colspan="4" col="2"> |
943 | + <field name="duedate" /> |
944 | + <field name="amount" /> |
945 | + <field name="show_refunds" /> |
946 | + </group> |
947 | + <group colspan="4"> |
948 | + <button name="cerrar" icon='gtk-no' string="Cancelar"/> |
949 | + <button name="search_entries" icon='gtk-ok' type="object" string="Buscar"/> |
950 | + </group> |
951 | + </form> |
952 | + </field> |
953 | + </record> |
954 | + |
955 | + <!-- ACCION --> |
956 | + <record id="act_wizard_payment_order" model="ir.actions.act_window"> |
957 | + <field name="name">Seleccionar facturas a Pagar/Cobrar</field> |
958 | + <field name="type">ir.actions.act_window</field> |
959 | + <field name="res_model">wizard.payment.order</field> |
960 | + <field name="view_type">form</field> |
961 | + <field name="view_mode">form</field> |
962 | + <field name="target">new</field> |
963 | + </record> |
964 | + |
965 | + </data> |
966 | +</openerp> |
967 | |
968 | === removed file 'account_payment_extension/wizard/wizard_populate_statement.py' |
969 | --- account_payment_extension/wizard/wizard_populate_statement.py 2011-11-17 21:02:14 +0000 |
970 | +++ account_payment_extension/wizard/wizard_populate_statement.py 1970-01-01 00:00:00 +0000 |
971 | @@ -1,152 +0,0 @@ |
972 | -# -*- encoding: utf-8 -*- |
973 | -############################################################################## |
974 | -# |
975 | -# OpenERP, Open Source Management Solution |
976 | -# Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved |
977 | -# $Id$ |
978 | -# |
979 | -# This program is free software: you can redistribute it and/or modify |
980 | -# it under the terms of the GNU Affero General Public License as published by |
981 | -# the Free Software Foundation, either version 3 of the License, or |
982 | -# (at your option) any later version. |
983 | -# |
984 | -# This program is distributed in the hope that it will be useful, |
985 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
986 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
987 | -# GNU Affero General Public License for more details. |
988 | -# |
989 | -# You should have received a copy of the GNU Affero General Public License |
990 | -# along with this program. If not, see <http://www.gnu.org/licenses/>. |
991 | -# |
992 | -############################################################################## |
993 | -import wizard |
994 | -import pooler |
995 | -from tools.misc import UpdateableStr |
996 | - |
997 | -FORM = UpdateableStr() |
998 | - |
999 | -FIELDS = { |
1000 | - 'lines': {'string': 'Payment Lines', 'type': 'many2many', |
1001 | - 'relation': 'payment.line'}, |
1002 | -} |
1003 | - |
1004 | -def _search_entries(obj, cr, uid, data, context): |
1005 | - pool = pooler.get_pool(cr.dbname) |
1006 | - line_obj = pool.get('payment.line') |
1007 | - statement_obj = pool.get('account.bank.statement') |
1008 | - |
1009 | - statement = statement_obj.browse(cr, uid, data['id'], context=context) |
1010 | - |
1011 | - line_ids = line_obj.search(cr, uid, [ |
1012 | - ('move_line_id.reconcile_id', '=', False), |
1013 | - ('order_id.mode.journal.id', '=', statement.journal_id.id)]) |
1014 | - line_ids.extend(line_obj.search(cr, uid, [ |
1015 | - ('move_line_id.reconcile_id', '=', False), |
1016 | - ('order_id.mode', '=', False)])) |
1017 | - |
1018 | - FORM.string = '''<?xml version="1.0"?> |
1019 | -<form string="Populate Statement:"> |
1020 | - <field name="lines" colspan="4" height="300" width="800" nolabel="1" |
1021 | - domain="[('id', 'in', [%s])]"/> |
1022 | -</form>''' % (','.join([str(x) for x in line_ids])) |
1023 | - return {} |
1024 | - |
1025 | -def _populate_statement(obj, cr, uid, data, context): |
1026 | - line_ids = data['form']['lines'][0][2] |
1027 | - if not line_ids: |
1028 | - return {} |
1029 | - |
1030 | - pool = pooler.get_pool(cr.dbname) |
1031 | - line_obj = pool.get('payment.line') |
1032 | - statement_obj = pool.get('account.bank.statement') |
1033 | - statement_line_obj = pool.get('account.bank.statement.line') |
1034 | - currency_obj = pool.get('res.currency') |
1035 | - move_line_obj = pool.get('account.move.line') |
1036 | - voucher_obj = pool.get('account.voucher') |
1037 | - voucher_line_obj = pool.get('account.voucher.line') |
1038 | - |
1039 | - statement = statement_obj.browse(cr, uid, data['id'], context=context) |
1040 | - |
1041 | - for line in line_obj.browse(cr, uid, line_ids, context=context): |
1042 | - ctx = context.copy() |
1043 | - ctx['date'] = line.ml_maturity_date |
1044 | - amount_currency = line.type == 'payment' and line.amount_currency or -line.amount_currency |
1045 | - amount = currency_obj.compute(cr, uid, line.currency.id, |
1046 | - statement.currency.id, amount_currency, context=ctx) |
1047 | - |
1048 | - voucher_id = False |
1049 | - if line.move_line_id: |
1050 | - #We have to create a voucher and link it to the bank statement line |
1051 | - context.update({'move_line_ids': [line.move_line_id.id]}) |
1052 | - result = voucher_obj.onchange_partner_id(cr, uid, [], partner_id=line.move_line_id.partner_id.id, |
1053 | - journal_id=statement.journal_id.id, price=abs(amount), currency_id= statement.currency.id, |
1054 | - ttype=(amount < 0 and 'payment' or 'receipt'), date=line.date or line.move_line_id.date, context=context) |
1055 | - |
1056 | - voucher_res = { 'type':(amount < 0 and 'payment' or 'receipt'), |
1057 | - 'name': line.move_line_id.name, |
1058 | - 'reference': (line.order_id.reference or '?') +'. '+ line.name, |
1059 | - 'partner_id': line.move_line_id.partner_id.id, |
1060 | - 'journal_id': statement.journal_id.id, |
1061 | - 'account_id': result.get('account_id', statement.journal_id.default_credit_account_id.id), # improve me: statement.journal_id.default_credit_account_id.id |
1062 | - 'company_id': statement.company_id.id, |
1063 | - 'currency_id': statement.currency.id, |
1064 | - 'date': line.date or line.move_line_id.date, |
1065 | - 'amount': abs(amount), |
1066 | - 'period_id': statement.period_id.id} |
1067 | - voucher_id = voucher_obj.create(cr, uid, voucher_res, context=context) |
1068 | - |
1069 | - voucher_line_dict = {} |
1070 | - if result['value']['line_ids']: |
1071 | - for line_dict in result['value']['line_ids']: |
1072 | - move_line = move_line_obj.browse(cr, uid, line_dict['move_line_id'], context) |
1073 | - if line.move_line_id.move_id.id == move_line.move_id.id: |
1074 | - voucher_line_dict = line_dict |
1075 | - if voucher_line_dict: |
1076 | - voucher_line_dict.update({'voucher_id': voucher_id, 'amount': abs(amount)}) |
1077 | - voucher_line_obj.create(cr, uid, voucher_line_dict, context=context) |
1078 | - |
1079 | - statement_line_obj.create(cr, uid, { |
1080 | - 'name': (line.order_id.reference or '?') +'. '+ line.name, |
1081 | - # Tipically: type=='payable' => amount>0 type=='receivable' => amount<0 |
1082 | - 'amount': line.type == 'payable' and amount or -amount, |
1083 | - 'type': line.order_id.type=='payable' and 'supplier' or 'customer', |
1084 | - 'partner_id': line.partner_id.id, |
1085 | - 'account_id': line.move_line_id.account_id.id, |
1086 | - 'statement_id': statement.id, |
1087 | - 'ref': line.communication, |
1088 | - 'voucher_id': voucher_id, |
1089 | - }, context=context) |
1090 | - return {} |
1091 | - |
1092 | - |
1093 | -class PopulateStatement(wizard.interface): |
1094 | - """ |
1095 | - Populate the current statement with selected payement lines |
1096 | - """ |
1097 | - states = { |
1098 | - 'init': { |
1099 | - 'actions': [_search_entries], |
1100 | - 'result': { |
1101 | - 'type': 'form', |
1102 | - 'arch': FORM, |
1103 | - 'fields': FIELDS, |
1104 | - 'state': [ |
1105 | - ('end', '_Cancel'), |
1106 | - ('add', '_Add', '', True) |
1107 | - ] |
1108 | - }, |
1109 | - }, |
1110 | - 'add': { |
1111 | - 'actions': [], |
1112 | - 'result': { |
1113 | - 'type': 'action', |
1114 | - 'action': _populate_statement, |
1115 | - 'state': 'end' |
1116 | - }, |
1117 | - }, |
1118 | - } |
1119 | - |
1120 | -PopulateStatement('populate_statement_ext') |
1121 | - |
1122 | -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
1123 | - |
The extra addons are slowly being replaced by community-driven sub-projects.
I can't comment on the module itself, but at this stage I'm not sure we should keep merging branches into the extra addons.
If you can gather the interested parties and found a new team or project, you could remove the module from the extra addons and host the new version in the new project, and publicize it through apps.openerp.com.
What do you think?
Lionel Sausin.