banking-addons-team team mailing list archive
-
banking-addons-team team
-
Mailing list archive
-
Message #01203
lp:~camptocamp/banking-addons/bank-statement-reconcile-7.0-fix-yaml-related-lep into lp:banking-addons/bank-statement-reconcile-7.0
Leonardo Pistone @ camptocamp has proposed merging lp:~camptocamp/banking-addons/bank-statement-reconcile-7.0-fix-yaml-related-lep into lp:banking-addons/bank-statement-reconcile-7.0.
Requested reviews:
Banking Addons Core Editors (banking-addons-team)
For more details, see:
https://code.launchpad.net/~camptocamp/banking-addons/bank-statement-reconcile-7.0-fix-yaml-related-lep/+merge/199124
This is a workaround needed for the YAML tests in the account_statement_base_completion module.
The constraint uses a related stored field that does not work in YAML tests. Here the check is kept, but is made explicit without using the related field.
As a sidenote, if the field related is made store=False, everything works fine (on YAML tests). When entering data via the interface and not via yaml tests, everything works fine as well.
This probably needs a proper, general solution. However, IMO this workaround is not too ugly and bad and we could also keep it anyway.
Thanks!
--
https://code.launchpad.net/~camptocamp/banking-addons/bank-statement-reconcile-7.0-fix-yaml-related-lep/+merge/199124
Your team Banking Addons Core Editors is requested to review the proposed merge of lp:~camptocamp/banking-addons/bank-statement-reconcile-7.0-fix-yaml-related-lep into lp:banking-addons/bank-statement-reconcile-7.0.
=== modified file 'account_statement_ext/statement.py'
--- account_statement_ext/statement.py 2013-12-11 16:01:01 +0000
+++ account_statement_ext/statement.py 2013-12-16 14:04:47 +0000
@@ -223,12 +223,21 @@
move of period_id to the statement line
"""
for statement in self.browse(cr, uid, ids, context=context):
- if (statement.period_id and
- statement.company_id.id != statement.period_id.company_id.id):
+ # statement.company_id is a related store=True that for some
+ # reason doesn't work in YAML tests. As a workaround, I unwind it
+ # to statement.journal_id.company_id here.
+ if (
+ statement.period_id
+ and statement.journal_id.company_id.id
+ != statement.period_id.company_id.id
+ ):
return False
for line in statement.line_ids:
- if (line.period_id and
- statement.company_id.id != line.period_id.company_id.id):
+ if (
+ line.period_id
+ and statement.journal_id.company_id.id
+ != line.period_id.company_id.id
+ ):
return False
return True
Follow ups