mirror of
https://github.com/OCA/bank-payment.git
synced 2025-02-02 10:37:31 +02:00
[ADD] Finish core code and views
This commit is contained in:
@@ -28,11 +28,15 @@
|
||||
'depends': ['account_banking'],
|
||||
'data': [
|
||||
'view/payment_mode.xml',
|
||||
'view/export_aggregate.xml',
|
||||
'data/payment_mode_type.xml',
|
||||
],
|
||||
},
|
||||
'description': '''
|
||||
Allows for aggregating several payments on a single partner
|
||||
Allows for aggregating several payments on a single partner by
|
||||
reconciling the payment lines in a payment order of this type
|
||||
with a single line on the partner, then proceeds to create a new
|
||||
order of a user chosen type with only this line in it.
|
||||
''',
|
||||
'active': False,
|
||||
}
|
||||
|
||||
2
account_banking_aggregate_payment/model/__init__.py
Normal file
2
account_banking_aggregate_payment/model/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
||||
import payment_mode
|
||||
import export_aggregate
|
||||
@@ -27,11 +27,28 @@ class banking_export_aggregate(orm.TransientModel):
|
||||
_name = 'banking.export.aggregate'
|
||||
_columns = {
|
||||
'payment_order_id': fields.many2one(
|
||||
'payment.order', 'Payment order'),
|
||||
'payment.order', 'Payment order',
|
||||
required=True),
|
||||
'reference': fields.char(
|
||||
'Reference', size=24),
|
||||
}
|
||||
|
||||
def create(self, cr, uid, vals, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
if not vals.get('payment_order_id'):
|
||||
if not context.get('active_ids'):
|
||||
raise orm.except_orm(
|
||||
_('Error'),
|
||||
_('Please select a payment order'))
|
||||
if len(context['active_ids']) > 1:
|
||||
raise orm.except_orm(
|
||||
_('Error'),
|
||||
_('Please only select a single payment order'))
|
||||
vals['payment_order_id'] = context['active_ids'][0]
|
||||
return self.create(
|
||||
cr, uid, vals, context=context)
|
||||
|
||||
def reconcile_lines(self, cr, uid, move_line_ids, context=None):
|
||||
"""
|
||||
Reconcile move lines lines, really. Talk about core functionality
|
||||
@@ -116,8 +133,8 @@ class banking_export_aggregate(orm.TransientModel):
|
||||
|
||||
move_id = account_move_obj.create(cr, uid, {
|
||||
'journal_id': order.mode.transfer_journal_id.id,
|
||||
'name': 'Aggregate Payment Order', # TODO: get order reference or number
|
||||
'reference': 'AGG', # TODO get order reference number or number
|
||||
'name': 'Aggregate Payment Order %s' % order.reference,
|
||||
'reference': order.reference,
|
||||
}, context=context)
|
||||
|
||||
counter_move_line_ids = []
|
||||
@@ -219,10 +236,13 @@ class banking_export_aggregate(orm.TransientModel):
|
||||
'mode': order.mode.aggregate_mode_id.id,
|
||||
}, context=context)
|
||||
|
||||
lines2bank = payment_order_line_obj.line2bank(
|
||||
cr, uid, [payable_move_line.id], order.mode.id, context)
|
||||
|
||||
payment_order_line_obj.create(cr, uid,{
|
||||
'move_line_id': payable_move_line.id,
|
||||
'amount_currency': payable_move_line.amount_to_pay,
|
||||
'bank_id': line2bank.get(line.id), # TODO line2bank get it from account_banking
|
||||
'bank_id': lines2bank.get(payable_move_line.id),
|
||||
'order_id': payment_order_id,
|
||||
'partner_id': order.mode.aggregate_partner_id.id,
|
||||
'communication': False,
|
||||
@@ -233,4 +253,15 @@ class banking_export_aggregate(orm.TransientModel):
|
||||
line.journal_id.company_id.currency_id.id),
|
||||
}, context=context)
|
||||
|
||||
return ### act_window to payment order{'type': 'ir.actions.act_window_close'}
|
||||
return {
|
||||
'name': payment_order_obj._description,
|
||||
'view_type': 'form',
|
||||
'view_mode': 'form',
|
||||
'res_model': payment_order_obj._name,
|
||||
'domain': [],
|
||||
'context': context,
|
||||
'type': 'ir.actions.act_window',
|
||||
'target': 'current',
|
||||
'res_id': payment_order_id,
|
||||
'nodestroy': True,
|
||||
}
|
||||
|
||||
24
account_banking_aggregate_payment/view/export_aggregate.xml
Normal file
24
account_banking_aggregate_payment/view/export_aggregate.xml
Normal file
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<record id="banking_export_aggregate_view" model="ir.ui.view">
|
||||
<field name="name">Export aggregate payment order</field>
|
||||
<field name="model">banking.export.aggregate</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Export aggregate payment order">
|
||||
<label string="Please confirm this aggregate export"/>
|
||||
<button icon="gtk-close"
|
||||
special="cancel"
|
||||
string="Cancel"
|
||||
/>
|
||||
<button icon="gtk-ok"
|
||||
string="Create"
|
||||
name="create_aggregate_order"
|
||||
type="object"
|
||||
/>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
||||
Reference in New Issue
Block a user