Merge lp:~acsone-openerp/banking-addons/ba-70-payment-export-refactoring into lp:banking-addons

Proposed by Stéphane Bidoul (Acsone)
Status: Merged
Merged at revision: 190
Proposed branch: lp:~acsone-openerp/banking-addons/ba-70-payment-export-refactoring
Merge into: lp:banking-addons
Diff against target: 1487 lines (+504/-460)
32 files modified
account_banking_payment/__openerp__.py (+1/-4)
account_banking_payment/data/payment_mode_type.xml (+0/-14)
account_banking_payment/model/__init__.py (+0/-1)
account_banking_payment/model/account_payment.py (+0/-43)
account_banking_payment/model/bank_payment_manual.py (+0/-53)
account_banking_payment/model/payment_mode.py (+0/-19)
account_banking_payment/model/payment_mode_type.py (+0/-62)
account_banking_payment/model/payment_order_create.py (+0/-199)
account_banking_payment/security/ir.model.access.csv (+0/-2)
account_banking_payment/view/account_payment.xml (+0/-4)
account_banking_payment/view/bank_payment_manual.xml (+0/-15)
account_banking_payment/view/payment_mode.xml (+2/-3)
account_banking_payment/view/payment_mode_type.xml (+0/-32)
account_banking_payment/workflow/account_payment.xml (+6/-0)
account_banking_payment_export/__init__.py (+1/-0)
account_banking_payment_export/__openerp__.py (+69/-0)
account_banking_payment_export/data/payment_mode_type.xml (+14/-0)
account_banking_payment_export/model/__init__.py (+5/-0)
account_banking_payment_export/model/account_payment.py (+75/-0)
account_banking_payment_export/model/bank_payment_manual.py (+59/-0)
account_banking_payment_export/model/payment_mode.py (+52/-0)
account_banking_payment_export/model/payment_mode_type.py (+61/-0)
account_banking_payment_export/model/payment_order_create.py (+58/-0)
account_banking_payment_export/security/ir.model.access.csv (+2/-0)
account_banking_payment_export/view/account_payment.xml (+22/-0)
account_banking_payment_export/view/bank_payment_manual.xml (+18/-0)
account_banking_payment_export/view/payment_mode.xml (+20/-0)
account_banking_payment_export/view/payment_mode_type.xml (+31/-0)
account_banking_sepa_credit_transfer/__openerp__.py (+1/-1)
account_banking_sepa_credit_transfer/account_banking_sepa.py (+0/-2)
account_banking_sepa_credit_transfer/account_banking_sepa_view.xml (+1/-1)
account_banking_sepa_credit_transfer/wizard/export_sepa.py (+6/-5)
To merge this branch: bzr merge lp:~acsone-openerp/banking-addons/ba-70-payment-export-refactoring
Reviewer Review Type Date Requested Status
Stefan Rijnhart (Opener) Approve
Stéphane Bidoul (Acsone) (community) Needs Resubmitting
Joël Grand-Guillaume @ camptocamp structre/concept, not test Approve
Review via email: mp+179543@code.launchpad.net

Commit message

[MRG] account_banking_payment_export

Refactoring of account_banking_payment to provide payment export infrastructure independently of bank statement reconciliation features.

Description of the change

Refactoring of account_banking_payment into
- account_banking_payment_export (export wizard hook, payment mode types, suitable bank types, etc)
- and account_banking_payment (workflow with sent state, transfer accounts, reconciliation, etc)

This allows using payment export (such as sepa credit transfer) independently of bank statement imports.
Account_payment_export does not depend on account_banking anymore, while remaining 100% compatible: when account_banking_payment is installed, the advanced worflow and reconciliation features are added.

Compatibility notes. In order to break the dependency on account_banking, the following minor changes were necessary
- the external id of manual_bank_tranfer payment mode type has changed
- the "Generated SEPA Credit Transfer files" moved to the Payment Orders menu
- manual and sepa credit transfers send the "done" signal when they are finished (instead of "sent") to remain compatible with the default workflow (however the advanced workflow in account_banking_payment supports both done and sent signals to transition from act_open to act_sent)

To post a comment you must log in.
180. By Stéphane Bidoul (Acsone)

[FIX] remove leftover of previous experiment

Revision history for this message
Stéphane Bidoul (Acsone) (sbi) wrote :

Would it be better to move the following to account_direct_debit?
- payment_term_ids field in payment.mode
- payment_order_type field on payment.mode.type
- payment_order_create.py

This would focus this module account_banking_payment_export on its real purpose, which is adding the hook for payment export wizards.

Revision history for this message
Stéphane Bidoul (Acsone) (sbi) wrote :

BTW, how does this all relate to lp:account-payment/account_payment_extension? #headache

181. By Stéphane Bidoul (Acsone)

[MRG] Merge base_iban_bic_not_required

182. By Stéphane Bidoul (Acsone)

[MRG] Sync with 7.0 branch

Revision history for this message
Joël Grand-Guillaume @ camptocamp (jgrandguillaume-c2c) wrote :

Hi Stéphane,

Thanks for this contrib, this is a good first step in merging this project into one ! I reviewed the structure/concept and it seems good to me. No deep look on the Python code though.

Regards,

Joël

review: Approve (structre/concept, not test)
183. By Stéphane Bidoul (Acsone)

[IMP] clarify scope of account_banking_payment_export by moving some features back to account_banking_payment
[IMP] nicer manual payment wizard

184. By Stéphane Bidoul (Acsone)

[IMP] clarified comment about workflow in account_banking_sepa_credit_transfer

185. By Stéphane Bidoul (Acsone)

[IMP] clarify account_banking_payment_export module description

Revision history for this message
Stéphane Bidoul (Acsone) (sbi) wrote :

Hi,

Since the purpose of account_banking_payment_export module was still difficult to explain, I went back a little bit and reduced its scope to providing the payment export infrastructure, including the sample "manual" payment mode type, and nothing more.

It's now easy to grasp it's purpose. Other features from account_banking(_payment) can be split in other modules later.

While I was at it I made the manual payment wizard a bit nicer for 7.0.

-sbi

186. By Stéphane Bidoul (Acsone)

declare conflict with lp:account-payment/account_payment_exention

Revision history for this message
Stéphane Bidoul (Acsone) (sbi) wrote :

Documented the conflict with lp:account-payment/account_payment_exention.

Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

Thanks for your hard work on that! I'm not enough familiar to speak about the merge in itself, but from what I can understand, sounds good.

Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

> Thanks for your hard work on that! I'm not enough familiar to speak about the
> merge in itself, but from what I can understand, sounds good.

s/merge/split/

187. By Stéphane Bidoul (Acsone)

[MRG] Sync with 7.0 branch

188. By Stéphane Bidoul (Acsone)

[MRG] Sync with 7.0 branch

Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote :

Hi Stéphane,

thank you for your great work and apologies for the late review. My first impression is that the refactoring is very solid. Also, and importantly, upgrading any existing installation of banking-addons should be straightforward because of the dependency structure, as long as the new module is in the addons path.

Of course, there are a few details to discuss:

- Having account_banking_payment installed, rerouting signal done to state 'send' works when exporting the payment order, but when the reconciliation in account_banking attempts to finish the payment order workflow using the same signal, the payment order stays in the 'send' state. I'm sure there is a way to get this to work using the workflow engine, but depending on whether you are a fan of the workflow engine you could also consider creating a method on the payment order model that triggers 'sent' in account_banking_payment and 'done' in account_banking_payment_export.

- As far as I know, there is no way to craft a migration script that guarantees to move an xml-id to a *newly* installed module that has no common dependency with the originating module. You should probably keep the old module name as part of the manual order type xml-id, and we'll move it back on the next OpenERP major release migration.
- 'name' in the __openerp__.py manifest is the same for both payment modules, which makes it hard to distinguish in the interface

- There is a missing dependency on base_iban, due to the bank type specified in the manual payment mode type. As depending on base_iban is a little Eurocentric, you could consider making the payment mode types editable in the interface (and its data 'noupdate') + let the SEPA export module depend on base_iban itself (or depend on base_iban now and we'll keep the latter in mind).

- Are you very strongly against keeping our version line2bank in the export module? In the days of transitioning to SEPA, where multiple account numbers per partner are not uncommon, I think this is going to hurt a number of people. One option is to at least refactor it into a separate module. But I would prefer to have it in the export module for simplicity.

Not for this review but on a related note, I want to implement a general check on the presence of an account number in each line. Would you agree to have me put this in the export module once it is merged? It is after all, essential for the export of any order to a bank. Alexis already resorted to putting one in the SEPA module itself, but it is useful for all export formats.

review: Needs Fixing
Revision history for this message
Stéphane Bidoul (Acsone) (sbi) wrote :
Download full text (4.0 KiB)

Thanks for the review, Stefan.

- I'll look into the workflow issue. It's not immediately obvious to me why
it does not work.

- regarding the xml_id, if I keep "account_banking.manual_bank_transfer",
it requires to have account_banking installed, which is a dependency we
want to avoid. Or do I overlook something?

- I'm fine with the dependency on base_iban

- with line2bank, do you mean the payment_order_create class? I left it
alone because it was pulling the payment_term filter which is unrelated to
the pure payment export functionality (and also because I was not too sure
of its purpose). Does it make sense to keep the
payment_order_create.create_payment() method in account_payment_export and
leave the rest in account_payment? Perhaps you can help me explaining it's
purpose in the module manifest.

Regarding the check for the presence of an account number, I'm fine with
that.

In the same line of thought, I also saw that Alexis put a feature to
preserve the history of exported files in the sepa module. That's also a
generic requirement that could live in account_payment_export.

-sbi

On Sat, Sep 7, 2013 at 3:40 PM, Stefan Rijnhart (Therp) <email address hidden>wrote:

> Review: Needs Fixing
>
> Hi Stéphane,
>
> thank you for your great work and apologies for the late review. My first
> impression is that the refactoring is very solid. Also, and importantly,
> upgrading any existing installation of banking-addons should be
> straightforward because of the dependency structure, as long as the new
> module is in the addons path.
>
> Of course, there are a few details to discuss:
>
> - Having account_banking_payment installed, rerouting signal done to state
> 'send' works when exporting the payment order, but when the reconciliation
> in account_banking attempts to finish the payment order workflow using the
> same signal, the payment order stays in the 'send' state. I'm sure there is
> a way to get this to work using the workflow engine, but depending on
> whether you are a fan of the workflow engine you could also consider
> creating a method on the payment order model that triggers 'sent' in
> account_banking_payment and 'done' in account_banking_payment_export.
>
> - As far as I know, there is no way to craft a migration script that
> guarantees to move an xml-id to a *newly* installed module that has no
> common dependency with the originating module. You should probably keep the
> old module name as part of the manual order type xml-id, and we'll move it
> back on the next OpenERP major release migration.
> - 'name' in the __openerp__.py manifest is the same for both payment
> modules, which makes it hard to distinguish in the interface
>
> - There is a missing dependency on base_iban, due to the bank type
> specified in the manual payment mode type. As depending on base_iban is a
> little Eurocentric, you could consider making the payment mode types
> editable in the interface (and its data 'noupdate') + let the SEPA export
> module depend on base_iban itself (or depend on base_iban now and we'll
> keep the latter in mind).
>
> - Are you very strongly against keeping our version line2bank in the
> export module? In the days of transitio...

Read more...

Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote :

On 09/07/2013 05:57 PM, Stéphane Bidoul (Acsone) wrote:
> Thanks for the review, Stefan.
>
> - I'll look into the workflow issue. It's not immediately obvious to me why
> it does not work.

Hi Stéphane,

Sorry, problem between keyboard and chair here, as I was doing the
reconciliation of the payment order (admittedly fueled by my
unfamiliarity of using the same workflow signal for multiple
transitions). It works!

> - regarding the xml_id, if I keep "account_banking.manual_bank_transfer",
> it requires to have account_banking installed, which is a dependency we
> want to avoid. Or do I overlook something?

Yes, apparently. I thought we could pull this one off, as official
modules do use references to other modules, combined with the fact that
internally you can assign arbitrary 'module' labels in ir_model_data.
But when I test it, the installation process complains that
"account_banking.manual_bank_tranfer" refers to an uninstalled module.

I'm not sure what to do. If I upgrade an existing setup that contains a
payment mode with this type, the process breaks with 'null value in
column "type" violates not-null constraint'.

> - with line2bank, do you mean the payment_order_create class? I left it
> alone because it was pulling the payment_term filter which is unrelated to
> the pure payment export functionality (and also because I was not too sure
> of its purpose).

It is actually not line2bank itself, but making it work properly. The
fix is twofold. First, it is reading suitable bank types from the
payment mode type. You kept this bit. The other part is passing the
payment order mode to line2bank. As you can see here, OpenERP does not
do this:
http://bazaar.launchpad.net/~openerp/openobject-addons/7.0/view/head:/account_payment/wizard/account_payment_order.py#L72.

> Does it make sense to keep the
> payment_order_create.create_payment() method in account_payment_export and
> leave the rest in account_payment? Perhaps you can help me explaining it's
> purpose in the module manifest.

Account_banking_payment overwrites payment_order_create.create_payment()
but you don't have to do that if you agree to apply the following trick:
wrap around create_payment to extract the payment mode id and put it in
the context + call super(). Then also wrap around line2bank and extract
the id from the context again, if the payment mode id passed to
line2bank is None + call super() with it.

(the payment term filter is an optional way to use the payment term to
preselect the manner of payment through partner settings or at invoicing
time. This is particularly useful for debit orders because of the
required mandates per partner)

Cheers,
Stefan.

Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote :

One option to move the xml id could be to update the record in ir_model_data using an SQL query in account_banking_payment_export, in payment.mode.type's _auto_init() method. I think that would give it the right timing. It will run every time the module is upgraded which is ugly but the overhead is negligible.

Revision history for this message
Stéphane Bidoul (Acsone) (sbi) wrote :

I was considering that approach too. I'll give it a try.

-sbi
Le 8 sept. 2013 11:08, "Stefan Rijnhart (Therp)" <email address hidden> a écrit :

> One option to move the xml id could be to update the record in
> ir_model_data using an SQL query in account_banking_payment_export, in
> payment.mode.type's _auto_init() method. I think that would give it the
> right timing. It will run every time the module is upgraded which is ugly
> but the overhead is negligible.
>
> --
>
> https://code.launchpad.net/~acsone-openerp/banking-addons/ba-70-payment-export-refactoring/+merge/179543
> You proposed
> lp:~acsone-openerp/banking-addons/ba-70-payment-export-refactoring for
> merging.
>

189. By Stéphane Bidoul (Acsone)

[IMP] module name, base_iban_dependency and migration of manual_bank_transfer

190. By Stéphane Bidoul (Acsone)

[IMP] propagate payment mode from create_payment to line2bank

191. By Stéphane Bidoul (Acsone)

[FIX] missing return
[IMP] docstring

192. By Stéphane Bidoul (Acsone)

[IMP] remove comment from the v5 era

193. By Stéphane Bidoul (Acsone)

pep8

194. By Stéphane Bidoul (Acsone)

pep8

195. By Stéphane Bidoul (Acsone)

[FIX] missing import

196. By Stéphane Bidoul (Acsone)

whitespace and pep8

197. By Stéphane Bidoul (Acsone)

[FIX] fix payment.mode.type view inheritance

Revision history for this message
Stéphane Bidoul (Acsone) (sbi) wrote :

Hi again,

Here is a new version.

I adressed all of Stefan's comments:
- module name
- base_iban dependency
- migration of manual_bank_transfer xml id
- the trick/hack/thing about making line2bank receive the payment mode :)

@Stefan, have you ever attempted to integrate that last one in a MP to the core?
The fix there would be simple, although difficult to explain in a bug report.

plus:
- a bit of pep8
- a view bug I discovered while testing

review: Needs Resubmitting
Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote :

Thanks. The code looks good. One nit:

l.1286: would it be alright with you to put the changes to the move line model in a separate file, following the (relatively recent) conventions in this series of modules?

I would still like a couple of days for testing before I can definately approve, but it's looking really good.

About line2bank in the core: it's just a remnant after payment.mode.type was removed from the core in OpenERP 6.0 so the proper fix would be to replace it in the core with a method that transparently selects the partner's first bank account. I don't see what this project wins with that, as a hack like the one we came up with would still be needed.

Revision history for this message
Stéphane Bidoul (Acsone) (sbi) wrote :

On Fri, Sep 13, 2013 at 9:57 AM, Stefan Rijnhart (Therp) <email address hidden>wrote:

> l.1286: would it be alright with you to put the changes to the move line
> model in a separate file, following the (relatively recent) conventions in
> this series of modules?
>

I considered that too, but in the end I decided that since the two parts of
the hack where so closely related that it would make the code much harder
to understand if it was split in two files. After all, python never
enforced a one-class-per-file rule like java, and in this case it made
sense to keep them together. What do you think?

-sbi

Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote :

Good point, let's keep them together.

198. By Stéphane Bidoul (Acsone)

[IMP] use local imports

199. By Stéphane Bidoul (Acsone)

[MRG] Sync with 7.0 branch

Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote :

Stéphane,

once again thank you for your patience. I have succesfully tested migrating existing databases to the current state of the branch. Meanwhile, I am writing a lengthy test that simulates a payment order - bank statement round trip, but that should not keep back the merge of this branch.

In the last revisions, a slight error showed up: BaseModel._auto_init() actually returns something that can be meaningful. It does not seem to make a difference here but I think it would be best to return the result of super() after line 1226.

And then we're done.

review: Needs Fixing
200. By Stéphane Bidoul (Acsone)

[FIX] proper _auto_init return value

Revision history for this message
Stéphane Bidoul (Acsone) (sbi) wrote :

Hi Stefan,

Done. Thanks for the extensive review.

-sbi

Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote :

