Merge lp:~ovnicraft/account-financial-tools/account-financial-tools-inv-voucher-constraints into lp:~account-core-editors/account-financial-tools/7.0

Proposed by Cristian Salamea
Status: Work in progress
Proposed branch: lp:~ovnicraft/account-financial-tools/account-financial-tools-inv-voucher-constraints
Merge into: lp:~account-core-editors/account-financial-tools/7.0
Diff against target: 123 lines (+107/-0) (has conflicts)
3 files modified
account_constraints/__init__.py (+23/-0)
account_constraints/__openerp__.py (+41/-0)
account_constraints/voucher.py (+43/-0)
Conflict adding file account_constraints.  Moved existing file to account_constraints.moved.
To merge this branch: bzr merge lp:~ovnicraft/account-financial-tools/account-financial-tools-inv-voucher-constraints
Reviewer Review Type Date Requested Status
Maxime Chambreuil (http://www.savoirfairelinux.com) code review Needs Fixing
Nhomar - Vauxoo Needs Information
Joël Grand-Guillaume @ camptocamp code review, no tests Approve
Frederic Clementi - Camptocamp Pending
Review via email: mp+175417@code.launchpad.net

Description of the change

Added constraint module for account.
First constaint added in vouchers
Voucher module pass silent difference to payable|receivable account if amount_diff is > 0.

To post a comment you must log in.
Revision history for this message
Joël Grand-Guillaume @ camptocamp (jgrandguillaume-c2c) wrote :

LGTM from code point of view, accountant opinion might be useful before merging.

review: Approve (code review, no tests)
Revision history for this message
Nhomar - Vauxoo (nhomar) wrote :

Hello.

In the description:

62 + 'description': """This module implement constraints required in account documents:
63 + Voucher: check open balance with amount
64 + Invoice: due_date must be in period

And in the code there are only one contraint.

I don't understand why validate the amount here, if you please can enlight us to understand why this amount from a functional PoV must be lower than another it should be great.

From My PoV i can pay more or less than what I mark in the invoice, we just need to be sure the reconciliation stay as partial (as it is now) to use the difference in other payment process, but may be I am wrong.

Thanks for your contribution.

review: Needs Information
Revision history for this message
Cristian Salamea (ovnicraft) wrote :

Hi,

in fact i consider a bug in openerp and constraint solve this problem:
Make and invoice, click on pay all default values are loaded, user can chance amount value, error happens when you pay more, system silent resolve problem and send the difference to payable|receivable account, from account PoV this cannot happen.

Constraint make this explicit, if you will let open balance most be less or the same value, if more change balance option to send to specific account.

This make more clear the process to account users.

I work this with accountants customers and all are a little bit happy .-).

Revision history for this message
Maxime Chambreuil (http://www.savoirfairelinux.com) (max3903) wrote :

Please update the module description according to the constraint provided, or implement the second constraint.

Thanks.

review: Needs Fixing (code review)
Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote :

No changes since 2013-11-03 after Need Fixing request -> I set this in WIP

@Cristian Salamea (Gnuthink) (ovnicraft)

Please do the required changes then set it in Needs Review again

(And please do a merge of lp:account-financial-tools in this branche to resolve conflicts)

Cheers,
Yannick

Unmerged revisions

96. By Cristian Salamea

[FIX] typo message error

95. By Cristian Salamea

[IMP] simplest method validation, dont allow users cause entry with extra line error

94. By Cristian Salamea

[IMP] constraint in voucher amount

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'account_constraints'
2=== renamed directory 'account_constraints' => 'account_constraints.moved'
3=== added file 'account_constraints/__init__.py'
4--- account_constraints/__init__.py 1970-01-01 00:00:00 +0000
5+++ account_constraints/__init__.py 2013-07-17 22:25:56 +0000
6@@ -0,0 +1,23 @@
7+# -*- coding: utf-8 -*-
8+##############################################################################
9+#
10+# Account Constraints module for OpenERP
11+# Copyright (C) 2013 Gnuthink (http://www.gnuthink.com). All Rights Reserved
12+# @author Cristian Salamea <cristian.salamea@gnuthink.com>
13+#
14+# This program is free software: you can redistribute it and/or modify
15+# it under the terms of the GNU Affero General Public License as
16+# published by the Free Software Foundation, either version 3 of the
17+# License, or (at your option) any later version.
18+#
19+# This program is distributed in the hope that it will be useful,
20+# but WITHOUT ANY WARRANTY; without even the implied warranty of
21+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22+# GNU Affero General Public License for more details.
23+#
24+# You should have received a copy of the GNU Affero General Public License
25+# along with this program. If not, see <http://www.gnu.org/licenses/>.
26+#
27+##############################################################################
28+
29+import voucher
30
31=== added file 'account_constraints/__openerp__.py'
32--- account_constraints/__openerp__.py 1970-01-01 00:00:00 +0000
33+++ account_constraints/__openerp__.py 2013-07-17 22:25:56 +0000
34@@ -0,0 +1,41 @@
35+# -*- coding: utf-8 -*-
36+##############################################################################
37+#
38+# Account Constraints module for OpenERP
39+# Copyright (C) 2013 Gnuthink (http://www.gnuthink.com). All Rights Reserved
40+# @author Cristian Salamea <cristian.salamea@gnuthink.com>
41+#
42+# This program is free software: you can redistribute it and/or modify
43+# it under the terms of the GNU Affero General Public License as
44+# published by the Free Software Foundation, either version 3 of the
45+# License, or (at your option) any later version.
46+#
47+# This program is distributed in the hope that it will be useful,
48+# but WITHOUT ANY WARRANTY; without even the implied warranty of
49+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
50+# GNU Affero General Public License for more details.
51+#
52+# You should have received a copy of the GNU Affero General Public License
53+# along with this program. If not, see <http://www.gnu.org/licenses/>.
54+#
55+##############################################################################
56+
57+{
58+ 'name': 'Account Constraints',
59+ 'version': '0.1',
60+ 'category': 'Generic Modules/Accounting',
61+ 'license': 'AGPL-3',
62+ 'description': """This module implement constraints required in account documents:
63+ Voucher: check open balance with amount
64+ Invoice: due_date must be in period
65+ """,
66+ 'author': 'Gnuthink Co. Ltd.',
67+ 'website': 'http://www.gnuthink.com/',
68+ 'depends': ['account_voucher'],
69+ 'init_xml': [],
70+ 'update_xml': [],
71+ 'demo_xml': [],
72+ 'installable': True,
73+ 'active': False,
74+}
75+
76
77=== added file 'account_constraints/voucher.py'
78--- account_constraints/voucher.py 1970-01-01 00:00:00 +0000
79+++ account_constraints/voucher.py 2013-07-17 22:25:56 +0000
80@@ -0,0 +1,43 @@
81+# -*- coding: utf-8 -*-
82+##############################################################################
83+#
84+# Account Constraints module for OpenERP
85+# Copyright (C) 2013 Gnuthink (http://www.gnuthink.com). All Rights Reserved
86+# @author Cristian Salamea <cristian.salamea@gnuthink.com>
87+#
88+# This program is free software: you can redistribute it and/or modify
89+# it under the terms of the GNU Affero General Public License as
90+# published by the Free Software Foundation, either version 3 of the
91+# License, or (at your option) any later version.
92+#
93+# This program is distributed in the hope that it will be useful,
94+# but WITHOUT ANY WARRANTY; without even the implied warranty of
95+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
96+# GNU Affero General Public License for more details.
97+#
98+# You should have received a copy of the GNU Affero General Public License
99+# along with this program. If not, see <http://www.gnu.org/licenses/>.
100+#
101+##############################################################################
102+
103+from osv import osv
104+
105+class AccountVoucher(osv.Model):
106+
107+ _inherit = 'account.voucher'
108+
109+ def _check_amount_payment(self, cr, uid, ids):
110+ """
111+ Method to check writeoff option set `with` when
112+ writeoff amount > 0.
113+
114+ CHECK: possible with sql_constraint ?
115+ """
116+ for obj in self.browse(cr, uid, ids):
117+ if obj.writeoff_amount > 0 and obj.payment_option == 'without_writeoff':
118+ return False
119+ return True
120+
121+ _constraints = [(_check_amount_payment, "Amount can't be great than unreconciled total.", ['Amount to Pay'])]
122+
123+

Subscribers

People subscribed via source and target branches