From bed87e98aa41e802ecfae5cede08b2ee380a3c33 Mon Sep 17 00:00:00 2001 From: Jared Kipe Date: Wed, 30 Jan 2019 12:55:01 -0800 Subject: [PATCH 01/10] Initial commit of `sale_payment_deposit` for 12.0 --- sale_payment_deposit/__init__.py | 1 + sale_payment_deposit/__manifest__.py | 24 ++++++ sale_payment_deposit/models/__init__.py | 3 + sale_payment_deposit/models/account.py | 31 +++++++ sale_payment_deposit/models/sale.py | 47 ++++++++++ sale_payment_deposit/models/sale_patch.py | 86 +++++++++++++++++++ sale_payment_deposit/views/account_views.xml | 13 +++ .../views/sale_portal_templates.xml | 22 +++++ 8 files changed, 227 insertions(+) create mode 100755 sale_payment_deposit/__init__.py create mode 100755 sale_payment_deposit/__manifest__.py create mode 100644 sale_payment_deposit/models/__init__.py create mode 100644 sale_payment_deposit/models/account.py create mode 100644 sale_payment_deposit/models/sale.py create mode 100644 sale_payment_deposit/models/sale_patch.py create mode 100644 sale_payment_deposit/views/account_views.xml create mode 100644 sale_payment_deposit/views/sale_portal_templates.xml diff --git a/sale_payment_deposit/__init__.py b/sale_payment_deposit/__init__.py new file mode 100755 index 00000000..0650744f --- /dev/null +++ b/sale_payment_deposit/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/sale_payment_deposit/__manifest__.py b/sale_payment_deposit/__manifest__.py new file mode 100755 index 00000000..4689959c --- /dev/null +++ b/sale_payment_deposit/__manifest__.py @@ -0,0 +1,24 @@ +{ + 'name': 'Sale Payment Deposit', + 'author': 'Hibou Corp. ', + 'category': 'Sales', + 'version': '12.0.1.0.0', + 'description': + """ +Sale Deposits +============= + +Automates the creation of 'Deposit' invoices and payments. For example, someone confirming +a sale with "50% Deposit, 50% on Delivery" payment terms, will pay the +50% deposit payment up front instead of the entire order. + """, + 'depends': [ + 'sale', + 'payment', + ], + 'auto_install': False, + 'data': [ + 'views/account_views.xml', + 'views/sale_portal_templates.xml', + ], +} diff --git a/sale_payment_deposit/models/__init__.py b/sale_payment_deposit/models/__init__.py new file mode 100644 index 00000000..13088db7 --- /dev/null +++ b/sale_payment_deposit/models/__init__.py @@ -0,0 +1,3 @@ +from . import account +from . import sale +from . import sale_patch diff --git a/sale_payment_deposit/models/account.py b/sale_payment_deposit/models/account.py new file mode 100644 index 00000000..111e748f --- /dev/null +++ b/sale_payment_deposit/models/account.py @@ -0,0 +1,31 @@ +from odoo import api, fields, models + + +class AccountPaymentTerm(models.Model): + _inherit = 'account.payment.term' + + deposit_percentage = fields.Float(string='Deposit Percentage', + help='Require deposit when paying on the front end.') + + +class PaymentTransaction(models.Model): + _inherit = 'payment.transaction' + + @api.multi + def _post_process_after_done(self): + now = fields.Datetime.now() + res = super(PaymentTransaction, self)._post_process_after_done() + + # Post Process Payments made on the front of the website, reconciling to Deposit. + for transaction in self.filtered(lambda t: t.payment_id + and t.sale_order_ids + and sum(t.sale_order_ids.mapped('amount_total_deposit')) + and not t.invoice_ids and (now - t.date).seconds < 1200): + if not transaction.sale_order_ids.mapped('invoice_ids'): + # don't process ones that we might still be able to process later... + transaction.write({'is_processed': False}) + else: + # we have a payment and could attempt to reconcile to an invoice + # Leave the payment in 'is_processed': True + transaction.sale_order_ids._auto_deposit_payment_match() + return res diff --git a/sale_payment_deposit/models/sale.py b/sale_payment_deposit/models/sale.py new file mode 100644 index 00000000..293a03bb --- /dev/null +++ b/sale_payment_deposit/models/sale.py @@ -0,0 +1,47 @@ +from odoo import api, fields, models +from json import loads as json_loads + + +class SaleOrder(models.Model): + _inherit = 'sale.order' + + amount_total_deposit = fields.Monetary(string='Deposit', compute='_amount_total_deposit') + + @api.depends('amount_total', 'payment_term_id.deposit_percentage') + def _amount_total_deposit(self): + for order in self: + order.amount_total_deposit = order.amount_total * float(order.payment_term_id.deposit_percentage) / 100.0 + + def action_confirm(self): + res = super(SaleOrder, self).action_confirm() + self._auto_deposit_invoice() + return res + + def _auto_deposit_invoice(self): + wizard_model = self.env['sale.advance.payment.inv'].sudo() + for sale in self.sudo().filtered(lambda o: o.amount_total_deposit): + # Create Deposit Invoices + wizard = wizard_model.create({ + 'advance_payment_method': 'percentage', + 'amount': sale.payment_term_id.deposit_percentage, + }) + wizard.with_context(active_ids=sale.ids).create_invoices() + # Validate Invoices + sale.invoice_ids.filtered(lambda i: i.state == 'draft').action_invoice_open() + # Attempt to reconcile + sale._auto_deposit_payment_match() + + def _auto_deposit_payment_match(self): + # Attempt to find payments that could be used on this new invoice and reconcile them. + # Note that this probably doesn't work for a payment made on the front, see .account.PaymentTransaction + aml_model = self.env['account.move.line'].sudo() + for sale in self.sudo(): + for invoice in sale.invoice_ids.filtered(lambda i: i.state == 'open'): + outstanding = json_loads(invoice.outstanding_credits_debits_widget) + if isinstance(outstanding, dict) and outstanding.get('content'): + for line in outstanding.get('content'): + if abs(line.get('amount', 0.0) - invoice.residual) < 0.01 and line.get('id'): + aml = aml_model.browse(line.get('id')) + aml += invoice.move_id.line_ids.filtered(lambda l: l.account_id == aml.account_id) + if aml.reconcile(): + break diff --git a/sale_payment_deposit/models/sale_patch.py b/sale_payment_deposit/models/sale_patch.py new file mode 100644 index 00000000..c306a21b --- /dev/null +++ b/sale_payment_deposit/models/sale_patch.py @@ -0,0 +1,86 @@ +from odoo import api, fields, models +from odoo.exceptions import ValidationError +from odoo.addons.sale.models.sale import SaleOrder + + +@api.multi +def _create_payment_transaction(self, vals): + # This is a copy job from odoo.addons.sale.models.sale due to the closed nature of the vals.update(dict) call + # Ultimately, only the 'vals.update' with the new amount is really used. + '''Similar to self.env['payment.transaction'].create(vals) but the values are filled with the + current sales orders fields (e.g. the partner or the currency). + :param vals: The values to create a new payment.transaction. + :return: The newly created payment.transaction record. + ''' + # Ensure the currencies are the same. + + # extract variable for use later. + sale = self[0] + + currency = sale.pricelist_id.currency_id + if any([so.pricelist_id.currency_id != currency for so in self]): + raise ValidationError(_('A transaction can\'t be linked to sales orders having different currencies.')) + + # Ensure the partner are the same. + partner = sale.partner_id + if any([so.partner_id != partner for so in self]): + raise ValidationError(_('A transaction can\'t be linked to sales orders having different partners.')) + + # Try to retrieve the acquirer. However, fallback to the token's acquirer. + acquirer_id = vals.get('acquirer_id') + acquirer = False + payment_token_id = vals.get('payment_token_id') + + if payment_token_id: + payment_token = self.env['payment.token'].sudo().browse(payment_token_id) + + # Check payment_token/acquirer matching or take the acquirer from token + if acquirer_id: + acquirer = self.env['payment.acquirer'].browse(acquirer_id) + if payment_token and payment_token.acquirer_id != acquirer: + raise ValidationError(_('Invalid token found! Token acquirer %s != %s') % ( + payment_token.acquirer_id.name, acquirer.name)) + if payment_token and payment_token.partner_id != partner: + raise ValidationError(_('Invalid token found! Token partner %s != %s') % ( + payment_token.partner.name, partner.name)) + else: + acquirer = payment_token.acquirer_id + + # Check an acquirer is there. + if not acquirer_id and not acquirer: + raise ValidationError(_('A payment acquirer is required to create a transaction.')) + + if not acquirer: + acquirer = self.env['payment.acquirer'].browse(acquirer_id) + + # Check a journal is set on acquirer. + if not acquirer.journal_id: + raise ValidationError(_('A journal must be specified of the acquirer %s.' % acquirer.name)) + + if not acquirer_id and acquirer: + vals['acquirer_id'] = acquirer.id + + # Override for Deposit + amount = sum(self.mapped('amount_total')) + # This is a patch, all databases will run this code even if this field doesn't exist. + if hasattr(sale, 'amount_total_deposit') and sum(self.mapped('amount_total_deposit')): + amount = sum(self.mapped('amount_total_deposit')) + + vals.update({ + 'amount': amount, + 'currency_id': currency.id, + 'partner_id': partner.id, + 'sale_order_ids': [(6, 0, self.ids)], + }) + + transaction = self.env['payment.transaction'].create(vals) + + # Process directly if payment_token + if transaction.payment_token_id: + transaction.s2s_do_transaction() + + return transaction + + +# Patch core implementation. +SaleOrder._create_payment_transaction = _create_payment_transaction diff --git a/sale_payment_deposit/views/account_views.xml b/sale_payment_deposit/views/account_views.xml new file mode 100644 index 00000000..aa174032 --- /dev/null +++ b/sale_payment_deposit/views/account_views.xml @@ -0,0 +1,13 @@ + + + + account.payment.term.form.inherit + account.payment.term + + + + + + + + \ No newline at end of file diff --git a/sale_payment_deposit/views/sale_portal_templates.xml b/sale_payment_deposit/views/sale_portal_templates.xml new file mode 100644 index 00000000..cd52552d --- /dev/null +++ b/sale_payment_deposit/views/sale_portal_templates.xml @@ -0,0 +1,22 @@ + + + + \ No newline at end of file From 551d985be99b91c2ae9fe4592429c29d3232944e Mon Sep 17 00:00:00 2001 From: Jared Kipe Date: Fri, 15 Feb 2019 08:46:20 -0800 Subject: [PATCH 02/10] IMP `sale_payment_deposit` Only make deposit invoice if no other invoices are present (e.g. cancelled SO re-confirming). --- sale_payment_deposit/models/sale.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sale_payment_deposit/models/sale.py b/sale_payment_deposit/models/sale.py index 293a03bb..4a15fdc2 100644 --- a/sale_payment_deposit/models/sale.py +++ b/sale_payment_deposit/models/sale.py @@ -19,7 +19,7 @@ class SaleOrder(models.Model): def _auto_deposit_invoice(self): wizard_model = self.env['sale.advance.payment.inv'].sudo() - for sale in self.sudo().filtered(lambda o: o.amount_total_deposit): + for sale in self.sudo().filtered(lambda o: not o.invoice_ids and o.amount_total_deposit): # Create Deposit Invoices wizard = wizard_model.create({ 'advance_payment_method': 'percentage', From 443426f324d24465693432b1cf0423b04038b842 Mon Sep 17 00:00:00 2001 From: Bhoomi Date: Thu, 5 Sep 2019 10:38:02 -0400 Subject: [PATCH 03/10] IMP `sale_payment_deposit` Implement flat deposit on Payment Terms and implement functionality on sale order and account invoice. --- sale_payment_deposit/models/account.py | 4 +++- sale_payment_deposit/models/sale.py | 9 ++++++--- sale_payment_deposit/views/account_views.xml | 1 + 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/sale_payment_deposit/models/account.py b/sale_payment_deposit/models/account.py index 111e748f..7250de61 100644 --- a/sale_payment_deposit/models/account.py +++ b/sale_payment_deposit/models/account.py @@ -5,7 +5,9 @@ class AccountPaymentTerm(models.Model): _inherit = 'account.payment.term' deposit_percentage = fields.Float(string='Deposit Percentage', - help='Require deposit when paying on the front end.') + help='Require Percentage deposit when paying on the front end.') + deposit_flat = fields.Float(string='Deposit Flat', + help='Require Flat deposit when paying on the front end.') class PaymentTransaction(models.Model): diff --git a/sale_payment_deposit/models/sale.py b/sale_payment_deposit/models/sale.py index 4a15fdc2..a7b44b32 100644 --- a/sale_payment_deposit/models/sale.py +++ b/sale_payment_deposit/models/sale.py @@ -10,7 +10,10 @@ class SaleOrder(models.Model): @api.depends('amount_total', 'payment_term_id.deposit_percentage') def _amount_total_deposit(self): for order in self: - order.amount_total_deposit = order.amount_total * float(order.payment_term_id.deposit_percentage) / 100.0 + percent_deposit = order.amount_total * float(order.payment_term_id.deposit_percentage) / 100.0 + flat_deposite = float(order.payment_term_id.deposit_flat) + order.amount_total_deposit = percent_deposit + flat_deposite + def action_confirm(self): res = super(SaleOrder, self).action_confirm() @@ -22,8 +25,8 @@ class SaleOrder(models.Model): for sale in self.sudo().filtered(lambda o: not o.invoice_ids and o.amount_total_deposit): # Create Deposit Invoices wizard = wizard_model.create({ - 'advance_payment_method': 'percentage', - 'amount': sale.payment_term_id.deposit_percentage, + 'advance_payment_method': 'fixed', + 'amount': sale.amount_total_deposit, }) wizard.with_context(active_ids=sale.ids).create_invoices() # Validate Invoices diff --git a/sale_payment_deposit/views/account_views.xml b/sale_payment_deposit/views/account_views.xml index aa174032..d46a6a2c 100644 --- a/sale_payment_deposit/views/account_views.xml +++ b/sale_payment_deposit/views/account_views.xml @@ -7,6 +7,7 @@ + From c3c4e68c4124dd3eef49f2ed84fa9619f09a900a Mon Sep 17 00:00:00 2001 From: Bhoomi Date: Thu, 3 Oct 2019 10:56:32 -0400 Subject: [PATCH 04/10] MIG `sale_payment_deposit` For Odoo 13.0 --- sale_payment_deposit/__manifest__.py | 2 +- sale_payment_deposit/models/account.py | 1 - sale_payment_deposit/models/sale.py | 13 ++++++------- sale_payment_deposit/models/sale_patch.py | 1 - .../views/sale_portal_templates.xml | 4 ++-- 5 files changed, 9 insertions(+), 12 deletions(-) diff --git a/sale_payment_deposit/__manifest__.py b/sale_payment_deposit/__manifest__.py index 4689959c..b42543fe 100755 --- a/sale_payment_deposit/__manifest__.py +++ b/sale_payment_deposit/__manifest__.py @@ -2,7 +2,7 @@ 'name': 'Sale Payment Deposit', 'author': 'Hibou Corp. ', 'category': 'Sales', - 'version': '12.0.1.0.0', + 'version': '13.0.1.0.0', 'description': """ Sale Deposits diff --git a/sale_payment_deposit/models/account.py b/sale_payment_deposit/models/account.py index 7250de61..04b31246 100644 --- a/sale_payment_deposit/models/account.py +++ b/sale_payment_deposit/models/account.py @@ -13,7 +13,6 @@ class AccountPaymentTerm(models.Model): class PaymentTransaction(models.Model): _inherit = 'payment.transaction' - @api.multi def _post_process_after_done(self): now = fields.Datetime.now() res = super(PaymentTransaction, self)._post_process_after_done() diff --git a/sale_payment_deposit/models/sale.py b/sale_payment_deposit/models/sale.py index a7b44b32..3da6f709 100644 --- a/sale_payment_deposit/models/sale.py +++ b/sale_payment_deposit/models/sale.py @@ -14,7 +14,6 @@ class SaleOrder(models.Model): flat_deposite = float(order.payment_term_id.deposit_flat) order.amount_total_deposit = percent_deposit + flat_deposite - def action_confirm(self): res = super(SaleOrder, self).action_confirm() self._auto_deposit_invoice() @@ -26,11 +25,11 @@ class SaleOrder(models.Model): # Create Deposit Invoices wizard = wizard_model.create({ 'advance_payment_method': 'fixed', - 'amount': sale.amount_total_deposit, + 'fixed_amount': sale.amount_total_deposit, }) wizard.with_context(active_ids=sale.ids).create_invoices() # Validate Invoices - sale.invoice_ids.filtered(lambda i: i.state == 'draft').action_invoice_open() + sale.invoice_ids.filtered(lambda i: i.state == 'draft').post() # Attempt to reconcile sale._auto_deposit_payment_match() @@ -39,12 +38,12 @@ class SaleOrder(models.Model): # Note that this probably doesn't work for a payment made on the front, see .account.PaymentTransaction aml_model = self.env['account.move.line'].sudo() for sale in self.sudo(): - for invoice in sale.invoice_ids.filtered(lambda i: i.state == 'open'): - outstanding = json_loads(invoice.outstanding_credits_debits_widget) + for invoice in sale.invoice_ids.filtered(lambda i: i.state == 'posted'): + outstanding = json_loads(invoice.invoice_outstanding_credits_debits_widget) if isinstance(outstanding, dict) and outstanding.get('content'): for line in outstanding.get('content'): - if abs(line.get('amount', 0.0) - invoice.residual) < 0.01 and line.get('id'): + if abs(line.get('amount', 0.0) - invoice.amount_residual) < 0.01 and line.get('id'): aml = aml_model.browse(line.get('id')) - aml += invoice.move_id.line_ids.filtered(lambda l: l.account_id == aml.account_id) + aml += invoice.line_ids.filtered(lambda l: l.account_id == aml.account_id) if aml.reconcile(): break diff --git a/sale_payment_deposit/models/sale_patch.py b/sale_payment_deposit/models/sale_patch.py index c306a21b..6be1e4ac 100644 --- a/sale_payment_deposit/models/sale_patch.py +++ b/sale_payment_deposit/models/sale_patch.py @@ -3,7 +3,6 @@ from odoo.exceptions import ValidationError from odoo.addons.sale.models.sale import SaleOrder -@api.multi def _create_payment_transaction(self, vals): # This is a copy job from odoo.addons.sale.models.sale due to the closed nature of the vals.update(dict) call # Ultimately, only the 'vals.update' with the new amount is really used. diff --git a/sale_payment_deposit/views/sale_portal_templates.xml b/sale_payment_deposit/views/sale_portal_templates.xml index cd52552d..cda5acea 100644 --- a/sale_payment_deposit/views/sale_portal_templates.xml +++ b/sale_payment_deposit/views/sale_portal_templates.xml @@ -7,13 +7,13 @@
Deposit
- +
  • For an amount of:
  • Deposit today of:
  • - +
  • For the deposit amount of:
  • For an amount of:
  • From b327a9a0972a83de29b7412a5aefb894e22c77b7 Mon Sep 17 00:00:00 2001 From: Jared Kipe Date: Thu, 17 Dec 2020 10:25:12 -0800 Subject: [PATCH 05/10] [FIX] sale_payment_deposit: confirmation of orders stopped because transaction now validates amount --- sale_payment_deposit/models/__init__.py | 1 + sale_payment_deposit/models/payment.py | 33 +++++++++++++++++++++++++ sale_payment_deposit/models/sale.py | 2 +- 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 sale_payment_deposit/models/payment.py diff --git a/sale_payment_deposit/models/__init__.py b/sale_payment_deposit/models/__init__.py index 13088db7..c3152eb5 100644 --- a/sale_payment_deposit/models/__init__.py +++ b/sale_payment_deposit/models/__init__.py @@ -1,3 +1,4 @@ from . import account +from . import payment from . import sale from . import sale_patch diff --git a/sale_payment_deposit/models/payment.py b/sale_payment_deposit/models/payment.py new file mode 100644 index 00000000..f19bf7f1 --- /dev/null +++ b/sale_payment_deposit/models/payment.py @@ -0,0 +1,33 @@ +from odoo import models, _ + +import logging +_logger = logging.getLogger(__name__) + + +class PaymentTransaction(models.Model): + _inherit = 'payment.transaction' + + # Override to confirm payments totaling the amount_total_deposit + def _check_amount_and_confirm_order(self): + self.ensure_one() + for order in self.sale_order_ids.filtered(lambda so: so.state in ('draft', 'sent')): + # default amount as originally calculated + amount = order.amount_total + if order.amount_total_deposit: + amount = order.amount_total_deposit + if order.currency_id.compare_amounts(self.amount, amount) == 0: + order.with_context(send_email=True).action_confirm() + else: + _logger.warning( + '<%s> transaction AMOUNT MISMATCH for order %s (ID %s): expected %r, got %r', + self.acquirer_id.provider,order.name, order.id, + amount, self.amount, + ) + order.message_post( + subject=_("Amount Mismatch (%s)") % self.acquirer_id.provider, + body=_("The order was not confirmed despite response from the acquirer (%s): order total is %r but acquirer replied with %r.") % ( + self.acquirer_id.provider, + amount, + self.amount, + ) + ) diff --git a/sale_payment_deposit/models/sale.py b/sale_payment_deposit/models/sale.py index 3da6f709..effa9af4 100644 --- a/sale_payment_deposit/models/sale.py +++ b/sale_payment_deposit/models/sale.py @@ -7,7 +7,7 @@ class SaleOrder(models.Model): amount_total_deposit = fields.Monetary(string='Deposit', compute='_amount_total_deposit') - @api.depends('amount_total', 'payment_term_id.deposit_percentage') + @api.depends('amount_total', 'payment_term_id.deposit_percentage', 'payment_term_id.deposit_flat') def _amount_total_deposit(self): for order in self: percent_deposit = order.amount_total * float(order.payment_term_id.deposit_percentage) / 100.0 From 3953c025fe4be63362ed86fb0c4e2504199b1a25 Mon Sep 17 00:00:00 2001 From: Cedric Collins Date: Thu, 28 Oct 2021 12:07:33 -0500 Subject: [PATCH 06/10] [MIG] sale_payment_deposit: migrated to 14.0 --- sale_payment_deposit/__manifest__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sale_payment_deposit/__manifest__.py b/sale_payment_deposit/__manifest__.py index b42543fe..e825a158 100755 --- a/sale_payment_deposit/__manifest__.py +++ b/sale_payment_deposit/__manifest__.py @@ -2,7 +2,7 @@ 'name': 'Sale Payment Deposit', 'author': 'Hibou Corp. ', 'category': 'Sales', - 'version': '13.0.1.0.0', + 'version': '14.0.1.0.0', 'description': """ Sale Deposits From 24669b46bc1a937549656cf57dcf0264b22bd8df Mon Sep 17 00:00:00 2001 From: Cedric Collins Date: Thu, 28 Oct 2021 15:56:19 -0500 Subject: [PATCH 07/10] [FIX] sale_payment_deposit: fix error in portal payment process --- sale_payment_deposit/models/payment.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/sale_payment_deposit/models/payment.py b/sale_payment_deposit/models/payment.py index f19bf7f1..e20e36cc 100644 --- a/sale_payment_deposit/models/payment.py +++ b/sale_payment_deposit/models/payment.py @@ -31,3 +31,19 @@ class PaymentTransaction(models.Model): self.amount, ) ) + + def render_sale_button(self, order, submit_txt=None, render_values=None): + values = { + 'partner_id': order.partner_id.id, + 'type': self.type, + } + if render_values: + values.update(render_values) + # Not very elegant to do that here but no choice regarding the design. + self._log_payment_transaction_sent() + return self.acquirer_id.with_context(submit_class='btn btn-primary', submit_txt=submit_txt or _('Pay Now')).sudo().render( + self.reference, + order.amount_total_deposit or order.amount_total, + order.pricelist_id.currency_id.id, + values=values, + ) From 54418d6698bbcec027f171791d48dd5d3df2c0c2 Mon Sep 17 00:00:00 2001 From: Cedric Collins Date: Mon, 1 Nov 2021 16:30:22 -0500 Subject: [PATCH 08/10] [MIG] sale_payment_deposit: migrate to 15.0 H5924 --- sale_payment_deposit/__manifest__.py | 2 +- sale_payment_deposit/models/sale_patch.py | 3 +-- sale_payment_deposit/views/sale_portal_templates.xml | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/sale_payment_deposit/__manifest__.py b/sale_payment_deposit/__manifest__.py index e825a158..c1747d1f 100755 --- a/sale_payment_deposit/__manifest__.py +++ b/sale_payment_deposit/__manifest__.py @@ -2,7 +2,7 @@ 'name': 'Sale Payment Deposit', 'author': 'Hibou Corp. ', 'category': 'Sales', - 'version': '14.0.1.0.0', + 'version': '15.0.1.0.0', 'description': """ Sale Deposits diff --git a/sale_payment_deposit/models/sale_patch.py b/sale_payment_deposit/models/sale_patch.py index 6be1e4ac..ac6b533b 100644 --- a/sale_payment_deposit/models/sale_patch.py +++ b/sale_payment_deposit/models/sale_patch.py @@ -1,6 +1,5 @@ -from odoo import api, fields, models from odoo.exceptions import ValidationError -from odoo.addons.sale.models.sale import SaleOrder +from odoo.addons.sale.models.sale_order import SaleOrder def _create_payment_transaction(self, vals): diff --git a/sale_payment_deposit/views/sale_portal_templates.xml b/sale_payment_deposit/views/sale_portal_templates.xml index cda5acea..d1243a93 100644 --- a/sale_payment_deposit/views/sale_portal_templates.xml +++ b/sale_payment_deposit/views/sale_portal_templates.xml @@ -10,13 +10,13 @@
  • For an amount of:
  • Deposit today of:
  • -
  • +
  • For the deposit amount of:
  • For an amount of:
  • -
  • +
  • \ No newline at end of file From 429c501e78441816776b6de31becc19e8f1ab7d8 Mon Sep 17 00:00:00 2001 From: Cedric Collins Date: Thu, 27 Jan 2022 19:49:52 -0600 Subject: [PATCH 09/10] [FIX] sale_payment_deposit: remove unneeded code and fix sale portal template --- sale_payment_deposit/__manifest__.py | 1 + sale_payment_deposit/models/payment.py | 16 ---------------- .../views/sale_portal_templates.xml | 14 ++++++++------ 3 files changed, 9 insertions(+), 22 deletions(-) diff --git a/sale_payment_deposit/__manifest__.py b/sale_payment_deposit/__manifest__.py index c1747d1f..57cdd654 100755 --- a/sale_payment_deposit/__manifest__.py +++ b/sale_payment_deposit/__manifest__.py @@ -2,6 +2,7 @@ 'name': 'Sale Payment Deposit', 'author': 'Hibou Corp. ', 'category': 'Sales', + 'license': 'AGPL-3', 'version': '15.0.1.0.0', 'description': """ diff --git a/sale_payment_deposit/models/payment.py b/sale_payment_deposit/models/payment.py index e20e36cc..f19bf7f1 100644 --- a/sale_payment_deposit/models/payment.py +++ b/sale_payment_deposit/models/payment.py @@ -31,19 +31,3 @@ class PaymentTransaction(models.Model): self.amount, ) ) - - def render_sale_button(self, order, submit_txt=None, render_values=None): - values = { - 'partner_id': order.partner_id.id, - 'type': self.type, - } - if render_values: - values.update(render_values) - # Not very elegant to do that here but no choice regarding the design. - self._log_payment_transaction_sent() - return self.acquirer_id.with_context(submit_class='btn btn-primary', submit_txt=submit_txt or _('Pay Now')).sudo().render( - self.reference, - order.amount_total_deposit or order.amount_total, - order.pricelist_id.currency_id.id, - values=values, - ) diff --git a/sale_payment_deposit/views/sale_portal_templates.xml b/sale_payment_deposit/views/sale_portal_templates.xml index d1243a93..75987c19 100644 --- a/sale_payment_deposit/views/sale_portal_templates.xml +++ b/sale_payment_deposit/views/sale_portal_templates.xml @@ -1,22 +1,24 @@ \ No newline at end of file From aa45f3c3829c282c4829e0c59259a9fd2a7c1161 Mon Sep 17 00:00:00 2001 From: Leo Pinedo Date: Mon, 24 Oct 2022 17:08:22 +0000 Subject: [PATCH 10/10] [MIG] sale_payment_deposit: to 16 --- sale_payment_deposit/__manifest__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sale_payment_deposit/__manifest__.py b/sale_payment_deposit/__manifest__.py index 57cdd654..c435a5a3 100755 --- a/sale_payment_deposit/__manifest__.py +++ b/sale_payment_deposit/__manifest__.py @@ -3,7 +3,7 @@ 'author': 'Hibou Corp. ', 'category': 'Sales', 'license': 'AGPL-3', - 'version': '15.0.1.0.0', + 'version': '16.0.1.0.0', 'description': """ Sale Deposits