diff --git a/account_payment_order/i18n/account_payment_order.pot b/account_payment_order/i18n/account_payment_order.pot index 342442e9b..2bb780af6 100644 --- a/account_payment_order/i18n/account_payment_order.pot +++ b/account_payment_order/i18n/account_payment_order.pot @@ -345,6 +345,11 @@ msgstr "" msgid "Currency of the Payment Transaction" msgstr "" +#. module: account_payment_order +#: model_terms:ir.ui.view,arch_db:account_payment_order.print_account_payment_order_document +msgid "Debit Order" +msgstr "" + #. module: account_payment_order #: model:ir.actions.act_window,name:account_payment_order.account_payment_order_inbound_action #: model:ir.ui.menu,name:account_payment_order.account_payment_order_inbound_menu @@ -352,14 +357,14 @@ msgid "Debit Orders" msgstr "" #. module: account_payment_order -#: code:addons/account_payment_order/models/account_payment_order.py:449 +#: code:addons/account_payment_order/models/account_payment_order.py:458 #, python-format msgid "Debit bank line %s" msgstr "" #. module: account_payment_order #: code:addons/account_payment_order/models/account_payment_order.py:376 -#: code:addons/account_payment_order/models/account_payment_order.py:399 +#: code:addons/account_payment_order/models/account_payment_order.py:408 #, python-format msgid "Debit order %s" msgstr "" @@ -969,12 +974,8 @@ msgstr "" #: model:ir.model.fields,field_description:account_payment_order.field_account_payment_line__order_id #: model:ir.model.fields,field_description:account_payment_order.field_account_payment_line_create__order_id #: model_terms:ir.ui.view,arch_db:account_payment_order.account_payment_order_form -msgid "Payment Order" -msgstr "" - -#. module: account_payment_order #: model_terms:ir.ui.view,arch_db:account_payment_order.print_account_payment_order_document -msgid "Payment Order / Payment" +msgid "Payment Order" msgstr "" #. module: account_payment_order @@ -1005,7 +1006,7 @@ msgid "Payment Type" msgstr "" #. module: account_payment_order -#: code:addons/account_payment_order/models/account_payment_order.py:447 +#: code:addons/account_payment_order/models/account_payment_order.py:456 #, python-format msgid "Payment bank line %s" msgstr "" @@ -1017,7 +1018,7 @@ msgstr "" #. module: account_payment_order #: code:addons/account_payment_order/models/account_payment_order.py:374 -#: code:addons/account_payment_order/models/account_payment_order.py:397 +#: code:addons/account_payment_order/models/account_payment_order.py:406 #, python-format msgid "Payment order %s" msgstr "" diff --git a/account_payment_order/models/account_payment_order.py b/account_payment_order/models/account_payment_order.py index 04d6ea2b8..95ac5ffc7 100644 --- a/account_payment_order/models/account_payment_order.py +++ b/account_payment_order/models/account_payment_order.py @@ -386,6 +386,15 @@ class AccountPaymentOrder(models.Model): 'payment_order_id': self.id, 'line_ids': [], } + total_company_currency = total_payment_currency = 0 + for bline in bank_lines: + total_company_currency += bline.amount_company_currency + total_payment_currency += bline.amount_currency + partner_ml_vals = self._prepare_move_line_partner_account(bline) + vals['line_ids'].append((0, 0, partner_ml_vals)) + trf_ml_vals = self._prepare_move_line_offsetting_account( + total_company_currency, total_payment_currency, bank_lines) + vals['line_ids'].append((0, 0, trf_ml_vals)) return vals @api.multi @@ -472,16 +481,6 @@ class AccountPaymentOrder(models.Model): post_move = self.payment_mode_id.post_move am_obj = self.env['account.move'] mvals = self._prepare_move(blines) - total_company_currency = total_payment_currency = 0 - for bline in blines: - total_company_currency += bline.amount_company_currency - total_payment_currency += bline.amount_currency - partner_ml_vals = self._prepare_move_line_partner_account( - bline) - mvals['line_ids'].append((0, 0, partner_ml_vals)) - trf_ml_vals = self._prepare_move_line_offsetting_account( - total_company_currency, total_payment_currency, blines) - mvals['line_ids'].append((0, 0, trf_ml_vals)) move = am_obj.create(mvals) blines.reconcile_payment_lines() if post_move: