summaryrefslogtreecommitdiff
path: root/addons/purchase/models
diff options
context:
space:
mode:
authorLaurent Smet <las@odoo.com>2019-10-29 12:21:27 +0000
committerqdp-odoo <qdp@odoo.com>2020-04-10 09:47:24 +0000
commitcaeb782841fc5a7ad71a196e2c9ee67644ef9074 (patch)
tree28103bc29ab4f0d98162095f607c4c6ab1433f25 /addons/purchase/models
parentb4d1360ed1d71c8fda44ca0c3b1a80d5a112b93f (diff)
[IMP] account,*: Improve bank statements/payments workflow
- Create journal entries as soon as bank/cash statement lines are created, temporary booked on a suspense account set on the journal. - Simplify the management of "blue" lines in the reconciliation widget. A "blue" line is now a journal item using a temporary liquidity account (outstanding payment/receipt accounts, set on the journal). - Adapt and simplify the bank reconciliation report. - Remove the bank reconciliation threshold date. The reconciliation report will show the not already reconciled journal entries using a liquidity account and the not already reconciled journal entries using a temporary liquidity account. Without accounting, an account.payment will involve directly the liquidity account and then, will be considered as a statement line directly. - Remove the post_at bank reconciliation feature. The "paid" state will be set on the invoices only if reconciled with a journal entry involving the journal's liquidity account. With invoicing, the payment will do that so the "in_payment" state should never be shown up. With accounting, only the statement lines have the power to move an invoice to the "paid" state. - Fix various corner cases about the management of multi-currency in bank statement lines. - Fix the conversion dates in multi-currency: Since the bank/cash is always used on the statement lines, it will use always the real "bank" date instead of the fictive payment one. - Ensure the 'reconcile' method will raise an error if the involved moves are not posted. related enterprise PR odoo/enterprise#7019 closes odoo/odoo#41301 --task: 2092096 Related: odoo/upgrade#1018 Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
Diffstat (limited to 'addons/purchase/models')
-rw-r--r--addons/purchase/models/account_invoice.py6
-rw-r--r--addons/purchase/models/purchase.py8
2 files changed, 7 insertions, 7 deletions
diff --git a/addons/purchase/models/account_invoice.py b/addons/purchase/models/account_invoice.py
index 99d51b28b7d..2b614f7cd6e 100644
--- a/addons/purchase/models/account_invoice.py
+++ b/addons/purchase/models/account_invoice.py
@@ -59,13 +59,13 @@ class AccountMove(models.Model):
refs = [ref for ref in refs if ref]
self.ref = ','.join(refs)
- # Compute invoice_payment_ref.
+ # Compute payment_reference.
if len(refs) == 1:
- self.invoice_payment_ref = refs[0]
+ self.payment_reference = refs[0]
self.purchase_id = False
self._onchange_currency()
- self.invoice_partner_bank_id = self.bank_partner_id.bank_ids and self.bank_partner_id.bank_ids[0]
+ self.partner_bank_id = self.bank_partner_id.bank_ids and self.bank_partner_id.bank_ids[0]
@api.onchange('partner_id', 'company_id')
def _onchange_partner_id(self):
diff --git a/addons/purchase/models/purchase.py b/addons/purchase/models/purchase.py
index cf85f9d50fb..0cfe68611ce 100644
--- a/addons/purchase/models/purchase.py
+++ b/addons/purchase/models/purchase.py
@@ -457,12 +457,12 @@ class PurchaseOrder(models.Model):
else:
ref_invoice_vals['invoice_line_ids'] += invoice_vals['invoice_line_ids']
origins.add(invoice_vals['invoice_origin'])
- payment_refs.add(invoice_vals['invoice_payment_ref'])
+ payment_refs.add(invoice_vals['payment_reference'])
refs.add(invoice_vals['ref'])
ref_invoice_vals.update({
'ref': ', '.join(refs)[:2000],
'invoice_origin': ', '.join(origins),
- 'invoice_payment_ref': len(payment_refs) == 1 and payment_refs.pop() or False,
+ 'payment_reference': len(payment_refs) == 1 and payment_refs.pop() or False,
})
new_invoice_vals_list.append(ref_invoice_vals)
invoice_vals_list = new_invoice_vals_list
@@ -499,8 +499,8 @@ class PurchaseOrder(models.Model):
'invoice_user_id': self.user_id and self.user_id.id,
'partner_id': partner_invoice_id,
'fiscal_position_id': (self.fiscal_position_id or self.fiscal_position_id.get_fiscal_position(partner_invoice_id)).id,
- 'invoice_payment_ref': self.partner_ref or '',
- 'invoice_partner_bank_id': self.partner_id.bank_ids[:1].id,
+ 'payment_reference': self.partner_ref or '',
+ 'partner_bank_id': self.partner_id.bank_ids[:1].id,
'invoice_origin': self.name,
'invoice_payment_term_id': self.payment_term_id.id,
'invoice_line_ids': [],