Skip to content

Commit

Permalink
[10.0] Add filter on partners on wizard "Create Payment Lines from Jo…
Browse files Browse the repository at this point in the history
…urnal Items" (OCA#489)

* Add filter on partners on wizard "Create Payment Lines from Journal Items"

* Bump version number
  • Loading branch information
Alexis de Lattre authored and pedrobaeza committed Mar 4, 2023
1 parent 14d8fea commit b7a4ada
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 11 deletions.
2 changes: 1 addition & 1 deletion account_payment_order/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

{
'name': 'Account Payment Order',
'version': '11.0.1.2.2',
'version': '11.0.1.3.0',
'license': 'AGPL-3',
'author': "ACSONE SA/NV, "
"Therp BV, "
Expand Down
20 changes: 15 additions & 5 deletions account_payment_order/i18n/account_payment_order.pot
Original file line number Diff line number Diff line change
Expand Up @@ -342,14 +342,14 @@ msgid "Debit Orders"
msgstr ""

#. module: account_payment_order
#: code:addons/account_payment_order/models/account_payment_order.py:442
#: code:addons/account_payment_order/models/account_payment_order.py:444
#, python-format
msgid "Debit bank line %s"
msgstr ""

#. module: account_payment_order
#: code:addons/account_payment_order/models/account_payment_order.py:371
#: code:addons/account_payment_order/models/account_payment_order.py:392
#: code:addons/account_payment_order/models/account_payment_order.py:394
#, python-format
msgid "Debit order %s"
msgstr ""
Expand Down Expand Up @@ -575,6 +575,11 @@ msgstr ""
msgid "Keep empty for using all journals"
msgstr ""

#. module: account_payment_order
#: model:ir.ui.view,arch_db:account_payment_order.account_payment_line_create_form
msgid "Keep empty to use all partners"
msgstr ""

#. module: account_payment_order
#: model:ir.model.fields,help:account_payment_order.field_account_payment_line_communication
msgid "Label of the payment that will be seen by the destinee"
Expand Down Expand Up @@ -778,6 +783,11 @@ msgstr ""
msgid "Partner Bank Account"
msgstr ""

#. module: account_payment_order
#: model:ir.model.fields,field_description:account_payment_order.field_account_payment_line_create_partner_ids
msgid "Partners"
msgstr ""

#. module: account_payment_order
#: model:ir.model.fields,help:account_payment_order.field_account_payment_mode_transfer_account_id
msgid "Pay off lines in 'file uploaded' payment orders with a move on this account. You can only select accounts that are marked for reconciliation"
Expand Down Expand Up @@ -878,7 +888,7 @@ msgid "Payment Type"
msgstr ""

#. module: account_payment_order
#: code:addons/account_payment_order/models/account_payment_order.py:440
#: code:addons/account_payment_order/models/account_payment_order.py:442
#, python-format
msgid "Payment bank line %s"
msgstr ""
Expand All @@ -890,7 +900,7 @@ msgstr ""

#. module: account_payment_order
#: code:addons/account_payment_order/models/account_payment_order.py:369
#: code:addons/account_payment_order/models/account_payment_order.py:390
#: code:addons/account_payment_order/models/account_payment_order.py:392
#, python-format
msgid "Payment order %s"
msgstr ""
Expand Down Expand Up @@ -937,7 +947,7 @@ msgid "Search Payment Orders"
msgstr ""

#. module: account_payment_order
#: code:addons/account_payment_order/wizard/account_payment_line_create.py:126
#: code:addons/account_payment_order/wizard/account_payment_line_create.py:130
#, python-format
msgid "Select Move Lines to Create Transactions"
msgstr ""
Expand Down
12 changes: 8 additions & 4 deletions account_payment_order/wizard/account_payment_line_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ class AccountPaymentLineCreate(models.TransientModel):
'account.payment.order', string='Payment Order')
journal_ids = fields.Many2many(
'account.journal', string='Journals Filter')
partner_ids = fields.Many2many(
'res.partner', string='Partners', domain=[('parent_id', '=', False)])
target_move = fields.Selection([
('posted', 'All Posted Entries'),
('all', 'All Entries'),
Expand Down Expand Up @@ -61,10 +63,12 @@ def default_get(self, field_list):
@api.multi
def _prepare_move_line_domain(self):
self.ensure_one()
journals = self.journal_ids or self.env['account.journal'].search([])
domain = [('reconciled', '=', False),
('company_id', '=', self.order_id.company_id.id),
('journal_id', 'in', journals.ids)]
('company_id', '=', self.order_id.company_id.id)]
if self.journal_ids:
domain += [('journal_id', 'in', self.journal_ids.ids)]
if self.partner_ids:
domain += [('partner_id', 'in', self.partner_ids.ids)]
if self.target_move == 'posted':
domain += [('move_id.state', '=', 'posted')]
if not self.allow_blocked:
Expand Down Expand Up @@ -135,7 +139,7 @@ def populate(self):

@api.onchange(
'date_type', 'move_date', 'due_date', 'journal_ids', 'invoice',
'target_move', 'allow_blocked', 'payment_mode')
'target_move', 'allow_blocked', 'payment_mode', 'partner_ids')
def move_line_filters_change(self):
domain = self._prepare_move_line_domain()
res = {'domain': {'move_line_ids': domain}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@
<field name="due_date" attrs="{'required': [('date_type', '=', 'due')], 'invisible': [('date_type', '!=', 'due')]}"/>
<field name="journal_ids"
widget="many2many_tags"
placeholder="Keep empty for using all journals"/>
placeholder="Keep empty for using all journals"/>
<field name="partner_ids"
widget="many2many_tags"
placeholder="Keep empty to use all partners"/>
<field name="payment_mode"/>
<field name="target_move" widget="radio"/>
<field name="invoice"/>
Expand Down

0 comments on commit b7a4ada

Please sign in to comment.