diff --git a/account_banking_payment/__openerp__.py b/account_banking_payment/__openerp__.py
index af1ecab2e..4453971bd 100644
--- a/account_banking_payment/__openerp__.py
+++ b/account_banking_payment/__openerp__.py
@@ -32,17 +32,13 @@
'category': 'Banking addons',
'depends': [
'account_banking',
- 'account_payment',
+ 'account_banking_payment_export',
],
'data': [
'view/account_payment.xml',
'view/banking_transaction_wizard.xml',
'view/payment_mode.xml',
- 'view/payment_mode_type.xml',
- 'view/bank_payment_manual.xml',
- 'data/payment_mode_type.xml',
'workflow/account_payment.xml',
- 'security/ir.model.access.csv',
],
'description': '''
This addon adds payment infrastructure to the Banking Addons.
diff --git a/account_banking_payment/model/__init__.py b/account_banking_payment/model/__init__.py
index 9908c8e01..c0ecd6f95 100644
--- a/account_banking_payment/model/__init__.py
+++ b/account_banking_payment/model/__init__.py
@@ -1,9 +1,6 @@
import account_payment
import payment_line
import payment_mode
-import payment_mode_type
-import payment_order_create
import banking_import_transaction
import banking_transaction_wizard
-import bank_payment_manual
import banking_import_line
diff --git a/account_banking_payment/model/account_payment.py b/account_banking_payment/model/account_payment.py
index b238cbeef..7b212654c 100644
--- a/account_banking_payment/model/account_payment.py
+++ b/account_banking_payment/model/account_payment.py
@@ -115,49 +115,6 @@ class payment_order(orm.Model):
'payment_order_type': 'payment',
}
- def launch_wizard(self, cr, uid, ids, context=None):
- """
- Search for a wizard to launch according to the type.
- If type is manual. just confirm the order.
- Previously (pre-v6) in account_payment/wizard/wizard_pay.py
- """
- if context == None:
- context = {}
- result = {}
- orders = self.browse(cr, uid, ids, context)
- order = orders[0]
- # check if a wizard is defined for the first order
- if order.mode.type and order.mode.type.ir_model_id:
- context['active_ids'] = ids
- wizard_model = order.mode.type.ir_model_id.model
- wizard_obj = self.pool.get(wizard_model)
- wizard_id = wizard_obj.create(cr, uid, {}, context)
- result = {
- 'name': wizard_obj._description or _('Payment Order Export'),
- 'view_type': 'form',
- 'view_mode': 'form',
- 'res_model': wizard_model,
- 'domain': [],
- 'context': context,
- 'type': 'ir.actions.act_window',
- 'target': 'new',
- 'res_id': wizard_id,
- 'nodestroy': True,
- }
- else:
- # should all be manual orders without type or wizard model
- for order in orders[1:]:
- if order.mode.type and order.mode.type.ir_model_id:
- raise orm.except_orm(
- _('Error'),
- _('You can only combine payment orders of the same type')
- )
- # process manual payments
- wf_service = netsvc.LocalService('workflow')
- for order_id in ids:
- wf_service.trg_validate(uid, 'payment.order', order_id, 'sent', cr)
- return result
-
def _write_payment_lines(self, cr, uid, ids, **kwargs):
'''
ORM method for setting attributes of corresponding payment.line objects.
@@ -287,6 +244,7 @@ class payment_order(orm.Model):
for line in order.line_ids:
# basic checks
if not line.move_line_id:
+ continue
raise orm.except_orm(
_('Error'),
_('No move line provided for line %s') % line.name)
diff --git a/account_banking_payment/model/payment_mode.py b/account_banking_payment/model/payment_mode.py
index f93acec8e..1b87b0a5a 100644
--- a/account_banking_payment/model/payment_mode.py
+++ b/account_banking_payment/model/payment_mode.py
@@ -27,28 +27,9 @@ from openerp.osv import orm, fields
class payment_mode(orm.Model):
- ''' Restoring the payment type from version 5,
- used to select the export wizard (if any) '''
_inherit = "payment.mode"
- def suitable_bank_types(self, cr, uid, payment_mode_id=None, context=None):
- """ Reinstates functional code for suitable bank type filtering.
- Current code in account_payment is disfunctional.
- """
- res = []
- payment_mode = self.browse(
- cr, uid, payment_mode_id, context)
- if (payment_mode and payment_mode.type and
- payment_mode.type.suitable_bank_types):
- res = [type.code for type in payment_mode.type.suitable_bank_types]
- return res
-
_columns = {
- 'type': fields.many2one(
- 'payment.mode.type', 'Payment type',
- required=True,
- help='Select the Payment Type for the Payment Mode.'
- ),
'transfer_account_id': fields.many2one(
'account.account', 'Transfer account',
domain=[('type', '=', 'other'),
@@ -63,10 +44,4 @@ class payment_mode(orm.Model):
help=('Journal to write payment entries when confirming '
'a debit order of this mode'),
),
- 'payment_term_ids': fields.many2many(
- 'account.payment.term', 'account_payment_order_terms_rel',
- 'mode_id', 'term_id', 'Payment terms',
- help=('Limit selected invoices to invoices with these payment '
- 'terms')
- ),
}
diff --git a/account_banking_payment/view/account_payment.xml b/account_banking_payment/view/account_payment.xml
index 4f7601332..c26847abf 100644
--- a/account_banking_payment/view/account_payment.xml
+++ b/account_banking_payment/view/account_payment.xml
@@ -17,10 +17,6 @@
'invisible':[('state','!=','draft')]
}
-
- launch_wizard
-
diff --git a/account_banking_payment/view/payment_mode.xml b/account_banking_payment/view/payment_mode.xml
index bb3c19ff4..08d0cf5b1 100644
--- a/account_banking_payment/view/payment_mode.xml
+++ b/account_banking_payment/view/payment_mode.xml
@@ -8,10 +8,9 @@
payment.mode.form.inherit
payment.mode
-
+
-
-
+
-
-
-
-
diff --git a/account_banking_payment/workflow/account_payment.xml b/account_banking_payment/workflow/account_payment.xml
index 3db2f9fb6..510a6610f 100644
--- a/account_banking_payment/workflow/account_payment.xml
+++ b/account_banking_payment/workflow/account_payment.xml
@@ -29,6 +29,12 @@ write({'state':'rejected'})
sent
+
+
+
+
+ done
+
diff --git a/account_banking_payment_export/__init__.py b/account_banking_payment_export/__init__.py
new file mode 100644
index 000000000..133ac66e4
--- /dev/null
+++ b/account_banking_payment_export/__init__.py
@@ -0,0 +1 @@
+import model
\ No newline at end of file
diff --git a/account_banking_payment_export/__openerp__.py b/account_banking_payment_export/__openerp__.py
new file mode 100644
index 000000000..56f8d1c1a
--- /dev/null
+++ b/account_banking_payment_export/__openerp__.py
@@ -0,0 +1,53 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# Copyright (C) 2009 EduSense BV ().
+# (C) 2011 - 2013 Therp BV ().
+#
+# All other contributions are (C) by their respective contributors
+#
+# All Rights Reserved
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+
+{
+ 'name': 'Account Banking - Payments',
+ 'version': '0.1.164',
+ 'license': 'AGPL-3',
+ 'author': 'Banking addons community',
+ 'website': 'https://launchpad.net/banking-addons',
+ 'category': 'Banking addons',
+ 'depends': [
+ 'account_payment',
+ ],
+ 'data': [
+ 'view/account_payment.xml',
+ 'view/bank_payment_manual.xml',
+ 'view/payment_mode.xml',
+ 'view/payment_mode_type.xml',
+ 'data/payment_mode_type.xml',
+ 'security/ir.model.access.csv',
+ ],
+ 'description': '''
+ This addon adds payment export infrastructure to the Banking Addons.
+ * the "make payment" launches a wizard depending on the payment mode
+ * create a manual payment mode type
+ * various improvements to the payment order invoice import wizard
+ * suitable bank account type filtering
+ ''',
+ 'auto_install': True,
+ 'installable': True,
+}
diff --git a/account_banking_payment/data/payment_mode_type.xml b/account_banking_payment_export/data/payment_mode_type.xml
similarity index 74%
rename from account_banking_payment/data/payment_mode_type.xml
rename to account_banking_payment_export/data/payment_mode_type.xml
index 96b0e0c56..c1e4a4abd 100644
--- a/account_banking_payment/data/payment_mode_type.xml
+++ b/account_banking_payment_export/data/payment_mode_type.xml
@@ -2,13 +2,13 @@
-
+
Manual Bank Transfer
BANKMAN
+ ref="model_payment_manual"/>
diff --git a/account_banking_payment_export/model/__init__.py b/account_banking_payment_export/model/__init__.py
new file mode 100644
index 000000000..4887825eb
--- /dev/null
+++ b/account_banking_payment_export/model/__init__.py
@@ -0,0 +1,5 @@
+import account_payment
+import bank_payment_manual
+import payment_mode
+import payment_mode_type
+import payment_order_create
diff --git a/account_banking_payment_export/model/account_payment.py b/account_banking_payment_export/model/account_payment.py
new file mode 100644
index 000000000..e5a14e8aa
--- /dev/null
+++ b/account_banking_payment_export/model/account_payment.py
@@ -0,0 +1,75 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# Copyright (C) 2009 EduSense BV ().
+# (C) 2011 - 2013 Therp BV ().
+#
+# All other contributions are (C) by their respective contributors
+#
+# All Rights Reserved
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+
+from openerp.osv import orm
+from openerp.tools.translate import _
+from openerp import netsvc
+
+
+class payment_order(orm.Model):
+ _inherit = 'payment.order'
+
+ def launch_wizard(self, cr, uid, ids, context=None):
+ """
+ Search for a wizard to launch according to the type.
+ If type is manual. just confirm the order.
+ Previously (pre-v6) in account_payment/wizard/wizard_pay.py
+ """
+ if context == None:
+ context = {}
+ result = {}
+ orders = self.browse(cr, uid, ids, context)
+ order = orders[0]
+ # check if a wizard is defined for the first order
+ if order.mode.type and order.mode.type.ir_model_id:
+ context['active_ids'] = ids
+ wizard_model = order.mode.type.ir_model_id.model
+ wizard_obj = self.pool.get(wizard_model)
+ wizard_id = wizard_obj.create(cr, uid, {}, context)
+ result = {
+ 'name': wizard_obj._description or _('Payment Order Export'),
+ 'view_type': 'form',
+ 'view_mode': 'form',
+ 'res_model': wizard_model,
+ 'domain': [],
+ 'context': context,
+ 'type': 'ir.actions.act_window',
+ 'target': 'new',
+ 'res_id': wizard_id,
+ 'nodestroy': True,
+ }
+ else:
+ # should all be manual orders without type or wizard model
+ for order in orders[1:]:
+ if order.mode.type and order.mode.type.ir_model_id:
+ raise orm.except_orm(
+ _('Error'),
+ _('You can only combine payment orders of the same type')
+ )
+ # process manual payments
+ wf_service = netsvc.LocalService('workflow')
+ for order_id in ids:
+ wf_service.trg_validate(uid, 'payment.order', order_id, 'done', cr)
+ return result
diff --git a/account_banking_payment/model/bank_payment_manual.py b/account_banking_payment_export/model/bank_payment_manual.py
similarity index 96%
rename from account_banking_payment/model/bank_payment_manual.py
rename to account_banking_payment_export/model/bank_payment_manual.py
index 700bf0210..fb15267dd 100644
--- a/account_banking_payment/model/bank_payment_manual.py
+++ b/account_banking_payment_export/model/bank_payment_manual.py
@@ -42,7 +42,7 @@ class payment_manual(orm.TransientModel):
wf_service = netsvc.LocalService('workflow')
for order_id in context['active_ids']:
wf_service.trg_validate(
- uid, 'payment.order', order_id, 'sent', cr)
+ uid, 'payment.order', order_id, 'done', cr)
return super(payment_manual, self).default_get(
cr, uid, fields_list, context=None)
diff --git a/account_banking_payment_export/model/payment_mode.py b/account_banking_payment_export/model/payment_mode.py
new file mode 100644
index 000000000..39e469690
--- /dev/null
+++ b/account_banking_payment_export/model/payment_mode.py
@@ -0,0 +1,58 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# Copyright (C) 2009 EduSense BV ().
+# (C) 2011 - 2013 Therp BV ().
+#
+# All other contributions are (C) by their respective contributors
+#
+# All Rights Reserved
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+
+from openerp.osv import orm, fields
+
+
+class payment_mode(orm.Model):
+ ''' Restoring the payment type from version 5,
+ used to select the export wizard (if any) '''
+ _inherit = "payment.mode"
+
+ def suitable_bank_types(self, cr, uid, payment_mode_id=None, context=None):
+ """ Reinstates functional code for suitable bank type filtering.
+ Current code in account_payment is disfunctional.
+ """
+ res = []
+ payment_mode = self.browse(
+ cr, uid, payment_mode_id, context)
+ if (payment_mode and payment_mode.type and
+ payment_mode.type.suitable_bank_types):
+ res = [type.code for type in payment_mode.type.suitable_bank_types]
+ return res
+
+ _columns = {
+ 'type': fields.many2one(
+ 'payment.mode.type', 'Payment type',
+ required=True,
+ help='Select the Payment Type for the Payment Mode.'
+ ),
+ 'payment_term_ids': fields.many2many(
+ 'account.payment.term', 'account_payment_order_terms_rel',
+ 'mode_id', 'term_id', 'Payment terms',
+ help=('Limit selected invoices to invoices with these payment '
+ 'terms')
+ ),
+ }
diff --git a/account_banking_payment/model/payment_mode_type.py b/account_banking_payment_export/model/payment_mode_type.py
similarity index 100%
rename from account_banking_payment/model/payment_mode_type.py
rename to account_banking_payment_export/model/payment_mode_type.py
diff --git a/account_banking_payment/model/payment_order_create.py b/account_banking_payment_export/model/payment_order_create.py
similarity index 100%
rename from account_banking_payment/model/payment_order_create.py
rename to account_banking_payment_export/model/payment_order_create.py
diff --git a/account_banking_payment/security/ir.model.access.csv b/account_banking_payment_export/security/ir.model.access.csv
similarity index 100%
rename from account_banking_payment/security/ir.model.access.csv
rename to account_banking_payment_export/security/ir.model.access.csv
diff --git a/account_banking_payment_export/view/account_payment.xml b/account_banking_payment_export/view/account_payment.xml
new file mode 100644
index 000000000..a8e7ed547
--- /dev/null
+++ b/account_banking_payment_export/view/account_payment.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+ account.payment.order.form.banking-1
+
+ payment.order
+
+
+
+ launch_wizard
+
+
+
+
+
+
+
diff --git a/account_banking_payment/view/bank_payment_manual.xml b/account_banking_payment_export/view/bank_payment_manual.xml
similarity index 100%
rename from account_banking_payment/view/bank_payment_manual.xml
rename to account_banking_payment_export/view/bank_payment_manual.xml
diff --git a/account_banking_payment_export/view/payment_mode.xml b/account_banking_payment_export/view/payment_mode.xml
new file mode 100644
index 000000000..fa68b1261
--- /dev/null
+++ b/account_banking_payment_export/view/payment_mode.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+ payment.mode.form.inherit
+ payment.mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/account_banking_payment/view/payment_mode_type.xml b/account_banking_payment_export/view/payment_mode_type.xml
similarity index 100%
rename from account_banking_payment/view/payment_mode_type.xml
rename to account_banking_payment_export/view/payment_mode_type.xml
diff --git a/account_banking_sepa_credit_transfer/__openerp__.py b/account_banking_sepa_credit_transfer/__openerp__.py
index 35891b16c..751058ea2 100644
--- a/account_banking_sepa_credit_transfer/__openerp__.py
+++ b/account_banking_sepa_credit_transfer/__openerp__.py
@@ -26,7 +26,7 @@
'author': 'Akretion',
'website': 'http://www.akretion.com',
'category': 'Banking addons',
- 'depends': ['account_banking_payment'],
+ 'depends': ['account_banking_payment_export'],
'data': [
'account_banking_sepa_view.xml',
'wizard/export_sepa_view.xml',
diff --git a/account_banking_sepa_credit_transfer/account_banking_sepa_view.xml b/account_banking_sepa_credit_transfer/account_banking_sepa_view.xml
index fca4ba4d2..1fdab318f 100644
--- a/account_banking_sepa_credit_transfer/account_banking_sepa_view.xml
+++ b/account_banking_sepa_credit_transfer/account_banking_sepa_view.xml
@@ -65,7 +65,7 @@
diff --git a/account_banking_sepa_credit_transfer/wizard/export_sepa.py b/account_banking_sepa_credit_transfer/wizard/export_sepa.py
index f1583fc68..4d73b5796 100644
--- a/account_banking_sepa_credit_transfer/wizard/export_sepa.py
+++ b/account_banking_sepa_credit_transfer/wizard/export_sepa.py
@@ -335,5 +335,5 @@ class banking_export_sepa_wizard(orm.TransientModel):
sepa_export.file_id.id, {'state': 'sent'}, context=context)
wf_service = netsvc.LocalService('workflow')
for order in sepa_export.payment_order_ids:
- wf_service.trg_validate(uid, 'payment.order', order.id, 'sent', cr)
+ wf_service.trg_validate(uid, 'payment.order', order.id, 'done', cr)
return {'type': 'ir.actions.act_window_close'}