Approved. Thank you for pushing the idea of decoupling the functionalities and working so hard on it! If no one else has any more comments this could be merged early next week.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account_banking_payment/__openerp__.py'
2--- account_banking_payment/__openerp__.py 2013-05-28 15:18:26 +0000
3+++ account_banking_payment/__openerp__.py 2013-09-25 08:52:04 +0000
4@@ -32,17 +32,14 @@
5 'category': 'Banking addons',
6 'depends': [
7 'account_banking',
8- 'account_payment',
9+ 'account_banking_payment_export',
10 ],
11 'data': [
12 'view/account_payment.xml',
13 'view/banking_transaction_wizard.xml',
14 'view/payment_mode.xml',
15 'view/payment_mode_type.xml',
16- 'view/bank_payment_manual.xml',
17- 'data/payment_mode_type.xml',
18 'workflow/account_payment.xml',
19- 'security/ir.model.access.csv',
20 ],
21 'description': '''
22 This addon adds payment infrastructure to the Banking Addons.
23
24=== removed directory 'account_banking_payment/data'
25=== removed file 'account_banking_payment/data/payment_mode_type.xml'
26--- account_banking_payment/data/payment_mode_type.xml 2013-03-17 12:53:37 +0000
27+++ account_banking_payment/data/payment_mode_type.xml 1970-01-01 00:00:00 +0000
28@@ -1,14 +0,0 @@
29-<?xml version="1.0" encoding="utf-8"?>
30-<openerp>
31- <data>
32- <!-- Add manual bank transfer as default payment option -->
33- <record model="payment.mode.type" id="account_banking.manual_bank_tranfer">
34- <field name="name">Manual Bank Transfer</field>
35- <field name="code">BANKMAN</field>
36- <field name="suitable_bank_types"
37- eval="[(6,0,[ref('base.bank_normal'),ref('base_iban.bank_iban'),])]" />
38- <field name="ir_model_id"
39- ref="account_banking_payment.model_payment_manual"/>
40- </record>
41- </data>
42-</openerp>
43
44=== modified file 'account_banking_payment/model/__init__.py'
45--- account_banking_payment/model/__init__.py 2013-05-30 10:03:41 +0000
46+++ account_banking_payment/model/__init__.py 2013-09-25 08:52:04 +0000
47@@ -5,5 +5,4 @@
48 import payment_order_create
49 import banking_import_transaction
50 import banking_transaction_wizard
51-import bank_payment_manual
52 import banking_import_line
53
54=== modified file 'account_banking_payment/model/account_payment.py'
55--- account_banking_payment/model/account_payment.py 2013-09-23 13:57:32 +0000
56+++ account_banking_payment/model/account_payment.py 2013-09-25 08:52:04 +0000
57@@ -115,49 +115,6 @@
58 'payment_order_type': 'payment',
59 }
60
61- def launch_wizard(self, cr, uid, ids, context=None):
62- """
63- Search for a wizard to launch according to the type.
64- If type is manual. just confirm the order.
65- Previously (pre-v6) in account_payment/wizard/wizard_pay.py
66- """
67- if context == None:
68- context = {}
69- result = {}
70- orders = self.browse(cr, uid, ids, context)
71- order = orders[0]
72- # check if a wizard is defined for the first order
73- if order.mode.type and order.mode.type.ir_model_id:
74- context['active_ids'] = ids
75- wizard_model = order.mode.type.ir_model_id.model
76- wizard_obj = self.pool.get(wizard_model)
77- wizard_id = wizard_obj.create(cr, uid, {}, context)
78- result = {
79- 'name': wizard_obj._description or _('Payment Order Export'),
80- 'view_type': 'form',
81- 'view_mode': 'form',
82- 'res_model': wizard_model,
83- 'domain': [],
84- 'context': context,
85- 'type': 'ir.actions.act_window',
86- 'target': 'new',
87- 'res_id': wizard_id,
88- 'nodestroy': True,
89- }
90- else:
91- # should all be manual orders without type or wizard model
92- for order in orders[1:]:
93- if order.mode.type and order.mode.type.ir_model_id:
94- raise orm.except_orm(
95- _('Error'),
96- _('You can only combine payment orders of the same type')
97- )
98- # process manual payments
99- wf_service = netsvc.LocalService('workflow')
100- for order_id in ids:
101- wf_service.trg_validate(uid, 'payment.order', order_id, 'sent', cr)
102- return result
103-
104 def _write_payment_lines(self, cr, uid, ids, **kwargs):
105 '''
106 ORM method for setting attributes of corresponding payment.line objects.
107
108=== removed file 'account_banking_payment/model/bank_payment_manual.py'
109--- account_banking_payment/model/bank_payment_manual.py 2013-03-17 20:03:32 +0000
110+++ account_banking_payment/model/bank_payment_manual.py 1970-01-01 00:00:00 +0000
111@@ -1,53 +0,0 @@
112-# -*- coding: utf-8 -*-
113-##############################################################################
114-#
115-# Copyright (C) 2009 EduSense BV (<http://www.edusense.nl>).
116-# (C) 2011 - 2013 Therp BV (<http://therp.nl>).
117-#
118-# All other contributions are (C) by their respective contributors
119-#
120-# All Rights Reserved
121-#
122-# This program is free software: you can redistribute it and/or modify
123-# it under the terms of the GNU Affero General Public License as
124-# published by the Free Software Foundation, either version 3 of the
125-# License, or (at your option) any later version.
126-#
127-# This program is distributed in the hope that it will be useful,
128-# but WITHOUT ANY WARRANTY; without even the implied warranty of
129-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
130-# GNU Affero General Public License for more details.
131-#
132-# You should have received a copy of the GNU Affero General Public License
133-# along with this program. If not, see <http://www.gnu.org/licenses/>.
134-#
135-##############################################################################
136-
137-'''
138-This module contains a single "wizard" for including a 'sent' state for manual
139-bank transfers.
140-'''
141-
142-from openerp.osv import orm, fields
143-from openerp import netsvc
144-
145-
146-class payment_manual(orm.TransientModel):
147- _name = 'payment.manual'
148- _description = 'Set payment orders to \'sent\' manually'
149-
150- def default_get(self, cr, uid, fields_list, context=None):
151- if context and context.get('active_ids'):
152- payment_order_obj = self.pool.get('payment.order')
153- wf_service = netsvc.LocalService('workflow')
154- for order_id in context['active_ids']:
155- wf_service.trg_validate(
156- uid, 'payment.order', order_id, 'sent', cr)
157- return super(payment_manual, self).default_get(
158- cr, uid, fields_list, context=None)
159-
160- _columns = {
161- # dummy field, to trigger a call to default_get
162- 'name': fields.char('Name', size=1),
163- }
164-
165
166=== modified file 'account_banking_payment/model/payment_mode.py'
167--- account_banking_payment/model/payment_mode.py 2013-05-29 12:35:04 +0000
168+++ account_banking_payment/model/payment_mode.py 2013-09-25 08:52:04 +0000
169@@ -27,28 +27,9 @@
170
171
172 class payment_mode(orm.Model):
173- ''' Restoring the payment type from version 5,
174- used to select the export wizard (if any) '''
175 _inherit = "payment.mode"
176
177- def suitable_bank_types(self, cr, uid, payment_mode_id=None, context=None):
178- """ Reinstates functional code for suitable bank type filtering.
179- Current code in account_payment is disfunctional.
180- """
181- res = []
182- payment_mode = self.browse(
183- cr, uid, payment_mode_id, context)
184- if (payment_mode and payment_mode.type and
185- payment_mode.type.suitable_bank_types):
186- res = [type.code for type in payment_mode.type.suitable_bank_types]
187- return res
188-
189 _columns = {
190- 'type': fields.many2one(
191- 'payment.mode.type', 'Payment type',
192- required=True,
193- help='Select the Payment Type for the Payment Mode.'
194- ),
195 'transfer_account_id': fields.many2one(
196 'account.account', 'Transfer account',
197 domain=[('type', '=', 'other'),
198
199=== added file 'account_banking_payment/model/payment_mode_type.py'
200--- account_banking_payment/model/payment_mode_type.py 1970-01-01 00:00:00 +0000
201+++ account_banking_payment/model/payment_mode_type.py 2013-09-25 08:52:04 +0000
202@@ -0,0 +1,41 @@
203+# -*- coding: utf-8 -*-
204+##############################################################################
205+#
206+# Copyright (C) 2009 EduSense BV (<http://www.edusense.nl>).
207+# (C) 2011 - 2013 Therp BV (<http://therp.nl>).
208+#
209+# All other contributions are (C) by their respective contributors
210+#
211+# All Rights Reserved
212+#
213+# This program is free software: you can redistribute it and/or modify
214+# it under the terms of the GNU Affero General Public License as
215+# published by the Free Software Foundation, either version 3 of the
216+# License, or (at your option) any later version.
217+#
218+# This program is distributed in the hope that it will be useful,
219+# but WITHOUT ANY WARRANTY; without even the implied warranty of
220+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
221+# GNU Affero General Public License for more details.
222+#
223+# You should have received a copy of the GNU Affero General Public License
224+# along with this program. If not, see <http://www.gnu.org/licenses/>.
225+#
226+##############################################################################
227+
228+from openerp.osv import orm, fields
229+
230+
231+class payment_mode_type(orm.Model):
232+ _inherit = 'payment.mode.type'
233+
234+ _columns = {
235+ 'payment_order_type': fields.selection(
236+ [('payment', 'Payment'),('debit', 'Direct debit')],
237+ 'Payment order type', required=True,
238+ ),
239+ }
240+
241+ _defaults = {
242+ 'payment_order_type': 'payment',
243+ }
244
245=== removed file 'account_banking_payment/model/payment_mode_type.py'
246--- account_banking_payment/model/payment_mode_type.py 2013-03-17 09:10:15 +0000
247+++ account_banking_payment/model/payment_mode_type.py 1970-01-01 00:00:00 +0000
248@@ -1,62 +0,0 @@
249-# -*- coding: utf-8 -*-
250-##############################################################################
251-#
252-# Copyright (C) 2009 EduSense BV (<http://www.edusense.nl>).
253-# (C) 2011 - 2013 Therp BV (<http://therp.nl>).
254-#
255-# All other contributions are (C) by their respective contributors
256-#
257-# All Rights Reserved
258-#
259-# This program is free software: you can redistribute it and/or modify
260-# it under the terms of the GNU Affero General Public License as
261-# published by the Free Software Foundation, either version 3 of the
262-# License, or (at your option) any later version.
263-#
264-# This program is distributed in the hope that it will be useful,
265-# but WITHOUT ANY WARRANTY; without even the implied warranty of
266-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
267-# GNU Affero General Public License for more details.
268-#
269-# You should have received a copy of the GNU Affero General Public License
270-# along with this program. If not, see <http://www.gnu.org/licenses/>.
271-#
272-##############################################################################
273-
274-from openerp.osv import orm, fields
275-
276-
277-class payment_mode_type(orm.Model):
278- _name = 'payment.mode.type'
279- _description = 'Payment Mode Type'
280- _columns = {
281- 'name': fields.char(
282- 'Name', size=64, required=True,
283- help='Payment Type'
284- ),
285- 'code': fields.char(
286- 'Code', size=64, required=True,
287- help='Specify the Code for Payment Type'
288- ),
289- # Setting suitable_bank_types to required pending
290- # https://bugs.launchpad.net/openobject-addons/+bug/786845
291- 'suitable_bank_types': fields.many2many(
292- 'res.partner.bank.type',
293- 'bank_type_payment_type_rel',
294- 'pay_type_id','bank_type_id',
295- 'Suitable bank types', required=True),
296- 'ir_model_id': fields.many2one(
297- 'ir.model', 'Payment wizard',
298- help=('Select the Payment Wizard for payments of this type. '
299- 'Leave empty for manual processing'),
300- domain=[('osv_memory', '=', True)],
301- ),
302- 'payment_order_type': fields.selection(
303- [('payment', 'Payment'),('debit', 'Direct debit')],
304- 'Payment order type', required=True,
305- ),
306- }
307-
308- _defaults = {
309- 'payment_order_type': 'payment',
310- }
311
312=== added file 'account_banking_payment/model/payment_order_create.py'
313--- account_banking_payment/model/payment_order_create.py 1970-01-01 00:00:00 +0000
314+++ account_banking_payment/model/payment_order_create.py 2013-09-25 08:52:04 +0000
315@@ -0,0 +1,197 @@
316+# -*- coding: utf-8 -*-
317+##############################################################################
318+#
319+# Copyright (C) 2009 EduSense BV (<http://www.edusense.nl>).
320+# (C) 2011 - 2013 Therp BV (<http://therp.nl>).
321+#
322+# All other contributions are (C) by their respective contributors
323+#
324+# All Rights Reserved
325+#
326+# This program is free software: you can redistribute it and/or modify
327+# it under the terms of the GNU Affero General Public License as
328+# published by the Free Software Foundation, either version 3 of the
329+# License, or (at your option) any later version.
330+#
331+# This program is distributed in the hope that it will be useful,
332+# but WITHOUT ANY WARRANTY; without even the implied warranty of
333+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
334+# GNU Affero General Public License for more details.
335+#
336+# You should have received a copy of the GNU Affero General Public License
337+# along with this program. If not, see <http://www.gnu.org/licenses/>.
338+#
339+##############################################################################
340+
341+from openerp.osv import orm, fields
342+from openerp.tools.translate import _
343+
344+
345+class payment_order_create(orm.TransientModel):
346+ _inherit = 'payment.order.create'
347+
348+ def extend_payment_order_domain(
349+ self, cr, uid, payment_order, domain, context=None):
350+ if payment_order.payment_order_type == 'payment':
351+ domain += [
352+ ('account_id.type', '=', 'payable'),
353+ ('amount_to_pay', '>', 0)
354+ ]
355+ return True
356+
357+ def search_entries(self, cr, uid, ids, context=None):
358+ """
359+ This method taken from account_payment module.
360+ We adapt the domain based on the payment_order_type
361+ """
362+ line_obj = self.pool.get('account.move.line')
363+ mod_obj = self.pool.get('ir.model.data')
364+ if context is None:
365+ context = {}
366+ data = self.read(cr, uid, ids, ['duedate'], context=context)[0]
367+ search_due_date = data['duedate']
368+
369+ ### start account_banking_payment ###
370+ payment = self.pool.get('payment.order').browse(
371+ cr, uid, context['active_id'], context=context)
372+ # Search for move line to pay:
373+ domain = [
374+ ('move_id.state', '=', 'posted'),
375+ ('reconcile_id', '=', False),
376+ ('company_id', '=', payment.mode.company_id.id),
377+ ]
378+ # apply payment term filter
379+ if payment.mode.payment_term_ids:
380+ domain += [
381+ ('invoice.payment_term', 'in',
382+ [term.id for term in payment.mode.payment_term_ids]
383+ )
384+ ]
385+ self.extend_payment_order_domain(
386+ cr, uid, payment, domain, context=context)
387+ ### end account_direct_debit ###
388+
389+ domain = domain + [
390+ '|', ('date_maturity', '<=', search_due_date),
391+ ('date_maturity', '=', False)
392+ ]
393+ line_ids = line_obj.search(cr, uid, domain, context=context)
394+ context.update({'line_ids': line_ids})
395+ model_data_ids = mod_obj.search(
396+ cr, uid,[
397+ ('model', '=', 'ir.ui.view'),
398+ ('name', '=', 'view_create_payment_order_lines')],
399+ context=context)
400+ resource_id = mod_obj.read(
401+ cr, uid, model_data_ids, fields=['res_id'],
402+ context=context)[0]['res_id']
403+ return {'name': _('Entry Lines'),
404+ 'context': context,
405+ 'view_type': 'form',
406+ 'view_mode': 'form',
407+ 'res_model': 'payment.order.create',
408+ 'views': [(resource_id, 'form')],
409+ 'type': 'ir.actions.act_window',
410+ 'target': 'new',
411+ }
412+
413+ def create_payment(self, cr, uid, ids, context=None):
414+ '''
415+ This method is a slightly modified version of the existing method on this
416+ model in account_payment.
417+ - pass the payment mode to line2bank()
418+ - allow invoices to create influence on the payment process: not only 'Free'
419+ references are allowed, but others as well
420+ - check date_to_pay is not in the past.
421+ '''
422+
423+ order_obj = self.pool.get('payment.order')
424+ line_obj = self.pool.get('account.move.line')
425+ payment_obj = self.pool.get('payment.line')
426+ if context is None:
427+ context = {}
428+ data = self.read(cr, uid, ids, [], context=context)[0]
429+ line_ids = data['entries']
430+ if not line_ids:
431+ return {'type': 'ir.actions.act_window_close'}
432+
433+ payment = order_obj.browse(
434+ cr, uid, context['active_id'], context=context)
435+ ### account banking
436+ # t = None
437+ # line2bank = line_obj.line2bank(cr, uid, line_ids, t, context)
438+ line2bank = line_obj.line2bank(
439+ cr, uid, line_ids, payment.mode.id, context)
440+ _today = fields.date.context_today(self, cr, uid, context=context)
441+ ### end account banking
442+
443+ ## Finally populate the current payment with new lines:
444+ for line in line_obj.browse(cr, uid, line_ids, context=context):
445+ if payment.date_prefered == "now":
446+ #no payment date => immediate payment
447+ date_to_pay = False
448+ elif payment.date_prefered == 'due':
449+ ### account_banking
450+ # date_to_pay = line.date_maturity
451+ date_to_pay = (
452+ line.date_maturity
453+ if line.date_maturity and line.date_maturity > _today
454+ else False)
455+ ### end account banking
456+ elif payment.date_prefered == 'fixed':
457+ ### account_banking
458+ # date_to_pay = payment.date_scheduled
459+ date_to_pay = (
460+ payment.date_scheduled
461+ if payment.date_scheduled and payment.date_scheduled > _today
462+ else False)
463+ ### end account banking
464+
465+ ### account_banking
466+ state = communication2 = False
467+ communication = line.ref or '/'
468+ if line.invoice:
469+ if line.invoice.type in ('in_invoice', 'in_refund'):
470+ if line.invoice.reference_type == 'structured':
471+ state = 'structured'
472+ communication = line.invoice.reference
473+ else:
474+ state = 'normal'
475+ communication2 = line.invoice.reference
476+ else:
477+ # Make sure that the communication includes the
478+ # customer invoice number (in the case of debit order)
479+ communication = line.invoice.number.replace('/', '')
480+ state = 'structured'
481+ if line.invoice.number != line.ref:
482+ communication2 = line.ref
483+ else:
484+ state = 'normal'
485+ communication2 = line.ref
486+
487+ # support debit orders when enabled
488+ if (payment.payment_order_type == 'debit' and
489+ 'amount_to_receive' in line):
490+ amount_currency = line.amount_to_receive
491+ else:
492+ amount_currency = line.amount_to_pay
493+ ### end account_banking
494+
495+ payment_obj.create(cr, uid, {
496+ 'move_line_id': line.id,
497+ 'amount_currency': amount_currency,
498+ 'bank_id': line2bank.get(line.id),
499+ 'order_id': payment.id,
500+ 'partner_id': line.partner_id and line.partner_id.id or False,
501+ ### account banking
502+ # 'communication': line.ref or '/'
503+ 'communication': communication,
504+ 'communication2': communication2,
505+ 'state': state,
506+ ### end account banking
507+ 'date': date_to_pay,
508+ 'currency': (line.invoice and line.invoice.currency_id.id
509+ or line.journal_id.currency.id
510+ or line.journal_id.company_id.currency_id.id),
511+ }, context=context)
512+ return {'type': 'ir.actions.act_window_close'}
513
514=== removed file 'account_banking_payment/model/payment_order_create.py'
515--- account_banking_payment/model/payment_order_create.py 2013-06-26 21:14:41 +0000
516+++ account_banking_payment/model/payment_order_create.py 1970-01-01 00:00:00 +0000
517@@ -1,199 +0,0 @@
518-# -*- coding: utf-8 -*-
519-##############################################################################
520-#
521-# Copyright (C) 2009 EduSense BV (<http://www.edusense.nl>).
522-# (C) 2011 - 2013 Therp BV (<http://therp.nl>).
523-#
524-# All other contributions are (C) by their respective contributors
525-#
526-# All Rights Reserved
527-#
528-# This program is free software: you can redistribute it and/or modify
529-# it under the terms of the GNU Affero General Public License as
530-# published by the Free Software Foundation, either version 3 of the
531-# License, or (at your option) any later version.
532-#
533-# This program is distributed in the hope that it will be useful,
534-# but WITHOUT ANY WARRANTY; without even the implied warranty of
535-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
536-# GNU Affero General Public License for more details.
537-#
538-# You should have received a copy of the GNU Affero General Public License
539-# along with this program. If not, see <http://www.gnu.org/licenses/>.
540-#
541-##############################################################################
542-
543-from datetime import datetime
544-from openerp.osv import orm, fields
545-from openerp.tools import DEFAULT_SERVER_DATE_FORMAT
546-from openerp.tools.translate import _
547-
548-
549-class payment_order_create(orm.TransientModel):
550- _inherit = 'payment.order.create'
551-
552- def extend_payment_order_domain(
553- self, cr, uid, payment_order, domain, context=None):
554- if payment_order.payment_order_type == 'payment':
555- domain += [
556- ('account_id.type', '=', 'payable'),
557- ('amount_to_pay', '>', 0)
558- ]
559- return True
560-
561- def search_entries(self, cr, uid, ids, context=None):
562- """
563- This method taken from account_payment module.
564- We adapt the domain based on the payment_order_type
565- """
566- line_obj = self.pool.get('account.move.line')
567- mod_obj = self.pool.get('ir.model.data')
568- if context is None:
569- context = {}
570- data = self.read(cr, uid, ids, ['duedate'], context=context)[0]
571- search_due_date = data['duedate']
572-
573- ### start account_banking_payment ###
574- payment = self.pool.get('payment.order').browse(
575- cr, uid, context['active_id'], context=context)
576- # Search for move line to pay:
577- domain = [
578- ('move_id.state', '=', 'posted'),
579- ('reconcile_id', '=', False),
580- ('company_id', '=', payment.mode.company_id.id),
581- ]
582- # apply payment term filter
583- if payment.mode.payment_term_ids:
584- domain += [
585- ('invoice.payment_term', 'in',
586- [term.id for term in payment.mode.payment_term_ids]
587- )
588- ]
589- self.extend_payment_order_domain(
590- cr, uid, payment, domain, context=context)
591- ### end account_direct_debit ###
592-
593- domain = domain + [
594- '|', ('date_maturity', '<=', search_due_date),
595- ('date_maturity', '=', False)
596- ]
597- line_ids = line_obj.search(cr, uid, domain, context=context)
598- context.update({'line_ids': line_ids})
599- model_data_ids = mod_obj.search(
600- cr, uid,[
601- ('model', '=', 'ir.ui.view'),
602- ('name', '=', 'view_create_payment_order_lines')],
603- context=context)
604- resource_id = mod_obj.read(
605- cr, uid, model_data_ids, fields=['res_id'],
606- context=context)[0]['res_id']
607- return {'name': _('Entry Lines'),
608- 'context': context,
609- 'view_type': 'form',
610- 'view_mode': 'form',
611- 'res_model': 'payment.order.create',
612- 'views': [(resource_id, 'form')],
613- 'type': 'ir.actions.act_window',
614- 'target': 'new',
615- }
616-
617- def create_payment(self, cr, uid, ids, context=None):
618- '''
619- This method is a slightly modified version of the existing method on this
620- model in account_payment.
621- - pass the payment mode to line2bank()
622- - allow invoices to create influence on the payment process: not only 'Free'
623- references are allowed, but others as well
624- - check date_to_pay is not in the past.
625- '''
626-
627- order_obj = self.pool.get('payment.order')
628- line_obj = self.pool.get('account.move.line')
629- payment_obj = self.pool.get('payment.line')
630- if context is None:
631- context = {}
632- data = self.read(cr, uid, ids, [], context=context)[0]
633- line_ids = data['entries']
634- if not line_ids:
635- return {'type': 'ir.actions.act_window_close'}
636-
637- payment = order_obj.browse(
638- cr, uid, context['active_id'], context=context)
639- ### account banking
640- # t = None
641- # line2bank = line_obj.line2bank(cr, uid, line_ids, t, context)
642- line2bank = line_obj.line2bank(
643- cr, uid, line_ids, payment.mode.id, context)
644- _today = fields.date.context_today(self, cr, uid, context=context)
645- ### end account banking
646-
647- ## Finally populate the current payment with new lines:
648- for line in line_obj.browse(cr, uid, line_ids, context=context):
649- if payment.date_prefered == "now":
650- #no payment date => immediate payment
651- date_to_pay = False
652- elif payment.date_prefered == 'due':
653- ### account_banking
654- # date_to_pay = line.date_maturity
655- date_to_pay = (
656- line.date_maturity
657- if line.date_maturity and line.date_maturity > _today
658- else False)
659- ### end account banking
660- elif payment.date_prefered == 'fixed':
661- ### account_banking
662- # date_to_pay = payment.date_scheduled
663- date_to_pay = (
664- payment.date_scheduled
665- if payment.date_scheduled and payment.date_scheduled > _today
666- else False)
667- ### end account banking
668-
669- ### account_banking
670- state = communication2 = False
671- communication = line.ref or '/'
672- if line.invoice:
673- if line.invoice.type in ('in_invoice', 'in_refund'):
674- if line.invoice.reference_type == 'structured':
675- state = 'structured'
676- communication = line.invoice.reference
677- else:
678- state = 'normal'
679- communication2 = line.invoice.reference
680- else:
681- # Make sure that the communication includes the
682- # customer invoice number (in the case of debit order)
683- communication = line.invoice.number.replace('/', '')
684- state = 'structured'
685- if line.invoice.number != line.ref:
686- communication2 = line.ref
687- else:
688- state = 'normal'
689- communication2 = line.ref
690-
691- # support debit orders when enabled
692- if (payment.payment_order_type == 'debit' and
693- 'amount_to_receive' in line):
694- amount_currency = line.amount_to_receive
695- else:
696- amount_currency = line.amount_to_pay
697- ### end account_banking
698-
699- payment_obj.create(cr, uid, {
700- 'move_line_id': line.id,
701- 'amount_currency': amount_currency,
702- 'bank_id': line2bank.get(line.id),
703- 'order_id': payment.id,
704- 'partner_id': line.partner_id and line.partner_id.id or False,
705- ### account banking
706- # 'communication': line.ref or '/'
707- 'communication': communication,
708- 'communication2': communication2,
709- 'state': state,
710- ### end account banking
711- 'date': date_to_pay,
712- 'currency': (line.invoice and line.invoice.currency_id.id
713- or line.journal_id.currency.id
714- or line.journal_id.company_id.currency_id.id),
715- }, context=context)
716- return {'type': 'ir.actions.act_window_close'}
717
718=== removed directory 'account_banking_payment/security'
719=== removed file 'account_banking_payment/security/ir.model.access.csv'
720--- account_banking_payment/security/ir.model.access.csv 2013-03-16 16:44:19 +0000
721+++ account_banking_payment/security/ir.model.access.csv 1970-01-01 00:00:00 +0000
722@@ -1,2 +0,0 @@
723-"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
724-"access_payment_mode_type","payment.mode.type","model_payment_mode_type","account_payment.group_account_payment",1,1,1,1
725
726=== modified file 'account_banking_payment/view/account_payment.xml'
727--- account_banking_payment/view/account_payment.xml 2013-06-04 10:18:31 +0000
728+++ account_banking_payment/view/account_payment.xml 2013-09-25 08:52:04 +0000
729@@ -17,10 +17,6 @@
730 'invisible':[('state','!=','draft')]
731 }</attribute>
732 </xpath>
733- <xpath expr="//button[@string='Make Payments']"
734- position="attributes">
735- <attribute name="name">launch_wizard</attribute>
736- </xpath>
737 <!-- Communication only used for 'structured' communication -->
738 <xpath expr="//field[@name='line_ids']/form//field[@name='communication']"
739 position="attributes">
740
741=== removed file 'account_banking_payment/view/bank_payment_manual.xml'
742--- account_banking_payment/view/bank_payment_manual.xml 2013-05-28 15:18:26 +0000
743+++ account_banking_payment/view/bank_payment_manual.xml 1970-01-01 00:00:00 +0000
744@@ -1,15 +0,0 @@
745-<?xml version="1.0" encoding="utf-8"?>
746-<openerp>
747- <data>
748- <record id="view_payment_manual_form" model="ir.ui.view">
749- <field name="name">Form for manual payment wizard</field>
750- <field name="model">payment.manual</field>
751- <field name="arch" type="xml">
752- <form string="Manual payment">
753- <label string="Payment order(s) have been set to 'sent'"/>
754- <button special="cancel" icon="gtk-ok" string="OK"/>
755- </form>
756- </field>
757- </record>
758- </data>
759-</openerp>
760
761=== modified file 'account_banking_payment/view/payment_mode.xml'
762--- account_banking_payment/view/payment_mode.xml 2013-05-29 12:35:04 +0000
763+++ account_banking_payment/view/payment_mode.xml 2013-09-25 08:52:04 +0000
764@@ -8,10 +8,9 @@
765 <record id="view_payment_mode_form_inherit" model="ir.ui.view">
766 <field name="name">payment.mode.form.inherit</field>
767 <field name="model">payment.mode</field>
768- <field name="inherit_id" ref="account_payment.view_payment_mode_form"/>
769+ <field name="inherit_id" ref="account_banking_payment_export.view_payment_mode_form_inherit"/>
770 <field name="arch" type="xml">
771- <field name="company_id" position="after">
772- <field name="type"/>
773+ <field name="type" position="after">
774 <group colspan="4" col="4">
775 <group colspan="2">
776 <separator colspan="2"
777
778=== added file 'account_banking_payment/view/payment_mode_type.xml'
779--- account_banking_payment/view/payment_mode_type.xml 1970-01-01 00:00:00 +0000
780+++ account_banking_payment/view/payment_mode_type.xml 2013-09-25 08:52:04 +0000
781@@ -0,0 +1,17 @@
782+<?xml version="1.0" encoding="utf-8"?>
783+<openerp>
784+ <data>
785+
786+ <record model="ir.ui.view" id="view_payment_mode_type_form_inherit">
787+ <field name="name">view.payment.mode.type.form</field>
788+ <field name="model">payment.mode.type</field>
789+ <field name="inherit_id" ref="account_banking_payment_export.view_payment_mode_type_form"/>
790+ <field name="arch" type="xml">
791+ <field name="suitable_bank_types" position="after">
792+ <field name="payment_order_type"/>
793+ </field>
794+ </field>
795+ </record>
796+
797+ </data>
798+</openerp>
799
800=== removed file 'account_banking_payment/view/payment_mode_type.xml'
801--- account_banking_payment/view/payment_mode_type.xml 2013-05-28 15:18:26 +0000
802+++ account_banking_payment/view/payment_mode_type.xml 1970-01-01 00:00:00 +0000
803@@ -1,32 +0,0 @@
804-<?xml version="1.0" encoding="utf-8"?>
805-<openerp>
806- <data>
807-
808- <record id="view_payment_mode_tree_inherit" model="ir.ui.view">
809- <field name="name">payment.mode.tree.inherit</field>
810- <field name="model">payment.mode</field>
811- <field name="inherit_id" ref="account_payment.view_payment_mode_tree"/>
812- <field name="arch" type="xml">
813- <field name="company_id" position="after">
814- <field name="type"/>
815- </field>
816- </field>
817- </record>
818-
819- <!-- basic view for payment mode type -->
820- <record model="ir.ui.view" id="view_payment_mode_type_form">
821- <field name="name">view.payment.mode.type.form</field>
822- <field name="model">payment.mode.type</field>
823- <field name="arch" type="xml">
824- <form string="Payment mode">
825- <field name="name" />
826- <field name="code" />
827- <field name="suitable_bank_types"/>
828- <field name="payment_order_type"/>
829- <field name="ir_model_id"/>
830- </form>
831- </field>
832- </record>
833-
834- </data>
835-</openerp>
836
837=== modified file 'account_banking_payment/workflow/account_payment.xml'
838--- account_banking_payment/workflow/account_payment.xml 2013-05-29 22:26:36 +0000
839+++ account_banking_payment/workflow/account_payment.xml 2013-09-25 08:52:04 +0000
840@@ -29,6 +29,12 @@
841 <field name="act_to" ref="account_banking.act_sent"/>
842 <field name="signal">sent</field>
843 </record>
844+ <!-- the done signal continues to work but goes to sent -->
845+ <record id="account_banking.trans_open_done" model="workflow.transition">
846+ <field name="act_from" ref="account_payment.act_open"/>
847+ <field name="act_to" ref="account_banking.act_sent"/>
848+ <field name="signal">done</field>
849+ </record>
850 <!-- From sent straight to sent_wait -->
851 <record id="account_banking.trans_sent_sent_wait" model="workflow.transition">
852 <field name="act_from" ref="account_banking.act_sent"/>
853
854=== added directory 'account_banking_payment_export'
855=== added file 'account_banking_payment_export/__init__.py'
856--- account_banking_payment_export/__init__.py 1970-01-01 00:00:00 +0000
857+++ account_banking_payment_export/__init__.py 2013-09-25 08:52:04 +0000
858@@ -0,0 +1,1 @@
859+from . import model
860\ No newline at end of file
861
862=== added file 'account_banking_payment_export/__openerp__.py'
863--- account_banking_payment_export/__openerp__.py 1970-01-01 00:00:00 +0000
864+++ account_banking_payment_export/__openerp__.py 2013-09-25 08:52:04 +0000
865@@ -0,0 +1,69 @@
866+# -*- coding: utf-8 -*-
867+##############################################################################
868+#
869+# Copyright (C) 2009 EduSense BV (<http://www.edusense.nl>).
870+# (C) 2011 - 2013 Therp BV (<http://therp.nl>).
871+#
872+# All other contributions are (C) by their respective contributors
873+#
874+# All Rights Reserved
875+#
876+# This program is free software: you can redistribute it and/or modify
877+# it under the terms of the GNU Affero General Public License as
878+# published by the Free Software Foundation, either version 3 of the
879+# License, or (at your option) any later version.
880+#
881+# This program is distributed in the hope that it will be useful,
882+# but WITHOUT ANY WARRANTY; without even the implied warranty of
883+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
884+# GNU Affero General Public License for more details.
885+#
886+# You should have received a copy of the GNU Affero General Public License
887+# along with this program. If not, see <http://www.gnu.org/licenses/>.
888+#
889+##############################################################################
890+
891+{
892+ 'name': 'Account Banking - Payments Export Infrastructure',
893+ 'version': '0.1.164',
894+ 'license': 'AGPL-3',
895+ 'author': 'Banking addons community',
896+ 'website': 'https://launchpad.net/banking-addons',
897+ 'category': 'Banking addons',
898+ 'depends': [
899+ 'account_payment',
900+ 'base_iban', # for manual_bank_tranfer
901+ ],
902+ 'conflicts': [
903+ # lp:account-payment/account_payment_extension also adds
904+ # a type field to payment.mode, with a very similar purpose.
905+ # We can't add a dependency on account_payment_extension here
906+ # because account_payment_extension adds many other features
907+ # that probably conflict with other parts of lp:banking-addons.
908+ # Proposal to resolve: make account_payment_extension depend
909+ # on the present account_banking_payment_export module.
910+ 'account_payment_extension',
911+ ],
912+ 'data': [
913+ 'view/account_payment.xml',
914+ 'view/bank_payment_manual.xml',
915+ 'view/payment_mode.xml',
916+ 'view/payment_mode_type.xml',
917+ 'data/payment_mode_type.xml',
918+ 'security/ir.model.access.csv',
919+ ],
920+ 'description': '''
921+ Infrastructure to export payment orders.
922+
923+ This technical module provides the base infrastructure to export
924+ payment orders for electronic banking. It provides the following
925+ technical features:
926+ * a new payment.mode.type model
927+ * payment.mode now has a mandatory type
928+ * a better implementation of payment_mode.suitable_bank_types() based on payment.mode.type
929+ * the "make payment" button launches a wizard depending on the payment.mode.type
930+ * a manual payment mode type is provided as an example, with a default "do nothing" wizard
931+ ''',
932+ 'auto_install': True,
933+ 'installable': True,
934+}
935
936=== added directory 'account_banking_payment_export/data'
937=== added file 'account_banking_payment_export/data/payment_mode_type.xml'
938--- account_banking_payment_export/data/payment_mode_type.xml 1970-01-01 00:00:00 +0000
939+++ account_banking_payment_export/data/payment_mode_type.xml 2013-09-25 08:52:04 +0000
940@@ -0,0 +1,14 @@
941+<?xml version="1.0" encoding="utf-8"?>
942+<openerp>
943+ <data>
944+ <!-- Add manual bank transfer as default payment option -->
945+ <record model="payment.mode.type" id="manual_bank_tranfer">
946+ <field name="name">Manual Bank Transfer</field>
947+ <field name="code">BANKMAN</field>
948+ <field name="suitable_bank_types"
949+ eval="[(6,0,[ref('base.bank_normal'),ref('base_iban.bank_iban'),])]" />
950+ <field name="ir_model_id"
951+ ref="model_payment_manual"/>
952+ </record>
953+ </data>
954+</openerp>
955
956=== added directory 'account_banking_payment_export/model'
957=== added file 'account_banking_payment_export/model/__init__.py'
958--- account_banking_payment_export/model/__init__.py 1970-01-01 00:00:00 +0000
959+++ account_banking_payment_export/model/__init__.py 2013-09-25 08:52:04 +0000
960@@ -0,0 +1,5 @@
961+from . import account_payment
962+from . import bank_payment_manual
963+from . import payment_mode
964+from . import payment_mode_type
965+from . import payment_order_create
966\ No newline at end of file
967
968=== added file 'account_banking_payment_export/model/account_payment.py'
969--- account_banking_payment_export/model/account_payment.py 1970-01-01 00:00:00 +0000
970+++ account_banking_payment_export/model/account_payment.py 2013-09-25 08:52:04 +0000
971@@ -0,0 +1,75 @@
972+# -*- coding: utf-8 -*-
973+##############################################################################
974+#
975+# Copyright (C) 2009 EduSense BV (<http://www.edusense.nl>).
976+# (C) 2011 - 2013 Therp BV (<http://therp.nl>).
977+#
978+# All other contributions are (C) by their respective contributors
979+#
980+# All Rights Reserved
981+#
982+# This program is free software: you can redistribute it and/or modify
983+# it under the terms of the GNU Affero General Public License as
984+# published by the Free Software Foundation, either version 3 of the
985+# License, or (at your option) any later version.
986+#
987+# This program is distributed in the hope that it will be useful,
988+# but WITHOUT ANY WARRANTY; without even the implied warranty of
989+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
990+# GNU Affero General Public License for more details.
991+#
992+# You should have received a copy of the GNU Affero General Public License
993+# along with this program. If not, see <http://www.gnu.org/licenses/>.
994+#
995+##############################################################################
996+
997+from openerp.osv import orm
998+from openerp.tools.translate import _
999+from openerp import netsvc
1000+
1001+
1002+class payment_order(orm.Model):
1003+ _inherit = 'payment.order'
1004+
1005+ def launch_wizard(self, cr, uid, ids, context=None):
1006+ """
1007+ Search for a wizard to launch according to the type.
1008+ If type is manual. just confirm the order.
1009+ Previously (pre-v6) in account_payment/wizard/wizard_pay.py
1010+ """
1011+ if context == None:
1012+ context = {}
1013+ result = {}
1014+ orders = self.browse(cr, uid, ids, context)
1015+ order = orders[0]
1016+ # check if a wizard is defined for the first order
1017+ if order.mode.type and order.mode.type.ir_model_id:
1018+ context['active_ids'] = ids
1019+ wizard_model = order.mode.type.ir_model_id.model
1020+ wizard_obj = self.pool.get(wizard_model)
1021+ wizard_id = wizard_obj.create(cr, uid, {}, context)
1022+ result = {
1023+ 'name': wizard_obj._description or _('Payment Order Export'),
1024+ 'view_type': 'form',
1025+ 'view_mode': 'form',
1026+ 'res_model': wizard_model,
1027+ 'domain': [],
1028+ 'context': context,
1029+ 'type': 'ir.actions.act_window',
1030+ 'target': 'new',
1031+ 'res_id': wizard_id,
1032+ 'nodestroy': True,
1033+ }
1034+ else:
1035+ # should all be manual orders without type or wizard model
1036+ for order in orders[1:]:
1037+ if order.mode.type and order.mode.type.ir_model_id:
1038+ raise orm.except_orm(
1039+ _('Error'),
1040+ _('You can only combine payment orders of the same type')
1041+ )
1042+ # process manual payments
1043+ wf_service = netsvc.LocalService('workflow')
1044+ for order_id in ids:
1045+ wf_service.trg_validate(uid, 'payment.order', order_id, 'done', cr)
1046+ return result
1047
1048=== added file 'account_banking_payment_export/model/bank_payment_manual.py'
1049--- account_banking_payment_export/model/bank_payment_manual.py 1970-01-01 00:00:00 +0000
1050+++ account_banking_payment_export/model/bank_payment_manual.py 2013-09-25 08:52:04 +0000
1051@@ -0,0 +1,59 @@
1052+# -*- coding: utf-8 -*-
1053+##############################################################################
1054+#
1055+# Copyright (C) 2009 EduSense BV (<http://www.edusense.nl>).
1056+# (C) 2011 - 2013 Therp BV (<http://therp.nl>).
1057+#
1058+# All other contributions are (C) by their respective contributors
1059+#
1060+# All Rights Reserved
1061+#
1062+# This program is free software: you can redistribute it and/or modify
1063+# it under the terms of the GNU Affero General Public License as
1064+# published by the Free Software Foundation, either version 3 of the
1065+# License, or (at your option) any later version.
1066+#
1067+# This program is distributed in the hope that it will be useful,
1068+# but WITHOUT ANY WARRANTY; without even the implied warranty of
1069+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1070+# GNU Affero General Public License for more details.
1071+#
1072+# You should have received a copy of the GNU Affero General Public License
1073+# along with this program. If not, see <http://www.gnu.org/licenses/>.
1074+#
1075+##############################################################################
1076+
1077+'''
1078+This module contains a single "wizard" for confirming manual
1079+bank transfers.
1080+'''
1081+
1082+from openerp.osv import orm, fields
1083+from openerp import netsvc
1084+
1085+
1086+class payment_manual(orm.TransientModel):
1087+ _name = 'payment.manual'
1088+ _description = 'Send payment order(s) manually'
1089+
1090+ _columns = {
1091+ 'payment_order_ids': fields.many2many('payment.order',
1092+ 'wiz_manual_payorders_rel', 'wizard_id', 'payment_order_id',
1093+ 'Payment orders', readonly=True),
1094+ }
1095+
1096+ def create(self, cr, uid, vals, context=None):
1097+ payment_order_ids = context.get('active_ids', [])
1098+ vals.update({
1099+ 'payment_order_ids': [[6, 0, payment_order_ids]],
1100+ })
1101+ return super(payment_manual, self).create(cr, uid,
1102+ vals, context=context)
1103+
1104+ def button_ok(self, cr, uid, ids, context=None):
1105+ wf_service = netsvc.LocalService('workflow')
1106+ for wiz in self.browse(cr, uid, ids, context=context):
1107+ for order_id in wiz.payment_order_ids:
1108+ wf_service.trg_validate(
1109+ uid, 'payment.order', order_id.id, 'done', cr)
1110+ return {'type': 'ir.actions.act_window_close'}
1111
1112=== added file 'account_banking_payment_export/model/payment_mode.py'
1113--- account_banking_payment_export/model/payment_mode.py 1970-01-01 00:00:00 +0000
1114+++ account_banking_payment_export/model/payment_mode.py 2013-09-25 08:52:04 +0000
1115@@ -0,0 +1,52 @@
1116+# -*- coding: utf-8 -*-
1117+##############################################################################
1118+#
1119+# Copyright (C) 2009 EduSense BV (<http://www.edusense.nl>).
1120+# (C) 2011 - 2013 Therp BV (<http://therp.nl>).
1121+#
1122+# All other contributions are (C) by their respective contributors
1123+#
1124+# All Rights Reserved
1125+#
1126+# This program is free software: you can redistribute it and/or modify
1127+# it under the terms of the GNU Affero General Public License as
1128+# published by the Free Software Foundation, either version 3 of the
1129+# License, or (at your option) any later version.
1130+#
1131+# This program is distributed in the hope that it will be useful,
1132+# but WITHOUT ANY WARRANTY; without even the implied warranty of
1133+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1134+# GNU Affero General Public License for more details.
1135+#
1136+# You should have received a copy of the GNU Affero General Public License
1137+# along with this program. If not, see <http://www.gnu.org/licenses/>.
1138+#
1139+##############################################################################
1140+
1141+from openerp.osv import orm, fields
1142+
1143+
1144+class payment_mode(orm.Model):
1145+ ''' Restoring the payment type from version 5,
1146+ used to select the export wizard (if any) '''
1147+ _inherit = "payment.mode"
1148+
1149+ def suitable_bank_types(self, cr, uid, payment_mode_id=None, context=None):
1150+ """ Reinstates functional code for suitable bank type filtering.
1151+ Current code in account_payment is disfunctional.
1152+ """
1153+ res = []
1154+ payment_mode = self.browse(
1155+ cr, uid, payment_mode_id, context)
1156+ if (payment_mode and payment_mode.type and
1157+ payment_mode.type.suitable_bank_types):
1158+ res = [t.code for t in payment_mode.type.suitable_bank_types]
1159+ return res
1160+
1161+ _columns = {
1162+ 'type': fields.many2one(
1163+ 'payment.mode.type', 'Payment type',
1164+ required=True,
1165+ help='Select the Payment Type for the Payment Mode.'
1166+ ),
1167+ }
1168
1169=== added file 'account_banking_payment_export/model/payment_mode_type.py'
1170--- account_banking_payment_export/model/payment_mode_type.py 1970-01-01 00:00:00 +0000
1171+++ account_banking_payment_export/model/payment_mode_type.py 2013-09-25 08:52:04 +0000
1172@@ -0,0 +1,61 @@
1173+# -*- coding: utf-8 -*-
1174+##############################################################################
1175+#
1176+# Copyright (C) 2009 EduSense BV (<http://www.edusense.nl>).
1177+# (C) 2011 - 2013 Therp BV (<http://therp.nl>).
1178+#
1179+# All other contributions are (C) by their respective contributors
1180+#
1181+# All Rights Reserved
1182+#
1183+# This program is free software: you can redistribute it and/or modify
1184+# it under the terms of the GNU Affero General Public License as
1185+# published by the Free Software Foundation, either version 3 of the
1186+# License, or (at your option) any later version.
1187+#
1188+# This program is distributed in the hope that it will be useful,
1189+# but WITHOUT ANY WARRANTY; without even the implied warranty of
1190+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1191+# GNU Affero General Public License for more details.
1192+#
1193+# You should have received a copy of the GNU Affero General Public License
1194+# along with this program. If not, see <http://www.gnu.org/licenses/>.
1195+#
1196+##############################################################################
1197+
1198+from openerp.osv import orm, fields
1199+
1200+
1201+class payment_mode_type(orm.Model):
1202+ _name = 'payment.mode.type'
1203+ _description = 'Payment Mode Type'
1204+ _columns = {
1205+ 'name': fields.char(
1206+ 'Name', size=64, required=True,
1207+ help='Payment Type'
1208+ ),
1209+ 'code': fields.char(
1210+ 'Code', size=64, required=True,
1211+ help='Specify the Code for Payment Type'
1212+ ),
1213+ 'suitable_bank_types': fields.many2many(
1214+ 'res.partner.bank.type',
1215+ 'bank_type_payment_type_rel',
1216+ 'pay_type_id','bank_type_id',
1217+ 'Suitable bank types', required=True),
1218+ 'ir_model_id': fields.many2one(
1219+ 'ir.model', 'Payment wizard',
1220+ help=('Select the Payment Wizard for payments of this type. '
1221+ 'Leave empty for manual processing'),
1222+ domain=[('osv_memory', '=', True)],
1223+ ),
1224+ }
1225+
1226+ def _auto_init(self, cr, context=None):
1227+ r = super(payment_mode_type, self)._auto_init(cr, context=context)
1228+ # migrate xmlid from manual_bank_transfer to avoid dependency on account_banking
1229+ cr.execute("""UPDATE ir_model_data SET module='account_banking_payment_export'
1230+ WHERE module='account_banking' AND
1231+ name='manual_bank_tranfer' AND
1232+ model='payment.mode.type'""")
1233+ return r
1234
1235=== added file 'account_banking_payment_export/model/payment_order_create.py'
1236--- account_banking_payment_export/model/payment_order_create.py 1970-01-01 00:00:00 +0000
1237+++ account_banking_payment_export/model/payment_order_create.py 2013-09-25 08:52:04 +0000
1238@@ -0,0 +1,58 @@
1239+# -*- coding: utf-8 -*-
1240+##############################################################################
1241+#
1242+# Copyright (C) 2013 ACSONE SA/NV (<http://acsone.eu>);.
1243+#
1244+# All other contributions are (C) by their respective contributors
1245+#
1246+# All Rights Reserved
1247+#
1248+# This program is free software: you can redistribute it and/or modify
1249+# it under the terms of the GNU Affero General Public License as
1250+# published by the Free Software Foundation, either version 3 of the
1251+# License, or (at your option) any later version.
1252+#
1253+# This program is distributed in the hope that it will be useful,
1254+# but WITHOUT ANY WARRANTY; without even the implied warranty of
1255+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1256+# GNU Affero General Public License for more details.
1257+#
1258+# You should have received a copy of the GNU Affero General Public License
1259+# along with this program. If not, see <http://www.gnu.org/licenses/>.
1260+#
1261+##############################################################################
1262+
1263+from openerp.osv import orm
1264+
1265+
1266+class payment_order_create(orm.TransientModel):
1267+ _inherit = 'payment.order.create'
1268+
1269+ def create_payment(self, cr, uid, ids, context=None):
1270+ '''This method adapts the core create_payment()
1271+ to pass the payment mode to line2bank() through the context,
1272+ so it is in turn propagated to suitable_bank_types().
1273+
1274+ This is necessary because the core does not propagate the payment mode to line2bank: t = None in
1275+ http://bazaar.launchpad.net/~openerp/openobject-addons/7.0/view/head:/account_payment/wizard/account_payment_order.py#L72
1276+
1277+ Hack idea courtesy Stefan Rijnhart.
1278+ '''
1279+ if context is None:
1280+ context = {}
1281+ order_obj = self.pool.get('payment.order')
1282+ payment = order_obj.browse(cr, uid, context['active_id'], context=context)
1283+ context['_fix_payment_mode_id'] = payment.mode.id
1284+ return super(payment_order_create, self).create_payment(cr, uid, ids, context=context)
1285+
1286+
1287+class account_move_line(orm.Model):
1288+ _inherit = 'account.move.line'
1289+
1290+ def line2bank(self, cr, uid, ids, payment_mode_id=None, context=None):
1291+ '''Obtain payment_type from context, see create_payment above'''
1292+ if context is None:
1293+ context = {}
1294+ payment_mode_id = payment_mode_id or context.get('_fix_payment_mode_id')
1295+ return super(account_move_line, self).line2bank(cr, uid, ids, payment_mode_id, context=context)
1296+
1297
1298=== added directory 'account_banking_payment_export/security'
1299=== added file 'account_banking_payment_export/security/ir.model.access.csv'
1300--- account_banking_payment_export/security/ir.model.access.csv 1970-01-01 00:00:00 +0000
1301+++ account_banking_payment_export/security/ir.model.access.csv 2013-09-25 08:52:04 +0000
1302@@ -0,0 +1,2 @@
1303+"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
1304+"access_payment_mode_type","payment.mode.type","model_payment_mode_type","account_payment.group_account_payment",1,1,1,1
1305
1306=== added directory 'account_banking_payment_export/view'
1307=== added file 'account_banking_payment_export/view/account_payment.xml'
1308--- account_banking_payment_export/view/account_payment.xml 1970-01-01 00:00:00 +0000
1309+++ account_banking_payment_export/view/account_payment.xml 2013-09-25 08:52:04 +0000
1310@@ -0,0 +1,22 @@
1311+<?xml version="1.0" encoding="utf-8"?>
1312+<openerp>
1313+ <data>
1314+ <!-- restore wizard functionality when making payments
1315+ -->
1316+
1317+ <record id="view_banking_payment_order_form_1" model="ir.ui.view">
1318+ <field name="name">account.payment.order.form.banking-1</field>
1319+ <field name="inherit_id" ref="account_payment.view_payment_order_form" />
1320+ <field name="model">payment.order</field>
1321+ <field name="arch" type="xml">
1322+ <data>
1323+ <xpath expr="//button[@string='Make Payments']"
1324+ position="attributes">
1325+ <attribute name="name">launch_wizard</attribute>
1326+ </xpath>
1327+ </data>
1328+ </field>
1329+ </record>
1330+
1331+ </data>
1332+</openerp>
1333
1334=== added file 'account_banking_payment_export/view/bank_payment_manual.xml'
1335--- account_banking_payment_export/view/bank_payment_manual.xml 1970-01-01 00:00:00 +0000
1336+++ account_banking_payment_export/view/bank_payment_manual.xml 2013-09-25 08:52:04 +0000
1337@@ -0,0 +1,18 @@
1338+<?xml version="1.0" encoding="utf-8"?>
1339+<openerp>
1340+ <data>
1341+ <record id="view_payment_manual_form" model="ir.ui.view">
1342+ <field name="name">Form for manual payment wizard</field>
1343+ <field name="model">payment.manual</field>
1344+ <field name="arch" type="xml">
1345+ <form string="Manual payment" version="7.0">
1346+ <label string="Please execute payment order manually, and click OK when succesfully sent."/>
1347+ <footer>
1348+ <button name="button_ok" type="object" string="OK" class="oe_highlight"/>
1349+ <button special="cancel" string="Cancel" class="oe_link"/>
1350+ </footer>
1351+ </form>
1352+ </field>
1353+ </record>
1354+ </data>
1355+</openerp>
1356
1357=== added file 'account_banking_payment_export/view/payment_mode.xml'
1358--- account_banking_payment_export/view/payment_mode.xml 1970-01-01 00:00:00 +0000
1359+++ account_banking_payment_export/view/payment_mode.xml 2013-09-25 08:52:04 +0000
1360@@ -0,0 +1,20 @@
1361+<?xml version="1.0" encoding="utf-8"?>
1362+<openerp>
1363+ <data>
1364+
1365+ <!--
1366+ Add the payment mode type and transfer settings
1367+ -->
1368+ <record id="view_payment_mode_form_inherit" model="ir.ui.view">
1369+ <field name="name">payment.mode.form.inherit</field>
1370+ <field name="model">payment.mode</field>
1371+ <field name="inherit_id" ref="account_payment.view_payment_mode_form"/>
1372+ <field name="arch" type="xml">
1373+ <field name="company_id" position="after">
1374+ <field name="type"/>
1375+ </field>
1376+ </field>
1377+ </record>
1378+
1379+ </data>
1380+</openerp>
1381
1382=== added file 'account_banking_payment_export/view/payment_mode_type.xml'
1383--- account_banking_payment_export/view/payment_mode_type.xml 1970-01-01 00:00:00 +0000
1384+++ account_banking_payment_export/view/payment_mode_type.xml 2013-09-25 08:52:04 +0000
1385@@ -0,0 +1,31 @@
1386+<?xml version="1.0" encoding="utf-8"?>
1387+<openerp>
1388+ <data>
1389+
1390+ <record id="view_payment_mode_tree_inherit" model="ir.ui.view">
1391+ <field name="name">payment.mode.tree.inherit</field>
1392+ <field name="model">payment.mode</field>
1393+ <field name="inherit_id" ref="account_payment.view_payment_mode_tree"/>
1394+ <field name="arch" type="xml">
1395+ <field name="company_id" position="after">
1396+ <field name="type"/>
1397+ </field>
1398+ </field>
1399+ </record>
1400+
1401+ <!-- basic view for payment mode type -->
1402+ <record model="ir.ui.view" id="view_payment_mode_type_form">
1403+ <field name="name">view.payment.mode.type.form</field>
1404+ <field name="model">payment.mode.type</field>
1405+ <field name="arch" type="xml">
1406+ <form string="Payment mode">
1407+ <field name="name" />
1408+ <field name="code" />
1409+ <field name="suitable_bank_types"/>
1410+ <field name="ir_model_id"/>
1411+ </form>
1412+ </field>
1413+ </record>
1414+
1415+ </data>
1416+</openerp>
1417
1418=== modified file 'account_banking_sepa_credit_transfer/__openerp__.py'
1419--- account_banking_sepa_credit_transfer/__openerp__.py 2013-08-02 22:39:11 +0000
1420+++ account_banking_sepa_credit_transfer/__openerp__.py 2013-09-25 08:52:04 +0000
1421@@ -26,7 +26,7 @@
1422 'author': 'Akretion',
1423 'website': 'http://www.akretion.com',
1424 'category': 'Banking addons',
1425- 'depends': ['account_banking_payment'],
1426+ 'depends': ['account_banking_payment_export'],
1427 'data': [
1428 'account_banking_sepa_view.xml',
1429 'wizard/export_sepa_view.xml',
1430
1431=== modified file 'account_banking_sepa_credit_transfer/account_banking_sepa.py'
1432--- account_banking_sepa_credit_transfer/account_banking_sepa.py 2013-06-28 20:34:58 +0000
1433+++ account_banking_sepa_credit_transfer/account_banking_sepa.py 2013-09-25 08:52:04 +0000
1434@@ -20,8 +20,6 @@
1435 ##############################################################################
1436
1437 from openerp.osv import orm, fields
1438-import time
1439-from openerp.tools.translate import _
1440 from openerp.addons.decimal_precision import decimal_precision as dp
1441
1442
1443
1444=== modified file 'account_banking_sepa_credit_transfer/account_banking_sepa_view.xml'
1445--- account_banking_sepa_credit_transfer/account_banking_sepa_view.xml 2013-08-02 22:39:11 +0000
1446+++ account_banking_sepa_credit_transfer/account_banking_sepa_view.xml 2013-09-25 08:52:04 +0000
1447@@ -65,7 +65,7 @@
1448
1449
1450 <menuitem id="menu_account_banking_sepa"
1451- parent="account_banking.menu_finance_banking_actions"
1452+ parent="account_payment.menu_main_payment"
1453 action="action_account_banking_sepa"
1454 sequence="15"
1455 />
1456
1457=== modified file 'account_banking_sepa_credit_transfer/wizard/export_sepa.py'
1458--- account_banking_sepa_credit_transfer/wizard/export_sepa.py 2013-09-19 11:50:30 +0000
1459+++ account_banking_sepa_credit_transfer/wizard/export_sepa.py 2013-09-25 08:52:04 +0000
1460@@ -101,8 +101,6 @@
1461 '''
1462 Creates the SEPA Credit Transfer file. That's the important code !
1463 '''
1464- payment_order_obj = self.pool.get('payment.order')
1465-
1466 sepa_export = self.browse(cr, uid, ids[0], context=context)
1467
1468 my_company_name = sepa_export.payment_order_ids[0].mode.bank_id.partner_id.name
1469@@ -330,12 +328,15 @@
1470
1471 def save_sepa(self, cr, uid, ids, context=None):
1472 '''
1473- Save the SEPA PAIN: mark all payments in the file as 'sent'.
1474+ Save the SEPA PAIN: send the done signal to all payment orders in the file.
1475+ With the default workflow, they will transition to 'done', while with the
1476+ advanced workflow in account_banking_payment they will transition to 'sent'
1477+ waiting reconciliation.
1478 '''
1479 sepa_export = self.browse(cr, uid, ids[0], context=context)
1480- sepa_file = self.pool.get('banking.export.sepa').write(cr, uid,
1481+ self.pool.get('banking.export.sepa').write(cr, uid,
1482 sepa_export.file_id.id, {'state': 'sent'}, context=context)
1483 wf_service = netsvc.LocalService('workflow')
1484 for order in sepa_export.payment_order_ids:
1485- wf_service.trg_validate(uid, 'payment.order', order.id, 'sent', cr)
1486+ wf_service.trg_validate(uid, 'payment.order', order.id, 'done', cr)
1487 return {'type': 'ir.actions.act_window_close'}

Subscribers

People subscribed via source and target branches

to status/vote changes: