openerp-community-reviewer team mailing list archive
-
openerp-community-reviewer team
-
Mailing list archive
-
Message #04396
[Merge] lp:~camptocamp/account-financial-tools/7.0-fix-1287072 into lp:account-financial-tools
Nicolas Bessi - Camptocamp has proposed merging lp:~camptocamp/account-financial-tools/7.0-fix-1287072 into lp:account-financial-tools.
Requested reviews:
Account Core Editors (account-core-editors)
For more details, see:
https://code.launchpad.net/~camptocamp/account-financial-tools/7.0-fix-1287072/+merge/209183
[FIX] bug 1287072 Level calculation error if previous credit line is ignored
--
https://code.launchpad.net/~camptocamp/account-financial-tools/7.0-fix-1287072/+merge/209183
Your team Account Core Editors is requested to review the proposed merge of lp:~camptocamp/account-financial-tools/7.0-fix-1287072 into lp:account-financial-tools.
=== modified file 'account_credit_control/policy.py'
--- account_credit_control/policy.py 2013-12-11 10:34:20 +0000
+++ account_credit_control/policy.py 2014-03-04 07:54:35 +0000
@@ -47,7 +47,7 @@
" for the selected accounts"),
'active': fields.boolean('Active'),
}
-
+
_defaults = {
'active': True,
}
@@ -327,7 +327,6 @@
data_dict = {'controlling_date': controlling_date,
'line_ids': tuple(lines),
'delay': level.delay_days}
-
cr.execute(sql, data_dict)
res = cr.fetchall()
if res:
@@ -346,6 +345,7 @@
" ON (mv_line.id = cr_line.move_line_id)\n"
" WHERE cr_line.id = (SELECT credit_control_line.id FROM credit_control_line\n"
" WHERE credit_control_line.move_line_id = mv_line.id\n"
+ " AND state != 'ignored'"
" ORDER BY credit_control_line.level desc limit 1)\n"
" AND cr_line.level = %(previous_level)s\n"
# lines from a previous level with a draft or ignored state
=== added file 'account_credit_control/scenarios/features/10_credit_control_run_aug.feature'
--- account_credit_control/scenarios/features/10_credit_control_run_aug.feature 1970-01-01 00:00:00 +0000
+++ account_credit_control/scenarios/features/10_credit_control_run_aug.feature 2014-03-04 07:54:35 +0000
@@ -0,0 +1,30 @@
+###############################################################################
+#
+# OERPScenario, OpenERP Functional Tests
+# Copyright 2012 Camptocamp SA
+# Author Nicolas Bessi
+##############################################################################
+
+# Features Generic tags (none for all)
+##############################################################################
+
+@account_credit_control @account_credit_control_run @account_credit_control_run_aug
+
+Feature: Ensure that ignore feature works as expected
+
+ @account_credit_control_mark_as_ignore
+ Scenario: mark last line as ignore
+ Given I ignore the "Gus Goose" credit line at level "3" for move line "SI_19" with amount "1050.0"
+
+ @account_credit_control_run_month_aug
+ Scenario: Create run
+ Given I need a "credit.control.run" with oid: credit_control.runignored
+ And having:
+ | name | value |
+ | date | 2013-08-30 |
+ When I launch the credit run
+ Then my credit run should be in state "done"
+
+ @check_ignored_line
+ Scenario: Check ignored lines
+ Given I have for "Gus Goose" "2" credit lines at level "3" for move line "SI_19" with amount "1050.0" respectively in state "draft" and "ignored"
=== modified file 'account_credit_control/scenarios/features/steps/account_credit_control.py'
--- account_credit_control/scenarios/features/steps/account_credit_control.py 2013-03-28 13:17:04 +0000
+++ account_credit_control/scenarios/features/steps/account_credit_control.py 2014-03-04 07:54:35 +0000
@@ -118,3 +118,28 @@
lines = model('credit.control.line').search([('state', '!=', state),
('id', 'in', ctx.lines)])
assert not lines
+
+@given(u'I ignore the "{partner}" credit line at level "{level:d}" for move line "{move_line_name}" with amount "{amount:f}"')
+def impl(ctx, partner, level, move_line_name, amount):
+ print ctx, partner, level, move_line_name, amount
+ to_ignore = model('credit.control.line').search([('partner_id.name', '=', partner),
+ ('level', '=', level),
+ ('amount_due', '=', amount),
+ ('move_line_id.name', '=', move_line_name)])
+ assert to_ignore
+ wiz = model('credit.control.marker').create({'name': 'ignored'})
+ ctx.lines = to_ignore
+ wiz.write({'line_ids': to_ignore})
+ wiz.mark_lines()
+ assert model('credit.control.line').get(to_ignore[0]).state == 'ignored'
+
+@given(u'I have for "{partner}" "{number:d}" credit lines at level "{level:d}" for move line "{move_line_name}" with amount "{amount:f}" respectively in state "draft" and "ignored"')
+def impl(ctx, partner, number, level, move_line_name, amount):
+ to_check = model('credit.control.line').search([('partner_id.name', '=', partner),
+ ('level', '=', level),
+ ('amount_due', '=', amount),
+ ('move_line_id.name', '=', move_line_name),
+ ('state', 'in', ('draft', 'ignored'))])
+ assert_equal(len(to_check), int(number), msg="More than %s found" % number)
+ lines = model('credit.control.line').browse(to_check)
+ assert ['ignored', 'draft'] == lines.state
Follow ups