mirror of
https://github.com/OCA/account-financial-tools.git
synced 2025-02-02 12:47:26 +02:00
[FIX] set state to done when no no lines are generated on selected policies
(lp:c2c-addons/6.1 rev 89.1.28)
This commit is contained in:
@@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
<act_window
|
<act_window
|
||||||
id="act_partner_credit_relation_relation"
|
id="act_partner_credit_relation_relation"
|
||||||
name="Credit lines"
|
name="Credit Lines"
|
||||||
groups="account_credit_control.group_account_credit_control_manager,account_credit_control.group_account_credit_control_user"
|
groups="account_credit_control.group_account_credit_control_manager,account_credit_control.group_account_credit_control_user"
|
||||||
domain="[('partner_id', '=', active_id)]"
|
domain="[('partner_id', '=', active_id)]"
|
||||||
res_model="credit.control.line"
|
res_model="credit.control.line"
|
||||||
|
|||||||
@@ -111,6 +111,8 @@ class CreditControlRun(Model):
|
|||||||
try:
|
try:
|
||||||
lines = policy._get_moves_line_to_process(run.date, context=context)
|
lines = policy._get_moves_line_to_process(run.date, context=context)
|
||||||
tmp_manual = policy._check_lines_policies(lines, context=context)
|
tmp_manual = policy._check_lines_policies(lines, context=context)
|
||||||
|
# FIXME why do not use only sets instead of converting them each
|
||||||
|
# time ?
|
||||||
lines = list(set(lines) - set(tmp_manual))
|
lines = list(set(lines) - set(tmp_manual))
|
||||||
manually_managed_lines += tmp_manual
|
manually_managed_lines += tmp_manual
|
||||||
if not lines:
|
if not lines:
|
||||||
@@ -139,13 +141,14 @@ class CreditControlRun(Model):
|
|||||||
context=context)
|
context=context)
|
||||||
return False
|
return False
|
||||||
vals = {'report': u"Number of generated lines : %s \n" % (len(credit_line_ids),),
|
vals = {'report': u"Number of generated lines : %s \n" % (len(credit_line_ids),),
|
||||||
'state': 'done',
|
|
||||||
'manual_ids': [(6, 0, manually_managed_lines)]}
|
'manual_ids': [(6, 0, manually_managed_lines)]}
|
||||||
|
|
||||||
if errors:
|
if errors:
|
||||||
vals['report'] += u"Following line generation errors appends:"
|
vals['report'] += u"Following line generation errors appends:"
|
||||||
vals['report'] += u"----\n".join(errors)
|
vals['report'] += u"----\n".join(errors)
|
||||||
vals['state'] = 'done'
|
|
||||||
run.write(vals, context=context)
|
run.write(vals, context=context)
|
||||||
|
run.write({'state': 'done'}, context=context)
|
||||||
# lines will correspond to line that where not treated
|
# lines will correspond to line that where not treated
|
||||||
return lines
|
return lines
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user