Discussion:
[Erp5-dev] Conversion applied consistency class
Łukasz Nowak
2008-05-29 12:38:59 UTC
Permalink
Hello,

Long time ago, in not so far away galaxy we've got problem with
accounting and unconverted transactions.[1]

Today we know, that using good combination of supported accounting
simulation states in preferences, we are able to filter out
transactions, which aren't converted.

To force users to do conversion, I've created ConversionApplied
Constraint. Attached. Feel free to commit it to repository, if you like
to.

Any comments welcome about this class.

BTW: Are there any guidelines about how to create best Constraints? Or
which Constraint class from core is good to write such guideline?

Regards,
Luke

[1]http://mail.nexedi.com/pipermail/erp5-dev/2007-September/001364.html
--
?ukasz Nowak R&D Ventis http://www.ventis.com.pl/
tel: +48 32 768 16 85 fax: +48 32 392 10 61
``Use the Source, Luke...'' I am only craftsman.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ConversionApplied.py
Type: text/x-python
Size: 2867 bytes
Desc: not available
URL: <http://mail.tiolive.com/pipermail/erp5-dev/attachments/20080529/6e5cc10d/attachment.py>
Mikolaj Antoszkiewicz
2008-05-29 14:16:12 UTC
Permalink
Post by Łukasz Nowak
Hello,
Long time ago, in not so far away galaxy we've got problem with
accounting and unconverted transactions.[1]
Today we know, that using good combination of supported accounting
simulation states in preferences, we are able to filter out
transactions, which aren't converted.
To force users to do conversion, I've created ConversionApplied
Constraint. Attached. Feel free to commit it to repository, if you like
to.
Any comments welcome about this class.
BTW: Are there any guidelines about how to create best Constraints? Or
which Constraint class from core is good to write such guideline?
There is a nice Interface (
http://svn.erp5.org/erp5/trunk/products/ERP5Type/Interface/Constraint.py?view=markup
) which is a first reference, then there's a guide at
http://www.erp5.org/HowToUseConstraints.

And I'm planning to write any day now a nice guide through existing
Constraint Classes with examples :)

Mikolaj

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3229 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://mail.tiolive.com/pipermail/erp5-dev/attachments/20080529/f22b9ccf/attachment.bin>
Jérome Perrin
2008-07-18 12:42:26 UTC
Permalink
Post by Łukasz Nowak
Hello,
Long time ago, in not so far away galaxy we've got problem with
accounting and unconverted transactions.[1]
Today we know, that using good combination of supported accounting
simulation states in preferences, we are able to filter out
transactions, which aren't converted.
To force users to do conversion, I've created ConversionApplied
Constraint.
good idea
Post by Łukasz Nowak
Attached. Feel free to commit it to repository, if you like to.
Any comments welcome about this class.
OK ...
Post by Łukasz Nowak
# Well - I really do not know, if we shall trust catalog in this
case.
movement_list = [q for q in obj.objectValues() \
if q.getPortalType() in accounting_movement_portal_type_list]
No need to check catalog, lines are contained as subdocuments, using
contentValues or objectValues, is faster for this case. Also those
methods support portal_type= argument to do the filtering.
Post by Łukasz Nowak
credit_sum = debit_sum = 0.0
credit_sum += movement.getSourceAssetCredit()
debit_sum += movement.getSourceAssetDebit()
This has rounding issues.
Better check that round(credit_sum, currency_precision) == 0.0
You can get the currency precision from the organisation default
accounting currency.
Post by Łukasz Nowak
error_list.append(self._generateError(obj,N_('Source
conversion undefined')))
We now have a new way of defining such messages so that they can be
overloaded in property sheets. Look at constraints in ERP5Type for
examples.

J?rome

Loading...