Merge lp:~therp-nl/banking-addons/ba70-aggregate_payment into lp:banking-addons

Proposed by Stefan Rijnhart (Opener)
Status: Work in progress
Proposed branch: lp:~therp-nl/banking-addons/ba70-aggregate_payment
Merge into: lp:banking-addons
Diff against target: 866 lines (+788/-2)
12 files modified
account_banking/res_partner_bank.py (+5/-0)
account_banking_aggregate_payment/__init__.py (+1/-0)
account_banking_aggregate_payment/__openerp__.py (+49/-0)
account_banking_aggregate_payment/data/payment_mode_type.xml (+17/-0)
account_banking_aggregate_payment/i18n/account_banking_aggregate_payment.pot (+175/-0)
account_banking_aggregate_payment/i18n/nl.po (+170/-0)
account_banking_aggregate_payment/model/__init__.py (+2/-0)
account_banking_aggregate_payment/model/export_aggregate.py (+252/-0)
account_banking_aggregate_payment/model/payment_mode.py (+35/-0)
account_banking_aggregate_payment/view/export_aggregate.xml (+29/-0)
account_banking_aggregate_payment/view/payment_mode.xml (+51/-0)
account_banking_payment/model/account_payment.py (+2/-2)
To merge this branch: bzr merge lp:~therp-nl/banking-addons/ba70-aggregate_payment
Reviewer Review Type Date Requested Status
Maxime Chambreuil (http://www.savoirfairelinux.com) code review Approve
Holger Brunn (Therp) Needs Fixing
Guewen Baconnier @ Camptocamp Needs Information
Review via email: mp+178466@code.launchpad.net

Commit message

[MIG] Aggregate payment module

To post a comment you must log in.
Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

Is there a reason why you didn't use the account_move_line.reconcile() / account_move_line.partial_reconcile()?
I think there is one, but I'm curious to know why you couldn't use it (performance?).

Aside of this question, from a code point of view, sounds good to me.

review: Needs Information
Revision history for this message
Holger Brunn (Therp) (hbrunn) wrote :

#521 if you know where it goes wrong, please tell the user
#591 i think you shouldn't be using context_today here. That's only for passing stuff to the user

review: Needs Fixing
Revision history for this message
Holger Brunn (Therp) (hbrunn) wrote :

...forget about the comment about #591, by now I think you're doing the right thing here

Revision history for this message
Maxime Chambreuil (http://www.savoirfairelinux.com) (max3903) :
review: Approve (code review)
Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote :

Thanks for the pointer, Guewen. I will look into it.

180. By Stefan Rijnhart (Opener)

[MRG] parent branch

181. By Stefan Rijnhart (Opener)

[FIX] Search

Unmerged revisions

181. By Stefan Rijnhart (Opener)

[FIX] Search

180. By Stefan Rijnhart (Opener)

[MRG] parent branch

179. By Stefan Rijnhart (Opener)

[RFR] Adapt aggregate payment module to new payment order workflow
[RFR] Finetune names and references of created moves and move lines
[RFR] Adapt reference to view that moved to another module
[RFR] Remove view types as per OpenERP 7.0 API change

178. By Stefan Rijnhart (Opener)

[ADD] Version 6.1 of the aggregate payment module

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'account_banking/res_partner_bank.py'
--- account_banking/res_partner_bank.py 2014-03-15 16:05:33 +0000
+++ account_banking/res_partner_bank.py 2015-06-24 07:17:58 +0000
@@ -68,6 +68,11 @@
68 if bban:68 if bban:
69 extra_terms.append(69 extra_terms.append(
70 ('acc_number_domestic', term[1], bban))70 ('acc_number_domestic', term[1], bban))
71 else:
72 result = [('acc_number', term[1], term[2])]
73 if 'acc_number_domestic' in self._columns:
74 extra_terms = [('acc_number_domestic', term[1], term[2])]
75
71 for extra_term in extra_terms:76 for extra_term in extra_terms:
72 result = ['|'] + result + [extra_term]77 result = ['|'] + result + [extra_term]
73 return result78 return result
7479
=== added directory 'account_banking_aggregate_payment'
=== added file 'account_banking_aggregate_payment/__init__.py'
--- account_banking_aggregate_payment/__init__.py 1970-01-01 00:00:00 +0000
+++ account_banking_aggregate_payment/__init__.py 2015-06-24 07:17:58 +0000
@@ -0,0 +1,1 @@
1import model
02
=== added file 'account_banking_aggregate_payment/__openerp__.py'
--- account_banking_aggregate_payment/__openerp__.py 1970-01-01 00:00:00 +0000
+++ account_banking_aggregate_payment/__openerp__.py 2015-06-24 07:17:58 +0000
@@ -0,0 +1,49 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# This module copyright (C) 2013 Therp BV (<http://therp.nl>).
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21{
22 'name': 'Account Banking Aggregate Payment',
23 'version': '0.1.173',
24 'license': 'AGPL-3',
25 'author': 'Therp BV',
26 'website': 'https://launchpad.net/banking-addons',
27 'category': 'Banking addons',
28 'depends': ['account_direct_debit'],
29 'data': [
30 'data/payment_mode_type.xml',
31 'view/payment_mode.xml',
32 'view/export_aggregate.xml',
33 ],
34 'description': '''
35 This module allows for aggregating payments for various creditors
36 and making them payable to a single partner. This is practiced in
37 certain purchasing consortia.
38
39 After collection of the payable invoices on a payment order of type
40 'Aggregate payment', the move lines in the payment order are
41 reconciled by a move on a transit account, the total amount of which
42 is then transferred onto the designated partner's account payable
43 (upon confirmation of the aggregate payment order).
44
45 The payment order wizard then proceeds to create a new payment order
46 of a user chosen payment mode with only the aggregate move line in it.
47 ''',
48 'active': False,
49}
050
=== added directory 'account_banking_aggregate_payment/data'
=== added file 'account_banking_aggregate_payment/data/payment_mode_type.xml'
--- account_banking_aggregate_payment/data/payment_mode_type.xml 1970-01-01 00:00:00 +0000
+++ account_banking_aggregate_payment/data/payment_mode_type.xml 2015-06-24 07:17:58 +0000
@@ -0,0 +1,17 @@
1<?xml version="1.0" encoding="utf-8"?>
2<openerp>
3 <data>
4
5 <record model="payment.mode.type"
6 id="type_aggregate">
7 <field name="name">Aggregate payment</field>
8 <field name="code">AGGR</field>
9 <field name="suitable_bank_types"
10 eval="[(6, 0, (ref('base_iban.bank_iban'),
11 ref('base.bank_normal')))]" />
12 <field name="ir_model_id"
13 ref="model_banking_export_aggregate"/>
14 </record>
15
16 </data>
17</openerp>
018
=== added directory 'account_banking_aggregate_payment/i18n'
=== added file 'account_banking_aggregate_payment/i18n/account_banking_aggregate_payment.pot'
--- account_banking_aggregate_payment/i18n/account_banking_aggregate_payment.pot 1970-01-01 00:00:00 +0000
+++ account_banking_aggregate_payment/i18n/account_banking_aggregate_payment.pot 2015-06-24 07:17:58 +0000
@@ -0,0 +1,175 @@
1# Translation of OpenERP Server.
2# This file contains the translation of the following modules:
3# * account_banking_aggregate_payment
4#
5msgid ""
6msgstr ""
7"Project-Id-Version: OpenERP Server 6.1\n"
8"Report-Msgid-Bugs-To: \n"
9"POT-Creation-Date: 2013-06-13 19:35+0000\n"
10"PO-Revision-Date: 2013-06-13 19:35+0000\n"
11"Last-Translator: <>\n"
12"Language-Team: \n"
13"MIME-Version: 1.0\n"
14"Content-Type: text/plain; charset=UTF-8\n"
15"Content-Transfer-Encoding: \n"
16"Plural-Forms: \n"
17
18#. module: account_banking_aggregate_payment
19#: view:payment.mode:0
20msgid "Aggregate payment"
21msgstr "Aggregate payment"
22
23#. module: account_banking_aggregate_payment
24#: view:banking.export.aggregate:0
25msgid "Create"
26msgstr "Create"
27
28#. module: account_banking_aggregate_payment
29#: help:payment.mode,aggregate_partner_id:0
30msgid "The single partner on the chained payment order"
31msgstr "The single partner on the chained payment order"
32
33#. module: account_banking_aggregate_payment
34#: code:addons/account_banking_aggregate_payment/model/export_aggregate.py:134
35#, python-format
36msgid "Aggregate Payment Order %s"
37msgstr "Aggregate Payment Order %s"
38
39#. module: account_banking_aggregate_payment
40#: code:addons/account_banking_aggregate_payment/model/export_aggregate.py:230
41#, python-format
42msgid "Payment order workflow does not go into state \"done\""
43msgstr "Payment order workflow does not go into state \"done\""
44
45#. module: account_banking_aggregate_payment
46#: code:addons/account_banking_aggregate_payment/model/export_aggregate.py:143
47#, python-format
48msgid "No move line provided for line %s"
49msgstr "No move line provided for line %s"
50
51#. module: account_banking_aggregate_payment
52#: model:ir.model,name:account_banking_aggregate_payment.model_payment_mode
53msgid "Payment Mode"
54msgstr "Payment Mode"
55
56#. module: account_banking_aggregate_payment
57#: code:addons/account_banking_aggregate_payment/model/export_aggregate.py:48
58#, python-format
59msgid "Please only select a single payment order"
60msgstr "Please only select a single payment order"
61
62#. module: account_banking_aggregate_payment
63#: code:addons/account_banking_aggregate_payment/model/export_aggregate.py:147
64#, python-format
65msgid "Move line %s has already been paid/reconciled"
66msgstr "Move line %s has already been paid/reconciled"
67
68#. module: account_banking_aggregate_payment
69#: code:addons/account_banking_aggregate_payment/model/export_aggregate.py:44
70#: code:addons/account_banking_aggregate_payment/model/export_aggregate.py:121
71#, python-format
72msgid "Please select a payment order"
73msgstr "Please select a payment order"
74
75#. module: account_banking_aggregate_payment
76#: code:addons/account_banking_aggregate_payment/model/export_aggregate.py:125
77#, python-format
78msgid "This operation can only be performed on a single payment order"
79msgstr "This operation can only be performed on a single payment order"
80
81#. module: account_banking_aggregate_payment
82#: code:addons/account_banking_aggregate_payment/model/export_aggregate.py:155
83#, python-format
84msgid "Transit %s"
85msgstr "Transit %s"
86
87#. module: account_banking_aggregate_payment
88#: code:addons/account_banking_aggregate_payment/model/export_aggregate.py:191
89#, python-format
90msgid "Transit reconciliation"
91msgstr "Transit reconciliation"
92
93#. module: account_banking_aggregate_payment
94#: view:banking.export.aggregate:0
95msgid "Export aggregate payment order"
96msgstr "Export aggregate payment order"
97
98#. module: account_banking_aggregate_payment
99#: code:addons/account_banking_aggregate_payment/model/export_aggregate.py:208
100#, python-format
101msgid "Amount payable"
102msgstr "Amount payable"
103
104#. module: account_banking_aggregate_payment
105#: field:payment.mode,aggregate_partner_id:0
106msgid "Aggregate payment beneficiary"
107msgstr "Aggregate payment beneficiary"
108
109#. module: account_banking_aggregate_payment
110#: help:payment.mode,chained_mode_id:0
111msgid "The payment type of the chained payment order"
112msgstr "The payment type of the chained payment order"
113
114#. module: account_banking_aggregate_payment
115#: code:addons/account_banking_aggregate_payment/model/export_aggregate.py:43
116#: code:addons/account_banking_aggregate_payment/model/export_aggregate.py:47
117#: code:addons/account_banking_aggregate_payment/model/export_aggregate.py:65
118#: code:addons/account_banking_aggregate_payment/model/export_aggregate.py:71
119#: code:addons/account_banking_aggregate_payment/model/export_aggregate.py:120
120#: code:addons/account_banking_aggregate_payment/model/export_aggregate.py:124
121#: code:addons/account_banking_aggregate_payment/model/export_aggregate.py:142
122#: code:addons/account_banking_aggregate_payment/model/export_aggregate.py:146
123#: code:addons/account_banking_aggregate_payment/model/export_aggregate.py:229
124#, python-format
125msgid "Error"
126msgstr "Error"
127
128#. module: account_banking_aggregate_payment
129#: model:ir.model,name:account_banking_aggregate_payment.model_banking_export_aggregate
130msgid "Execute aggregate payment"
131msgstr "Execute aggregate payment"
132
133#. module: account_banking_aggregate_payment
134#: view:banking.export.aggregate:0
135msgid "When you confirm this order, the total amount will be made payable to the partner that has been set on the payment mode. A new payment order will open in your screen with this one payment."
136msgstr "When you confirm this order, the total amount will be made payable to the partner that has been set on the payment mode. A new payment order will open in your screen with this one payment."
137
138#. module: account_banking_aggregate_payment
139#: code:addons/account_banking_aggregate_payment/model/export_aggregate.py:172
140#, python-format
141msgid "Reconciliation %s"
142msgstr "Reconciliation %s"
143
144#. module: account_banking_aggregate_payment
145#: field:banking.export.aggregate,reference:0
146msgid "Reference"
147msgstr "Reference"
148
149#. module: account_banking_aggregate_payment
150#: field:banking.export.aggregate,payment_order_id:0
151msgid "Payment order"
152msgstr "Payment order"
153
154#. module: account_banking_aggregate_payment
155#: field:payment.mode,chained_mode_id:0
156msgid "Chained payment mode"
157msgstr "Chained payment mode"
158
159#. module: account_banking_aggregate_payment
160#: code:addons/account_banking_aggregate_payment/model/export_aggregate.py:66
161#, python-format
162msgid "Cannot reconcile between different accounts"
163msgstr "Cannot reconcile between different accounts"
164
165#. module: account_banking_aggregate_payment
166#: code:addons/account_banking_aggregate_payment/model/export_aggregate.py:72
167#, python-format
168msgid "Line is already fully reconciled"
169msgstr "Line is already fully reconciled"
170
171#. module: account_banking_aggregate_payment
172#: view:banking.export.aggregate:0
173msgid "Cancel"
174msgstr "Cancel"
175
0176
=== added file 'account_banking_aggregate_payment/i18n/nl.po'
--- account_banking_aggregate_payment/i18n/nl.po 1970-01-01 00:00:00 +0000
+++ account_banking_aggregate_payment/i18n/nl.po 2015-06-24 07:17:58 +0000
@@ -0,0 +1,170 @@
1# Translation of OpenERP Server.
2# This file contains the translation of the following modules:
3# * account_banking_aggregate_payment
4#
5msgid ""
6msgstr ""
7"Project-Id-Version: OpenERP Server 6.1\n"
8"Report-Msgid-Bugs-To: \n"
9"POT-Creation-Date: 2013-06-13 19:35+0000\n"
10"PO-Revision-Date: 2013-06-13 19:35+0000\n"
11"Last-Translator: <stefan@therp.nl>\n"
12"Language-Team: \n"
13"MIME-Version: 1.0\n"
14"Content-Type: text/plain; charset=UTF-8\n"
15"Content-Transfer-Encoding: \n"
16"Plural-Forms: \n"
17
18#. module: account_banking_aggregate_payment
19#: view:payment.mode:0
20msgid "Aggregate payment"
21msgstr "Verzamelbetaalopdracht"
22
23#. module: account_banking_aggregate_payment
24#: view:banking.export.aggregate:0
25msgid "Create"
26msgstr "Aanmaken"
27
28#. module: account_banking_aggregate_payment
29#: help:payment.mode,aggregate_partner_id:0
30msgid "The single partner on the chained payment order"
31msgstr "De relatie die geldt als crediteur van het verzameld bedrag"
32
33#. module: account_banking_aggregate_payment
34#: code:addons/account_banking_aggregate_payment/model/export_aggregate.py:134
35#, python-format
36msgid "Aggregate Payment Order %s"
37msgstr "Verzamelbetaling %s"
38
39#. module: account_banking_aggregate_payment
40#: code:addons/account_banking_aggregate_payment/model/export_aggregate.py:230
41#, python-format
42msgid "Payment order workflow does not go into state \"done\""
43msgstr "De workflow van de betaalopdracht komt niet in de status \"verwerkt\""
44
45#. module: account_banking_aggregate_payment
46#: code:addons/account_banking_aggregate_payment/model/export_aggregate.py:143
47#, python-format
48msgid "No move line provided for line %s"
49msgstr "Er is geen boeking voor regel %s"
50
51#. module: account_banking_aggregate_payment
52#: model:ir.model,name:account_banking_aggregate_payment.model_payment_mode
53msgid "Payment Mode"
54msgstr "Betaalwijze"
55
56#. module: account_banking_aggregate_payment
57#: code:addons/account_banking_aggregate_payment/model/export_aggregate.py:48
58#, python-format
59msgid "Please only select a single payment order"
60msgstr "Er kan maar één betaalopdracht worden geselecteerd"
61
62#. module: account_banking_aggregate_payment
63#: code:addons/account_banking_aggregate_payment/model/export_aggregate.py:147
64#, python-format
65msgid "Move line %s has already been paid/reconciled"
66msgstr "Boekingsregel %s is al afgeletterd"
67
68#. module: account_banking_aggregate_payment
69#: code:addons/account_banking_aggregate_payment/model/export_aggregate.py:44
70#: code:addons/account_banking_aggregate_payment/model/export_aggregate.py:121
71#, python-format
72msgid "Please select a payment order"
73msgstr "Selecteer alstublieft een betaalopdracht"
74
75#. module: account_banking_aggregate_payment
76#: code:addons/account_banking_aggregate_payment/model/export_aggregate.py:125
77#, python-format
78msgid "This operation can only be performed on a single payment order"
79msgstr "Deze bewerking kan alleen worden uitgevoerd op een enkele betaalopdracht"
80
81#. module: account_banking_aggregate_payment
82#: code:addons/account_banking_aggregate_payment/model/export_aggregate.py:155
83#, python-format
84msgid "Transit %s"
85msgstr "Tussenboeking %s"
86
87#. module: account_banking_aggregate_payment
88#: code:addons/account_banking_aggregate_payment/model/export_aggregate.py:191
89#, python-format
90msgid "Transit reconciliation"
91msgstr "Aflettering tussenboeking"
92
93#. module: account_banking_aggregate_payment
94#: view:banking.export.aggregate:0
95msgid "Export aggregate payment order"
96msgstr "Verwerken een verzamelbetalingsopdracht"
97
98#. module: account_banking_aggregate_payment
99#: code:addons/account_banking_aggregate_payment/model/export_aggregate.py:208
100#, python-format
101msgid "Amount payable"
102msgstr "Verschuldigd bedrag"
103
104#. module: account_banking_aggregate_payment
105#: field:payment.mode,aggregate_partner_id:0
106msgid "Aggregate payment beneficiary"
107msgstr "Begunstigde van de verzamelbetaling"
108
109#. module: account_banking_aggregate_payment
110#: help:payment.mode,chained_mode_id:0
111msgid "The payment type of the chained payment order"
112msgstr "De betaalwijze van de gekoppelde betaalopdracht"
113
114#. module: account_banking_aggregate_payment
115#: code:addons/account_banking_aggregate_payment/model/export_aggregate.py:43
116#: code:addons/account_banking_aggregate_payment/model/export_aggregate.py:47
117#: code:addons/account_banking_aggregate_payment/model/export_aggregate.py:65
118#: code:addons/account_banking_aggregate_payment/model/export_aggregate.py:71
119#: code:addons/account_banking_aggregate_payment/model/export_aggregate.py:120
120#: code:addons/account_banking_aggregate_payment/model/export_aggregate.py:124
121#: code:addons/account_banking_aggregate_payment/model/export_aggregate.py:142
122#: code:addons/account_banking_aggregate_payment/model/export_aggregate.py:146
123#: code:addons/account_banking_aggregate_payment/model/export_aggregate.py:229
124#, python-format
125msgid "Error"
126msgstr "Fout"
127
128#. module: account_banking_aggregate_payment
129#: model:ir.model,name:account_banking_aggregate_payment.model_banking_export_aggregate
130msgid "Execute aggregate payment"
131msgstr "Verzamelbetaling boeken"
132
133#. module: account_banking_aggregate_payment
134#: view:banking.export.aggregate:0
135msgid "When you confirm this order, the total amount will be made payable to the partner that has been set on the payment mode. A new payment order will open in your screen with this one payment."
136msgstr "Als u deze betaalopdracht bevestigd, dan wordt het totaalbedrag betaalbaar gemaakt aan de relatie die op de betaalwijze aangegeven staat. In het scherm wordt een nieuwe betaalopdracht geopend met alleen dit totaalbedrag."
137
138#. module: account_banking_aggregate_payment
139#: code:addons/account_banking_aggregate_payment/model/export_aggregate.py:172
140#, python-format
141msgid "Reconciliation %s"
142msgstr "Aflettering %s"
143
144#. module: account_banking_aggregate_payment
145#: field:banking.export.aggregate,payment_order_id:0
146msgid "Payment order"
147msgstr "Betaalopdracht"
148
149#. module: account_banking_aggregate_payment
150#: field:payment.mode,chained_mode_id:0
151msgid "Chained payment mode"
152msgstr "Gekoppelde betaalwijze"
153
154#. module: account_banking_aggregate_payment
155#: code:addons/account_banking_aggregate_payment/model/export_aggregate.py:66
156#, python-format
157msgid "Cannot reconcile between different accounts"
158msgstr "Kan niet afletteren tussen verschillende grootboekrekeningen"
159
160#. module: account_banking_aggregate_payment
161#: code:addons/account_banking_aggregate_payment/model/export_aggregate.py:72
162#, python-format
163msgid "Line is already fully reconciled"
164msgstr "De regel is al afgeletterd"
165
166#. module: account_banking_aggregate_payment
167#: view:banking.export.aggregate:0
168msgid "Cancel"
169msgstr "Annuleer"
170
0171
=== added directory 'account_banking_aggregate_payment/model'
=== added file 'account_banking_aggregate_payment/model/__init__.py'
--- account_banking_aggregate_payment/model/__init__.py 1970-01-01 00:00:00 +0000
+++ account_banking_aggregate_payment/model/__init__.py 2015-06-24 07:17:58 +0000
@@ -0,0 +1,2 @@
1import payment_mode
2import export_aggregate
03
=== added file 'account_banking_aggregate_payment/model/export_aggregate.py'
--- account_banking_aggregate_payment/model/export_aggregate.py 1970-01-01 00:00:00 +0000
+++ account_banking_aggregate_payment/model/export_aggregate.py 2015-06-24 07:17:58 +0000
@@ -0,0 +1,252 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# This module copyright (C) 2013 Therp BV (<http://therp.nl>).
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22from openerp.osv import orm, fields
23from openerp.tools.translate import _
24from openerp import netsvc
25
26
27class banking_export_aggregate(orm.TransientModel):
28 _name = 'banking.export.aggregate'
29 _description = 'Execute aggregate payment order'
30 _rec_name = 'payment_order_id'
31
32 _columns = {
33 'payment_order_id': fields.many2one(
34 'payment.order', 'Payment order',
35 required=True),
36 }
37
38 def create(self, cr, uid, vals, context=None):
39 if context is None:
40 context = {}
41 if not vals.get('payment_order_id'):
42 if not context.get('active_ids'):
43 raise orm.except_orm(
44 _('Error'),
45 _('Please select a payment order'))
46 if len(context['active_ids']) > 1:
47 raise orm.except_orm(
48 _('Error'),
49 _('Please only select a single payment order'))
50 vals['payment_order_id'] = context['active_ids'][0]
51 return super(banking_export_aggregate, self).create(
52 cr, uid, vals, context=context)
53
54 def reconcile_lines(self, cr, uid, move_line_ids, context=None):
55 """
56 Reconcile move lines lines, really. ERP core functionality.
57 """
58 reconcile_obj = self.pool.get('account.move.reconcile')
59 account_move_line_obj = self.pool.get('account.move.line')
60 currency_obj = self.pool.get('res.currency')
61 lines = account_move_line_obj.browse(cr, uid, move_line_ids, context=context)
62
63 for line in lines[1:]:
64 if line.account_id != lines[0].account_id:
65 raise orm.except_orm(
66 _('Error'),
67 _('Cannot reconcile between different accounts'))
68
69 if any([line.reconcile_id and line.reconcile_id.line_id
70 for line in lines]):
71 raise orm.except_orm(
72 _('Error'),
73 _('Line is already fully reconciled'))
74
75 currency = lines[0].company_id.currency_id
76
77 partials = []
78 line_ids = []
79 for line in lines:
80 if line.id not in line_ids:
81 line_ids.append(line.id)
82 if line.reconcile_partial_id:
83 line_ids += line.reconcile_partial_id.line_partial_ids
84 if line.reconcile_partial_id.id not in partials:
85 partials.append(line.reconcile_partial_id.id)
86
87 total = account_move_line_obj.get_balance(cr, uid, line_ids)
88 is_zero = currency_obj.is_zero(cr, uid, currency, total)
89
90 vals = {
91 'type': 'auto',
92 'line_id': is_zero and [(6, 0, line_ids)] or [(6, 0, [])],
93 'line_partial_ids': is_zero and [(6, 0, [])] or [(6, 0, line_ids)],
94 }
95
96 if partials:
97 if len(partials) > 1:
98 reconcile_obj.unlink(
99 cr, uid, partials[1:], context=context)
100 reconcile_obj.write(
101 cr, uid, partials[0],
102 vals, context=context)
103 else:
104 reconcile_obj.create(
105 cr, uid, vals, context=context)
106
107 for line_id in line_ids:
108 netsvc.LocalService("workflow").trg_trigger(
109 uid, 'account.move.line', line_id, cr)
110 return True
111
112 def create_aggregate_order(self, cr, uid, ids, context=None):
113 wf_service = netsvc.LocalService('workflow')
114
115 def wf_trigger_check(order, state):
116 wf_service.trg_validate(uid, 'payment.order', order.id, state, cr)
117 order.refresh()
118 if order.state != state:
119 raise orm.except_orm(
120 _('Error'),
121 _('Payment order workflow does not go into state '
122 '"%s"') % state)
123
124 account_move_line_obj = self.pool.get('account.move.line')
125 account_move_obj = self.pool.get('account.move')
126 payment_order_obj = self.pool.get('payment.order')
127 payment_order_line_obj = self.pool.get('payment.line')
128 payment_order_ids = context.get('active_ids', [])
129 if not payment_order_ids:
130 raise orm.except_orm(
131 _('Error'),
132 _('Please select a payment order'))
133 if len(payment_order_ids) > 1:
134 raise orm.except_orm(
135 _('Error'),
136 _('This operation can only be performed on a single '
137 'payment order'))
138
139 today = fields.date.context_today(self, cr, uid, context=context)
140 order = payment_order_obj.browse(
141 cr, uid, payment_order_ids[0], context=context)
142
143 wf_trigger_check(order, 'sent')
144
145 move_id = account_move_obj.create(cr, uid, {
146 'journal_id': order.mode.transfer_journal_id.id,
147 'ref': _('Aggregate Payment Order %s') % order.reference,
148 }, context=context)
149
150 line_ids = []
151 for order_line in order.line_ids:
152 for line in order_line.transit_move_line_id.move_id.line_id:
153 if line.account_id.type == 'other':
154 account_id = line.account_id.id
155 if line.reconcile_id:
156 raise orm.except_orm(
157 _('Error'),
158 _('Transfer move line %s has already been '
159 'paid/reconciled') %
160 line.name
161 )
162 line_ids.append(line.id)
163
164 # TODO: take multicurrency into account?
165
166 total = account_move_line_obj.get_balance(
167 cr, uid, line_ids)
168
169 # Write the aggregate partner on the order's counter move line
170 account_move_line_obj.write(
171 cr, uid, line_ids,
172 {'partner_id': order.mode.aggregate_partner_id.id},
173 context=context)
174
175 # Create the counter move to the order's transit move line
176 # and reconcile
177 vals = {
178 'name': _('Transfer reconciliation'),
179 'move_id': move_id,
180 'partner_id': order.mode.aggregate_partner_id.id,
181 'account_id': account_id,
182 'debit': total < 0 and -total or 0.0,
183 'credit': total >= 0 and total or 0.0,
184 'date': today,
185 }
186
187 aggregate_move_line_id = account_move_line_obj.create(
188 cr, uid, vals, context=context)
189
190 self.reconcile_lines(
191 cr, uid, line_ids + [aggregate_move_line_id],
192 context=context)
193
194 destination_account_id = (
195 order.mode.aggregate_partner_id.property_account_receivable.id
196 if order.payment_order_type == 'debit'
197 else order.mode.aggregate_partner_id.property_account_payable.id)
198
199 # create the credit move line on the aggregate partner
200 vals.update({
201 'name': _('Amount payable'),
202 'account_id': destination_account_id,
203 'partner_id': order.mode.aggregate_partner_id.id,
204 'debit': total >= 0 and total or 0.0,
205 'credit': total < 0 and -total or 0.0,
206 })
207
208 payable_move_line = account_move_line_obj.browse(
209 cr, uid,
210 account_move_line_obj.create(
211 cr, uid, vals, context=context),
212 context=context)
213
214 account_move_obj.post(cr, uid, [move_id], context=context)
215
216 wf_trigger_check(order, 'done')
217
218 payment_order_id = payment_order_obj.create(
219 cr, uid, {
220 'company_id': order.company_id.id,
221 'mode': order.mode.chained_mode_id.id,
222 }, context=context)
223
224 lines2bank = account_move_line_obj.line2bank(
225 cr, uid, [payable_move_line.id], order.mode.id, context)
226
227 payment_order_line_obj.create(cr, uid,{
228 'move_line_id': payable_move_line.id,
229 'amount_currency': payable_move_line.amount_to_pay,
230 'bank_id': lines2bank.get(payable_move_line.id),
231 'order_id': payment_order_id,
232 'partner_id': order.mode.aggregate_partner_id.id,
233 'communication': order.reference.replace('/', ''),
234 'communication2': False,
235 'state': 'structured',
236 'date': today,
237 'currency': (
238 order.company_id.currency_id.id),
239 }, context=context)
240
241 return {
242 'name': payment_order_obj._description,
243 'view_type': 'form',
244 'view_mode': 'form',
245 'res_model': payment_order_obj._name,
246 'domain': [],
247 'context': context,
248 'type': 'ir.actions.act_window',
249 'target': 'current',
250 'res_id': payment_order_id,
251 'nodestroy': True,
252 }
0253
=== added file 'account_banking_aggregate_payment/model/payment_mode.py'
--- account_banking_aggregate_payment/model/payment_mode.py 1970-01-01 00:00:00 +0000
+++ account_banking_aggregate_payment/model/payment_mode.py 2015-06-24 07:17:58 +0000
@@ -0,0 +1,35 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# This module copyright (C) 2013 Therp BV (<http://therp.nl>).
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22from openerp.osv import orm, fields
23
24
25class payment_mode(orm.Model):
26 _inherit = "payment.mode"
27 _columns = {
28 'aggregate_partner_id': fields.many2one(
29 'res.partner', 'Aggregate payment beneficiary',
30 help="The single partner on the chained payment order",
31 ),
32 'chained_mode_id': fields.many2one(
33 'payment.mode', 'Chained payment mode',
34 help="The payment type of the chained payment order"),
35 }
036
=== added directory 'account_banking_aggregate_payment/view'
=== added file 'account_banking_aggregate_payment/view/export_aggregate.xml'
--- account_banking_aggregate_payment/view/export_aggregate.xml 1970-01-01 00:00:00 +0000
+++ account_banking_aggregate_payment/view/export_aggregate.xml 2015-06-24 07:17:58 +0000
@@ -0,0 +1,29 @@
1<?xml version="1.0" encoding="utf-8"?>
2<openerp>
3 <data>
4 <record id="banking_export_aggregate_view" model="ir.ui.view">
5 <field name="name">Export aggregate payment order</field>
6 <field name="model">banking.export.aggregate</field>
7 <field name="arch" type="xml">
8 <form string="Export aggregate payment order">
9 <label string="When you confirm this order, the total
10 amount will be made payable to the partner
11 that has been set on the payment mode. A
12 new payment order will open in your screen
13 with this one payment."/>
14 <group col="2" colspan="1">
15 <button icon="gtk-close"
16 special="cancel"
17 string="Cancel"
18 />
19 <button icon="gtk-ok"
20 string="Create"
21 name="create_aggregate_order"
22 type="object"
23 />
24 </group>
25 </form>
26 </field>
27 </record>
28 </data>
29</openerp>
030
=== added file 'account_banking_aggregate_payment/view/payment_mode.xml'
--- account_banking_aggregate_payment/view/payment_mode.xml 1970-01-01 00:00:00 +0000
+++ account_banking_aggregate_payment/view/payment_mode.xml 2015-06-24 07:17:58 +0000
@@ -0,0 +1,51 @@
1<?xml version="1.0" encoding="utf-8"?>
2<openerp>
3 <data>
4 <record id="view_payment_mode_form" model="ir.ui.view">
5 <field name="name">Adaptations for aggregate payment modes</field>
6 <field name="model">payment.mode</field>
7 <field name="inherit_id"
8 ref="account_banking_payment.view_payment_mode_form_inherit"/>
9 <field name="arch" type="xml">
10 <field name="payment_term_ids" position="after">
11 <group colspan="2" col="2" string="Aggregate payment"
12 attrs="{
13 'invisible': [
14 ('type', '!=',
15 %(account_banking_aggregate_payment.type_aggregate)d
16 )]}">
17 <field name="aggregate_partner_id"
18 attrs="{'required': [
19 ('type', '=',
20 %(account_banking_aggregate_payment.type_aggregate)d
21 )]}"
22 />
23 <field name="chained_mode_id"
24 attrs="{'required': [
25 ('type', '=',
26 %(account_banking_aggregate_payment.type_aggregate)d
27 )]}"
28 />
29 </group>
30 </field>
31
32 <field name="transfer_account_id" position="attributes">
33 <attribute name="attrs">{
34 'required': [
35 ('type', '=',
36 %(account_banking_aggregate_payment.type_aggregate)d
37 )]}</attribute>
38 </field>
39
40 <field name="transfer_journal_id" position="attributes">
41 <attribute name="attrs">{
42 'required': [
43 ('type', '=',
44 %(account_banking_aggregate_payment.type_aggregate)d
45 )]}</attribute>
46 </field>
47
48 </field>
49 </record>
50 </data>
51</openerp>
052
=== modified file 'account_banking_payment/model/account_payment.py'
--- account_banking_payment/model/account_payment.py 2014-03-18 22:51:10 +0000
+++ account_banking_payment/model/account_payment.py 2015-06-24 07:17:58 +0000
@@ -289,8 +289,8 @@
289 account_move_line_obj = self.pool.get('account.move.line')289 account_move_line_obj = self.pool.get('account.move.line')
290 payment_line_obj = self.pool.get('payment.line')290 payment_line_obj = self.pool.get('payment.line')
291 labels = {291 labels = {
292 'payment': _('Payment order'),292 'payment': _('Payment'),
293 'debit': _('Direct debit order'),293 'debit': _('Direct debit'),
294 }294 }
295 for order in self.browse(cr, uid, ids, context=context):295 for order in self.browse(cr, uid, ids, context=context):
296 if not order.mode.transfer_journal_id \296 if not order.mode.transfer_journal_id \

Subscribers

People subscribed via source and target branches

to status/vote changes: