Merge lp:~openerp-dev/openobject-addons/trunk-payment-order-tpa into lp:openobject-addons

Proposed by Turkesh Patel (openERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-addons/trunk-payment-order-tpa
Merge into: lp:openobject-addons
Diff against target: 460 lines (+97/-182)
7 files modified
account_payment/account_payment.py (+7/-1)
account_payment/account_payment_demo.xml (+1/-1)
account_payment/account_payment_view.xml (+47/-102)
account_payment/test/cancel_payment_order.yml (+6/-6)
account_payment/test/payment_order_process.yml (+10/-15)
account_payment/wizard/account_payment_create_order_view.xml (+18/-20)
account_payment/wizard/account_payment_order.py (+8/-37)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/trunk-payment-order-tpa
Reviewer Review Type Date Requested Status
Mustufa Rangwala (Open ERP) (community) Needs Fixing
Review via email: mp+206339@code.launchpad.net

Description of the change

[IMP] show only one wizard instead of two wizard to select invoice lines based on due date.
[IMP] improved form views.

To post a comment you must log in.
8851. By Turkesh Patel (openERP)

[RMV] remove conflicts

8852. By Turkesh Patel (openERP)

[FIX] improved code which changed during merge

8853. By Turkesh Patel (openERP)

[MRG] merge with lp:openobject-addons

8854. By Chirag Dodiya(OpenERP)

[MRG]Merge with lp:openobject-addons

8855. By Sunil Sharma(OpenERP)

[mrg]:lp:openobject-addons

8856. By Sunil Sharma(OpenERP)

[MRG]:lp:openobject-addons

8857. By Sunil Sharma(OpenERP)

[MRG]:lp:openobject-addons

Revision history for this message
Mustufa Rangwala (Open ERP) (mra-tinyerp) wrote :

Few remarks:
1. onchange_duedate_search_entries => onchange_duedate
2. onchange_duedate_search_entries method missing domain of credit > 0 and account_id.reconcile = True as shown in old code.
3. Will select the unpaid yet supplier's invoices before the selected due date. => Remove this.
4. Please improve get_obj_ref return variable types.

review: Needs Fixing
8858. By Sunil Sharma(OpenERP)

[imp]:improve onchange or domain and remove unused string

8859. By Sunil Sharma(OpenERP)

[imp]:improve onchange return and rename action name

8860. By Sunil Sharma(OpenERP)

[MRG]:lp:openobject-addons

8861. By Sunil Sharma(OpenERP)

[MRG]:lp:~openerp-dev/openobject-addons/trunk-payment-order-tpa-remove-action_id-ssh

8862. By Sunil Sharma(OpenERP)

[imp]:apply groups in fields or improve onchange_duedate

Revision history for this message
Sunil Sharma(OpenERP) (sunil.sharma-openerp) wrote :

Hello Sir,

 I have done following changes as per suggestion.

 1. onchange_duedate_search_entries => onchange_duedate
 2. onchange_duedate_search_entries method missing domain of credit > 0 and account_id.reconcile = True as shown in old code.
 3. Will select the unpaid yet supplier's invoices before the selected due date. => Remove this.
 4. Please improve get_obj_ref return variable types.

Thanks
Sunil Sharma (SSH)

8863. By Sunil Sharma(OpenERP)

[IMP]:improve entries tree view

8864. By Sunil Sharma(OpenERP)

[MRG]:lp:openobject-addons

Unmerged revisions

8864. By Sunil Sharma(OpenERP)

[MRG]:lp:openobject-addons

8863. By Sunil Sharma(OpenERP)

[IMP]:improve entries tree view

8862. By Sunil Sharma(OpenERP)

[imp]:apply groups in fields or improve onchange_duedate

8861. By Sunil Sharma(OpenERP)

[MRG]:lp:~openerp-dev/openobject-addons/trunk-payment-order-tpa-remove-action_id-ssh

8860. By Sunil Sharma(OpenERP)

[MRG]:lp:openobject-addons

8859. By Sunil Sharma(OpenERP)

[imp]:improve onchange return and rename action name

8858. By Sunil Sharma(OpenERP)

[imp]:improve onchange or domain and remove unused string

8857. By Sunil Sharma(OpenERP)

[MRG]:lp:openobject-addons

8856. By Sunil Sharma(OpenERP)

[MRG]:lp:openobject-addons

8855. By Sunil Sharma(OpenERP)

[mrg]:lp:openobject-addons

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account_payment/account_payment.py'
2--- account_payment/account_payment.py 2013-10-27 12:31:04 +0000
3+++ account_payment/account_payment.py 2014-04-24 09:55:13 +0000
4@@ -23,6 +23,7 @@
5 import time
6
7 from openerp.osv import fields, osv
8+from openerp.tools.translate import _
9
10 _logger = logging.getLogger(__name__)
11
12@@ -114,6 +115,7 @@
13 'date_prefered': 'due',
14 'date_created': lambda *a: time.strftime('%Y-%m-%d'),
15 'reference': lambda self,cr,uid,context: self.pool.get('ir.sequence').get(cr, uid, 'payment.order'),
16+ 'company_id': lambda self, cr, uid, context: self.pool.get('res.company')._company_default_get(cr, uid, 'payment.order', context=context)
17 }
18
19 def set_to_draft(self, cr, uid, ids, *args):
20@@ -124,6 +126,10 @@
21 def action_open(self, cr, uid, ids, *args):
22 ir_seq_obj = self.pool.get('ir.sequence')
23
24+ for line in self.browse(cr, uid, ids, context=None):
25+ if not line.line_ids :
26+ raise osv.except_osv(_('Error!'), _('You cannot confirm a Payment Order which has no line.'))
27+
28 for order in self.read(cr, uid, ids, ['reference']):
29 if not order['reference']:
30 reference = ir_seq_obj.get(cr, uid, 'payment.order')
31@@ -307,7 +313,7 @@
32 'communication': fields.char('Communication', size=64, required=True, help="Used as the message between ordering customer and current company. Depicts 'What do you want to say to the recipient about this order ?'"),
33 'communication2': fields.char('Communication 2', size=64, help='The successor message of Communication.'),
34 'move_line_id': fields.many2one('account.move.line', 'Entry line', domain=[('reconcile_id', '=', False), ('account_id.type', '=', 'payable')], help='This Entry Line will be referred for the information of the ordering customer.'),
35- 'amount_currency': fields.float('Amount in Partner Currency', digits=(16, 2),
36+ 'amount_currency': fields.float('Amount', digits=(16, 2),
37 required=True, help='Payment amount in the partner currency'),
38 'currency': fields.many2one('res.currency','Partner Currency', required=True),
39 'company_currency': fields.many2one('res.currency', 'Company Currency', readonly=True),
40
41=== modified file 'account_payment/account_payment_demo.xml'
42--- account_payment/account_payment_demo.xml 2012-11-29 22:26:45 +0000
43+++ account_payment/account_payment_demo.xml 2014-04-24 09:55:13 +0000
44@@ -4,7 +4,7 @@
45 <record id="partner_bank_1" model="res.partner.bank">
46 <field name="name">Reserve Bank</field>
47 <field name="acc_number">00987654321</field>
48- <field name="partner_id" ref="base.res_partner_2"></field>
49+ <field name="partner_id" ref="base.main_partner"></field>
50 <field name="state">bank</field>
51 <field name="bank" ref="base.res_bank_1"/>
52 </record>
53
54=== modified file 'account_payment/account_payment_view.xml'
55--- account_payment/account_payment_view.xml 2013-12-20 16:55:19 +0000
56+++ account_payment/account_payment_view.xml 2014-04-24 09:55:13 +0000
57@@ -62,17 +62,13 @@
58 <field name="arch" type="xml">
59 <form string="Payment Order" version="7.0">
60 <header>
61- <button name="open" states="draft" string="Confirm Payments" class="oe_highlight"/>
62+ <button name="open" states="draft" string="Confirm Payment" class="oe_highlight"/>
63 <button name="set_done" states="open" string="Make Payments" type="object" class="oe_highlight"/>
64 <button name="set_to_draft" states="cancel" string="Set to draft" type="object"/>
65- <button name="cancel" states="draft,open" string="Cancel Payments"/>
66- <field name="state" widget="statusbar" statusbar_visible="draft,open"/>
67+ <button name="cancel" states="draft,open" string="Cancel Payment"/>
68+ <field name="state" widget="statusbar" statusbar_visible="draft,open,done"/>
69 </header>
70 <sheet string="Payment order">
71- <div class="oe_button_box">
72- <button name="%(action_create_payment_order)d" string="Select Invoices to Pay"
73- type="action" attrs="{'invisible':[('state','=','done')]}" icon="gtk-find"/>
74- </div>
75 <div class="oe_title">
76 <label for="reference" class="oe_edit_only"/>
77 <h1><field name="reference"/></h1>
78@@ -84,64 +80,14 @@
79 </group>
80 <group>
81 <field name="date_prefered"/>
82- <field name="date_scheduled" attrs="{'readonly':[('date_prefered','!=','fixed')]}"/>
83+ <field name="date_scheduled" attrs="{'invisible':['|',('date_prefered','=','now'),('date_prefered','=','due')]}"/>
84 <field name="company_id" widget='selection' groups="base.group_multi_company"/>
85 </group>
86+ <p attrs="{'invisible':[('state','=','done')]}" style="font-size: 13px; font-weight: bold;">Payment Schedule <button name="%(action_create_payment_order)d" string="(Import unpaid Journal Items)"
87+ type="action" attrs="{'invisible':[('state','=','done')]}" class="oe_inline oe_link" colspan="0"/>
88+ </p>
89 </group>
90- <field name="line_ids" context="{'order_id': active_id or False}" >
91- <form string="Payment Line" version="7.0">
92- <notebook>
93- <page string="Payment">
94- <group col="4">
95- <field name="move_line_id" on_change="onchange_move_line(move_line_id,parent.mode,parent.date_prefered,parent.date_scheduled,currency,company_currency)" domain="[('reconcile_id','=', False), ('credit', '>',0), ('account_id.reconcile', '=', True)] "/>
96- <separator colspan="4" string="Transaction Information"/>
97- <field name="date"/>
98- <label for="amount_currency" groups="base.group_multi_currency"/>
99- <div groups="base.group_multi_currency">
100- <field name="amount_currency" on_change="onchange_amount(amount_currency,currency,company_currency)" class="oe_inline"/>
101- <field name="currency" nolabel="1" class="oe_inline"/>
102- </div>
103- <field name="partner_id" on_change="onchange_partner(partner_id,parent.mode)"/>
104- <field domain="[('partner_id','=',partner_id)]" name="bank_id"/>
105- <separator colspan="2" string="Owner Account"/>
106- <separator colspan="2" string="Destination Account"/>
107- <field colspan="2" name="info_owner" nolabel="1"/>
108- <field colspan="2" name="info_partner" nolabel="1"/>
109- <field colspan="4" name="communication"/>
110- <field colspan="4" name="communication2"/>
111- <field name="name"/>
112- <field name="state"/>
113- <field name="company_id" widget="selection" groups="base.group_multi_company"/>
114- </group>
115- </page>
116- <page string="Information">
117- <group col="4" string="General Information">
118- <label for="amount" groups="base.group_multi_currency"/>
119- <div groups="base.group_multi_currency">
120- <field name="amount" class="oe_inline"/>
121- <field name="company_currency" class="oe_inline"/>
122- </div>
123- <separator colspan="4" string="Entry Information"/>
124- <field name="create_date" readonly="1"/>
125- <field name="ml_maturity_date"/>
126- <field name="ml_inv_ref"/>
127- </group>
128- </page>
129- </notebook>
130- </form>
131- <tree string="Payment Line">
132- <field name="ml_inv_ref" />
133- <field name="partner_id"/>
134- <field name="communication"/>
135- <field name="bank_id" domain="[('partner_id', '=', partner_id)]"/>
136- <field name="ml_maturity_date"/>
137- <field name="date"/>
138- <field name="amount_currency" string="Amount" groups="base.group_multi_currency"/>
139- <field name="currency" groups="base.group_multi_currency"/>
140- <field name="name"/>
141- <field name="amount" sum="Total in Company Currency" invisible="1"/>
142- </tree>
143- </field>
144+ <field name="line_ids"/>
145 </sheet>
146 </form>
147 </field>
148@@ -215,46 +161,48 @@
149 <field name="model">payment.line</field>
150 <field name="arch" type="xml">
151 <form string="Payment Line" version="7.0">
152- <notebook>
153- <page string="Payment">
154- <group col="4">
155- <field name="order_id"/>
156- <field name="move_line_id" on_change="onchange_move_line(move_line_id, False, currency, company_currency)" domain="[('reconcile_id','=', False), ('credit', '>',0), ('account_id.reconcile', '=', True)]"/>
157- <separator colspan="4" string="Transaction Information"/>
158+ <sheet string="Payment">
159+ <div class="oe_title">
160+ <label for="move_line_id" class="oe_edit_only"/>
161+ <h1><field name="move_line_id" on_change="onchange_move_line(move_line_id,parent.mode,parent.date_prefered,parent.date_scheduled,company_currency)" domain="[('reconcile_id','=', False), ('credit', '>',0),('amount_residual','>',0)] "/></h1>
162+ </div>
163+ <group>
164+ <group>
165 <field name="date"/>
166- <label for="amount_currency" groups="base.group_multi_currency"/>
167- <div groups="base.group_multi_currency">
168+ <field name="partner_id" on_change="onchange_partner(partner_id,parent.mode)" string="Supplier"/>
169+ <field name="ml_inv_ref" string="Supplier Invoice"/>
170+ <label for="amount_currency"/>
171+ <div>
172 <field name="amount_currency" on_change="onchange_amount(amount_currency,currency,company_currency)" class="oe_inline"/>
173- <field name="currency" class="oe_inline"/>
174+ <field name="currency" nolabel="1" class="oe_inline oe_no_button" groups="base.group_multi_currency"/>
175 </div>
176- <field name="partner_id" on_change="onchange_partner(partner_id, False)"/>
177- <field domain="[('partner_id','=',partner_id)]" name="bank_id"/>
178- <separator colspan="2" string="Owner Account"/>
179- <separator colspan="2" string="Desitination Account"/>
180- <field colspan="2" name="info_owner" nolabel="1"/>
181- <field colspan="2" name="info_partner" nolabel="1"/>
182-
183- <field colspan="4" name="communication"/>
184- <field colspan="4" name="communication2"/>
185+ </group>
186+ <group>
187+ <field name="ml_maturity_date"/>
188+ <field domain="[('partner_id','=',partner_id)]" name="bank_id" string="Supplier Bank Account"/>
189 <field name="name"/>
190- <field name="state"/>
191- </group>
192- </page>
193- <page string="Information">
194- <group col="4" string="General Information">
195- <label for="amoun"/>
196- <div>
197+ <label for="amount" groups="base.group_multi_currency"/>
198+ <div groups="base.group_multi_currency">
199 <field name="amount" class="oe_inline"/>
200 <field name="company_currency" class="oe_inline"/>
201 </div>
202 </group>
203- <group col="4" string="Entry Information">
204- <field name="create_date"/>
205- <field name="ml_maturity_date"/>
206- <field name="ml_inv_ref"/>
207- </group>
208- </page>
209- </notebook>
210+ <group>
211+ <separator string="Owner Account" colspan="2"/>
212+ <field name="info_owner" nolabel="1"/>
213+ </group>
214+ <group>
215+ <separator string="Supplier Account" colspan="2"/>
216+ <field name="info_partner" nolabel="1"/>
217+ </group>
218+ </group>
219+ <separator string="Communications"/>
220+ <group>
221+ <field name="state"/>
222+ <field name="communication" string="Communication Note"/>
223+ <field name="communication2" string="Second Communication Note"/>
224+ </group>
225+ </sheet>
226 </form>
227 </field>
228 </record>
229@@ -264,17 +212,14 @@
230 <field eval="4" name="priority"/>
231 <field name="arch" type="xml">
232 <tree string="Payment Line">
233- <field name="order_id"/>
234 <field name="ml_inv_ref" />
235+ <field name="partner_id" string="Supplier"/>
236+ <field name="communication"/>
237+ <field name="bank_id" domain="[('partner_id', '=', partner_id)]"/>
238 <field name="ml_maturity_date"/>
239- <field name="partner_id"/>
240- <field name="communication"/>
241- <field name="amount" sum="Amount Total"/>
242- <field name="amount_currency" sum="Currency Amount Total" groups="base.group_multi_currency"/>
243+ <field name="date"/>
244+ <field name="amount_currency" groups="base.group_multi_currency" />
245 <field name="currency" groups="base.group_multi_currency"/>
246- <field name="bank_id" domain="[('partner_id', '=', partner_id)]"/>
247- <field name="move_line_id" on_change="onchange_move_line(move_line_id,parent.mode)"/>
248- <field name="create_date"/>
249 <field name="name"/>
250 </tree>
251 </field>
252
253=== modified file 'account_payment/test/cancel_payment_order.yml'
254--- account_payment/test/cancel_payment_order.yml 2011-12-22 06:02:53 +0000
255+++ account_payment/test/cancel_payment_order.yml 2014-04-24 09:55:13 +0000
256@@ -3,28 +3,28 @@
257 -
258 I confirm payment order.
259 -
260- !workflow {model: payment.order, action: open, ref: payment_order_1}
261+ !workflow {model: payment.order, action: open, ref: payment_order_2}
262 -
263 I check that payment order is now "Confirmed".
264 -
265- !assert {model: payment.order, id: payment_order_1, severity: error, string: Payment Order should be 'Confirmed'.}:
266+ !assert {model: payment.order, id: payment_order_2, severity: error, string: Payment Order should be 'Confirmed'.}:
267 - state == 'open'
268 -
269 Now, I cancel the payment order.
270 -
271- !workflow {model: payment.order, action: cancel, ref: payment_order_1}
272+ !workflow {model: payment.order, action: cancel, ref: payment_order_2}
273 -
274 I check that payment order is now "Cancelled".
275 -
276- !assert {model: payment.order, id: payment_order_1, severity: error, string: Payment Order should be 'Cancelled'.}:
277+ !assert {model: payment.order, id: payment_order_2, severity: error, string: Payment Order should be 'Cancelled'.}:
278 - state == 'cancel'
279 -
280 I again set the payment order to draft.
281 -
282 !python {model: payment.order}: |
283- self.set_to_draft(cr, uid, [ref("payment_order_1")])
284+ self.set_to_draft(cr, uid, [ref("payment_order_2")])
285 -
286 I check that payment order is now "Draft".
287 -
288- !assert {model: payment.order, id: payment_order_1, severity: error, string: Payment Order should be in 'Draft' state.}:
289+ !assert {model: payment.order, id: payment_order_2, severity: error, string: Payment Order should be in 'Draft' state.}:
290 - state == 'draft'
291
292=== modified file 'account_payment/test/payment_order_process.yml'
293--- account_payment/test/payment_order_process.yml 2012-01-31 13:36:57 +0000
294+++ account_payment/test/payment_order_process.yml 2014-04-24 09:55:13 +0000
295@@ -19,25 +19,11 @@
296 !assert {model: account.invoice, id: account.demo_invoice_0, severity: error, string: Invoice should be in 'Open' state}:
297 - state == 'open'
298 -
299- I confirm the payment order.
300--
301- !workflow {model: payment.order, action: open, ref: payment_order_1}
302--
303- I check that payment order is now "Confirmed".
304--
305- !assert {model: payment.order, id: payment_order_1, severity: error, string: Payment Order should be 'Confirmed'.}:
306- - state == 'open'
307+ I search for the invoice entries based on due date to make the payment.
308 -
309 !record {model: payment.order.create, id: payment_order_create_0}:
310 duedate: !eval time.strftime('%Y-%m-%d')
311 -
312- I search for the invoice entries to make the payment.
313--
314- !python {model: payment.order.create}: |
315- self.search_entries(cr, uid, [ref("payment_order_create_0")], {
316- "active_model": "payment.order", "active_ids": [ref("payment_order_1")],
317- "active_id": ref("payment_order_1"), })
318--
319 I create payment lines entries.
320 -
321 !python {model: payment.order.create}: |
322@@ -48,6 +34,15 @@
323 "active_model": "payment.order", "active_ids": [ref("payment_order_1")],
324 "active_id": ref("payment_order_1")})
325 -
326+ I confirm the payment order.
327+-
328+ !workflow {model: payment.order, action: open, ref: payment_order_1}
329+-
330+ I check that payment order is now "Confirmed".
331+-
332+ !assert {model: payment.order, id: payment_order_1, severity: error, string: Payment Order should be 'Confirmed'.}:
333+ - state == 'open'
334+-
335 I check that payment line is created with proper data.
336 -
337 !python {model: payment.order}: |
338
339=== modified file 'account_payment/wizard/account_payment_create_order_view.xml'
340--- account_payment/wizard/account_payment_create_order_view.xml 2012-11-29 22:26:45 +0000
341+++ account_payment/wizard/account_payment_create_order_view.xml 2014-04-24 09:55:13 +0000
342@@ -8,10 +8,25 @@
343 <field name="arch" type="xml">
344 <form string="Search Payment lines" version="7.0">
345 <group>
346- <field name="duedate" />
347+ <field name="duedate" on_change="onchange_duedate(duedate)"/>
348 </group>
349+ <separator string="Journal Items"/>
350+ <field name="entries">
351+ <tree string="Entries">
352+ <field name="journal_id"/>
353+ <field name="period_id"/>
354+ <field name="date"/>
355+ <field name="name"/>
356+ <field name="ref"/>
357+ <field name="partner_id"/>
358+ <field name="account_id"/>
359+ <field name="move_id"/>
360+ <field name="debit"/>
361+ <field name="credit"/>
362+ </tree>
363+ </field>
364 <footer>
365- <button name="search_entries" string="Search" type="object" class="oe_highlight"/>
366+ <button name="create_payment" string="_Add to Payment Order" type="object" class="oe_highlight"/>
367 or
368 <button string="Cancel" class="oe_link" special="cancel"/>
369 </footer>
370@@ -19,25 +34,8 @@
371 </field>
372 </record>
373
374- <record id="view_create_payment_order_lines" model="ir.ui.view">
375- <field name="name">payment.order.create.form</field>
376- <field name="model">payment.order.create</field>
377- <field name="arch" type="xml">
378- <form string="Search Payment lines" version="7.0">
379- <group string="Entries">
380- <field name="entries"/>
381- </group>
382- <footer>
383- <button name="create_payment" string="_Add to payment order" type="object" class="oe_highlight"/>
384- or
385- <button string="Cancel" class="oe_link" special="cancel"/>
386- </footer>
387- </form>
388- </field>
389- </record>
390-
391 <record id="action_create_payment_order" model="ir.actions.act_window">
392- <field name="name">Populate Payment</field>
393+ <field name="name">Import Journal Items</field>
394 <field name="type">ir.actions.act_window</field>
395 <field name="res_model">payment.order.create</field>
396 <field name="view_type">form</field>
397
398=== modified file 'account_payment/wizard/account_payment_order.py'
399--- account_payment/wizard/account_payment_order.py 2013-11-27 15:32:57 +0000
400+++ account_payment/wizard/account_payment_order.py 2014-04-24 09:55:13 +0000
401@@ -46,17 +46,6 @@
402 'duedate': lambda *a: time.strftime('%Y-%m-%d'),
403 }
404
405- def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
406- if not context: context = {}
407- res = super(payment_order_create, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=False)
408- if context and 'line_ids' in context:
409- doc = etree.XML(res['arch'])
410- nodes = doc.xpath("//field[@name='entries']")
411- for node in nodes:
412- node.set('domain', '[("id", "in", '+ str(context['line_ids'])+')]')
413- res['arch'] = etree.tostring(doc)
414- return res
415-
416 def create_payment(self, cr, uid, ids, context=None):
417 order_obj = self.pool.get('payment.order')
418 line_obj = self.pool.get('account.move.line')
419@@ -92,33 +81,15 @@
420 'date': date_to_pay,
421 'currency': (line.invoice and line.invoice.currency_id.id) or line.journal_id.currency.id or line.journal_id.company_id.currency_id.id,
422 }, context=context)
423+
424 return {'type': 'ir.actions.act_window_close'}
425
426- def search_entries(self, cr, uid, ids, context=None):
427- line_obj = self.pool.get('account.move.line')
428- mod_obj = self.pool.get('ir.model.data')
429- if context is None:
430- context = {}
431- data = self.browse(cr, uid, ids, context=context)[0]
432- search_due_date = data.duedate
433-# payment = self.pool.get('payment.order').browse(cr, uid, context['active_id'], context=context)
434-
435- # Search for move line to pay:
436- domain = [('reconcile_id', '=', False), ('account_id.type', '=', 'payable'), ('credit', '>', 0), ('account_id.reconcile', '=', True)]
437- domain = domain + ['|', ('date_maturity', '<=', search_due_date), ('date_maturity', '=', False)]
438- line_ids = line_obj.search(cr, uid, domain, context=context)
439- context.update({'line_ids': line_ids})
440- model_data_ids = mod_obj.search(cr, uid,[('model', '=', 'ir.ui.view'), ('name', '=', 'view_create_payment_order_lines')], context=context)
441- resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
442- return {'name': _('Entry Lines'),
443- 'context': context,
444- 'view_type': 'form',
445- 'view_mode': 'form',
446- 'res_model': 'payment.order.create',
447- 'views': [(resource_id,'form')],
448- 'type': 'ir.actions.act_window',
449- 'target': 'new',
450- }
451-
452+ def onchange_duedate(self, cr, uid, ids, due_date, context=None):
453+ res = {}
454+ if due_date:
455+ domain = [('reconcile_id', '=', False), ('account_id.type', '=', 'payable'), ('credit', '>', 0), ('account_id.reconcile', '=', True), '|', ('date_maturity', '<=', due_date), ('date_maturity', '=', False)]
456+ line_ids = self.pool.get('account.move.line').search(cr, uid, domain, context=context)
457+ res['domain'] = {'entries': [('id', 'in', line_ids)]}
458+ return res
459
460 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

Subscribers

People subscribed via source and target branches

to all changes: