From ed94f2b9af41889fa835f69a3504a09aa50f453d Mon Sep 17 00:00:00 2001 From: mymage Date: Fri, 15 Mar 2024 13:20:48 +0000 Subject: [PATCH 01/12] Translated using Weblate (Italian) Currently translated at 100.0% (229 of 229 strings) Translation: purchase-workflow-17.0/purchase-workflow-17.0-purchase_request Translate-URL: https://translation.odoo-community.org/projects/purchase-workflow-17-0/purchase-workflow-17-0-purchase_request/it/ --- procurement_purchase_no_grouping/i18n/it.po | 8 ++- purchase_request/i18n/it.po | 66 ++++++++++----------- 2 files changed, 40 insertions(+), 34 deletions(-) diff --git a/procurement_purchase_no_grouping/i18n/it.po b/procurement_purchase_no_grouping/i18n/it.po index 1f6d9d0ee8c..ac26d454dce 100644 --- a/procurement_purchase_no_grouping/i18n/it.po +++ b/procurement_purchase_no_grouping/i18n/it.po @@ -9,7 +9,7 @@ msgstr "" "Project-Id-Version: Odoo Server 10.0\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2017-11-24 07:53+0000\n" -"PO-Revision-Date: 2024-03-05 14:35+0000\n" +"PO-Revision-Date: 2024-03-18 09:37+0000\n" "Last-Translator: mymage \n" "Language-Team: Italian (https://www.transifex.com/oca/teams/23907/it/)\n" "Language: it\n" @@ -29,6 +29,12 @@ msgid "" "role=\"img\">\n" " " msgstr "" +"Raggruppamento\n" +" \n" +" " #. module: procurement_purchase_no_grouping #: model:ir.model,name:procurement_purchase_no_grouping.model_res_company diff --git a/purchase_request/i18n/it.po b/purchase_request/i18n/it.po index 6d7caa4296c..0c997922021 100644 --- a/purchase_request/i18n/it.po +++ b/purchase_request/i18n/it.po @@ -12,7 +12,7 @@ msgstr "" "Project-Id-Version: purchase-workflow (10.0)\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2016-11-17 03:38+0000\n" -"PO-Revision-Date: 2024-02-14 16:40+0000\n" +"PO-Revision-Date: 2024-03-19 18:37+0000\n" "Last-Translator: mymage \n" "Language-Team: Italian (http://www.transifex.com/oca/" "OCA-purchase-workflow-10-0/language/it/)\n" @@ -124,13 +124,13 @@ msgid "" "Request Reference:\n" "
" msgstr "" -"Riferimento Richiesta:\n" +"Riferimento richiesta:\n" "
" #. module: purchase_request #: model_terms:ir.ui.view,arch_db:purchase_request.report_purchase_request msgid "Requested Date" -msgstr "Data Richiesta" +msgstr "Data richiesta" #. module: purchase_request #: model_terms:ir.ui.view,arch_db:purchase_request.report_purchase_request @@ -162,7 +162,7 @@ msgid "" " a certain quantity of materials services, so that they are\n" " available at a certain point in time." msgstr "" -"Una richiesta di acquisto è un'istruzione all'Acquisto per procurarsi\n" +"Una richiesta di acquisto è un'istruzione all'ufficio acquisti di procurare\n" " una determinata quantità di servizi materiali, in modo che " "siano\n" " disponibili in un determinato momento." @@ -317,8 +317,8 @@ msgid "" "Check this box to generate Purchase Request instead of generating Requests " "For Quotation from procurement." msgstr "" -"Selezionare questa casella per generare una Richiesta d'Acquisto invece di " -"generare Richieste di Preventivo dall'approvvigionamento." +"Selezionare questa casella per generare una richiesta di acquisto invece di " +"generare richieste di preventivo dall'approvvigionamento." #. module: purchase_request #: model_terms:ir.actions.act_window,help:purchase_request.purchase_request_form_action @@ -352,12 +352,12 @@ msgstr "Copia le descrizioni in un nuovo ordine d'acquisto" #: model_terms:ir.ui.view,arch_db:purchase_request.view_purchase_request_form #: model_terms:ir.ui.view,arch_db:purchase_request.view_purchase_request_line_make_purchase_order msgid "Create RFQ" -msgstr "Crea Richiesta di preventivo" +msgstr "Crea RdP" #. module: purchase_request #: model:ir.model.fields,field_description:purchase_request.field_stock_move__created_purchase_request_line_id msgid "Created Purchase Request Line" -msgstr "Linea Richiesta d'Acquisto Creata" +msgstr "Riga richiesta di acquisto creata" #. module: purchase_request #: model:ir.model.fields,field_description:purchase_request.field_purchase_request__create_uid @@ -460,8 +460,8 @@ msgstr "Costo Stimato" #: model:ir.model.fields,help:purchase_request.field_purchase_request_line__estimated_cost msgid "Estimated cost of Purchase Request Line, not propagated to PO." msgstr "" -"Costo stimato della Riga della Richiesta d'Acquisto, non esteso all'Ordine " -"d'Acquisto." +"Costo stimato della riga della richiesta di acquisto, non esteso all'ordine " +"di acquisto." #. module: purchase_request #: model_terms:ir.ui.view,arch_db:purchase_request.view_purchase_request_line_make_purchase_order @@ -847,14 +847,14 @@ msgstr "Richiesta di acquisto" #: code:addons/purchase_request/models/purchase_order.py:0 #, python-format msgid "Purchase Request %s has already been completed" -msgstr "La Richiesta di Acquisto %s è già stata completata" +msgstr "La richiesta di acquisto %s è già stata completata" #. module: purchase_request #. odoo-python #: code:addons/purchase_request/wizard/purchase_request_line_make_purchase_order.py:0 #, python-format msgid "Purchase Request %s is not approved" -msgstr "La Richiesta d'Acquisto %s non è approvata" +msgstr "La richiesta di acquisto %s non è approvata" #. module: purchase_request #: model:ir.model,name:purchase_request.model_purchase_request_allocation @@ -862,12 +862,12 @@ msgstr "La Richiesta d'Acquisto %s non è approvata" #: model:ir.model.fields,field_description:purchase_request.field_purchase_request_line__purchase_request_allocation_ids #: model:ir.model.fields,field_description:purchase_request.field_stock_move__purchase_request_allocation_ids msgid "Purchase Request Allocation" -msgstr "Allocazione Richiesta d'Acquisto" +msgstr "Allocazione richiesta di acquisto" #. module: purchase_request #: model_terms:ir.ui.view,arch_db:purchase_request.view_move_form msgid "Purchase Request Allocations" -msgstr "Allocazioni Richiesta d'Acquisto" +msgstr "Allocazioni richiesta di acquisto" #. module: purchase_request #: model:ir.model,name:purchase_request.model_purchase_request_line @@ -875,7 +875,7 @@ msgstr "Allocazioni Richiesta d'Acquisto" #: model:ir.model.fields,field_description:purchase_request.field_purchase_request_line_make_purchase_order_item__line_id #: model_terms:ir.ui.view,arch_db:purchase_request.purchase_request_line_form msgid "Purchase Request Line" -msgstr "Linea Richiesta d'Acquisto" +msgstr "Riga richiesta di acquisto" #. module: purchase_request #: model:ir.model,name:purchase_request.model_purchase_request_line_make_purchase_order @@ -903,45 +903,45 @@ msgstr "Conteggio righe richiesta di acquisto" #: model_terms:ir.ui.view,arch_db:purchase_request.purchase_order_line_form2_sub #, python-format msgid "Purchase Request Lines" -msgstr "Linee Richiesta d'Acquisto" +msgstr "Righe richieste di acquisto" #. module: purchase_request #: model:res.groups,name:purchase_request.group_purchase_request_manager msgid "Purchase Request Manager" -msgstr "Manager Richiesta d'Acquisto" +msgstr "Responsabile richiesta di acquisto" #. module: purchase_request #: model:res.groups,name:purchase_request.group_purchase_request_user msgid "Purchase Request User" -msgstr "Utente Richiesta d'Acquisto" +msgstr "Utente richiesta di acquisto" #. module: purchase_request #: model:mail.message.subtype,description:purchase_request.mt_request_approved #: model:mail.message.subtype,name:purchase_request.mt_request_approved msgid "Purchase Request approved" -msgstr "Richiesta d'Acquisto approvata" +msgstr "Richiesta di acquisto approvata" #. module: purchase_request #: model:mail.message.subtype,name:purchase_request.mt_request_done msgid "Purchase Request done" -msgstr "Richiesta Acquisto completata" +msgstr "Richiesta di acquisto completata" #. module: purchase_request #: model:mail.message.subtype,description:purchase_request.mt_request_done msgid "Purchase Request is done" -msgstr "La Richiesta d'Acquisto è completata" +msgstr "La richiesta di acquisto è completata" #. module: purchase_request #: model:mail.message.subtype,description:purchase_request.mt_request_rejected #: model:mail.message.subtype,name:purchase_request.mt_request_rejected msgid "Purchase Request rejected" -msgstr "Richiesta d'Acquisto rifiutata" +msgstr "Richiesta di acquisto rifiutata" #. module: purchase_request #: model:mail.message.subtype,description:purchase_request.mt_request_to_approve #: model:mail.message.subtype,name:purchase_request.mt_request_to_approve msgid "Purchase Request to be approved" -msgstr "Richiesta d'Acquisto in approvazione" +msgstr "Richiesta di acquisto da approvare" #. module: purchase_request #: model:ir.actions.act_window,name:purchase_request.action_purchase_request_line_product_tree @@ -952,7 +952,7 @@ msgstr "Richiesta d'Acquisto in approvazione" #: model:ir.ui.menu,name:purchase_request.menu_purchase_request_pro_mgt #: model:ir.ui.menu,name:purchase_request.parent_menu_purchase_request msgid "Purchase Requests" -msgstr "Richieste d'Acquisto" +msgstr "Richieste di acquisto" #. module: purchase_request #: model:ir.model.fields,field_description:purchase_request.field_purchase_request_line__purchase_state @@ -1053,7 +1053,7 @@ msgstr "" #: code:addons/purchase_request/models/stock_move_line.py:0 #, python-format msgid "Receipt confirmation for Request %s" -msgstr "Ricevuta di conferma per la Richiesta %s" +msgstr "Ricevuta di conferma per la richiesta %s" #. module: purchase_request #: model_terms:ir.ui.view,arch_db:purchase_request.view_purchase_request_form @@ -1086,18 +1086,18 @@ msgstr "Righe richiesta" #. module: purchase_request #: model:ir.model.fields,field_description:purchase_request.field_purchase_request__name msgid "Request Reference" -msgstr "Riferimento Richiesta" +msgstr "Riferimento richiesta" #. module: purchase_request #: model_terms:ir.ui.view,arch_db:purchase_request.view_purchase_request_form msgid "Request approval" -msgstr "Approvazione Richiesta" +msgstr "Approvazione richiesta" #. module: purchase_request #: model_terms:ir.ui.view,arch_db:purchase_request.purchase_request_line_search #: model_terms:ir.ui.view,arch_db:purchase_request.view_purchase_request_search msgid "Request is approved" -msgstr "La Richiesta è approvata" +msgstr "La richiesta è approvata" #. module: purchase_request #: model_terms:ir.ui.view,arch_db:purchase_request.view_purchase_request_search @@ -1108,13 +1108,13 @@ msgstr "La richiesta è completata" #: model_terms:ir.ui.view,arch_db:purchase_request.purchase_request_line_search #: model_terms:ir.ui.view,arch_db:purchase_request.view_purchase_request_search msgid "Request is rejected" -msgstr "La Richiesta è rifiutata" +msgstr "La richiesta è rifiutata" #. module: purchase_request #: model_terms:ir.ui.view,arch_db:purchase_request.purchase_request_line_search #: model_terms:ir.ui.view,arch_db:purchase_request.view_purchase_request_search msgid "Request is to be approved" -msgstr "La Richiesta è in approvazione" +msgstr "La richiesta è in approvazione" #. module: purchase_request #: model:ir.model.fields,field_description:purchase_request.field_purchase_request_line__request_state @@ -1124,7 +1124,7 @@ msgstr "Stato richiesta" #. module: purchase_request #: model_terms:ir.ui.view,arch_db:purchase_request.purchase_request_line_search msgid "Request status" -msgstr "Stato Richiesta" +msgstr "Stato richiesta" #. module: purchase_request #: model:ir.model.fields,field_description:purchase_request.field_purchase_request__requested_by @@ -1146,7 +1146,7 @@ msgstr "Richiesta da" #. module: purchase_request #: model_terms:ir.ui.view,arch_db:purchase_request.purchase_request_line_search msgid "Requested for Quotation" -msgstr "Richiesta Offerta" +msgstr "Richiesta per offerta" #. module: purchase_request #: model_terms:ir.ui.view,arch_db:purchase_request.view_purchase_request_form @@ -1496,7 +1496,7 @@ msgstr "Bisogna selezionare le righe dallo stesso tipo di prelievo." #: code:addons/purchase_request/wizard/purchase_request_line_make_purchase_order.py:0 #, python-format msgid "You have to select lines from the same company." -msgstr "Devi selezionare le righe della stessa azienda." +msgstr "Bisogna selezionare le righe della stessa azienda." #~ msgid "Last Modified on" #~ msgstr "Ultima modifica il" From 79042dbca78231488184c95e057b720208fe0459 Mon Sep 17 00:00:00 2001 From: Mateu Griful Date: Tue, 13 Jul 2021 15:46:42 +0200 Subject: [PATCH 02/12] [ADD] purchase_advance_payment --- purchase_advance_payment/__init__.py | 2 + purchase_advance_payment/__manifest__.py | 19 ++ purchase_advance_payment/models/__init__.py | 2 + purchase_advance_payment/models/payment.py | 16 ++ .../models/purchase_order.py | 86 +++++++ .../readme/CONTRIBUTORS.rst | 2 + .../readme/DESCRIPTION.rst | 3 + purchase_advance_payment/readme/USAGE.rst | 8 + .../security/ir.model.access.csv | 4 + purchase_advance_payment/tests/__init__.py | 1 + .../tests/test_purchase_advance_payment.py | 218 ++++++++++++++++++ .../views/purchase_view.xml | 96 ++++++++ purchase_advance_payment/wizard/__init__.py | 1 + .../wizard/purchase_advance_payment_wizard.py | 128 ++++++++++ .../purchase_advance_payment_wizard_view.xml | 53 +++++ 15 files changed, 639 insertions(+) create mode 100644 purchase_advance_payment/__init__.py create mode 100644 purchase_advance_payment/__manifest__.py create mode 100644 purchase_advance_payment/models/__init__.py create mode 100644 purchase_advance_payment/models/payment.py create mode 100644 purchase_advance_payment/models/purchase_order.py create mode 100644 purchase_advance_payment/readme/CONTRIBUTORS.rst create mode 100644 purchase_advance_payment/readme/DESCRIPTION.rst create mode 100644 purchase_advance_payment/readme/USAGE.rst create mode 100644 purchase_advance_payment/security/ir.model.access.csv create mode 100644 purchase_advance_payment/tests/__init__.py create mode 100644 purchase_advance_payment/tests/test_purchase_advance_payment.py create mode 100644 purchase_advance_payment/views/purchase_view.xml create mode 100644 purchase_advance_payment/wizard/__init__.py create mode 100644 purchase_advance_payment/wizard/purchase_advance_payment_wizard.py create mode 100644 purchase_advance_payment/wizard/purchase_advance_payment_wizard_view.xml diff --git a/purchase_advance_payment/__init__.py b/purchase_advance_payment/__init__.py new file mode 100644 index 00000000000..9b4296142f4 --- /dev/null +++ b/purchase_advance_payment/__init__.py @@ -0,0 +1,2 @@ +from . import models +from . import wizard diff --git a/purchase_advance_payment/__manifest__.py b/purchase_advance_payment/__manifest__.py new file mode 100644 index 00000000000..01e76a79c09 --- /dev/null +++ b/purchase_advance_payment/__manifest__.py @@ -0,0 +1,19 @@ +# Copyright (C) 2021 ForgeFlow S.L. +# License AGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html) + +{ + "name": "Purchase Advance Payment", + "version": "14.0.1.0.0", + "author": "Forgeflow, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/purchase-workflow", + "category": "Purchase", + "license": "AGPL-3", + "summary": "Allow to add advance payments on purchase orders", + "depends": ["purchase"], + "data": [ + "wizard/purchase_advance_payment_wizard_view.xml", + "views/purchase_view.xml", + "security/ir.model.access.csv", + ], + "installable": True, +} diff --git a/purchase_advance_payment/models/__init__.py b/purchase_advance_payment/models/__init__.py new file mode 100644 index 00000000000..2a7a713d96d --- /dev/null +++ b/purchase_advance_payment/models/__init__.py @@ -0,0 +1,2 @@ +from . import payment +from . import purchase_order diff --git a/purchase_advance_payment/models/payment.py b/purchase_advance_payment/models/payment.py new file mode 100644 index 00000000000..3b6473ed6af --- /dev/null +++ b/purchase_advance_payment/models/payment.py @@ -0,0 +1,16 @@ +# Copyright (C) 2021 ForgeFlow S.L. +# License AGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html) + +from odoo import fields, models + + +class AccountPayment(models.Model): + + _inherit = "account.payment" + + purchase_id = fields.Many2one( + "purchase.order", + "Purchase", + readonly=True, + states={"draft": [("readonly", False)]}, + ) diff --git a/purchase_advance_payment/models/purchase_order.py b/purchase_advance_payment/models/purchase_order.py new file mode 100644 index 00000000000..e4f025d669e --- /dev/null +++ b/purchase_advance_payment/models/purchase_order.py @@ -0,0 +1,86 @@ +# Copyright (C) 2021 ForgeFlow S.L. +# License AGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html) + +from odoo import api, fields, models +from odoo.tools import float_compare + + +class PurchaseOrder(models.Model): + + _inherit = "purchase.order" + + account_payment_ids = fields.One2many( + "account.payment", "purchase_id", string="Pay purchase advanced", readonly=True + ) + amount_residual = fields.Float( + "Residual amount", + readonly=True, + compute="_compute_purchase_advance_payment", + store=True, + ) + payment_line_ids = fields.Many2many( + "account.move.line", + string="Payment move lines", + compute="_compute_purchase_advance_payment", + store=True, + ) + advance_payment_status = fields.Selection( + selection=[ + ("not_paid", "Not Paid"), + ("paid", "Paid"), + ("partial", "Partially Paid"), + ], + string="Advance Payment Status", + store=True, + readonly=True, + copy=False, + tracking=True, + compute="_compute_purchase_advance_payment", + ) + + @api.depends( + "currency_id", + "company_id", + "amount_total", + "account_payment_ids", + "account_payment_ids.state", + "account_payment_ids.move_id", + "account_payment_ids.move_id.line_ids", + "account_payment_ids.move_id.line_ids.date", + "account_payment_ids.move_id.line_ids.debit", + "account_payment_ids.move_id.line_ids.credit", + "account_payment_ids.move_id.line_ids.currency_id", + "account_payment_ids.move_id.line_ids.amount_currency", + ) + def _compute_purchase_advance_payment(self): + for order in self: + mls = order.account_payment_ids.mapped("move_id.line_ids").filtered( + lambda x: x.account_id.internal_type == "payable" + and x.parent_state == "posted" + ) + advance_amount = 0.0 + for line in mls: + line_currency = line.currency_id or line.company_id.currency_id + line_amount = line.amount_currency if line.currency_id else line.balance + if line_currency != order.currency_id: + advance_amount += line.currency_id._convert( + line_amount, + order.currency_id, + order.company_id, + line.date or fields.Date.today(), + ) + else: + advance_amount += line_amount + amount_residual = order.amount_total - advance_amount + payment_state = "not_paid" + if mls: + has_due_amount = float_compare( + amount_residual, 0.0, precision_rounding=order.currency_id.rounding + ) + if has_due_amount <= 0: + payment_state = "paid" + elif has_due_amount > 0: + payment_state = "partial" + order.payment_line_ids = mls + order.amount_residual = amount_residual + order.advance_payment_status = payment_state diff --git a/purchase_advance_payment/readme/CONTRIBUTORS.rst b/purchase_advance_payment/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000000..087dd29233f --- /dev/null +++ b/purchase_advance_payment/readme/CONTRIBUTORS.rst @@ -0,0 +1,2 @@ +* Mateu Griful +* Lois Rilo diff --git a/purchase_advance_payment/readme/DESCRIPTION.rst b/purchase_advance_payment/readme/DESCRIPTION.rst new file mode 100644 index 00000000000..2509a323453 --- /dev/null +++ b/purchase_advance_payment/readme/DESCRIPTION.rst @@ -0,0 +1,3 @@ +The module allows to add advance payments on purchase orders and Request +for Quotation. The advance payments are allowed even before confirmation +and before starting the billing process. diff --git a/purchase_advance_payment/readme/USAGE.rst b/purchase_advance_payment/readme/USAGE.rst new file mode 100644 index 00000000000..df9904e8b23 --- /dev/null +++ b/purchase_advance_payment/readme/USAGE.rst @@ -0,0 +1,8 @@ +To use this module, you need to: + +* Go to a purchase order. +* Click on "Pay Purchase Advance". +* Select the Journal and specify the amount of the advanced payment. +* "Make Advance Payment". + +When generating the invoice, the system displays the advanced payments, select those you want to add to the invoice. diff --git a/purchase_advance_payment/security/ir.model.access.csv b/purchase_advance_payment/security/ir.model.access.csv new file mode 100644 index 00000000000..a432eb67dbf --- /dev/null +++ b/purchase_advance_payment/security/ir.model.access.csv @@ -0,0 +1,4 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_account_payment_purchase_advance,account.payment purchase_advance,account.model_account_payment,purchase.group_purchase_user,1,1,1,0 +access_account_payment_method_purchase_advance,account.payment.method purchase_advance,account.model_account_payment_method,purchase.group_purchase_user,1,0,0,0 +access_account_voucher_wizard_purchase_advance,access_account_voucher_wizard_purchase_advance,model_account_voucher_wizard_purchase,purchase.group_purchase_user,1,1,1,0 diff --git a/purchase_advance_payment/tests/__init__.py b/purchase_advance_payment/tests/__init__.py new file mode 100644 index 00000000000..beeea01aff5 --- /dev/null +++ b/purchase_advance_payment/tests/__init__.py @@ -0,0 +1 @@ +from . import test_purchase_advance_payment diff --git a/purchase_advance_payment/tests/test_purchase_advance_payment.py b/purchase_advance_payment/tests/test_purchase_advance_payment.py new file mode 100644 index 00000000000..665a9cf21de --- /dev/null +++ b/purchase_advance_payment/tests/test_purchase_advance_payment.py @@ -0,0 +1,218 @@ +# Copyright (C) 2021 ForgeFlow S.L. +# License AGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html) + + +from odoo.exceptions import ValidationError +from odoo.tests import common + + +class TestPurchaseAdvancePayment(common.SavepointCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + + # Partners + cls.res_partner_1 = cls.env["res.partner"].create({"name": "Wood Corner"}) + cls.res_partner_address_1 = cls.env["res.partner"].create( + {"name": "Willie Burke", "parent_id": cls.res_partner_1.id} + ) + cls.res_partner_2 = cls.env["res.partner"].create({"name": "Partner 12"}) + + # Products + cls.product_1 = cls.env["product.product"].create( + {"name": "Desk Combination", "type": "consu", "purchase_method": "purchase"} + ) + cls.product_2 = cls.env["product.product"].create( + {"name": "Conference Chair", "type": "consu", "purchase_method": "purchase"} + ) + cls.product_3 = cls.env["product.product"].create( + { + "name": "Repair Services", + "type": "service", + "purchase_method": "purchase", + } + ) + + cls.tax = cls.env["account.tax"].create( + { + "name": "Tax 20", + "type_tax_use": "purchase", + "amount": 20, + } + ) + + # purchase Order + cls.purchase_order_1 = cls.env["purchase.order"].create( + {"partner_id": cls.res_partner_1.id} + ) + cls.order_line_1 = cls.env["purchase.order.line"].create( + { + "order_id": cls.purchase_order_1.id, + "product_id": cls.product_1.id, + "product_uom": cls.product_1.uom_id.id, + "product_qty": 10.0, + "price_unit": 100.0, + "taxes_id": cls.tax, + } + ) + cls.order_line_2 = cls.env["purchase.order.line"].create( + { + "order_id": cls.purchase_order_1.id, + "product_id": cls.product_2.id, + "product_uom": cls.product_2.uom_id.id, + "product_qty": 25.0, + "price_unit": 40.0, + "taxes_id": cls.tax, + } + ) + cls.order_line_3 = cls.env["purchase.order.line"].create( + { + "order_id": cls.purchase_order_1.id, + "product_id": cls.product_3.id, + "product_uom": cls.product_3.uom_id.id, + "product_qty": 20.0, + "price_unit": 50.0, + "taxes_id": cls.tax, + } + ) + + cls.currency_euro = cls.env["res.currency"].search([("name", "=", "EUR")]) + cls.currency_usd = cls.env["res.currency"].search([("name", "=", "USD")]) + cls.currency_rate = cls.env["res.currency.rate"].create( + { + "rate": 1.20, + "currency_id": cls.currency_usd.id, + } + ) + + cls.journal_eur_bank = cls.env["account.journal"].create( + { + "name": "Journal Euro Bank", + "type": "bank", + "code": "111", + "currency_id": cls.currency_euro.id, + } + ) + + cls.journal_usd_bank = cls.env["account.journal"].create( + { + "name": "Journal USD Bank", + "type": "bank", + "code": "222", + "currency_id": cls.currency_usd.id, + } + ) + cls.journal_eur_cash = cls.env["account.journal"].create( + { + "name": "Journal Euro Cash", + "type": "cash", + "code": "333", + "currency_id": cls.currency_euro.id, + } + ) + + cls.journal_usd_cash = cls.env["account.journal"].create( + { + "name": "Journal USD Cash", + "type": "cash", + "code": "444", + "currency_id": cls.currency_usd.id, + } + ) + + def test_purchase_advance_payment(self): + self.assertEqual( + self.purchase_order_1.amount_residual, + 3600, + ) + self.assertEqual( + self.purchase_order_1.amount_residual, + self.purchase_order_1.amount_total, + "Amounts should match", + ) + + context_payment = { + "active_ids": [self.purchase_order_1.id], + "active_id": self.purchase_order_1.id, + } + + # Check residual > advance payment and the comparison takes + # into account the currency. 3001*1.2 > 3600 + with self.assertRaises(ValidationError): + advance_payment_0 = ( + self.env["account.voucher.wizard.purchase"] + .with_context(context_payment) + .create( + { + "journal_id": self.journal_eur_bank.id, + "amount_advance": 3001, + "order_id": self.purchase_order_1.id, + } + ) + ) + advance_payment_0.make_advance_payment() + + # Create Advance Payment 1 - EUR - bank + advance_payment_1 = ( + self.env["account.voucher.wizard.purchase"] + .with_context(context_payment) + .create( + { + "journal_id": self.journal_eur_bank.id, + "amount_advance": 100, + "order_id": self.purchase_order_1.id, + } + ) + ) + advance_payment_1.make_advance_payment() + + self.assertEqual(self.purchase_order_1.amount_residual, 3480) + + # Create Advance Payment 2 - USD - cash + advance_payment_2 = ( + self.env["account.voucher.wizard.purchase"] + .with_context(context_payment) + .create( + { + "journal_id": self.journal_usd_cash.id, + "amount_advance": 200, + "order_id": self.purchase_order_1.id, + } + ) + ) + advance_payment_2.make_advance_payment() + + self.assertEqual(self.purchase_order_1.amount_residual, 3280) + + # Confirm Purchase Order + self.purchase_order_1.button_confirm() + + # Create Advance Payment 3 - EUR - cash + advance_payment_3 = ( + self.env["account.voucher.wizard.purchase"] + .with_context(context_payment) + .create( + { + "journal_id": self.journal_eur_cash.id, + "amount_advance": 250, + "order_id": self.purchase_order_1.id, + } + ) + ) + advance_payment_3.make_advance_payment() + self.assertEqual(self.purchase_order_1.amount_residual, 2980) + + # Create Advance Payment 4 - USD - bank + advance_payment_4 = ( + self.env["account.voucher.wizard.purchase"] + .with_context(context_payment) + .create( + { + "journal_id": self.journal_usd_bank.id, + "amount_advance": 400, + "order_id": self.purchase_order_1.id, + } + ) + ) + advance_payment_4.make_advance_payment() + self.assertEqual(self.purchase_order_1.amount_residual, 2580) diff --git a/purchase_advance_payment/views/purchase_view.xml b/purchase_advance_payment/views/purchase_view.xml new file mode 100644 index 00000000000..44d8e6e9fb8 --- /dev/null +++ b/purchase_advance_payment/views/purchase_view.xml @@ -0,0 +1,96 @@ + + + + purchase.order.form + purchase.order + + + + + + + + + + + + + + + + + purchase.order.view.tree + purchase.order + + + + + + + + + + + + + purchase.order.inherit.purchase.order.tree + purchase.order + + + + + + + + + + + + diff --git a/purchase_advance_payment/wizard/__init__.py b/purchase_advance_payment/wizard/__init__.py new file mode 100644 index 00000000000..875157a0fda --- /dev/null +++ b/purchase_advance_payment/wizard/__init__.py @@ -0,0 +1 @@ +from . import purchase_advance_payment_wizard diff --git a/purchase_advance_payment/wizard/purchase_advance_payment_wizard.py b/purchase_advance_payment/wizard/purchase_advance_payment_wizard.py new file mode 100644 index 00000000000..0ef7fdc4fbd --- /dev/null +++ b/purchase_advance_payment/wizard/purchase_advance_payment_wizard.py @@ -0,0 +1,128 @@ +# Copyright (C) 2021 ForgeFlow S.L. +# License AGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html) + +from odoo import _, api, exceptions, fields, models +from odoo.tools import float_compare + + +class AccountVoucherWizardPurchase(models.TransientModel): + + _name = "account.voucher.wizard.purchase" + _description = "Account Voucher Wizard Purchase" + + order_id = fields.Many2one("purchase.order", required=True) + journal_id = fields.Many2one( + "account.journal", + "Journal", + required=True, + domain=[("type", "in", ("bank", "cash"))], + ) + journal_currency_id = fields.Many2one( + "res.currency", + "Journal Currency", + store=True, + readonly=False, + compute="_compute_get_journal_currency", + ) + currency_id = fields.Many2one("res.currency", "Currency", readonly=True) + amount_total = fields.Monetary("Amount total", readonly=True) + amount_advance = fields.Monetary( + "Amount advanced", required=True, currency_field="journal_currency_id" + ) + date = fields.Date("Date", required=True, default=fields.Date.context_today) + currency_amount = fields.Monetary( + "Curr. amount", readonly=True, currency_field="currency_id" + ) + payment_ref = fields.Char("Ref.") + + @api.depends("journal_id") + def _compute_get_journal_currency(self): + for wzd in self: + wzd.journal_currency_id = ( + wzd.journal_id.currency_id.id or self.env.user.company_id.currency_id.id + ) + + @api.constrains("amount_advance") + def check_amount(self): + if self.amount_advance <= 0: + raise exceptions.ValidationError(_("Amount of advance must be positive.")) + if self.env.context.get("active_id", False): + self.onchange_date() + if ( + float_compare( + self.currency_amount, + self.order_id.amount_residual, + precision_digits=2, + ) + > 0 + ): + raise exceptions.ValidationError( + _("Amount of advance is greater than residual amount on purchase") + ) + + @api.model + def default_get(self, fields_list): + res = super().default_get(fields_list) + purchase_ids = self.env.context.get("active_ids", []) + if not purchase_ids: + return res + purchase_id = fields.first(purchase_ids) + purchase = self.env["purchase.order"].browse(purchase_id) + if "amount_total" in fields_list: + res.update( + { + "order_id": purchase.id, + "amount_total": purchase.amount_residual, + "currency_id": purchase.currency_id.id, + } + ) + + return res + + @api.onchange("journal_id", "date", "amount_advance") + def onchange_date(self): + if self.journal_currency_id != self.currency_id: + amount_advance = self.journal_currency_id._convert( + self.amount_advance, + self.currency_id, + self.order_id.company_id, + self.date or fields.Date.today(), + ) + else: + amount_advance = self.amount_advance + self.currency_amount = amount_advance + + def _prepare_payment_vals(self, purchase): + partner_id = purchase.partner_id.id + return { + "date": self.date, + "amount": self.amount_advance, + "payment_type": "outbound", + "partner_type": "supplier", + "ref": self.payment_ref or purchase.name, + "journal_id": self.journal_id.id, + "currency_id": self.journal_currency_id.id, + "partner_id": partner_id, + "payment_method_id": self.env.ref( + "account.account_payment_method_manual_out" + ).id, + } + + def make_advance_payment(self): + """Create customer paylines and validates the payment""" + self.ensure_one() + payment_obj = self.env["account.payment"] + purchase_obj = self.env["purchase.order"] + + purchase_ids = self.env.context.get("active_ids", []) + if purchase_ids: + purchase_id = fields.first(purchase_ids) + purchase = purchase_obj.browse(purchase_id) + payment_vals = self._prepare_payment_vals(purchase) + payment = payment_obj.create(payment_vals) + purchase.account_payment_ids |= payment + payment.action_post() + + return { + "type": "ir.actions.act_window_close", + } diff --git a/purchase_advance_payment/wizard/purchase_advance_payment_wizard_view.xml b/purchase_advance_payment/wizard/purchase_advance_payment_wizard_view.xml new file mode 100644 index 00000000000..41c4d5b3f45 --- /dev/null +++ b/purchase_advance_payment/wizard/purchase_advance_payment_wizard_view.xml @@ -0,0 +1,53 @@ + + + + Advance Payment + account.voucher.wizard.purchase + form + +
+ + + + + + + + + + + + + + + + +
+
+
+
+
+ + Advance Payment + ir.actions.act_window + account.voucher.wizard.purchase + form + new + +
From 5b77effc840072be4a580e528c373e2417a7f50b Mon Sep 17 00:00:00 2001 From: Lois Rilo Date: Wed, 3 Nov 2021 15:11:49 +0100 Subject: [PATCH 03/12] [IMP] purchase_advance_payment: consider payments in PO bills to compute residual. --- purchase_advance_payment/README.rst | 88 ++++ .../i18n/purchase_advance_payment.pot | 221 +++++++++ .../models/purchase_order.py | 13 +- .../static/description/index.html | 434 ++++++++++++++++++ .../tests/test_purchase_advance_payment.py | 52 ++- .../views/purchase_view.xml | 2 +- 6 files changed, 806 insertions(+), 4 deletions(-) create mode 100644 purchase_advance_payment/README.rst create mode 100644 purchase_advance_payment/i18n/purchase_advance_payment.pot create mode 100644 purchase_advance_payment/static/description/index.html diff --git a/purchase_advance_payment/README.rst b/purchase_advance_payment/README.rst new file mode 100644 index 00000000000..dc3ab94c339 --- /dev/null +++ b/purchase_advance_payment/README.rst @@ -0,0 +1,88 @@ +======================== +Purchase Advance Payment +======================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fpurchase--workflow-lightgray.png?logo=github + :target: https://github.com/OCA/purchase-workflow/tree/14.0/purchase_advance_payment + :alt: OCA/purchase-workflow +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/purchase-workflow-14-0/purchase-workflow-14-0-purchase_advance_payment + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/142/14.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +The module allows to add advance payments on purchase orders and Request +for Quotation. The advance payments are allowed even before confirmation +and before starting the billing process. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +To use this module, you need to: + +* Go to a purchase order. +* Click on "Pay Purchase Advance". +* Select the Journal and specify the amount of the advanced payment. +* "Make Advance Payment". + +When generating the invoice, the system displays the advanced payments, select those you want to add to the invoice. + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Forgeflow + +Contributors +~~~~~~~~~~~~ + +* Mateu Griful +* Lois Rilo + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +This module is part of the `OCA/purchase-workflow `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/purchase_advance_payment/i18n/purchase_advance_payment.pot b/purchase_advance_payment/i18n/purchase_advance_payment.pot new file mode 100644 index 00000000000..38c7beadd7d --- /dev/null +++ b/purchase_advance_payment/i18n/purchase_advance_payment.pot @@ -0,0 +1,221 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * purchase_advance_payment +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: purchase_advance_payment +#: model:ir.model,name:purchase_advance_payment.model_account_voucher_wizard_purchase +msgid "Account Voucher Wizard Purchase" +msgstr "" + +#. module: purchase_advance_payment +#: model:ir.actions.act_window,name:purchase_advance_payment.action_view_account_voucher_wizard +#: model_terms:ir.ui.view,arch_db:purchase_advance_payment.view_account_voucher_wizard +msgid "Advance Payment" +msgstr "" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_purchase_order__advance_payment_status +msgid "Advance Payment Status" +msgstr "" + +#. module: purchase_advance_payment +#: model_terms:ir.ui.view,arch_db:purchase_advance_payment.purchase_order_kpis_tree +#: model_terms:ir.ui.view,arch_db:purchase_advance_payment.purchase_order_view_tree +msgid "Amount Residual" +msgstr "" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__amount_advance +msgid "Amount advanced" +msgstr "" + +#. module: purchase_advance_payment +#: model_terms:ir.ui.view,arch_db:purchase_advance_payment.view_account_voucher_wizard +msgid "Amount in Order Currency" +msgstr "" + +#. module: purchase_advance_payment +#: code:addons/purchase_advance_payment/wizard/purchase_advance_payment_wizard.py:0 +#, python-format +msgid "Amount of advance is greater than residual amount on purchase" +msgstr "" + +#. module: purchase_advance_payment +#: code:addons/purchase_advance_payment/wizard/purchase_advance_payment_wizard.py:0 +#, python-format +msgid "Amount of advance must be positive." +msgstr "" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__amount_total +msgid "Amount total" +msgstr "" + +#. module: purchase_advance_payment +#: model_terms:ir.ui.view,arch_db:purchase_advance_payment.view_account_voucher_wizard +msgid "Cancel" +msgstr "" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__create_uid +msgid "Created by" +msgstr "" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__create_date +msgid "Created on" +msgstr "" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__currency_amount +msgid "Curr. amount" +msgstr "" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__currency_id +#: model_terms:ir.ui.view,arch_db:purchase_advance_payment.view_account_voucher_wizard +msgid "Currency" +msgstr "" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__date +msgid "Date" +msgstr "" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_payment__display_name +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__display_name +#: model:ir.model.fields,field_description:purchase_advance_payment.field_purchase_order__display_name +msgid "Display Name" +msgstr "" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_payment__id +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__id +#: model:ir.model.fields,field_description:purchase_advance_payment.field_purchase_order__id +msgid "ID" +msgstr "" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__journal_id +msgid "Journal" +msgstr "" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__journal_currency_id +msgid "Journal Currency" +msgstr "" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_payment____last_update +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase____last_update +#: model:ir.model.fields,field_description:purchase_advance_payment.field_purchase_order____last_update +msgid "Last Modified on" +msgstr "" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__write_uid +msgid "Last Updated by" +msgstr "" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__write_date +msgid "Last Updated on" +msgstr "" + +#. module: purchase_advance_payment +#: model_terms:ir.ui.view,arch_db:purchase_advance_payment.view_account_voucher_wizard +msgid "Make advance payment" +msgstr "" + +#. module: purchase_advance_payment +#: model:ir.model.fields.selection,name:purchase_advance_payment.selection__purchase_order__advance_payment_status__not_paid +msgid "Not Paid" +msgstr "" + +#. module: purchase_advance_payment +#: model_terms:ir.ui.view,arch_db:purchase_advance_payment.view_account_voucher_wizard +msgid "Operation" +msgstr "" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__order_id +msgid "Order" +msgstr "" + +#. module: purchase_advance_payment +#: model_terms:ir.ui.view,arch_db:purchase_advance_payment.view_account_voucher_wizard +msgid "Order Currency" +msgstr "" + +#. module: purchase_advance_payment +#: model_terms:ir.ui.view,arch_db:purchase_advance_payment.view_account_voucher_wizard +msgid "Order Due Amount" +msgstr "" + +#. module: purchase_advance_payment +#: model:ir.model.fields.selection,name:purchase_advance_payment.selection__purchase_order__advance_payment_status__paid +msgid "Paid" +msgstr "" + +#. module: purchase_advance_payment +#: model:ir.model.fields.selection,name:purchase_advance_payment.selection__purchase_order__advance_payment_status__partial +msgid "Partially Paid" +msgstr "" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_purchase_order__account_payment_ids +#: model_terms:ir.ui.view,arch_db:purchase_advance_payment.purchase_order_form +msgid "Pay purchase advanced" +msgstr "" + +#. module: purchase_advance_payment +#: model_terms:ir.ui.view,arch_db:purchase_advance_payment.view_account_voucher_wizard +msgid "Payment Method" +msgstr "" + +#. module: purchase_advance_payment +#: model_terms:ir.ui.view,arch_db:purchase_advance_payment.purchase_order_form +msgid "Payment advances" +msgstr "" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_purchase_order__payment_line_ids +msgid "Payment move lines" +msgstr "" + +#. module: purchase_advance_payment +#: model:ir.model,name:purchase_advance_payment.model_account_payment +msgid "Payments" +msgstr "" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_payment__purchase_id +msgid "Purchase" +msgstr "" + +#. module: purchase_advance_payment +#: model:ir.model,name:purchase_advance_payment.model_purchase_order +msgid "Purchase Order" +msgstr "" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__payment_ref +msgid "Ref." +msgstr "" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_purchase_order__amount_residual +msgid "Residual amount" +msgstr "" diff --git a/purchase_advance_payment/models/purchase_order.py b/purchase_advance_payment/models/purchase_order.py index e4f025d669e..b6b5791668a 100644 --- a/purchase_advance_payment/models/purchase_order.py +++ b/purchase_advance_payment/models/purchase_order.py @@ -51,6 +51,9 @@ class PurchaseOrder(models.Model): "account_payment_ids.move_id.line_ids.credit", "account_payment_ids.move_id.line_ids.currency_id", "account_payment_ids.move_id.line_ids.amount_currency", + "order_line.invoice_lines.move_id", + "order_line.invoice_lines.move_id.amount_total", + "order_line.invoice_lines.move_id.amount_residual", ) def _compute_purchase_advance_payment(self): for order in self: @@ -71,9 +74,15 @@ def _compute_purchase_advance_payment(self): ) else: advance_amount += line_amount - amount_residual = order.amount_total - advance_amount + # Consider payments in related invoices. + invoice_not_paid_amount = 0.0 + for inv in order.invoice_ids: + invoice_not_paid_amount += inv.amount_total - inv.amount_residual + amount_residual = ( + order.amount_total - advance_amount - invoice_not_paid_amount + ) payment_state = "not_paid" - if mls: + if mls or order.invoice_ids: has_due_amount = float_compare( amount_residual, 0.0, precision_rounding=order.currency_id.rounding ) diff --git a/purchase_advance_payment/static/description/index.html b/purchase_advance_payment/static/description/index.html new file mode 100644 index 00000000000..bc37d1434d4 --- /dev/null +++ b/purchase_advance_payment/static/description/index.html @@ -0,0 +1,434 @@ + + + + + + +Purchase Advance Payment + + + +
+

Purchase Advance Payment

+ + +

Beta License: AGPL-3 OCA/purchase-workflow Translate me on Weblate Try me on Runbot

+

The module allows to add advance payments on purchase orders and Request +for Quotation. The advance payments are allowed even before confirmation +and before starting the billing process.

+

Table of contents

+ +
+

Usage

+

To use this module, you need to:

+
    +
  • Go to a purchase order.
  • +
  • Click on “Pay Purchase Advance”.
  • +
  • Select the Journal and specify the amount of the advanced payment.
  • +
  • “Make Advance Payment”.
  • +
+

When generating the invoice, the system displays the advanced payments, select those you want to add to the invoice.

+
+
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Forgeflow
  • +
+
+ +
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

This module is part of the OCA/purchase-workflow project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/purchase_advance_payment/tests/test_purchase_advance_payment.py b/purchase_advance_payment/tests/test_purchase_advance_payment.py index 665a9cf21de..017d71a3807 100644 --- a/purchase_advance_payment/tests/test_purchase_advance_payment.py +++ b/purchase_advance_payment/tests/test_purchase_advance_payment.py @@ -2,6 +2,7 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html) +from odoo import fields from odoo.exceptions import ValidationError from odoo.tests import common @@ -120,7 +121,7 @@ def setUpClass(cls): } ) - def test_purchase_advance_payment(self): + def test_01_purchase_advance_payment(self): self.assertEqual( self.purchase_order_1.amount_residual, 3600, @@ -216,3 +217,52 @@ def test_purchase_advance_payment(self): ) advance_payment_4.make_advance_payment() self.assertEqual(self.purchase_order_1.amount_residual, 2580) + + def test_02_residual_amount_with_bill(self): + self.assertEqual( + self.purchase_order_1.amount_residual, + 3600, + ) + self.assertEqual( + self.purchase_order_1.amount_residual, + self.purchase_order_1.amount_total, + ) + # Create Advance Payment 1 - EUR - bank + context_payment = { + "active_ids": [self.purchase_order_1.id], + "active_id": self.purchase_order_1.id, + } + # Create Advance Payment 2 - USD - cash + advance_payment_2 = ( + self.env["account.voucher.wizard.purchase"] + .with_context(context_payment) + .create( + { + "journal_id": self.journal_usd_cash.id, + "amount_advance": 200, + "order_id": self.purchase_order_1.id, + } + ) + ) + advance_payment_2.make_advance_payment() + self.assertEqual(self.purchase_order_1.amount_residual, 3400) + # generate bill, pay bill, check amount residual. + self.purchase_order_1.button_confirm() + self.assertEqual(self.purchase_order_1.invoice_status, "to invoice") + self.purchase_order_1.action_create_invoice() + self.assertEqual(self.purchase_order_1.invoice_status, "invoiced") + self.assertEqual(self.purchase_order_1.amount_residual, 3400) + invoice = self.purchase_order_1.invoice_ids + invoice.invoice_date = fields.Date.today() + invoice.action_post() + active_ids = invoice.ids + self.env["account.payment.register"].with_context( + active_model="account.move", active_ids=active_ids + ).create( + { + "amount": 1200.0, + "group_payment": True, + "payment_difference_handling": "open", + } + )._create_payments() + self.assertEqual(self.purchase_order_1.amount_residual, 2200) diff --git a/purchase_advance_payment/views/purchase_view.xml b/purchase_advance_payment/views/purchase_view.xml index 44d8e6e9fb8..95d54657920 100644 --- a/purchase_advance_payment/views/purchase_view.xml +++ b/purchase_advance_payment/views/purchase_view.xml @@ -11,7 +11,7 @@ string="Pay purchase advanced" type="action" groups="account.group_account_invoice" - attrs="{'invisible': ['|',('state', 'in', ['done','cancel']),('invoice_status', 'in', ['invoiced'])]}" + attrs="{'invisible': ['|',('state', 'in', ['done','cancel']),('amount_residual', '=', 0)]}" /> From 08dd432f6c5933b231b91783c5a92343337de9cf Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Thu, 4 Nov 2021 16:21:07 +0000 Subject: [PATCH 04/12] [ADD] icon.png --- .../static/description/icon.png | Bin 0 -> 9455 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 purchase_advance_payment/static/description/icon.png diff --git a/purchase_advance_payment/static/description/icon.png b/purchase_advance_payment/static/description/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..3a0328b516c4980e8e44cdb63fd945757ddd132d GIT binary patch literal 9455 zcmW++2RxMjAAjx~&dlBk9S+%}OXg)AGE&Cb*&}d0jUxM@u(PQx^-s)697TX`ehR4?GS^qbkof1cslKgkU)h65qZ9Oc=ml_0temigYLJfnz{IDzUf>bGs4N!v3=Z3jMq&A#7%rM5eQ#dc?k~! zVpnB`o+K7|Al`Q_U;eD$B zfJtP*jH`siUq~{KE)`jP2|#TUEFGRryE2`i0**z#*^6~AI|YzIWy$Cu#CSLW3q=GA z6`?GZymC;dCPk~rBS%eCb`5OLr;RUZ;D`}um=H)BfVIq%7VhiMr)_#G0N#zrNH|__ zc+blN2UAB0=617@>_u;MPHN;P;N#YoE=)R#i$k_`UAA>WWCcEVMh~L_ zj--gtp&|K1#58Yz*AHCTMziU1Jzt_jG0I@qAOHsk$2}yTmVkBp_eHuY$A9)>P6o~I z%aQ?!(GqeQ-Y+b0I(m9pwgi(IIZZzsbMv+9w{PFtd_<_(LA~0H(xz{=FhLB@(1&qHA5EJw1>>=%q2f&^X>IQ{!GJ4e9U z&KlB)z(84HmNgm2hg2C0>WM{E(DdPr+EeU_N@57;PC2&DmGFW_9kP&%?X4}+xWi)( z;)z%wI5>D4a*5XwD)P--sPkoY(a~WBw;E~AW`Yue4kFa^LM3X`8x|}ZUeMnqr}>kH zG%WWW>3ml$Yez?i%)2pbKPI7?5o?hydokgQyZsNEr{a|mLdt;X2TX(#B1j35xPnPW z*bMSSOauW>o;*=kO8ojw91VX!qoOQb)zHJ!odWB}d+*K?#sY_jqPdg{Sm2HdYzdEx zOGVPhVRTGPtv0o}RfVP;Nd(|CB)I;*t&QO8h zFfekr30S!-LHmV_Su-W+rEwYXJ^;6&3|L$mMC8*bQptyOo9;>Qb9Q9`ySe3%V$A*9 zeKEe+b0{#KWGp$F+tga)0RtI)nhMa-K@JS}2krK~n8vJ=Ngm?R!9G<~RyuU0d?nz# z-5EK$o(!F?hmX*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2021 16:10:36 +0000 Subject: [PATCH 05/12] Added translation using Weblate (French) --- purchase_advance_payment/i18n/fr.po | 222 ++++++++++++++++++++++++++++ 1 file changed, 222 insertions(+) create mode 100644 purchase_advance_payment/i18n/fr.po diff --git a/purchase_advance_payment/i18n/fr.po b/purchase_advance_payment/i18n/fr.po new file mode 100644 index 00000000000..0392173c55b --- /dev/null +++ b/purchase_advance_payment/i18n/fr.po @@ -0,0 +1,222 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * purchase_advance_payment +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: Automatically generated\n" +"Language-Team: none\n" +"Language: fr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n > 1;\n" + +#. module: purchase_advance_payment +#: model:ir.model,name:purchase_advance_payment.model_account_voucher_wizard_purchase +msgid "Account Voucher Wizard Purchase" +msgstr "" + +#. module: purchase_advance_payment +#: model:ir.actions.act_window,name:purchase_advance_payment.action_view_account_voucher_wizard +#: model_terms:ir.ui.view,arch_db:purchase_advance_payment.view_account_voucher_wizard +msgid "Advance Payment" +msgstr "" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_purchase_order__advance_payment_status +msgid "Advance Payment Status" +msgstr "" + +#. module: purchase_advance_payment +#: model_terms:ir.ui.view,arch_db:purchase_advance_payment.purchase_order_kpis_tree +#: model_terms:ir.ui.view,arch_db:purchase_advance_payment.purchase_order_view_tree +msgid "Amount Residual" +msgstr "" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__amount_advance +msgid "Amount advanced" +msgstr "" + +#. module: purchase_advance_payment +#: model_terms:ir.ui.view,arch_db:purchase_advance_payment.view_account_voucher_wizard +msgid "Amount in Order Currency" +msgstr "" + +#. module: purchase_advance_payment +#: code:addons/purchase_advance_payment/wizard/purchase_advance_payment_wizard.py:0 +#, python-format +msgid "Amount of advance is greater than residual amount on purchase" +msgstr "" + +#. module: purchase_advance_payment +#: code:addons/purchase_advance_payment/wizard/purchase_advance_payment_wizard.py:0 +#, python-format +msgid "Amount of advance must be positive." +msgstr "" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__amount_total +msgid "Amount total" +msgstr "" + +#. module: purchase_advance_payment +#: model_terms:ir.ui.view,arch_db:purchase_advance_payment.view_account_voucher_wizard +msgid "Cancel" +msgstr "" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__create_uid +msgid "Created by" +msgstr "" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__create_date +msgid "Created on" +msgstr "" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__currency_amount +msgid "Curr. amount" +msgstr "" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__currency_id +#: model_terms:ir.ui.view,arch_db:purchase_advance_payment.view_account_voucher_wizard +msgid "Currency" +msgstr "" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__date +msgid "Date" +msgstr "" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_payment__display_name +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__display_name +#: model:ir.model.fields,field_description:purchase_advance_payment.field_purchase_order__display_name +msgid "Display Name" +msgstr "" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_payment__id +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__id +#: model:ir.model.fields,field_description:purchase_advance_payment.field_purchase_order__id +msgid "ID" +msgstr "" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__journal_id +msgid "Journal" +msgstr "" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__journal_currency_id +msgid "Journal Currency" +msgstr "" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_payment____last_update +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase____last_update +#: model:ir.model.fields,field_description:purchase_advance_payment.field_purchase_order____last_update +msgid "Last Modified on" +msgstr "" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__write_uid +msgid "Last Updated by" +msgstr "" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__write_date +msgid "Last Updated on" +msgstr "" + +#. module: purchase_advance_payment +#: model_terms:ir.ui.view,arch_db:purchase_advance_payment.view_account_voucher_wizard +msgid "Make advance payment" +msgstr "" + +#. module: purchase_advance_payment +#: model:ir.model.fields.selection,name:purchase_advance_payment.selection__purchase_order__advance_payment_status__not_paid +msgid "Not Paid" +msgstr "" + +#. module: purchase_advance_payment +#: model_terms:ir.ui.view,arch_db:purchase_advance_payment.view_account_voucher_wizard +msgid "Operation" +msgstr "" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__order_id +msgid "Order" +msgstr "" + +#. module: purchase_advance_payment +#: model_terms:ir.ui.view,arch_db:purchase_advance_payment.view_account_voucher_wizard +msgid "Order Currency" +msgstr "" + +#. module: purchase_advance_payment +#: model_terms:ir.ui.view,arch_db:purchase_advance_payment.view_account_voucher_wizard +msgid "Order Due Amount" +msgstr "" + +#. module: purchase_advance_payment +#: model:ir.model.fields.selection,name:purchase_advance_payment.selection__purchase_order__advance_payment_status__paid +msgid "Paid" +msgstr "" + +#. module: purchase_advance_payment +#: model:ir.model.fields.selection,name:purchase_advance_payment.selection__purchase_order__advance_payment_status__partial +msgid "Partially Paid" +msgstr "" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_purchase_order__account_payment_ids +#: model_terms:ir.ui.view,arch_db:purchase_advance_payment.purchase_order_form +msgid "Pay purchase advanced" +msgstr "" + +#. module: purchase_advance_payment +#: model_terms:ir.ui.view,arch_db:purchase_advance_payment.view_account_voucher_wizard +msgid "Payment Method" +msgstr "" + +#. module: purchase_advance_payment +#: model_terms:ir.ui.view,arch_db:purchase_advance_payment.purchase_order_form +msgid "Payment advances" +msgstr "" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_purchase_order__payment_line_ids +msgid "Payment move lines" +msgstr "" + +#. module: purchase_advance_payment +#: model:ir.model,name:purchase_advance_payment.model_account_payment +msgid "Payments" +msgstr "" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_payment__purchase_id +msgid "Purchase" +msgstr "" + +#. module: purchase_advance_payment +#: model:ir.model,name:purchase_advance_payment.model_purchase_order +msgid "Purchase Order" +msgstr "" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__payment_ref +msgid "Ref." +msgstr "" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_purchase_order__amount_residual +msgid "Residual amount" +msgstr "" From ab5dee618b69b5603ed9b5cc8e68711804af4275 Mon Sep 17 00:00:00 2001 From: Lois Rilo Date: Tue, 4 Jan 2022 16:36:00 +0100 Subject: [PATCH 06/12] [FIX] purchase_advance_payment: do not count twice reconciled pre-payments in PO residual amount. --- .../models/purchase_order.py | 17 ++-- .../tests/test_purchase_advance_payment.py | 96 +++++++++++++++++++ 2 files changed, 107 insertions(+), 6 deletions(-) diff --git a/purchase_advance_payment/models/purchase_order.py b/purchase_advance_payment/models/purchase_order.py index b6b5791668a..789f567c0c4 100644 --- a/purchase_advance_payment/models/purchase_order.py +++ b/purchase_advance_payment/models/purchase_order.py @@ -64,7 +64,14 @@ def _compute_purchase_advance_payment(self): advance_amount = 0.0 for line in mls: line_currency = line.currency_id or line.company_id.currency_id - line_amount = line.amount_currency if line.currency_id else line.balance + # Exclude reconciled pre-payments amount because once reconciled + # the pre-payment will reduce bill residual amount like any + # other payment. + line_amount = ( + line.amount_residual_currency + if line.currency_id + else line.amount_residual + ) if line_currency != order.currency_id: advance_amount += line.currency_id._convert( line_amount, @@ -75,12 +82,10 @@ def _compute_purchase_advance_payment(self): else: advance_amount += line_amount # Consider payments in related invoices. - invoice_not_paid_amount = 0.0 + invoice_paid_amount = 0.0 for inv in order.invoice_ids: - invoice_not_paid_amount += inv.amount_total - inv.amount_residual - amount_residual = ( - order.amount_total - advance_amount - invoice_not_paid_amount - ) + invoice_paid_amount += inv.amount_total - inv.amount_residual + amount_residual = order.amount_total - advance_amount - invoice_paid_amount payment_state = "not_paid" if mls or order.invoice_ids: has_due_amount = float_compare( diff --git a/purchase_advance_payment/tests/test_purchase_advance_payment.py b/purchase_advance_payment/tests/test_purchase_advance_payment.py index 017d71a3807..16fd626fb9e 100644 --- a/purchase_advance_payment/tests/test_purchase_advance_payment.py +++ b/purchase_advance_payment/tests/test_purchase_advance_payment.py @@ -245,6 +245,8 @@ def test_02_residual_amount_with_bill(self): ) ) advance_payment_2.make_advance_payment() + pre_payment = self.purchase_order_1.account_payment_ids + self.assertEqual(len(pre_payment), 1) self.assertEqual(self.purchase_order_1.amount_residual, 3400) # generate bill, pay bill, check amount residual. self.purchase_order_1.button_confirm() @@ -266,3 +268,97 @@ def test_02_residual_amount_with_bill(self): } )._create_payments() self.assertEqual(self.purchase_order_1.amount_residual, 2200) + + # Reconciling the pre-payment should not affect amount_residual in PO. + ( + liquidity_lines, + counterpart_lines, + writeoff_lines, + ) = pre_payment._seek_for_lines() + ( + counterpart_lines + + invoice.line_ids.filtered( + lambda line: line.account_internal_type == "payable" + ) + ).reconcile() + self.purchase_order_1.invalidate_cache() + self.assertEqual(self.purchase_order_1.amount_residual, 2200) + + def test_03_residual_amount_big_pre_payment(self): + self.assertEqual( + self.purchase_order_1.amount_residual, + 3600, + ) + self.assertEqual( + self.purchase_order_1.amount_residual, + self.purchase_order_1.amount_total, + ) + # Create Advance Payment 1 - EUR - bank + context_payment = { + "active_ids": [self.purchase_order_1.id], + "active_id": self.purchase_order_1.id, + } + # Create Advance Payment 2 - USD - cash + advance_payment_2 = ( + self.env["account.voucher.wizard.purchase"] + .with_context(context_payment) + .create( + { + "journal_id": self.journal_usd_cash.id, + "amount_advance": 2000, + "order_id": self.purchase_order_1.id, + } + ) + ) + advance_payment_2.make_advance_payment() + pre_payment = self.purchase_order_1.account_payment_ids + self.assertEqual(len(pre_payment), 1) + self.assertEqual(self.purchase_order_1.amount_residual, 1600) + # generate a partial bill, reconcile with pre payment, check amount residual. + self.purchase_order_1.button_confirm() + self.assertEqual(self.purchase_order_1.invoice_status, "to invoice") + # Adjust billing method to then do a partial bill with a total amount + # smaller than the pre-payment. + self.product_1.purchase_method = "receive" + self.order_line_1.qty_received = 10.0 + self.assertEqual(self.order_line_1.qty_to_invoice, 10.0) + self.product_2.purchase_method = "receive" + self.order_line_2.qty_received = 0.0 + self.assertEqual(self.order_line_2.qty_to_invoice, 0.0) + self.product_3.purchase_method = "receive" + self.order_line_3.qty_received = 0.0 + self.assertEqual(self.order_line_3.qty_to_invoice, 0.0) + self.purchase_order_1.action_create_invoice() + self.assertEqual(self.purchase_order_1.invoice_status, "invoiced") + self.assertEqual(self.purchase_order_1.amount_residual, 1600) + invoice = self.purchase_order_1.invoice_ids + invoice.invoice_date = fields.Date.today() + invoice.action_post() + self.assertEqual(invoice.amount_residual, 1200) + active_ids = invoice.ids + self.env["account.payment.register"].with_context( + active_model="account.move", active_ids=active_ids + ).create( + { + "amount": 300.0, + "group_payment": True, + "payment_difference_handling": "open", + } + )._create_payments() + self.assertEqual(invoice.amount_residual, 900) + self.assertEqual(self.purchase_order_1.amount_residual, 1300) + + # Partially reconciling the pre-payment should not affect amount_residual in PO. + ( + liquidity_lines, + counterpart_lines, + writeoff_lines, + ) = pre_payment._seek_for_lines() + ( + counterpart_lines + + invoice.line_ids.filtered( + lambda line: line.account_internal_type == "payable" + ) + ).reconcile() + self.purchase_order_1.invalidate_cache() + self.assertEqual(self.purchase_order_1.amount_residual, 1300) From 9b9899fa3737ff9f7363a1d1a8c1a023e51e2140 Mon Sep 17 00:00:00 2001 From: Jasmin Solanki Date: Tue, 18 Jan 2022 16:52:18 +0530 Subject: [PATCH 07/12] [MIG] purchase_advance_payment: Migration to 15.0 --- purchase_advance_payment/README.rst | 10 +++---- purchase_advance_payment/__manifest__.py | 2 +- .../i18n/purchase_advance_payment.pot | 18 +++++-------- .../models/purchase_order.py | 1 - .../static/description/index.html | 6 ++--- .../tests/test_purchase_advance_payment.py | 27 ++++++++++++------- .../views/purchase_view.xml | 2 +- .../wizard/purchase_advance_payment_wizard.py | 25 +++++++++-------- 8 files changed, 46 insertions(+), 45 deletions(-) diff --git a/purchase_advance_payment/README.rst b/purchase_advance_payment/README.rst index dc3ab94c339..ebfd928c518 100644 --- a/purchase_advance_payment/README.rst +++ b/purchase_advance_payment/README.rst @@ -14,13 +14,13 @@ Purchase Advance Payment :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fpurchase--workflow-lightgray.png?logo=github - :target: https://github.com/OCA/purchase-workflow/tree/14.0/purchase_advance_payment + :target: https://github.com/OCA/purchase-workflow/tree/15.0/purchase_advance_payment :alt: OCA/purchase-workflow .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/purchase-workflow-14-0/purchase-workflow-14-0-purchase_advance_payment + :target: https://translation.odoo-community.org/projects/purchase-workflow-15-0/purchase-workflow-15-0-purchase_advance_payment :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/142/14.0 + :target: https://runbot.odoo-community.org/runbot/142/15.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -52,7 +52,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -83,6 +83,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. -This module is part of the `OCA/purchase-workflow `_ project on GitHub. +This module is part of the `OCA/purchase-workflow `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/purchase_advance_payment/__manifest__.py b/purchase_advance_payment/__manifest__.py index 01e76a79c09..6e63bd4177c 100644 --- a/purchase_advance_payment/__manifest__.py +++ b/purchase_advance_payment/__manifest__.py @@ -3,7 +3,7 @@ { "name": "Purchase Advance Payment", - "version": "14.0.1.0.0", + "version": "15.0.1.0.0", "author": "Forgeflow, Odoo Community Association (OCA)", "website": "https://github.com/OCA/purchase-workflow", "category": "Purchase", diff --git a/purchase_advance_payment/i18n/purchase_advance_payment.pot b/purchase_advance_payment/i18n/purchase_advance_payment.pot index 38c7beadd7d..7cd03dd46b3 100644 --- a/purchase_advance_payment/i18n/purchase_advance_payment.pot +++ b/purchase_advance_payment/i18n/purchase_advance_payment.pot @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 14.0\n" +"Project-Id-Version: Odoo Server 15.0\n" "Report-Msgid-Bugs-To: \n" "Last-Translator: \n" "Language-Team: \n" @@ -35,6 +35,11 @@ msgstr "" msgid "Amount Residual" msgstr "" +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__amount_total +msgid "Amount Total" +msgstr "" + #. module: purchase_advance_payment #: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__amount_advance msgid "Amount advanced" @@ -57,11 +62,6 @@ msgstr "" msgid "Amount of advance must be positive." msgstr "" -#. module: purchase_advance_payment -#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__amount_total -msgid "Amount total" -msgstr "" - #. module: purchase_advance_payment #: model_terms:ir.ui.view,arch_db:purchase_advance_payment.view_account_voucher_wizard msgid "Cancel" @@ -94,16 +94,12 @@ msgid "Date" msgstr "" #. module: purchase_advance_payment -#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_payment__display_name #: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__display_name -#: model:ir.model.fields,field_description:purchase_advance_payment.field_purchase_order__display_name msgid "Display Name" msgstr "" #. module: purchase_advance_payment -#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_payment__id #: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__id -#: model:ir.model.fields,field_description:purchase_advance_payment.field_purchase_order__id msgid "ID" msgstr "" @@ -118,9 +114,7 @@ msgid "Journal Currency" msgstr "" #. module: purchase_advance_payment -#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_payment____last_update #: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase____last_update -#: model:ir.model.fields,field_description:purchase_advance_payment.field_purchase_order____last_update msgid "Last Modified on" msgstr "" diff --git a/purchase_advance_payment/models/purchase_order.py b/purchase_advance_payment/models/purchase_order.py index 789f567c0c4..0f58b465c28 100644 --- a/purchase_advance_payment/models/purchase_order.py +++ b/purchase_advance_payment/models/purchase_order.py @@ -30,7 +30,6 @@ class PurchaseOrder(models.Model): ("paid", "Paid"), ("partial", "Partially Paid"), ], - string="Advance Payment Status", store=True, readonly=True, copy=False, diff --git a/purchase_advance_payment/static/description/index.html b/purchase_advance_payment/static/description/index.html index bc37d1434d4..5c70bf46113 100644 --- a/purchase_advance_payment/static/description/index.html +++ b/purchase_advance_payment/static/description/index.html @@ -367,7 +367,7 @@

Purchase Advance Payment

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Beta License: AGPL-3 OCA/purchase-workflow Translate me on Weblate Try me on Runbot

+

Beta License: AGPL-3 OCA/purchase-workflow Translate me on Weblate Try me on Runbot

The module allows to add advance payments on purchase orders and Request for Quotation. The advance payments are allowed even before confirmation and before starting the billing process.

@@ -400,7 +400,7 @@

Bug Tracker

Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed -feedback.

+feedback.

Do not contact contributors directly about support or help with technical issues.

@@ -425,7 +425,7 @@

Maintainers

OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.

-

This module is part of the OCA/purchase-workflow project on GitHub.

+

This module is part of the OCA/purchase-workflow project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

diff --git a/purchase_advance_payment/tests/test_purchase_advance_payment.py b/purchase_advance_payment/tests/test_purchase_advance_payment.py index 16fd626fb9e..4b66610c48b 100644 --- a/purchase_advance_payment/tests/test_purchase_advance_payment.py +++ b/purchase_advance_payment/tests/test_purchase_advance_payment.py @@ -7,7 +7,7 @@ from odoo.tests import common -class TestPurchaseAdvancePayment(common.SavepointCase): +class TestPurchaseAdvancePayment(common.TransactionCase): @classmethod def setUpClass(cls): super().setUpClass() @@ -77,7 +77,16 @@ def setUpClass(cls): } ) - cls.currency_euro = cls.env["res.currency"].search([("name", "=", "EUR")]) + cls.active_euro = False + cls.currency_euro = ( + cls.env["res.currency"] + .with_context(active_test=False) + .search([("name", "=", "EUR")]) + ) + # active euro currency if inactive for test + if not cls.currency_euro.active: + cls.currency_euro.active = True + cls.active_euro = True cls.currency_usd = cls.env["res.currency"].search([("name", "=", "USD")]) cls.currency_rate = cls.env["res.currency.rate"].create( { @@ -142,7 +151,7 @@ def test_01_purchase_advance_payment(self): with self.assertRaises(ValidationError): advance_payment_0 = ( self.env["account.voucher.wizard.purchase"] - .with_context(context_payment) + .with_context(**context_payment) .create( { "journal_id": self.journal_eur_bank.id, @@ -156,7 +165,7 @@ def test_01_purchase_advance_payment(self): # Create Advance Payment 1 - EUR - bank advance_payment_1 = ( self.env["account.voucher.wizard.purchase"] - .with_context(context_payment) + .with_context(**context_payment) .create( { "journal_id": self.journal_eur_bank.id, @@ -172,7 +181,7 @@ def test_01_purchase_advance_payment(self): # Create Advance Payment 2 - USD - cash advance_payment_2 = ( self.env["account.voucher.wizard.purchase"] - .with_context(context_payment) + .with_context(**context_payment) .create( { "journal_id": self.journal_usd_cash.id, @@ -191,7 +200,7 @@ def test_01_purchase_advance_payment(self): # Create Advance Payment 3 - EUR - cash advance_payment_3 = ( self.env["account.voucher.wizard.purchase"] - .with_context(context_payment) + .with_context(**context_payment) .create( { "journal_id": self.journal_eur_cash.id, @@ -206,7 +215,7 @@ def test_01_purchase_advance_payment(self): # Create Advance Payment 4 - USD - bank advance_payment_4 = ( self.env["account.voucher.wizard.purchase"] - .with_context(context_payment) + .with_context(**context_payment) .create( { "journal_id": self.journal_usd_bank.id, @@ -235,7 +244,7 @@ def test_02_residual_amount_with_bill(self): # Create Advance Payment 2 - USD - cash advance_payment_2 = ( self.env["account.voucher.wizard.purchase"] - .with_context(context_payment) + .with_context(**context_payment) .create( { "journal_id": self.journal_usd_cash.id, @@ -301,7 +310,7 @@ def test_03_residual_amount_big_pre_payment(self): # Create Advance Payment 2 - USD - cash advance_payment_2 = ( self.env["account.voucher.wizard.purchase"] - .with_context(context_payment) + .with_context(**context_payment) .create( { "journal_id": self.journal_usd_cash.id, diff --git a/purchase_advance_payment/views/purchase_view.xml b/purchase_advance_payment/views/purchase_view.xml index 95d54657920..0bd22ba850e 100644 --- a/purchase_advance_payment/views/purchase_view.xml +++ b/purchase_advance_payment/views/purchase_view.xml @@ -24,7 +24,7 @@ />
- + diff --git a/purchase_advance_payment/wizard/purchase_advance_payment_wizard.py b/purchase_advance_payment/wizard/purchase_advance_payment_wizard.py index 0ef7fdc4fbd..80f62dc8bbb 100644 --- a/purchase_advance_payment/wizard/purchase_advance_payment_wizard.py +++ b/purchase_advance_payment/wizard/purchase_advance_payment_wizard.py @@ -2,11 +2,9 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html) from odoo import _, api, exceptions, fields, models -from odoo.tools import float_compare class AccountVoucherWizardPurchase(models.TransientModel): - _name = "account.voucher.wizard.purchase" _description = "Account Voucher Wizard Purchase" @@ -25,13 +23,17 @@ class AccountVoucherWizardPurchase(models.TransientModel): compute="_compute_get_journal_currency", ) currency_id = fields.Many2one("res.currency", "Currency", readonly=True) - amount_total = fields.Monetary("Amount total", readonly=True) + amount_total = fields.Monetary(readonly=True) amount_advance = fields.Monetary( "Amount advanced", required=True, currency_field="journal_currency_id" ) - date = fields.Date("Date", required=True, default=fields.Date.context_today) + date = fields.Date(required=True, default=fields.Date.context_today) currency_amount = fields.Monetary( - "Curr. amount", readonly=True, currency_field="currency_id" + "Curr. amount", + readonly=True, + currency_field="currency_id", + compute="_compute_currency_amount", + store=True, ) payment_ref = fields.Char("Ref.") @@ -44,15 +46,12 @@ def _compute_get_journal_currency(self): @api.constrains("amount_advance") def check_amount(self): - if self.amount_advance <= 0: + if self.journal_currency_id.compare_amounts(self.amount_advance, 0.0) <= 0: raise exceptions.ValidationError(_("Amount of advance must be positive.")) if self.env.context.get("active_id", False): - self.onchange_date() if ( - float_compare( - self.currency_amount, - self.order_id.amount_residual, - precision_digits=2, + self.currency_id.compare_amounts( + self.currency_amount, self.order_id.amount_residual ) > 0 ): @@ -79,8 +78,8 @@ def default_get(self, fields_list): return res - @api.onchange("journal_id", "date", "amount_advance") - def onchange_date(self): + @api.depends("journal_id", "date", "amount_advance") + def _compute_currency_amount(self): if self.journal_currency_id != self.currency_id: amount_advance = self.journal_currency_id._convert( self.amount_advance, From 8542e0764fdc3cc151b58786e82ceb0c71a3d75e Mon Sep 17 00:00:00 2001 From: sonhd91 Date: Thu, 5 Jan 2023 13:43:01 +0700 Subject: [PATCH 08/12] [16.0][MIG] purchase_advance_payment: Migrate to version 16.0 --- purchase_advance_payment/README.rst | 18 ++- purchase_advance_payment/__manifest__.py | 2 +- purchase_advance_payment/i18n/fr.po | 18 +-- .../i18n/purchase_advance_payment.pot | 4 +- .../models/purchase_order.py | 2 +- .../readme/CONTRIBUTORS.rst | 3 + purchase_advance_payment/readme/CREDITS.rst | 1 + .../static/description/index.html | 28 +++- .../tests/test_purchase_advance_payment.py | 143 +++++++++++++++--- .../views/purchase_view.xml | 2 +- 10 files changed, 169 insertions(+), 52 deletions(-) create mode 100644 purchase_advance_payment/readme/CREDITS.rst diff --git a/purchase_advance_payment/README.rst b/purchase_advance_payment/README.rst index ebfd928c518..4e589857b37 100644 --- a/purchase_advance_payment/README.rst +++ b/purchase_advance_payment/README.rst @@ -14,13 +14,13 @@ Purchase Advance Payment :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fpurchase--workflow-lightgray.png?logo=github - :target: https://github.com/OCA/purchase-workflow/tree/15.0/purchase_advance_payment + :target: https://github.com/OCA/purchase-workflow/tree/16.0/purchase_advance_payment :alt: OCA/purchase-workflow .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/purchase-workflow-15-0/purchase-workflow-15-0-purchase_advance_payment + :target: https://translation.odoo-community.org/projects/purchase-workflow-16-0/purchase-workflow-16-0-purchase_advance_payment :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/142/15.0 + :target: https://runbot.odoo-community.org/runbot/142/16.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -52,7 +52,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -69,6 +69,14 @@ Contributors * Mateu Griful * Lois Rilo +* `Trobz `_: + + * Son Ho + +Other credits +~~~~~~~~~~~~~ + +The migration of this module from 15.0 to 16.0 was financially supported by Camptocamp Maintainers ~~~~~~~~~~~ @@ -83,6 +91,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. -This module is part of the `OCA/purchase-workflow `_ project on GitHub. +This module is part of the `OCA/purchase-workflow `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/purchase_advance_payment/__manifest__.py b/purchase_advance_payment/__manifest__.py index 6e63bd4177c..0821aa4fb22 100644 --- a/purchase_advance_payment/__manifest__.py +++ b/purchase_advance_payment/__manifest__.py @@ -3,7 +3,7 @@ { "name": "Purchase Advance Payment", - "version": "15.0.1.0.0", + "version": "16.0.1.0.0", "author": "Forgeflow, Odoo Community Association (OCA)", "website": "https://github.com/OCA/purchase-workflow", "category": "Purchase", diff --git a/purchase_advance_payment/i18n/fr.po b/purchase_advance_payment/i18n/fr.po index 0392173c55b..837ff265e93 100644 --- a/purchase_advance_payment/i18n/fr.po +++ b/purchase_advance_payment/i18n/fr.po @@ -36,6 +36,11 @@ msgstr "" msgid "Amount Residual" msgstr "" +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__amount_total +msgid "Amount Total" +msgstr "" + #. module: purchase_advance_payment #: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__amount_advance msgid "Amount advanced" @@ -47,22 +52,19 @@ msgid "Amount in Order Currency" msgstr "" #. module: purchase_advance_payment +#. odoo-python #: code:addons/purchase_advance_payment/wizard/purchase_advance_payment_wizard.py:0 #, python-format msgid "Amount of advance is greater than residual amount on purchase" msgstr "" #. module: purchase_advance_payment +#. odoo-python #: code:addons/purchase_advance_payment/wizard/purchase_advance_payment_wizard.py:0 #, python-format msgid "Amount of advance must be positive." msgstr "" -#. module: purchase_advance_payment -#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__amount_total -msgid "Amount total" -msgstr "" - #. module: purchase_advance_payment #: model_terms:ir.ui.view,arch_db:purchase_advance_payment.view_account_voucher_wizard msgid "Cancel" @@ -95,16 +97,12 @@ msgid "Date" msgstr "" #. module: purchase_advance_payment -#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_payment__display_name #: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__display_name -#: model:ir.model.fields,field_description:purchase_advance_payment.field_purchase_order__display_name msgid "Display Name" msgstr "" #. module: purchase_advance_payment -#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_payment__id #: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__id -#: model:ir.model.fields,field_description:purchase_advance_payment.field_purchase_order__id msgid "ID" msgstr "" @@ -119,9 +117,7 @@ msgid "Journal Currency" msgstr "" #. module: purchase_advance_payment -#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_payment____last_update #: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase____last_update -#: model:ir.model.fields,field_description:purchase_advance_payment.field_purchase_order____last_update msgid "Last Modified on" msgstr "" diff --git a/purchase_advance_payment/i18n/purchase_advance_payment.pot b/purchase_advance_payment/i18n/purchase_advance_payment.pot index 7cd03dd46b3..b8b69c32c05 100644 --- a/purchase_advance_payment/i18n/purchase_advance_payment.pot +++ b/purchase_advance_payment/i18n/purchase_advance_payment.pot @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 15.0\n" +"Project-Id-Version: Odoo Server 16.0\n" "Report-Msgid-Bugs-To: \n" "Last-Translator: \n" "Language-Team: \n" @@ -51,12 +51,14 @@ msgid "Amount in Order Currency" msgstr "" #. module: purchase_advance_payment +#. odoo-python #: code:addons/purchase_advance_payment/wizard/purchase_advance_payment_wizard.py:0 #, python-format msgid "Amount of advance is greater than residual amount on purchase" msgstr "" #. module: purchase_advance_payment +#. odoo-python #: code:addons/purchase_advance_payment/wizard/purchase_advance_payment_wizard.py:0 #, python-format msgid "Amount of advance must be positive." diff --git a/purchase_advance_payment/models/purchase_order.py b/purchase_advance_payment/models/purchase_order.py index 0f58b465c28..398e0661246 100644 --- a/purchase_advance_payment/models/purchase_order.py +++ b/purchase_advance_payment/models/purchase_order.py @@ -57,7 +57,7 @@ class PurchaseOrder(models.Model): def _compute_purchase_advance_payment(self): for order in self: mls = order.account_payment_ids.mapped("move_id.line_ids").filtered( - lambda x: x.account_id.internal_type == "payable" + lambda x: x.account_id.account_type == "liability_payable" and x.parent_state == "posted" ) advance_amount = 0.0 diff --git a/purchase_advance_payment/readme/CONTRIBUTORS.rst b/purchase_advance_payment/readme/CONTRIBUTORS.rst index 087dd29233f..8077f0385e3 100644 --- a/purchase_advance_payment/readme/CONTRIBUTORS.rst +++ b/purchase_advance_payment/readme/CONTRIBUTORS.rst @@ -1,2 +1,5 @@ * Mateu Griful * Lois Rilo +* `Trobz `_: + + * Son Ho diff --git a/purchase_advance_payment/readme/CREDITS.rst b/purchase_advance_payment/readme/CREDITS.rst new file mode 100644 index 00000000000..70bc307ad0b --- /dev/null +++ b/purchase_advance_payment/readme/CREDITS.rst @@ -0,0 +1 @@ +The migration of this module from 15.0 to 16.0 was financially supported by Camptocamp diff --git a/purchase_advance_payment/static/description/index.html b/purchase_advance_payment/static/description/index.html index 5c70bf46113..b0f5f98337f 100644 --- a/purchase_advance_payment/static/description/index.html +++ b/purchase_advance_payment/static/description/index.html @@ -367,7 +367,7 @@

Purchase Advance Payment

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Beta License: AGPL-3 OCA/purchase-workflow Translate me on Weblate Try me on Runbot

+

Beta License: AGPL-3 OCA/purchase-workflow Translate me on Weblate Try me on Runbot

The module allows to add advance payments on purchase orders and Request for Quotation. The advance payments are allowed even before confirmation and before starting the billing process.

@@ -379,7 +379,8 @@

Purchase Advance Payment

  • Credits
  • @@ -400,7 +401,7 @@

    Bug Tracker

    Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed -feedback.

    +feedback.

    Do not contact contributors directly about support or help with technical issues.

    @@ -413,19 +414,32 @@

    Authors

    Contributors

    + +
    +
    +

    Other credits

    +

    The migration of this module from 15.0 to 16.0 was financially supported by Camptocamp

    -

    Maintainers

    +

    Maintainers

    This module is maintained by the OCA.

    Odoo Community Association

    OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.

    -

    This module is part of the OCA/purchase-workflow project on GitHub.

    +

    This module is part of the OCA/purchase-workflow project on GitHub.

    You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

    diff --git a/purchase_advance_payment/tests/test_purchase_advance_payment.py b/purchase_advance_payment/tests/test_purchase_advance_payment.py index 4b66610c48b..6c04b9e393e 100644 --- a/purchase_advance_payment/tests/test_purchase_advance_payment.py +++ b/purchase_advance_payment/tests/test_purchase_advance_payment.py @@ -11,6 +11,7 @@ class TestPurchaseAdvancePayment(common.TransactionCase): @classmethod def setUpClass(cls): super().setUpClass() + cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True)) # Partners cls.res_partner_1 = cls.env["res.partner"].create({"name": "Wood Corner"}) @@ -46,6 +47,21 @@ def setUpClass(cls): cls.purchase_order_1 = cls.env["purchase.order"].create( {"partner_id": cls.res_partner_1.id} ) + cls.purchase_order_2 = cls.env["purchase.order"].create( + {"partner_id": cls.res_partner_2.id} + ) + + cls.order_line_2_1 = cls.env["purchase.order.line"].create( + { + "order_id": cls.purchase_order_2.id, + "product_id": cls.product_1.id, + "product_uom": cls.product_1.uom_id.id, + "product_qty": 10.0, + "price_unit": 100.0, + "taxes_id": cls.tax, + } + ) + cls.order_line_1 = cls.env["purchase.order.line"].create( { "order_id": cls.purchase_order_1.id, @@ -130,15 +146,40 @@ def setUpClass(cls): } ) - def test_01_purchase_advance_payment(self): + def test_00_with_context_payment(self): + context_payment_2 = { + "active_ids": [self.purchase_order_2.id], + "active_id": self.purchase_order_2.id, + } + advance_payment_with_context = ( + self.env["account.voucher.wizard.purchase"] + .with_context(**context_payment_2) + .create( + { + "journal_id": self.journal_eur_bank.id, + "amount_advance": 10, + } + ) + ) + self.assertEqual(advance_payment_with_context.order_id, self.purchase_order_2) + + advance_payment_without_context = self.env[ + "account.voucher.wizard.purchase" + ].create( + { + "journal_id": self.journal_eur_bank.id, + "amount_advance": 20, + "order_id": self.purchase_order_1.id, + } + ) self.assertEqual( - self.purchase_order_1.amount_residual, - 3600, + advance_payment_without_context.order_id, self.purchase_order_1 ) + + def test_01_purchase_advance_payment(self): self.assertEqual( self.purchase_order_1.amount_residual, - self.purchase_order_1.amount_total, - "Amounts should match", + 3600, ) context_payment = { @@ -146,22 +187,6 @@ def test_01_purchase_advance_payment(self): "active_id": self.purchase_order_1.id, } - # Check residual > advance payment and the comparison takes - # into account the currency. 3001*1.2 > 3600 - with self.assertRaises(ValidationError): - advance_payment_0 = ( - self.env["account.voucher.wizard.purchase"] - .with_context(**context_payment) - .create( - { - "journal_id": self.journal_eur_bank.id, - "amount_advance": 3001, - "order_id": self.purchase_order_1.id, - } - ) - ) - advance_payment_0.make_advance_payment() - # Create Advance Payment 1 - EUR - bank advance_payment_1 = ( self.env["account.voucher.wizard.purchase"] @@ -287,10 +312,10 @@ def test_02_residual_amount_with_bill(self): ( counterpart_lines + invoice.line_ids.filtered( - lambda line: line.account_internal_type == "payable" + lambda line: line.account_type == "liability_payable" ) ).reconcile() - self.purchase_order_1.invalidate_cache() + self.purchase_order_1.env.invalidate_all() self.assertEqual(self.purchase_order_1.amount_residual, 2200) def test_03_residual_amount_big_pre_payment(self): @@ -366,8 +391,76 @@ def test_03_residual_amount_big_pre_payment(self): ( counterpart_lines + invoice.line_ids.filtered( - lambda line: line.account_internal_type == "payable" + lambda line: line.account_type == "liability_payable" ) ).reconcile() - self.purchase_order_1.invalidate_cache() + self.purchase_order_1.env.invalidate_all() self.assertEqual(self.purchase_order_1.amount_residual, 1300) + + def test_04_residual_amount_with_no_amount_left(self): + self.assertEqual( + self.purchase_order_1.amount_residual, + 3600, + ) + context_payment = { + "active_ids": [self.purchase_order_1.id], + "active_id": self.purchase_order_1.id, + } + # Create Advance Payment with the same residual amount + advance_payment = ( + self.env["account.voucher.wizard.purchase"] + .with_context(**context_payment) + .create( + { + "journal_id": self.journal_usd_cash.id, + "amount_advance": 3600, + "order_id": self.purchase_order_1.id, + } + ) + ) + advance_payment.make_advance_payment() + self.assertEqual(self.purchase_order_1.amount_residual, 0) + self.assertEqual(self.purchase_order_1.advance_payment_status, "paid") + + def test_05_check_residual_amount_warning(self): + self.assertEqual( + self.purchase_order_1.amount_residual, + 3600, + ) + self.assertEqual( + self.purchase_order_1.amount_residual, + self.purchase_order_1.amount_total, + "Amounts should match", + ) + + context_payment = { + "active_ids": [self.purchase_order_1.id], + "active_id": self.purchase_order_1.id, + } + + # Check residual > advance payment and the comparison takes + # into account the currency. 3001*1.2 > 3600 + mes = "Amount of advance is greater than residual amount on purchase" + with self.assertRaisesRegex(ValidationError, mes): + advance_payment_0 = ( + self.env["account.voucher.wizard.purchase"] + .with_context(**context_payment) + .create( + { + "journal_id": self.journal_eur_bank.id, + "amount_advance": 3001, + "order_id": self.purchase_order_1.id, + } + ) + ) + advance_payment_0.make_advance_payment() + # Check positive advance payment + mes2 = "Amount of advance must be positive." + with self.assertRaisesRegex(ValidationError, mes2): + self.env["account.voucher.wizard.purchase"].create( + { + "journal_id": self.journal_eur_bank.id, + "amount_advance": -300, + "order_id": self.purchase_order_2.id, + } + ) diff --git a/purchase_advance_payment/views/purchase_view.xml b/purchase_advance_payment/views/purchase_view.xml index 0bd22ba850e..1c26a200198 100644 --- a/purchase_advance_payment/views/purchase_view.xml +++ b/purchase_advance_payment/views/purchase_view.xml @@ -24,7 +24,7 @@ /> - + From c628a21e212a303552c34e69f8068609009ac731 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?gelo=20joga=20Rodr=C3=ADguez?= Date: Tue, 18 Apr 2023 07:56:42 +0000 Subject: [PATCH 09/12] Added translation using Weblate (Spanish) --- purchase_advance_payment/i18n/es.po | 220 ++++++++++++++++++++++++++++ 1 file changed, 220 insertions(+) create mode 100644 purchase_advance_payment/i18n/es.po diff --git a/purchase_advance_payment/i18n/es.po b/purchase_advance_payment/i18n/es.po new file mode 100644 index 00000000000..6fc5ff90c64 --- /dev/null +++ b/purchase_advance_payment/i18n/es.po @@ -0,0 +1,220 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * purchase_advance_payment +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2023-07-20 10:15+0000\n" +"Last-Translator: Ivorra78 \n" +"Language-Team: none\n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.17\n" + +#. module: purchase_advance_payment +#: model:ir.model,name:purchase_advance_payment.model_account_voucher_wizard_purchase +msgid "Account Voucher Wizard Purchase" +msgstr "Asistente de compra de vales de cuenta" + +#. module: purchase_advance_payment +#: model:ir.actions.act_window,name:purchase_advance_payment.action_view_account_voucher_wizard +#: model_terms:ir.ui.view,arch_db:purchase_advance_payment.view_account_voucher_wizard +msgid "Advance Payment" +msgstr "Pago por Adelantado" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_purchase_order__advance_payment_status +msgid "Advance Payment Status" +msgstr "Estado del pago anticipado" + +#. module: purchase_advance_payment +#: model_terms:ir.ui.view,arch_db:purchase_advance_payment.purchase_order_kpis_tree +#: model_terms:ir.ui.view,arch_db:purchase_advance_payment.purchase_order_view_tree +msgid "Amount Residual" +msgstr "Importe residual" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__amount_total +msgid "Amount Total" +msgstr "Importe total" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__amount_advance +msgid "Amount advanced" +msgstr "Importe anticipado" + +#. module: purchase_advance_payment +#: model_terms:ir.ui.view,arch_db:purchase_advance_payment.view_account_voucher_wizard +msgid "Amount in Order Currency" +msgstr "Importe en la moneda del pedido" + +#. module: purchase_advance_payment +#. odoo-python +#: code:addons/purchase_advance_payment/wizard/purchase_advance_payment_wizard.py:0 +#, python-format +msgid "Amount of advance is greater than residual amount on purchase" +msgstr "El importe anticipado es mayor que el importe pendiente del pedido" + +#. module: purchase_advance_payment +#. odoo-python +#: code:addons/purchase_advance_payment/wizard/purchase_advance_payment_wizard.py:0 +#, python-format +msgid "Amount of advance must be positive." +msgstr "El importe del anticipo debe ser positivo." + +#. module: purchase_advance_payment +#: model_terms:ir.ui.view,arch_db:purchase_advance_payment.view_account_voucher_wizard +msgid "Cancel" +msgstr "Cancelar" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__create_uid +msgid "Created by" +msgstr "Creado por" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__create_date +msgid "Created on" +msgstr "Creado el" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__currency_amount +msgid "Curr. amount" +msgstr "Importe en divisa" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__currency_id +#: model_terms:ir.ui.view,arch_db:purchase_advance_payment.view_account_voucher_wizard +msgid "Currency" +msgstr "Moneda" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__date +msgid "Date" +msgstr "Fecha" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__display_name +msgid "Display Name" +msgstr "Nombre mostrado" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__id +msgid "ID" +msgstr "ID" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__journal_id +msgid "Journal" +msgstr "Diario" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__journal_currency_id +msgid "Journal Currency" +msgstr "Moneda del diario" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase____last_update +msgid "Last Modified on" +msgstr "última modificación el" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__write_uid +msgid "Last Updated by" +msgstr "última modificación por" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__write_date +msgid "Last Updated on" +msgstr "Última actualización el" + +#. module: purchase_advance_payment +#: model_terms:ir.ui.view,arch_db:purchase_advance_payment.view_account_voucher_wizard +msgid "Make advance payment" +msgstr "Realizar anticipo" + +#. module: purchase_advance_payment +#: model:ir.model.fields.selection,name:purchase_advance_payment.selection__purchase_order__advance_payment_status__not_paid +msgid "Not Paid" +msgstr "No pagado" + +#. module: purchase_advance_payment +#: model_terms:ir.ui.view,arch_db:purchase_advance_payment.view_account_voucher_wizard +msgid "Operation" +msgstr "Operación" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__order_id +msgid "Order" +msgstr "Pedido" + +#. module: purchase_advance_payment +#: model_terms:ir.ui.view,arch_db:purchase_advance_payment.view_account_voucher_wizard +msgid "Order Currency" +msgstr "Moneda del pedido" + +#. module: purchase_advance_payment +#: model_terms:ir.ui.view,arch_db:purchase_advance_payment.view_account_voucher_wizard +msgid "Order Due Amount" +msgstr "Importe pendiente del pedido" + +#. module: purchase_advance_payment +#: model:ir.model.fields.selection,name:purchase_advance_payment.selection__purchase_order__advance_payment_status__paid +msgid "Paid" +msgstr "Pagado" + +#. module: purchase_advance_payment +#: model:ir.model.fields.selection,name:purchase_advance_payment.selection__purchase_order__advance_payment_status__partial +msgid "Partially Paid" +msgstr "Pagado parcialmente" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_purchase_order__account_payment_ids +#: model_terms:ir.ui.view,arch_db:purchase_advance_payment.purchase_order_form +msgid "Pay purchase advanced" +msgstr "Pagar anticipo de compra" + +#. module: purchase_advance_payment +#: model_terms:ir.ui.view,arch_db:purchase_advance_payment.view_account_voucher_wizard +msgid "Payment Method" +msgstr "Método de pago" + +#. module: purchase_advance_payment +#: model_terms:ir.ui.view,arch_db:purchase_advance_payment.purchase_order_form +msgid "Payment advances" +msgstr "Anticipos" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_purchase_order__payment_line_ids +msgid "Payment move lines" +msgstr "Líneas de asiento de pago" + +#. module: purchase_advance_payment +#: model:ir.model,name:purchase_advance_payment.model_account_payment +msgid "Payments" +msgstr "Pagos" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_payment__purchase_id +msgid "Purchase" +msgstr "Compra" + +#. module: purchase_advance_payment +#: model:ir.model,name:purchase_advance_payment.model_purchase_order +msgid "Purchase Order" +msgstr "Pedido de compra" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__payment_ref +msgid "Ref." +msgstr "Ref." + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_purchase_order__amount_residual +msgid "Residual amount" +msgstr "Importe pendiente" From 8a8ec3343302ab683e4ce67e575bf9c4ea44c910 Mon Sep 17 00:00:00 2001 From: Adriano Prado Date: Fri, 25 Aug 2023 20:40:33 +0000 Subject: [PATCH 10/12] Added translation using Weblate (Portuguese (Brazil)) --- purchase_advance_payment/README.rst | 15 +- purchase_advance_payment/i18n/pt_BR.po | 220 ++++++++++++++++++ .../static/description/index.html | 42 ++-- 3 files changed, 251 insertions(+), 26 deletions(-) create mode 100644 purchase_advance_payment/i18n/pt_BR.po diff --git a/purchase_advance_payment/README.rst b/purchase_advance_payment/README.rst index 4e589857b37..6054dfcd581 100644 --- a/purchase_advance_payment/README.rst +++ b/purchase_advance_payment/README.rst @@ -2,10 +2,13 @@ Purchase Advance Payment ======================== -.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:c8c4c2c055f100b2245f4176a379aa4c1d6ea3e28c815fd9faa0ec6e109f71b7 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png :target: https://odoo-community.org/page/development-status @@ -19,11 +22,11 @@ Purchase Advance Payment .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png :target: https://translation.odoo-community.org/projects/purchase-workflow-16-0/purchase-workflow-16-0-purchase_advance_payment :alt: Translate me on Weblate -.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/142/16.0 - :alt: Try me on Runbot +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/purchase-workflow&target_branch=16.0 + :alt: Try me on Runboat -|badge1| |badge2| |badge3| |badge4| |badge5| +|badge1| |badge2| |badge3| |badge4| |badge5| The module allows to add advance payments on purchase orders and Request for Quotation. The advance payments are allowed even before confirmation @@ -51,7 +54,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. -If you spotted it first, help us smashing it by providing a detailed and welcomed +If you spotted it first, help us to smash it by providing a detailed and welcomed `feedback `_. Do not contact contributors directly about support or help with technical issues. diff --git a/purchase_advance_payment/i18n/pt_BR.po b/purchase_advance_payment/i18n/pt_BR.po new file mode 100644 index 00000000000..e4bb6813051 --- /dev/null +++ b/purchase_advance_payment/i18n/pt_BR.po @@ -0,0 +1,220 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * purchase_advance_payment +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2023-11-01 11:38+0000\n" +"Last-Translator: Adriano Prado \n" +"Language-Team: none\n" +"Language: pt_BR\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n > 1;\n" +"X-Generator: Weblate 4.17\n" + +#. module: purchase_advance_payment +#: model:ir.model,name:purchase_advance_payment.model_account_voucher_wizard_purchase +msgid "Account Voucher Wizard Purchase" +msgstr "" + +#. module: purchase_advance_payment +#: model:ir.actions.act_window,name:purchase_advance_payment.action_view_account_voucher_wizard +#: model_terms:ir.ui.view,arch_db:purchase_advance_payment.view_account_voucher_wizard +msgid "Advance Payment" +msgstr "Pagamento Antecipado" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_purchase_order__advance_payment_status +msgid "Advance Payment Status" +msgstr "Situação Pagamento Antecipado" + +#. module: purchase_advance_payment +#: model_terms:ir.ui.view,arch_db:purchase_advance_payment.purchase_order_kpis_tree +#: model_terms:ir.ui.view,arch_db:purchase_advance_payment.purchase_order_view_tree +msgid "Amount Residual" +msgstr "Valor Residual" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__amount_total +msgid "Amount Total" +msgstr "Valor Total" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__amount_advance +msgid "Amount advanced" +msgstr "Valor Antecipado" + +#. module: purchase_advance_payment +#: model_terms:ir.ui.view,arch_db:purchase_advance_payment.view_account_voucher_wizard +msgid "Amount in Order Currency" +msgstr "Valor na Moeda do Pedido" + +#. module: purchase_advance_payment +#. odoo-python +#: code:addons/purchase_advance_payment/wizard/purchase_advance_payment_wizard.py:0 +#, python-format +msgid "Amount of advance is greater than residual amount on purchase" +msgstr "O valor do adiantamento é maior que o valor residual na compra" + +#. module: purchase_advance_payment +#. odoo-python +#: code:addons/purchase_advance_payment/wizard/purchase_advance_payment_wizard.py:0 +#, python-format +msgid "Amount of advance must be positive." +msgstr "O valor do adiantamento deve ser positivo." + +#. module: purchase_advance_payment +#: model_terms:ir.ui.view,arch_db:purchase_advance_payment.view_account_voucher_wizard +msgid "Cancel" +msgstr "Cancelar" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__create_uid +msgid "Created by" +msgstr "Criado por" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__create_date +msgid "Created on" +msgstr "Criado em" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__currency_amount +msgid "Curr. amount" +msgstr "Valor moeda" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__currency_id +#: model_terms:ir.ui.view,arch_db:purchase_advance_payment.view_account_voucher_wizard +msgid "Currency" +msgstr "Moeda" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__date +msgid "Date" +msgstr "Data" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__display_name +msgid "Display Name" +msgstr "Nome Exibição" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__id +msgid "ID" +msgstr "ID" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__journal_id +msgid "Journal" +msgstr "Diário" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__journal_currency_id +msgid "Journal Currency" +msgstr "Moeda Díario" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase____last_update +msgid "Last Modified on" +msgstr "Última Modificação em" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__write_uid +msgid "Last Updated by" +msgstr "Última Atualização por" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__write_date +msgid "Last Updated on" +msgstr "Última Atualização em" + +#. module: purchase_advance_payment +#: model_terms:ir.ui.view,arch_db:purchase_advance_payment.view_account_voucher_wizard +msgid "Make advance payment" +msgstr "Faça o Pagamento Antecipado" + +#. module: purchase_advance_payment +#: model:ir.model.fields.selection,name:purchase_advance_payment.selection__purchase_order__advance_payment_status__not_paid +msgid "Not Paid" +msgstr "Não Pago" + +#. module: purchase_advance_payment +#: model_terms:ir.ui.view,arch_db:purchase_advance_payment.view_account_voucher_wizard +msgid "Operation" +msgstr "Operação" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__order_id +msgid "Order" +msgstr "Pedido" + +#. module: purchase_advance_payment +#: model_terms:ir.ui.view,arch_db:purchase_advance_payment.view_account_voucher_wizard +msgid "Order Currency" +msgstr "Moeda Pedido" + +#. module: purchase_advance_payment +#: model_terms:ir.ui.view,arch_db:purchase_advance_payment.view_account_voucher_wizard +msgid "Order Due Amount" +msgstr "Valor Devido do Pedido" + +#. module: purchase_advance_payment +#: model:ir.model.fields.selection,name:purchase_advance_payment.selection__purchase_order__advance_payment_status__paid +msgid "Paid" +msgstr "Pago" + +#. module: purchase_advance_payment +#: model:ir.model.fields.selection,name:purchase_advance_payment.selection__purchase_order__advance_payment_status__partial +msgid "Partially Paid" +msgstr "Parcialmente Pago" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_purchase_order__account_payment_ids +#: model_terms:ir.ui.view,arch_db:purchase_advance_payment.purchase_order_form +msgid "Pay purchase advanced" +msgstr "Pagar Compra Antecipadamente" + +#. module: purchase_advance_payment +#: model_terms:ir.ui.view,arch_db:purchase_advance_payment.view_account_voucher_wizard +msgid "Payment Method" +msgstr "Forma de Pagamento" + +#. module: purchase_advance_payment +#: model_terms:ir.ui.view,arch_db:purchase_advance_payment.purchase_order_form +msgid "Payment advances" +msgstr "Adiantamentos de pagamento" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_purchase_order__payment_line_ids +msgid "Payment move lines" +msgstr "Linhas Movimento Pagamento" + +#. module: purchase_advance_payment +#: model:ir.model,name:purchase_advance_payment.model_account_payment +msgid "Payments" +msgstr "Pagamentos" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_payment__purchase_id +msgid "Purchase" +msgstr "Compra" + +#. module: purchase_advance_payment +#: model:ir.model,name:purchase_advance_payment.model_purchase_order +msgid "Purchase Order" +msgstr "Pedido Compra" + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__payment_ref +msgid "Ref." +msgstr "Ref." + +#. module: purchase_advance_payment +#: model:ir.model.fields,field_description:purchase_advance_payment.field_purchase_order__amount_residual +msgid "Residual amount" +msgstr "Valor Residual" diff --git a/purchase_advance_payment/static/description/index.html b/purchase_advance_payment/static/description/index.html index b0f5f98337f..eccde0ec8f6 100644 --- a/purchase_advance_payment/static/description/index.html +++ b/purchase_advance_payment/static/description/index.html @@ -1,20 +1,20 @@ - + - + Purchase Advance Payment