mirror of
https://github.com/OCA/bank-payment.git
synced 2025-02-02 10:37:31 +02:00
Add option 'target_move' (all or posted) in wizard to select move lines to pay
Remove module account_payment_include_draft_move
This commit is contained in:
committed by
Enric Tobella
parent
b505cabcd9
commit
4454a41241
@@ -26,6 +26,10 @@ class AccountPaymentMode(models.Model):
|
||||
'account.journal', string="Journals Filter")
|
||||
default_invoice = fields.Boolean(
|
||||
string='Linked to an Invoice or Refund', default=False)
|
||||
default_target_move = fields.Selection([
|
||||
('posted', 'All Posted Entries'),
|
||||
('all', 'All Entries'),
|
||||
], string='Target Moves', default='posted')
|
||||
default_date_type = fields.Selection([
|
||||
('due', 'Due'),
|
||||
('move', 'Move'),
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
<group name="payment_order_create_defaults" string="Select Move Lines to Pay - Default Values">
|
||||
<field name="default_journal_ids" widget="many2many_tags"/>
|
||||
<field name="default_payment_mode"/>
|
||||
<field name="default_target_move" widget="radio"/>
|
||||
<field name="default_invoice"/>
|
||||
<field name="default_date_type"/>
|
||||
</group>
|
||||
|
||||
@@ -16,6 +16,10 @@ class AccountPaymentLineCreate(models.TransientModel):
|
||||
'account.payment.order', string='Payment Order')
|
||||
journal_ids = fields.Many2many(
|
||||
'account.journal', string='Journals Filter')
|
||||
target_move = fields.Selection([
|
||||
('posted', 'All Posted Entries'),
|
||||
('all', 'All Entries'),
|
||||
], string='Target Moves')
|
||||
invoice = fields.Boolean(
|
||||
string='Linked to an Invoice or Refund')
|
||||
date_type = fields.Selection([
|
||||
@@ -44,6 +48,7 @@ class AccountPaymentLineCreate(models.TransientModel):
|
||||
mode = order.payment_mode_id
|
||||
res.update({
|
||||
'journal_ids': mode.default_journal_ids.ids or False,
|
||||
'target_move': mode.default_target_move,
|
||||
'invoice': mode.default_invoice,
|
||||
'date_type': mode.default_date_type,
|
||||
'payment_mode': mode.default_payment_mode,
|
||||
@@ -55,10 +60,11 @@ class AccountPaymentLineCreate(models.TransientModel):
|
||||
def _prepare_move_line_domain(self):
|
||||
self.ensure_one()
|
||||
journals = self.journal_ids or self.env['account.journal'].search([])
|
||||
domain = [('move_id.state', '=', 'posted'),
|
||||
('reconciled', '=', False),
|
||||
domain = [('reconciled', '=', False),
|
||||
('company_id', '=', self.order_id.company_id.id),
|
||||
('journal_id', 'in', journals.ids)]
|
||||
if self.target_move == 'posted':
|
||||
domain += [('move_id.state', '=', 'posted')]
|
||||
if self.date_type == 'due':
|
||||
domain += [
|
||||
'|',
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
widget="many2many_tags"
|
||||
placeholder="Keep empty for using all journals"/>
|
||||
<field name="payment_mode"/>
|
||||
<field name="target_move" widget="radio"/>
|
||||
<field name="invoice"/>
|
||||
<label string="Click on Add All Move Lines to auto-select the move lines matching the above criteria or click on Add an item to manually select the move lines filtered by the above criteria." colspan="2"/>
|
||||
<button name="populate" type="object" string="Add All Move Lines"/>
|
||||
|
||||
Reference in New Issue
Block a user