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
=== modified file 'account_banking_payment/__openerp__.py'
--- account_banking_payment/__openerp__.py 2013-05-28 15:18:26 +0000
+++ account_banking_payment/__openerp__.py 2013-09-25 08:52:04 +0000
@@ -32,17 +32,14 @@
32 'category': 'Banking addons',32 'category': 'Banking addons',
33 'depends': [33 'depends': [
34 'account_banking',34 'account_banking',
35 'account_payment',35 'account_banking_payment_export',
36 ],36 ],
37 'data': [37 'data': [
38 'view/account_payment.xml',38 'view/account_payment.xml',
39 'view/banking_transaction_wizard.xml',39 'view/banking_transaction_wizard.xml',
40 'view/payment_mode.xml',40 'view/payment_mode.xml',
41 'view/payment_mode_type.xml',41 'view/payment_mode_type.xml',
42 'view/bank_payment_manual.xml',
43 'data/payment_mode_type.xml',
44 'workflow/account_payment.xml',42 'workflow/account_payment.xml',
45 'security/ir.model.access.csv',
46 ],43 ],
47 'description': '''44 'description': '''
48 This addon adds payment infrastructure to the Banking Addons.45 This addon adds payment infrastructure to the Banking Addons.
4946
=== removed directory 'account_banking_payment/data'
=== removed file 'account_banking_payment/data/payment_mode_type.xml'
--- account_banking_payment/data/payment_mode_type.xml 2013-03-17 12:53:37 +0000
+++ account_banking_payment/data/payment_mode_type.xml 1970-01-01 00:00:00 +0000
@@ -1,14 +0,0 @@
1<?xml version="1.0" encoding="utf-8"?>
2<openerp>
3 <data>
4 <!-- Add manual bank transfer as default payment option -->
5 <record model="payment.mode.type" id="account_banking.manual_bank_tranfer">
6 <field name="name">Manual Bank Transfer</field>
7 <field name="code">BANKMAN</field>
8 <field name="suitable_bank_types"
9 eval="[(6,0,[ref('base.bank_normal'),ref('base_iban.bank_iban'),])]" />
10 <field name="ir_model_id"
11 ref="account_banking_payment.model_payment_manual"/>
12 </record>
13 </data>
14</openerp>
150
=== modified file 'account_banking_payment/model/__init__.py'
--- account_banking_payment/model/__init__.py 2013-05-30 10:03:41 +0000
+++ account_banking_payment/model/__init__.py 2013-09-25 08:52:04 +0000
@@ -5,5 +5,4 @@
5import payment_order_create5import payment_order_create
6import banking_import_transaction6import banking_import_transaction
7import banking_transaction_wizard7import banking_transaction_wizard
8import bank_payment_manual
9import banking_import_line8import banking_import_line
109
=== modified file 'account_banking_payment/model/account_payment.py'
--- account_banking_payment/model/account_payment.py 2013-09-23 13:57:32 +0000
+++ account_banking_payment/model/account_payment.py 2013-09-25 08:52:04 +0000
@@ -115,49 +115,6 @@
115 'payment_order_type': 'payment',115 'payment_order_type': 'payment',
116 }116 }
117117
118 def launch_wizard(self, cr, uid, ids, context=None):
119 """
120 Search for a wizard to launch according to the type.
121 If type is manual. just confirm the order.
122 Previously (pre-v6) in account_payment/wizard/wizard_pay.py
123 """
124 if context == None:
125 context = {}
126 result = {}
127 orders = self.browse(cr, uid, ids, context)
128 order = orders[0]
129 # check if a wizard is defined for the first order
130 if order.mode.type and order.mode.type.ir_model_id:
131 context['active_ids'] = ids
132 wizard_model = order.mode.type.ir_model_id.model
133 wizard_obj = self.pool.get(wizard_model)
134 wizard_id = wizard_obj.create(cr, uid, {}, context)
135 result = {
136 'name': wizard_obj._description or _('Payment Order Export'),
137 'view_type': 'form',
138 'view_mode': 'form',
139 'res_model': wizard_model,
140 'domain': [],
141 'context': context,
142 'type': 'ir.actions.act_window',
143 'target': 'new',
144 'res_id': wizard_id,
145 'nodestroy': True,
146 }
147 else:
148 # should all be manual orders without type or wizard model
149 for order in orders[1:]:
150 if order.mode.type and order.mode.type.ir_model_id:
151 raise orm.except_orm(
152 _('Error'),
153 _('You can only combine payment orders of the same type')
154 )
155 # process manual payments
156 wf_service = netsvc.LocalService('workflow')
157 for order_id in ids:
158 wf_service.trg_validate(uid, 'payment.order', order_id, 'sent', cr)
159 return result
160
161 def _write_payment_lines(self, cr, uid, ids, **kwargs):118 def _write_payment_lines(self, cr, uid, ids, **kwargs):
162 '''119 '''
163 ORM method for setting attributes of corresponding payment.line objects.120 ORM method for setting attributes of corresponding payment.line objects.
164121
=== removed file 'account_banking_payment/model/bank_payment_manual.py'
--- account_banking_payment/model/bank_payment_manual.py 2013-03-17 20:03:32 +0000
+++ account_banking_payment/model/bank_payment_manual.py 1970-01-01 00:00:00 +0000
@@ -1,53 +0,0 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# Copyright (C) 2009 EduSense BV (<http://www.edusense.nl>).
5# (C) 2011 - 2013 Therp BV (<http://therp.nl>).
6#
7# All other contributions are (C) by their respective contributors
8#
9# All Rights Reserved
10#
11# This program is free software: you can redistribute it and/or modify
12# it under the terms of the GNU Affero General Public License as
13# published by the Free Software Foundation, either version 3 of the
14# License, or (at your option) any later version.
15#
16# This program is distributed in the hope that it will be useful,
17# but WITHOUT ANY WARRANTY; without even the implied warranty of
18# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19# GNU Affero General Public License for more details.
20#
21# You should have received a copy of the GNU Affero General Public License
22# along with this program. If not, see <http://www.gnu.org/licenses/>.
23#
24##############################################################################
25
26'''
27This module contains a single "wizard" for including a 'sent' state for manual
28bank transfers.
29'''
30
31from openerp.osv import orm, fields
32from openerp import netsvc
33
34
35class payment_manual(orm.TransientModel):
36 _name = 'payment.manual'
37 _description = 'Set payment orders to \'sent\' manually'
38
39 def default_get(self, cr, uid, fields_list, context=None):
40 if context and context.get('active_ids'):
41 payment_order_obj = self.pool.get('payment.order')
42 wf_service = netsvc.LocalService('workflow')
43 for order_id in context['active_ids']:
44 wf_service.trg_validate(
45 uid, 'payment.order', order_id, 'sent', cr)
46 return super(payment_manual, self).default_get(
47 cr, uid, fields_list, context=None)
48
49 _columns = {
50 # dummy field, to trigger a call to default_get
51 'name': fields.char('Name', size=1),
52 }
53
540
=== modified file 'account_banking_payment/model/payment_mode.py'
--- account_banking_payment/model/payment_mode.py 2013-05-29 12:35:04 +0000
+++ account_banking_payment/model/payment_mode.py 2013-09-25 08:52:04 +0000
@@ -27,28 +27,9 @@
2727
2828
29class payment_mode(orm.Model):29class payment_mode(orm.Model):
30 ''' Restoring the payment type from version 5,
31 used to select the export wizard (if any) '''
32 _inherit = "payment.mode"30 _inherit = "payment.mode"
3331
34 def suitable_bank_types(self, cr, uid, payment_mode_id=None, context=None):
35 """ Reinstates functional code for suitable bank type filtering.
36 Current code in account_payment is disfunctional.
37 """
38 res = []
39 payment_mode = self.browse(
40 cr, uid, payment_mode_id, context)
41 if (payment_mode and payment_mode.type and
42 payment_mode.type.suitable_bank_types):
43 res = [type.code for type in payment_mode.type.suitable_bank_types]
44 return res
45
46 _columns = {32 _columns = {
47 'type': fields.many2one(
48 'payment.mode.type', 'Payment type',
49 required=True,
50 help='Select the Payment Type for the Payment Mode.'
51 ),
52 'transfer_account_id': fields.many2one(33 'transfer_account_id': fields.many2one(
53 'account.account', 'Transfer account',34 'account.account', 'Transfer account',
54 domain=[('type', '=', 'other'),35 domain=[('type', '=', 'other'),
5536
=== added file 'account_banking_payment/model/payment_mode_type.py'
--- account_banking_payment/model/payment_mode_type.py 1970-01-01 00:00:00 +0000
+++ account_banking_payment/model/payment_mode_type.py 2013-09-25 08:52:04 +0000
@@ -0,0 +1,41 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# Copyright (C) 2009 EduSense BV (<http://www.edusense.nl>).
5# (C) 2011 - 2013 Therp BV (<http://therp.nl>).
6#
7# All other contributions are (C) by their respective contributors
8#
9# All Rights Reserved
10#
11# This program is free software: you can redistribute it and/or modify
12# it under the terms of the GNU Affero General Public License as
13# published by the Free Software Foundation, either version 3 of the
14# License, or (at your option) any later version.
15#
16# This program is distributed in the hope that it will be useful,
17# but WITHOUT ANY WARRANTY; without even the implied warranty of
18# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19# GNU Affero General Public License for more details.
20#
21# You should have received a copy of the GNU Affero General Public License
22# along with this program. If not, see <http://www.gnu.org/licenses/>.
23#
24##############################################################################
25
26from openerp.osv import orm, fields
27
28
29class payment_mode_type(orm.Model):
30 _inherit = 'payment.mode.type'
31
32 _columns = {
33 'payment_order_type': fields.selection(
34 [('payment', 'Payment'),('debit', 'Direct debit')],
35 'Payment order type', required=True,
36 ),
37 }
38
39 _defaults = {
40 'payment_order_type': 'payment',
41 }
042
=== removed file 'account_banking_payment/model/payment_mode_type.py'
--- account_banking_payment/model/payment_mode_type.py 2013-03-17 09:10:15 +0000
+++ account_banking_payment/model/payment_mode_type.py 1970-01-01 00:00:00 +0000
@@ -1,62 +0,0 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# Copyright (C) 2009 EduSense BV (<http://www.edusense.nl>).
5# (C) 2011 - 2013 Therp BV (<http://therp.nl>).
6#
7# All other contributions are (C) by their respective contributors
8#
9# All Rights Reserved
10#
11# This program is free software: you can redistribute it and/or modify
12# it under the terms of the GNU Affero General Public License as
13# published by the Free Software Foundation, either version 3 of the
14# License, or (at your option) any later version.
15#
16# This program is distributed in the hope that it will be useful,
17# but WITHOUT ANY WARRANTY; without even the implied warranty of
18# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19# GNU Affero General Public License for more details.
20#
21# You should have received a copy of the GNU Affero General Public License
22# along with this program. If not, see <http://www.gnu.org/licenses/>.
23#
24##############################################################################
25
26from openerp.osv import orm, fields
27
28
29class payment_mode_type(orm.Model):
30 _name = 'payment.mode.type'
31 _description = 'Payment Mode Type'
32 _columns = {
33 'name': fields.char(
34 'Name', size=64, required=True,
35 help='Payment Type'
36 ),
37 'code': fields.char(
38 'Code', size=64, required=True,
39 help='Specify the Code for Payment Type'
40 ),
41 # Setting suitable_bank_types to required pending
42 # https://bugs.launchpad.net/openobject-addons/+bug/786845
43 'suitable_bank_types': fields.many2many(
44 'res.partner.bank.type',
45 'bank_type_payment_type_rel',
46 'pay_type_id','bank_type_id',
47 'Suitable bank types', required=True),
48 'ir_model_id': fields.many2one(
49 'ir.model', 'Payment wizard',
50 help=('Select the Payment Wizard for payments of this type. '
51 'Leave empty for manual processing'),
52 domain=[('osv_memory', '=', True)],
53 ),
54 'payment_order_type': fields.selection(
55 [('payment', 'Payment'),('debit', 'Direct debit')],
56 'Payment order type', required=True,
57 ),
58 }
59
60 _defaults = {
61 'payment_order_type': 'payment',
62 }
630
=== added file 'account_banking_payment/model/payment_order_create.py'
--- account_banking_payment/model/payment_order_create.py 1970-01-01 00:00:00 +0000
+++ account_banking_payment/model/payment_order_create.py 2013-09-25 08:52:04 +0000
@@ -0,0 +1,197 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# Copyright (C) 2009 EduSense BV (<http://www.edusense.nl>).
5# (C) 2011 - 2013 Therp BV (<http://therp.nl>).
6#
7# All other contributions are (C) by their respective contributors
8#
9# All Rights Reserved
10#
11# This program is free software: you can redistribute it and/or modify
12# it under the terms of the GNU Affero General Public License as
13# published by the Free Software Foundation, either version 3 of the
14# License, or (at your option) any later version.
15#
16# This program is distributed in the hope that it will be useful,
17# but WITHOUT ANY WARRANTY; without even the implied warranty of
18# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19# GNU Affero General Public License for more details.
20#
21# You should have received a copy of the GNU Affero General Public License
22# along with this program. If not, see <http://www.gnu.org/licenses/>.
23#
24##############################################################################
25
26from openerp.osv import orm, fields
27from openerp.tools.translate import _
28
29
30class payment_order_create(orm.TransientModel):
31 _inherit = 'payment.order.create'
32
33 def extend_payment_order_domain(
34 self, cr, uid, payment_order, domain, context=None):
35 if payment_order.payment_order_type == 'payment':
36 domain += [
37 ('account_id.type', '=', 'payable'),
38 ('amount_to_pay', '>', 0)
39 ]
40 return True
41
42 def search_entries(self, cr, uid, ids, context=None):
43 """
44 This method taken from account_payment module.
45 We adapt the domain based on the payment_order_type
46 """
47 line_obj = self.pool.get('account.move.line')
48 mod_obj = self.pool.get('ir.model.data')
49 if context is None:
50 context = {}
51 data = self.read(cr, uid, ids, ['duedate'], context=context)[0]
52 search_due_date = data['duedate']
53
54 ### start account_banking_payment ###
55 payment = self.pool.get('payment.order').browse(
56 cr, uid, context['active_id'], context=context)
57 # Search for move line to pay:
58 domain = [
59 ('move_id.state', '=', 'posted'),
60 ('reconcile_id', '=', False),
61 ('company_id', '=', payment.mode.company_id.id),
62 ]
63 # apply payment term filter
64 if payment.mode.payment_term_ids:
65 domain += [
66 ('invoice.payment_term', 'in',
67 [term.id for term in payment.mode.payment_term_ids]
68 )
69 ]
70 self.extend_payment_order_domain(
71 cr, uid, payment, domain, context=context)
72 ### end account_direct_debit ###
73
74 domain = domain + [
75 '|', ('date_maturity', '<=', search_due_date),
76 ('date_maturity', '=', False)
77 ]
78 line_ids = line_obj.search(cr, uid, domain, context=context)
79 context.update({'line_ids': line_ids})
80 model_data_ids = mod_obj.search(
81 cr, uid,[
82 ('model', '=', 'ir.ui.view'),
83 ('name', '=', 'view_create_payment_order_lines')],
84 context=context)
85 resource_id = mod_obj.read(
86 cr, uid, model_data_ids, fields=['res_id'],
87 context=context)[0]['res_id']
88 return {'name': _('Entry Lines'),
89 'context': context,
90 'view_type': 'form',
91 'view_mode': 'form',
92 'res_model': 'payment.order.create',
93 'views': [(resource_id, 'form')],
94 'type': 'ir.actions.act_window',
95 'target': 'new',
96 }
97
98 def create_payment(self, cr, uid, ids, context=None):
99 '''
100 This method is a slightly modified version of the existing method on this
101 model in account_payment.
102 - pass the payment mode to line2bank()
103 - allow invoices to create influence on the payment process: not only 'Free'
104 references are allowed, but others as well
105 - check date_to_pay is not in the past.
106 '''
107
108 order_obj = self.pool.get('payment.order')
109 line_obj = self.pool.get('account.move.line')
110 payment_obj = self.pool.get('payment.line')
111 if context is None:
112 context = {}
113 data = self.read(cr, uid, ids, [], context=context)[0]
114 line_ids = data['entries']
115 if not line_ids:
116 return {'type': 'ir.actions.act_window_close'}
117
118 payment = order_obj.browse(
119 cr, uid, context['active_id'], context=context)
120 ### account banking
121 # t = None
122 # line2bank = line_obj.line2bank(cr, uid, line_ids, t, context)
123 line2bank = line_obj.line2bank(
124 cr, uid, line_ids, payment.mode.id, context)
125 _today = fields.date.context_today(self, cr, uid, context=context)
126 ### end account banking
127
128 ## Finally populate the current payment with new lines:
129 for line in line_obj.browse(cr, uid, line_ids, context=context):
130 if payment.date_prefered == "now":
131 #no payment date => immediate payment
132 date_to_pay = False
133 elif payment.date_prefered == 'due':
134 ### account_banking
135 # date_to_pay = line.date_maturity
136 date_to_pay = (
137 line.date_maturity
138 if line.date_maturity and line.date_maturity > _today
139 else False)
140 ### end account banking
141 elif payment.date_prefered == 'fixed':
142 ### account_banking
143 # date_to_pay = payment.date_scheduled
144 date_to_pay = (
145 payment.date_scheduled
146 if payment.date_scheduled and payment.date_scheduled > _today
147 else False)
148 ### end account banking
149
150 ### account_banking
151 state = communication2 = False
152 communication = line.ref or '/'
153 if line.invoice:
154 if line.invoice.type in ('in_invoice', 'in_refund'):
155 if line.invoice.reference_type == 'structured':
156 state = 'structured'
157 communication = line.invoice.reference
158 else:
159 state = 'normal'
160 communication2 = line.invoice.reference
161 else:
162 # Make sure that the communication includes the
163 # customer invoice number (in the case of debit order)
164 communication = line.invoice.number.replace('/', '')
165 state = 'structured'
166 if line.invoice.number != line.ref:
167 communication2 = line.ref
168 else:
169 state = 'normal'
170 communication2 = line.ref
171
172 # support debit orders when enabled
173 if (payment.payment_order_type == 'debit' and
174 'amount_to_receive' in line):
175 amount_currency = line.amount_to_receive
176 else:
177 amount_currency = line.amount_to_pay
178 ### end account_banking
179
180 payment_obj.create(cr, uid, {
181 'move_line_id': line.id,
182 'amount_currency': amount_currency,
183 'bank_id': line2bank.get(line.id),
184 'order_id': payment.id,
185 'partner_id': line.partner_id and line.partner_id.id or False,
186 ### account banking
187 # 'communication': line.ref or '/'
188 'communication': communication,
189 'communication2': communication2,
190 'state': state,
191 ### end account banking
192 'date': date_to_pay,
193 'currency': (line.invoice and line.invoice.currency_id.id
194 or line.journal_id.currency.id
195 or line.journal_id.company_id.currency_id.id),
196 }, context=context)
197 return {'type': 'ir.actions.act_window_close'}
0198
=== removed file 'account_banking_payment/model/payment_order_create.py'
--- account_banking_payment/model/payment_order_create.py 2013-06-26 21:14:41 +0000
+++ account_banking_payment/model/payment_order_create.py 1970-01-01 00:00:00 +0000
@@ -1,199 +0,0 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# Copyright (C) 2009 EduSense BV (<http://www.edusense.nl>).
5# (C) 2011 - 2013 Therp BV (<http://therp.nl>).
6#
7# All other contributions are (C) by their respective contributors
8#
9# All Rights Reserved
10#
11# This program is free software: you can redistribute it and/or modify
12# it under the terms of the GNU Affero General Public License as
13# published by the Free Software Foundation, either version 3 of the
14# License, or (at your option) any later version.
15#
16# This program is distributed in the hope that it will be useful,
17# but WITHOUT ANY WARRANTY; without even the implied warranty of
18# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19# GNU Affero General Public License for more details.
20#
21# You should have received a copy of the GNU Affero General Public License
22# along with this program. If not, see <http://www.gnu.org/licenses/>.
23#
24##############################################################################
25
26from datetime import datetime
27from openerp.osv import orm, fields
28from openerp.tools import DEFAULT_SERVER_DATE_FORMAT
29from openerp.tools.translate import _
30
31
32class payment_order_create(orm.TransientModel):
33 _inherit = 'payment.order.create'
34
35 def extend_payment_order_domain(
36 self, cr, uid, payment_order, domain, context=None):
37 if payment_order.payment_order_type == 'payment':
38 domain += [
39 ('account_id.type', '=', 'payable'),
40 ('amount_to_pay', '>', 0)
41 ]
42 return True
43
44 def search_entries(self, cr, uid, ids, context=None):
45 """
46 This method taken from account_payment module.
47 We adapt the domain based on the payment_order_type
48 """
49 line_obj = self.pool.get('account.move.line')
50 mod_obj = self.pool.get('ir.model.data')
51 if context is None:
52 context = {}
53 data = self.read(cr, uid, ids, ['duedate'], context=context)[0]
54 search_due_date = data['duedate']
55
56 ### start account_banking_payment ###
57 payment = self.pool.get('payment.order').browse(
58 cr, uid, context['active_id'], context=context)
59 # Search for move line to pay:
60 domain = [
61 ('move_id.state', '=', 'posted'),
62 ('reconcile_id', '=', False),
63 ('company_id', '=', payment.mode.company_id.id),
64 ]
65 # apply payment term filter
66 if payment.mode.payment_term_ids:
67 domain += [
68 ('invoice.payment_term', 'in',
69 [term.id for term in payment.mode.payment_term_ids]
70 )
71 ]
72 self.extend_payment_order_domain(
73 cr, uid, payment, domain, context=context)
74 ### end account_direct_debit ###
75
76 domain = domain + [
77 '|', ('date_maturity', '<=', search_due_date),
78 ('date_maturity', '=', False)
79 ]
80 line_ids = line_obj.search(cr, uid, domain, context=context)
81 context.update({'line_ids': line_ids})
82 model_data_ids = mod_obj.search(
83 cr, uid,[
84 ('model', '=', 'ir.ui.view'),
85 ('name', '=', 'view_create_payment_order_lines')],
86 context=context)
87 resource_id = mod_obj.read(
88 cr, uid, model_data_ids, fields=['res_id'],
89 context=context)[0]['res_id']
90 return {'name': _('Entry Lines'),
91 'context': context,
92 'view_type': 'form',
93 'view_mode': 'form',
94 'res_model': 'payment.order.create',
95 'views': [(resource_id, 'form')],
96 'type': 'ir.actions.act_window',
97 'target': 'new',
98 }
99
100 def create_payment(self, cr, uid, ids, context=None):
101 '''
102 This method is a slightly modified version of the existing method on this
103 model in account_payment.
104 - pass the payment mode to line2bank()
105 - allow invoices to create influence on the payment process: not only 'Free'
106 references are allowed, but others as well
107 - check date_to_pay is not in the past.
108 '''
109
110 order_obj = self.pool.get('payment.order')
111 line_obj = self.pool.get('account.move.line')
112 payment_obj = self.pool.get('payment.line')
113 if context is None:
114 context = {}
115 data = self.read(cr, uid, ids, [], context=context)[0]
116 line_ids = data['entries']
117 if not line_ids:
118 return {'type': 'ir.actions.act_window_close'}
119
120 payment = order_obj.browse(
121 cr, uid, context['active_id'], context=context)
122 ### account banking
123 # t = None
124 # line2bank = line_obj.line2bank(cr, uid, line_ids, t, context)
125 line2bank = line_obj.line2bank(
126 cr, uid, line_ids, payment.mode.id, context)
127 _today = fields.date.context_today(self, cr, uid, context=context)
128 ### end account banking
129
130 ## Finally populate the current payment with new lines:
131 for line in line_obj.browse(cr, uid, line_ids, context=context):
132 if payment.date_prefered == "now":
133 #no payment date => immediate payment
134 date_to_pay = False
135 elif payment.date_prefered == 'due':
136 ### account_banking
137 # date_to_pay = line.date_maturity
138 date_to_pay = (
139 line.date_maturity
140 if line.date_maturity and line.date_maturity > _today
141 else False)
142 ### end account banking
143 elif payment.date_prefered == 'fixed':
144 ### account_banking
145 # date_to_pay = payment.date_scheduled
146 date_to_pay = (
147 payment.date_scheduled
148 if payment.date_scheduled and payment.date_scheduled > _today
149 else False)
150 ### end account banking
151
152 ### account_banking
153 state = communication2 = False
154 communication = line.ref or '/'
155 if line.invoice:
156 if line.invoice.type in ('in_invoice', 'in_refund'):
157 if line.invoice.reference_type == 'structured':
158 state = 'structured'
159 communication = line.invoice.reference
160 else:
161 state = 'normal'
162 communication2 = line.invoice.reference
163 else:
164 # Make sure that the communication includes the
165 # customer invoice number (in the case of debit order)
166 communication = line.invoice.number.replace('/', '')
167 state = 'structured'
168 if line.invoice.number != line.ref:
169 communication2 = line.ref
170 else:
171 state = 'normal'
172 communication2 = line.ref
173
174 # support debit orders when enabled
175 if (payment.payment_order_type == 'debit' and
176 'amount_to_receive' in line):
177 amount_currency = line.amount_to_receive
178 else:
179 amount_currency = line.amount_to_pay
180 ### end account_banking
181
182 payment_obj.create(cr, uid, {
183 'move_line_id': line.id,
184 'amount_currency': amount_currency,
185 'bank_id': line2bank.get(line.id),
186 'order_id': payment.id,
187 'partner_id': line.partner_id and line.partner_id.id or False,
188 ### account banking
189 # 'communication': line.ref or '/'
190 'communication': communication,
191 'communication2': communication2,
192 'state': state,
193 ### end account banking
194 'date': date_to_pay,
195 'currency': (line.invoice and line.invoice.currency_id.id
196 or line.journal_id.currency.id
197 or line.journal_id.company_id.currency_id.id),
198 }, context=context)
199 return {'type': 'ir.actions.act_window_close'}
2000
=== removed directory 'account_banking_payment/security'
=== removed file 'account_banking_payment/security/ir.model.access.csv'
--- account_banking_payment/security/ir.model.access.csv 2013-03-16 16:44:19 +0000
+++ account_banking_payment/security/ir.model.access.csv 1970-01-01 00:00:00 +0000
@@ -1,2 +0,0 @@
1"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
2"access_payment_mode_type","payment.mode.type","model_payment_mode_type","account_payment.group_account_payment",1,1,1,1
30
=== modified file 'account_banking_payment/view/account_payment.xml'
--- account_banking_payment/view/account_payment.xml 2013-06-04 10:18:31 +0000
+++ account_banking_payment/view/account_payment.xml 2013-09-25 08:52:04 +0000
@@ -17,10 +17,6 @@
17 'invisible':[('state','!=','draft')]17 'invisible':[('state','!=','draft')]
18 }</attribute>18 }</attribute>
19 </xpath>19 </xpath>
20 <xpath expr="//button[@string='Make Payments']"
21 position="attributes">
22 <attribute name="name">launch_wizard</attribute>
23 </xpath>
24 <!-- Communication only used for 'structured' communication -->20 <!-- Communication only used for 'structured' communication -->
25 <xpath expr="//field[@name='line_ids']/form//field[@name='communication']"21 <xpath expr="//field[@name='line_ids']/form//field[@name='communication']"
26 position="attributes">22 position="attributes">
2723
=== removed file 'account_banking_payment/view/bank_payment_manual.xml'
--- account_banking_payment/view/bank_payment_manual.xml 2013-05-28 15:18:26 +0000
+++ account_banking_payment/view/bank_payment_manual.xml 1970-01-01 00:00:00 +0000
@@ -1,15 +0,0 @@
1<?xml version="1.0" encoding="utf-8"?>
2<openerp>
3 <data>
4 <record id="view_payment_manual_form" model="ir.ui.view">
5 <field name="name">Form for manual payment wizard</field>
6 <field name="model">payment.manual</field>
7 <field name="arch" type="xml">
8 <form string="Manual payment">
9 <label string="Payment order(s) have been set to 'sent'"/>
10 <button special="cancel" icon="gtk-ok" string="OK"/>
11 </form>
12 </field>
13 </record>
14 </data>
15</openerp>
160
=== modified file 'account_banking_payment/view/payment_mode.xml'
--- account_banking_payment/view/payment_mode.xml 2013-05-29 12:35:04 +0000
+++ account_banking_payment/view/payment_mode.xml 2013-09-25 08:52:04 +0000
@@ -8,10 +8,9 @@
8 <record id="view_payment_mode_form_inherit" model="ir.ui.view">8 <record id="view_payment_mode_form_inherit" model="ir.ui.view">
9 <field name="name">payment.mode.form.inherit</field>9 <field name="name">payment.mode.form.inherit</field>
10 <field name="model">payment.mode</field>10 <field name="model">payment.mode</field>
11 <field name="inherit_id" ref="account_payment.view_payment_mode_form"/>11 <field name="inherit_id" ref="account_banking_payment_export.view_payment_mode_form_inherit"/>
12 <field name="arch" type="xml">12 <field name="arch" type="xml">
13 <field name="company_id" position="after">13 <field name="type" position="after">
14 <field name="type"/>
15 <group colspan="4" col="4">14 <group colspan="4" col="4">
16 <group colspan="2">15 <group colspan="2">
17 <separator colspan="2"16 <separator colspan="2"
1817
=== added file 'account_banking_payment/view/payment_mode_type.xml'
--- account_banking_payment/view/payment_mode_type.xml 1970-01-01 00:00:00 +0000
+++ account_banking_payment/view/payment_mode_type.xml 2013-09-25 08:52:04 +0000
@@ -0,0 +1,17 @@
1<?xml version="1.0" encoding="utf-8"?>
2<openerp>
3 <data>
4
5 <record model="ir.ui.view" id="view_payment_mode_type_form_inherit">
6 <field name="name">view.payment.mode.type.form</field>
7 <field name="model">payment.mode.type</field>
8 <field name="inherit_id" ref="account_banking_payment_export.view_payment_mode_type_form"/>
9 <field name="arch" type="xml">
10 <field name="suitable_bank_types" position="after">
11 <field name="payment_order_type"/>
12 </field>
13 </field>
14 </record>
15
16 </data>
17</openerp>
018
=== removed file 'account_banking_payment/view/payment_mode_type.xml'
--- account_banking_payment/view/payment_mode_type.xml 2013-05-28 15:18:26 +0000
+++ account_banking_payment/view/payment_mode_type.xml 1970-01-01 00:00:00 +0000
@@ -1,32 +0,0 @@
1<?xml version="1.0" encoding="utf-8"?>
2<openerp>
3 <data>
4
5 <record id="view_payment_mode_tree_inherit" model="ir.ui.view">
6 <field name="name">payment.mode.tree.inherit</field>
7 <field name="model">payment.mode</field>
8 <field name="inherit_id" ref="account_payment.view_payment_mode_tree"/>
9 <field name="arch" type="xml">
10 <field name="company_id" position="after">
11 <field name="type"/>
12 </field>
13 </field>
14 </record>
15
16 <!-- basic view for payment mode type -->
17 <record model="ir.ui.view" id="view_payment_mode_type_form">
18 <field name="name">view.payment.mode.type.form</field>
19 <field name="model">payment.mode.type</field>
20 <field name="arch" type="xml">
21 <form string="Payment mode">
22 <field name="name" />
23 <field name="code" />
24 <field name="suitable_bank_types"/>
25 <field name="payment_order_type"/>
26 <field name="ir_model_id"/>
27 </form>
28 </field>
29 </record>
30
31 </data>
32</openerp>
330
=== modified file 'account_banking_payment/workflow/account_payment.xml'
--- account_banking_payment/workflow/account_payment.xml 2013-05-29 22:26:36 +0000
+++ account_banking_payment/workflow/account_payment.xml 2013-09-25 08:52:04 +0000
@@ -29,6 +29,12 @@
29 <field name="act_to" ref="account_banking.act_sent"/>29 <field name="act_to" ref="account_banking.act_sent"/>
30 <field name="signal">sent</field>30 <field name="signal">sent</field>
31 </record>31 </record>
32 <!-- the done signal continues to work but goes to sent -->
33 <record id="account_banking.trans_open_done" model="workflow.transition">
34 <field name="act_from" ref="account_payment.act_open"/>
35 <field name="act_to" ref="account_banking.act_sent"/>
36 <field name="signal">done</field>
37 </record>
32 <!-- From sent straight to sent_wait -->38 <!-- From sent straight to sent_wait -->
33 <record id="account_banking.trans_sent_sent_wait" model="workflow.transition">39 <record id="account_banking.trans_sent_sent_wait" model="workflow.transition">
34 <field name="act_from" ref="account_banking.act_sent"/>40 <field name="act_from" ref="account_banking.act_sent"/>
3541
=== added directory 'account_banking_payment_export'
=== added file 'account_banking_payment_export/__init__.py'
--- account_banking_payment_export/__init__.py 1970-01-01 00:00:00 +0000
+++ account_banking_payment_export/__init__.py 2013-09-25 08:52:04 +0000
@@ -0,0 +1,1 @@
1from . import model
0\ No newline at end of file2\ No newline at end of file
13
=== added file 'account_banking_payment_export/__openerp__.py'
--- account_banking_payment_export/__openerp__.py 1970-01-01 00:00:00 +0000
+++ account_banking_payment_export/__openerp__.py 2013-09-25 08:52:04 +0000
@@ -0,0 +1,69 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# Copyright (C) 2009 EduSense BV (<http://www.edusense.nl>).
5# (C) 2011 - 2013 Therp BV (<http://therp.nl>).
6#
7# All other contributions are (C) by their respective contributors
8#
9# All Rights Reserved
10#
11# This program is free software: you can redistribute it and/or modify
12# it under the terms of the GNU Affero General Public License as
13# published by the Free Software Foundation, either version 3 of the
14# License, or (at your option) any later version.
15#
16# This program is distributed in the hope that it will be useful,
17# but WITHOUT ANY WARRANTY; without even the implied warranty of
18# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19# GNU Affero General Public License for more details.
20#
21# You should have received a copy of the GNU Affero General Public License
22# along with this program. If not, see <http://www.gnu.org/licenses/>.
23#
24##############################################################################
25
26{
27 'name': 'Account Banking - Payments Export Infrastructure',
28 'version': '0.1.164',
29 'license': 'AGPL-3',
30 'author': 'Banking addons community',
31 'website': 'https://launchpad.net/banking-addons',
32 'category': 'Banking addons',
33 'depends': [
34 'account_payment',
35 'base_iban', # for manual_bank_tranfer
36 ],
37 'conflicts': [
38 # lp:account-payment/account_payment_extension also adds
39 # a type field to payment.mode, with a very similar purpose.
40 # We can't add a dependency on account_payment_extension here
41 # because account_payment_extension adds many other features
42 # that probably conflict with other parts of lp:banking-addons.
43 # Proposal to resolve: make account_payment_extension depend
44 # on the present account_banking_payment_export module.
45 'account_payment_extension',
46 ],
47 'data': [
48 'view/account_payment.xml',
49 'view/bank_payment_manual.xml',
50 'view/payment_mode.xml',
51 'view/payment_mode_type.xml',
52 'data/payment_mode_type.xml',
53 'security/ir.model.access.csv',
54 ],
55 'description': '''
56 Infrastructure to export payment orders.
57
58 This technical module provides the base infrastructure to export
59 payment orders for electronic banking. It provides the following
60 technical features:
61 * a new payment.mode.type model
62 * payment.mode now has a mandatory type
63 * a better implementation of payment_mode.suitable_bank_types() based on payment.mode.type
64 * the "make payment" button launches a wizard depending on the payment.mode.type
65 * a manual payment mode type is provided as an example, with a default "do nothing" wizard
66 ''',
67 'auto_install': True,
68 'installable': True,
69}
070
=== added directory 'account_banking_payment_export/data'
=== added file 'account_banking_payment_export/data/payment_mode_type.xml'
--- account_banking_payment_export/data/payment_mode_type.xml 1970-01-01 00:00:00 +0000
+++ account_banking_payment_export/data/payment_mode_type.xml 2013-09-25 08:52:04 +0000
@@ -0,0 +1,14 @@
1<?xml version="1.0" encoding="utf-8"?>
2<openerp>
3 <data>
4 <!-- Add manual bank transfer as default payment option -->
5 <record model="payment.mode.type" id="manual_bank_tranfer">
6 <field name="name">Manual Bank Transfer</field>
7 <field name="code">BANKMAN</field>
8 <field name="suitable_bank_types"
9 eval="[(6,0,[ref('base.bank_normal'),ref('base_iban.bank_iban'),])]" />
10 <field name="ir_model_id"
11 ref="model_payment_manual"/>
12 </record>
13 </data>
14</openerp>
015
=== added directory 'account_banking_payment_export/model'
=== added file 'account_banking_payment_export/model/__init__.py'
--- account_banking_payment_export/model/__init__.py 1970-01-01 00:00:00 +0000
+++ account_banking_payment_export/model/__init__.py 2013-09-25 08:52:04 +0000
@@ -0,0 +1,5 @@
1from . import account_payment
2from . import bank_payment_manual
3from . import payment_mode
4from . import payment_mode_type
5from . import payment_order_create
0\ No newline at end of file6\ No newline at end of file
17
=== added file 'account_banking_payment_export/model/account_payment.py'
--- account_banking_payment_export/model/account_payment.py 1970-01-01 00:00:00 +0000
+++ account_banking_payment_export/model/account_payment.py 2013-09-25 08:52:04 +0000
@@ -0,0 +1,75 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# Copyright (C) 2009 EduSense BV (<http://www.edusense.nl>).
5# (C) 2011 - 2013 Therp BV (<http://therp.nl>).
6#
7# All other contributions are (C) by their respective contributors
8#
9# All Rights Reserved
10#
11# This program is free software: you can redistribute it and/or modify
12# it under the terms of the GNU Affero General Public License as
13# published by the Free Software Foundation, either version 3 of the
14# License, or (at your option) any later version.
15#
16# This program is distributed in the hope that it will be useful,
17# but WITHOUT ANY WARRANTY; without even the implied warranty of
18# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19# GNU Affero General Public License for more details.
20#
21# You should have received a copy of the GNU Affero General Public License
22# along with this program. If not, see <http://www.gnu.org/licenses/>.
23#
24##############################################################################
25
26from openerp.osv import orm
27from openerp.tools.translate import _
28from openerp import netsvc
29
30
31class payment_order(orm.Model):
32 _inherit = 'payment.order'
33
34 def launch_wizard(self, cr, uid, ids, context=None):
35 """
36 Search for a wizard to launch according to the type.
37 If type is manual. just confirm the order.
38 Previously (pre-v6) in account_payment/wizard/wizard_pay.py
39 """
40 if context == None:
41 context = {}
42 result = {}
43 orders = self.browse(cr, uid, ids, context)
44 order = orders[0]
45 # check if a wizard is defined for the first order
46 if order.mode.type and order.mode.type.ir_model_id:
47 context['active_ids'] = ids
48 wizard_model = order.mode.type.ir_model_id.model
49 wizard_obj = self.pool.get(wizard_model)
50 wizard_id = wizard_obj.create(cr, uid, {}, context)
51 result = {
52 'name': wizard_obj._description or _('Payment Order Export'),
53 'view_type': 'form',
54 'view_mode': 'form',
55 'res_model': wizard_model,
56 'domain': [],
57 'context': context,
58 'type': 'ir.actions.act_window',
59 'target': 'new',
60 'res_id': wizard_id,
61 'nodestroy': True,
62 }
63 else:
64 # should all be manual orders without type or wizard model
65 for order in orders[1:]:
66 if order.mode.type and order.mode.type.ir_model_id:
67 raise orm.except_orm(
68 _('Error'),
69 _('You can only combine payment orders of the same type')
70 )
71 # process manual payments
72 wf_service = netsvc.LocalService('workflow')
73 for order_id in ids:
74 wf_service.trg_validate(uid, 'payment.order', order_id, 'done', cr)
75 return result
076
=== added file 'account_banking_payment_export/model/bank_payment_manual.py'
--- account_banking_payment_export/model/bank_payment_manual.py 1970-01-01 00:00:00 +0000
+++ account_banking_payment_export/model/bank_payment_manual.py 2013-09-25 08:52:04 +0000
@@ -0,0 +1,59 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# Copyright (C) 2009 EduSense BV (<http://www.edusense.nl>).
5# (C) 2011 - 2013 Therp BV (<http://therp.nl>).
6#
7# All other contributions are (C) by their respective contributors
8#
9# All Rights Reserved
10#
11# This program is free software: you can redistribute it and/or modify
12# it under the terms of the GNU Affero General Public License as
13# published by the Free Software Foundation, either version 3 of the
14# License, or (at your option) any later version.
15#
16# This program is distributed in the hope that it will be useful,
17# but WITHOUT ANY WARRANTY; without even the implied warranty of
18# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19# GNU Affero General Public License for more details.
20#
21# You should have received a copy of the GNU Affero General Public License
22# along with this program. If not, see <http://www.gnu.org/licenses/>.
23#
24##############################################################################
25
26'''
27This module contains a single "wizard" for confirming manual
28bank transfers.
29'''
30
31from openerp.osv import orm, fields
32from openerp import netsvc
33
34
35class payment_manual(orm.TransientModel):
36 _name = 'payment.manual'
37 _description = 'Send payment order(s) manually'
38
39 _columns = {
40 'payment_order_ids': fields.many2many('payment.order',
41 'wiz_manual_payorders_rel', 'wizard_id', 'payment_order_id',
42 'Payment orders', readonly=True),
43 }
44
45 def create(self, cr, uid, vals, context=None):
46 payment_order_ids = context.get('active_ids', [])
47 vals.update({
48 'payment_order_ids': [[6, 0, payment_order_ids]],
49 })
50 return super(payment_manual, self).create(cr, uid,
51 vals, context=context)
52
53 def button_ok(self, cr, uid, ids, context=None):
54 wf_service = netsvc.LocalService('workflow')
55 for wiz in self.browse(cr, uid, ids, context=context):
56 for order_id in wiz.payment_order_ids:
57 wf_service.trg_validate(
58 uid, 'payment.order', order_id.id, 'done', cr)
59 return {'type': 'ir.actions.act_window_close'}
060
=== added file 'account_banking_payment_export/model/payment_mode.py'
--- account_banking_payment_export/model/payment_mode.py 1970-01-01 00:00:00 +0000
+++ account_banking_payment_export/model/payment_mode.py 2013-09-25 08:52:04 +0000
@@ -0,0 +1,52 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# Copyright (C) 2009 EduSense BV (<http://www.edusense.nl>).
5# (C) 2011 - 2013 Therp BV (<http://therp.nl>).
6#
7# All other contributions are (C) by their respective contributors
8#
9# All Rights Reserved
10#
11# This program is free software: you can redistribute it and/or modify
12# it under the terms of the GNU Affero General Public License as
13# published by the Free Software Foundation, either version 3 of the
14# License, or (at your option) any later version.
15#
16# This program is distributed in the hope that it will be useful,
17# but WITHOUT ANY WARRANTY; without even the implied warranty of
18# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19# GNU Affero General Public License for more details.
20#
21# You should have received a copy of the GNU Affero General Public License
22# along with this program. If not, see <http://www.gnu.org/licenses/>.
23#
24##############################################################################
25
26from openerp.osv import orm, fields
27
28
29class payment_mode(orm.Model):
30 ''' Restoring the payment type from version 5,
31 used to select the export wizard (if any) '''
32 _inherit = "payment.mode"
33
34 def suitable_bank_types(self, cr, uid, payment_mode_id=None, context=None):
35 """ Reinstates functional code for suitable bank type filtering.
36 Current code in account_payment is disfunctional.
37 """
38 res = []
39 payment_mode = self.browse(
40 cr, uid, payment_mode_id, context)
41 if (payment_mode and payment_mode.type and
42 payment_mode.type.suitable_bank_types):
43 res = [t.code for t in payment_mode.type.suitable_bank_types]
44 return res
45
46 _columns = {
47 'type': fields.many2one(
48 'payment.mode.type', 'Payment type',
49 required=True,
50 help='Select the Payment Type for the Payment Mode.'
51 ),
52 }
053
=== added file 'account_banking_payment_export/model/payment_mode_type.py'
--- account_banking_payment_export/model/payment_mode_type.py 1970-01-01 00:00:00 +0000
+++ account_banking_payment_export/model/payment_mode_type.py 2013-09-25 08:52:04 +0000
@@ -0,0 +1,61 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# Copyright (C) 2009 EduSense BV (<http://www.edusense.nl>).
5# (C) 2011 - 2013 Therp BV (<http://therp.nl>).
6#
7# All other contributions are (C) by their respective contributors
8#
9# All Rights Reserved
10#
11# This program is free software: you can redistribute it and/or modify
12# it under the terms of the GNU Affero General Public License as
13# published by the Free Software Foundation, either version 3 of the
14# License, or (at your option) any later version.
15#
16# This program is distributed in the hope that it will be useful,
17# but WITHOUT ANY WARRANTY; without even the implied warranty of
18# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19# GNU Affero General Public License for more details.
20#
21# You should have received a copy of the GNU Affero General Public License
22# along with this program. If not, see <http://www.gnu.org/licenses/>.
23#
24##############################################################################
25
26from openerp.osv import orm, fields
27
28
29class payment_mode_type(orm.Model):
30 _name = 'payment.mode.type'
31 _description = 'Payment Mode Type'
32 _columns = {
33 'name': fields.char(
34 'Name', size=64, required=True,
35 help='Payment Type'
36 ),
37 'code': fields.char(
38 'Code', size=64, required=True,
39 help='Specify the Code for Payment Type'
40 ),
41 'suitable_bank_types': fields.many2many(
42 'res.partner.bank.type',
43 'bank_type_payment_type_rel',
44 'pay_type_id','bank_type_id',
45 'Suitable bank types', required=True),
46 'ir_model_id': fields.many2one(
47 'ir.model', 'Payment wizard',
48 help=('Select the Payment Wizard for payments of this type. '
49 'Leave empty for manual processing'),
50 domain=[('osv_memory', '=', True)],
51 ),
52 }
53
54 def _auto_init(self, cr, context=None):
55 r = super(payment_mode_type, self)._auto_init(cr, context=context)
56 # migrate xmlid from manual_bank_transfer to avoid dependency on account_banking
57 cr.execute("""UPDATE ir_model_data SET module='account_banking_payment_export'
58 WHERE module='account_banking' AND
59 name='manual_bank_tranfer' AND
60 model='payment.mode.type'""")
61 return r
062
=== added file 'account_banking_payment_export/model/payment_order_create.py'
--- account_banking_payment_export/model/payment_order_create.py 1970-01-01 00:00:00 +0000
+++ account_banking_payment_export/model/payment_order_create.py 2013-09-25 08:52:04 +0000
@@ -0,0 +1,58 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# Copyright (C) 2013 ACSONE SA/NV (<http://acsone.eu>);.
5#
6# All other contributions are (C) by their respective contributors
7#
8# All Rights Reserved
9#
10# This program is free software: you can redistribute it and/or modify
11# it under the terms of the GNU Affero General Public License as
12# published by the Free Software Foundation, either version 3 of the
13# License, or (at your option) any later version.
14#
15# This program is distributed in the hope that it will be useful,
16# but WITHOUT ANY WARRANTY; without even the implied warranty of
17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18# GNU Affero General Public License for more details.
19#
20# You should have received a copy of the GNU Affero General Public License
21# along with this program. If not, see <http://www.gnu.org/licenses/>.
22#
23##############################################################################
24
25from openerp.osv import orm
26
27
28class payment_order_create(orm.TransientModel):
29 _inherit = 'payment.order.create'
30
31 def create_payment(self, cr, uid, ids, context=None):
32 '''This method adapts the core create_payment()
33 to pass the payment mode to line2bank() through the context,
34 so it is in turn propagated to suitable_bank_types().
35
36 This is necessary because the core does not propagate the payment mode to line2bank: t = None in
37 http://bazaar.launchpad.net/~openerp/openobject-addons/7.0/view/head:/account_payment/wizard/account_payment_order.py#L72
38
39 Hack idea courtesy Stefan Rijnhart.
40 '''
41 if context is None:
42 context = {}
43 order_obj = self.pool.get('payment.order')
44 payment = order_obj.browse(cr, uid, context['active_id'], context=context)
45 context['_fix_payment_mode_id'] = payment.mode.id
46 return super(payment_order_create, self).create_payment(cr, uid, ids, context=context)
47
48
49class account_move_line(orm.Model):
50 _inherit = 'account.move.line'
51
52 def line2bank(self, cr, uid, ids, payment_mode_id=None, context=None):
53 '''Obtain payment_type from context, see create_payment above'''
54 if context is None:
55 context = {}
56 payment_mode_id = payment_mode_id or context.get('_fix_payment_mode_id')
57 return super(account_move_line, self).line2bank(cr, uid, ids, payment_mode_id, context=context)
58
059
=== added directory 'account_banking_payment_export/security'
=== added file 'account_banking_payment_export/security/ir.model.access.csv'
--- account_banking_payment_export/security/ir.model.access.csv 1970-01-01 00:00:00 +0000
+++ account_banking_payment_export/security/ir.model.access.csv 2013-09-25 08:52:04 +0000
@@ -0,0 +1,2 @@
1"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
2"access_payment_mode_type","payment.mode.type","model_payment_mode_type","account_payment.group_account_payment",1,1,1,1
03
=== added directory 'account_banking_payment_export/view'
=== added file 'account_banking_payment_export/view/account_payment.xml'
--- account_banking_payment_export/view/account_payment.xml 1970-01-01 00:00:00 +0000
+++ account_banking_payment_export/view/account_payment.xml 2013-09-25 08:52:04 +0000
@@ -0,0 +1,22 @@
1<?xml version="1.0" encoding="utf-8"?>
2<openerp>
3 <data>
4 <!-- restore wizard functionality when making payments
5 -->
6
7 <record id="view_banking_payment_order_form_1" model="ir.ui.view">
8 <field name="name">account.payment.order.form.banking-1</field>
9 <field name="inherit_id" ref="account_payment.view_payment_order_form" />
10 <field name="model">payment.order</field>
11 <field name="arch" type="xml">
12 <data>
13 <xpath expr="//button[@string='Make Payments']"
14 position="attributes">
15 <attribute name="name">launch_wizard</attribute>
16 </xpath>
17 </data>
18 </field>
19 </record>
20
21 </data>
22</openerp>
023
=== added file 'account_banking_payment_export/view/bank_payment_manual.xml'
--- account_banking_payment_export/view/bank_payment_manual.xml 1970-01-01 00:00:00 +0000
+++ account_banking_payment_export/view/bank_payment_manual.xml 2013-09-25 08:52:04 +0000
@@ -0,0 +1,18 @@
1<?xml version="1.0" encoding="utf-8"?>
2<openerp>
3 <data>
4 <record id="view_payment_manual_form" model="ir.ui.view">
5 <field name="name">Form for manual payment wizard</field>
6 <field name="model">payment.manual</field>
7 <field name="arch" type="xml">
8 <form string="Manual payment" version="7.0">
9 <label string="Please execute payment order manually, and click OK when succesfully sent."/>
10 <footer>
11 <button name="button_ok" type="object" string="OK" class="oe_highlight"/>
12 <button special="cancel" string="Cancel" class="oe_link"/>
13 </footer>
14 </form>
15 </field>
16 </record>
17 </data>
18</openerp>
019
=== added file 'account_banking_payment_export/view/payment_mode.xml'
--- account_banking_payment_export/view/payment_mode.xml 1970-01-01 00:00:00 +0000
+++ account_banking_payment_export/view/payment_mode.xml 2013-09-25 08:52:04 +0000
@@ -0,0 +1,20 @@
1<?xml version="1.0" encoding="utf-8"?>
2<openerp>
3 <data>
4
5 <!--
6 Add the payment mode type and transfer settings
7 -->
8 <record id="view_payment_mode_form_inherit" model="ir.ui.view">
9 <field name="name">payment.mode.form.inherit</field>
10 <field name="model">payment.mode</field>
11 <field name="inherit_id" ref="account_payment.view_payment_mode_form"/>
12 <field name="arch" type="xml">
13 <field name="company_id" position="after">
14 <field name="type"/>
15 </field>
16 </field>
17 </record>
18
19 </data>
20</openerp>
021
=== added file 'account_banking_payment_export/view/payment_mode_type.xml'
--- account_banking_payment_export/view/payment_mode_type.xml 1970-01-01 00:00:00 +0000
+++ account_banking_payment_export/view/payment_mode_type.xml 2013-09-25 08:52:04 +0000
@@ -0,0 +1,31 @@
1<?xml version="1.0" encoding="utf-8"?>
2<openerp>
3 <data>
4
5 <record id="view_payment_mode_tree_inherit" model="ir.ui.view">
6 <field name="name">payment.mode.tree.inherit</field>
7 <field name="model">payment.mode</field>
8 <field name="inherit_id" ref="account_payment.view_payment_mode_tree"/>
9 <field name="arch" type="xml">
10 <field name="company_id" position="after">
11 <field name="type"/>
12 </field>
13 </field>
14 </record>
15
16 <!-- basic view for payment mode type -->
17 <record model="ir.ui.view" id="view_payment_mode_type_form">
18 <field name="name">view.payment.mode.type.form</field>
19 <field name="model">payment.mode.type</field>
20 <field name="arch" type="xml">
21 <form string="Payment mode">
22 <field name="name" />
23 <field name="code" />
24 <field name="suitable_bank_types"/>
25 <field name="ir_model_id"/>
26 </form>
27 </field>
28 </record>
29
30 </data>
31</openerp>
032
=== modified file 'account_banking_sepa_credit_transfer/__openerp__.py'
--- account_banking_sepa_credit_transfer/__openerp__.py 2013-08-02 22:39:11 +0000
+++ account_banking_sepa_credit_transfer/__openerp__.py 2013-09-25 08:52:04 +0000
@@ -26,7 +26,7 @@
26 'author': 'Akretion',26 'author': 'Akretion',
27 'website': 'http://www.akretion.com',27 'website': 'http://www.akretion.com',
28 'category': 'Banking addons',28 'category': 'Banking addons',
29 'depends': ['account_banking_payment'],29 'depends': ['account_banking_payment_export'],
30 'data': [30 'data': [
31 'account_banking_sepa_view.xml',31 'account_banking_sepa_view.xml',
32 'wizard/export_sepa_view.xml',32 'wizard/export_sepa_view.xml',
3333
=== modified file 'account_banking_sepa_credit_transfer/account_banking_sepa.py'
--- account_banking_sepa_credit_transfer/account_banking_sepa.py 2013-06-28 20:34:58 +0000
+++ account_banking_sepa_credit_transfer/account_banking_sepa.py 2013-09-25 08:52:04 +0000
@@ -20,8 +20,6 @@
20##############################################################################20##############################################################################
2121
22from openerp.osv import orm, fields22from openerp.osv import orm, fields
23import time
24from openerp.tools.translate import _
25from openerp.addons.decimal_precision import decimal_precision as dp23from openerp.addons.decimal_precision import decimal_precision as dp
2624
2725
2826
=== modified file 'account_banking_sepa_credit_transfer/account_banking_sepa_view.xml'
--- account_banking_sepa_credit_transfer/account_banking_sepa_view.xml 2013-08-02 22:39:11 +0000
+++ account_banking_sepa_credit_transfer/account_banking_sepa_view.xml 2013-09-25 08:52:04 +0000
@@ -65,7 +65,7 @@
6565
6666
67<menuitem id="menu_account_banking_sepa"67<menuitem id="menu_account_banking_sepa"
68 parent="account_banking.menu_finance_banking_actions"68 parent="account_payment.menu_main_payment"
69 action="action_account_banking_sepa"69 action="action_account_banking_sepa"
70 sequence="15"70 sequence="15"
71 />71 />
7272
=== modified file 'account_banking_sepa_credit_transfer/wizard/export_sepa.py'
--- account_banking_sepa_credit_transfer/wizard/export_sepa.py 2013-09-19 11:50:30 +0000
+++ account_banking_sepa_credit_transfer/wizard/export_sepa.py 2013-09-25 08:52:04 +0000
@@ -101,8 +101,6 @@
101 '''101 '''
102 Creates the SEPA Credit Transfer file. That's the important code !102 Creates the SEPA Credit Transfer file. That's the important code !
103 '''103 '''
104 payment_order_obj = self.pool.get('payment.order')
105
106 sepa_export = self.browse(cr, uid, ids[0], context=context)104 sepa_export = self.browse(cr, uid, ids[0], context=context)
107105
108 my_company_name = sepa_export.payment_order_ids[0].mode.bank_id.partner_id.name106 my_company_name = sepa_export.payment_order_ids[0].mode.bank_id.partner_id.name
@@ -330,12 +328,15 @@
330328
331 def save_sepa(self, cr, uid, ids, context=None):329 def save_sepa(self, cr, uid, ids, context=None):
332 '''330 '''
333 Save the SEPA PAIN: mark all payments in the file as 'sent'.331 Save the SEPA PAIN: send the done signal to all payment orders in the file.
332 With the default workflow, they will transition to 'done', while with the
333 advanced workflow in account_banking_payment they will transition to 'sent'
334 waiting reconciliation.
334 '''335 '''
335 sepa_export = self.browse(cr, uid, ids[0], context=context)336 sepa_export = self.browse(cr, uid, ids[0], context=context)
336 sepa_file = self.pool.get('banking.export.sepa').write(cr, uid,337 self.pool.get('banking.export.sepa').write(cr, uid,
337 sepa_export.file_id.id, {'state': 'sent'}, context=context)338 sepa_export.file_id.id, {'state': 'sent'}, context=context)
338 wf_service = netsvc.LocalService('workflow')339 wf_service = netsvc.LocalService('workflow')
339 for order in sepa_export.payment_order_ids:340 for order in sepa_export.payment_order_ids:
340 wf_service.trg_validate(uid, 'payment.order', order.id, 'sent', cr)341 wf_service.trg_validate(uid, 'payment.order', order.id, 'done', cr)
341 return {'type': 'ir.actions.act_window_close'}342 return {'type': 'ir.actions.act_window_close'}

Subscribers

People subscribed via source and target branches

to status/vote changes: