Finalise the wizard of selection of move lines to pay

Add button "Add to payment/debit order" on invoice form view
Started to integrate payment transfer in account_payment_order (not finished at all though)
Various fixes/changes/improvements/...
This commit is contained in:
Alexis de Lattre
2016-05-06 01:16:20 +02:00
parent 3c8c2e9e70
commit abb052d894
28 changed files with 446 additions and 330 deletions

View File

@@ -1,25 +0,0 @@
# -*- coding: utf-8 -*-
# © 2014 ACSONE SA (<http://acsone.eu>).
# © 2014 Akretion (www.akretion.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import models, workflow, api
class AccountMoveReconcile(models.Model):
_inherit = 'account.move.reconcile'
@api.multi
def unlink(self):
"""
Workflow triggers upon unreconcile. This should go into the core.
"""
line_ids = []
for reconcile in self:
for move_line in reconcile.line_id:
line_ids.append(move_line.id)
res = super(AccountMoveReconcile, self).unlink()
for line_id in line_ids:
workflow.trg_trigger(
self._uid, 'account.move.line', line_id, self._cr)
return res

View File

@@ -1,31 +0,0 @@
# -*- coding: utf-8 -*-
# © 2009 EduSense BV (<http://www.edusense.nl>)
# © 2011-2013 Therp BV (<http://therp.nl>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import models, fields, api
class PaymentLine(models.Model):
'''
Add some fields; make destination bank account
mandatory, as it makes no sense to send payments into thin air.
Edit: Payments can be by cash too, which is prohibited by mandatory bank
accounts.
'''
_inherit = 'payment.line'
msg = fields.Char('Message', required=False, readonly=True, default='')
date_done = fields.Date('Date Confirmed', select=True, readonly=True)
@api.multi
def payment_line_hashcode(self):
"""
Don't group the payment lines that are attached to the same supplier
but to move lines with different accounts (very unlikely),
for easier generation/comprehension of the transfer move
"""
res = super(PaymentLine, self).payment_line_hashcode()
res += '-' + unicode(
self.move_line_id and self.move_line_id.account_id or False)
return res

View File

@@ -1,26 +0,0 @@
# -*- coding: utf-8 -*-
# © 2009 EduSense BV (<http://www.edusense.nl>)
# © 2011-2013 Therp BV (<http://therp.nl>)
# © 2014 Akretion (www.akretion.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import models, fields
class PaymentMode(models.Model):
_inherit = "payment.mode"
transfer_account_id = fields.Many2one(
'account.account', string='Transfer account',
domain=[('type', '=', 'other'), ('reconcile', '=', True)],
help='Pay off lines in sent orders with a move on this '
'account. You can only select accounts of type regular '
'that are marked for reconciliation')
transfer_journal_id = fields.Many2one(
'account.journal', string='Transfer journal',
help='Journal to write payment entries when confirming '
'a debit order of this mode')
transfer_move_option = fields.Selection([
('date', 'One move per payment date'),
('line', 'One move per payment line'),
], string='Transfer move option', default='date')

View File

@@ -1,34 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!--
Add the payment mode transfer account settings
-->
<record id="view_payment_mode_form_inherit" model="ir.ui.view">
<field name="name">payment.mode.form.inherit</field>
<field name="model">payment.mode</field>
<field name="inherit_id" ref="account_banking_payment_export.view_payment_mode_form_inherit"/>
<field name="arch" type="xml">
<xpath expr="/form/group[@col='4']" position="inside">
<group name="trf-move-config" string="Transfer move settings" colspan="2">
<field name="transfer_account_id"
domain="[('type', '=', 'other'),
('reconcile', '=', True),
('company_id', '=', company_id)]"
context="{
'default_type': 'other',
'default_reconcile': True,
'default_company_id': company_id}"
/>
<field name="transfer_journal_id"
domain="[('company_id', '=', company_id)]"
/>
<field name="transfer_move_option"/>
</group>
</xpath>
</field>
</record>
</data>
</openerp>