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: