diff --git a/addons/account/models/account_invoice.py b/addons/account/models/account_invoice.py index cd8a907c796..efc2d3aa831 100644 --- a/addons/account/models/account_invoice.py +++ b/addons/account/models/account_invoice.py @@ -1368,7 +1368,7 @@ class AccountInvoice(models.Model): refund_invoice = self.create(values) invoice_type = {'out_invoice': ('customer invoices credit note'), 'in_invoice': ('vendor bill credit note')} - message = _("This %s has been created from: %s") % (invoice_type[invoice.type], invoice.id, invoice.number) + message = _("This %s has been created from: %s
Reason: %s") % (invoice_type[invoice.type], invoice.id, invoice.number, description) refund_invoice.message_post(body=message) new_invoices += refund_invoice return new_invoices diff --git a/addons/account/models/account_journal_dashboard.py b/addons/account/models/account_journal_dashboard.py index 5512398a92e..cb58e37df92 100644 --- a/addons/account/models/account_journal_dashboard.py +++ b/addons/account/models/account_journal_dashboard.py @@ -5,7 +5,7 @@ from babel.dates import format_datetime, format_date from odoo import models, api, _, fields from odoo.release import version -from odoo.tools import DEFAULT_SERVER_DATE_FORMAT as DF +from odoo.tools import DEFAULT_SERVER_DATE_FORMAT as DF, safe_eval from odoo.tools.misc import formatLang class account_journal(models.Model): @@ -374,19 +374,18 @@ class account_journal(models.Model): return self.open_payments_action('transfer') @api.multi - def open_payments_action(self, payment_type): - ctx = self._context.copy() - ctx.update({ - 'default_payment_type': payment_type, - 'default_journal_id': self.id - }) - ctx.pop('group_by', None) - action_rec = self.env['ir.model.data'].xmlid_to_object('account.action_account_payments') - if action_rec: - action = action_rec.read([])[0] - action['context'] = ctx - action['domain'] = [('journal_id','=',self.id),('payment_type','=',payment_type)] - return action + def open_payments_action(self, payment_type, mode='tree'): + if payment_type == 'outbound': + action_ref = 'account.action_account_payments_payable' + elif payment_type == 'transfer': + action_ref = 'account.action_account_payments_transfer' + else: + action_ref = 'account.action_account_payments' + [action] = self.env.ref(action_ref).read() + action['context'] = dict(safe_eval(action.get('context')), default_journal_id=self.id, search_default_journal_id=self.id) + if mode == 'form': + action['views'] = [[False, 'form']] + return action @api.multi def open_action_with_context(self): @@ -417,6 +416,21 @@ class account_journal(models.Model): }) return action + @api.multi + def create_customer_payment(self): + """return action to create a customer payment""" + return self.open_payments_action('inbound', mode='form') + + @api.multi + def create_supplier_payment(self): + """return action to create a supplier payment""" + return self.open_payments_action('outbound', mode='form') + + @api.multi + def create_internal_transfer(self): + """return action to create a internal transfer""" + return self.open_payments_action('transfer', mode='form') + ##################### # Setup Steps Stuff # ##################### diff --git a/addons/account/views/account_journal_dashboard_view.xml b/addons/account/views/account_journal_dashboard_view.xml index f6b74013d54..a5378c46823 100644 --- a/addons/account/views/account_journal_dashboard_view.xml +++ b/addons/account/views/account_journal_dashboard_view.xml @@ -60,13 +60,19 @@ View
- - Bank Statements - Cash Statements - + Statements
- Search Operations + Operations +
+
+ Customer Payments +
+
+ Vendor Payments +
+
+ Internal Transfers
Journal Items @@ -79,20 +85,20 @@
- Transaction + Statement - Transaction + Statement
- Send Money + Customer Payment
- Receive Money + Vendor Payment
- Internal Transfer + Internal Transfer
@@ -100,10 +106,6 @@
Reconciliation
-
- Reconcile - Nothing to Reconcile -
Reconciliation Models
diff --git a/addons/account/views/account_payment_view.xml b/addons/account/views/account_payment_view.xml index 480b1378a29..f7a425f174b 100644 --- a/addons/account/views/account_payment_view.xml +++ b/addons/account/views/account_payment_view.xml @@ -92,8 +92,8 @@ - - + + @@ -217,6 +217,23 @@ + + Internal Transfers + account.payment + form + tree,kanban,form,graph + {'default_payment_type': 'transfer', 'search_default_transfers_filter': 1} + [] + + +

+ Register a payment +

+ Payments are used to register liquidity movements. You can process those payments by your own means or by using installed facilities. +

+
+
+ diff --git a/addons/account/wizard/account_invoice_refund.py b/addons/account/wizard/account_invoice_refund.py index 96bbe456e37..846d61b184e 100644 --- a/addons/account/wizard/account_invoice_refund.py +++ b/addons/account/wizard/account_invoice_refund.py @@ -100,6 +100,8 @@ class AccountInvoiceRefund(models.TransientModel): else: invoice[field] = invoice[field] or False inv_refund = inv_obj.create(invoice) + body = _('Correction of %s
Reason: %s') % (inv.id, inv.number, description) + inv_refund.message_post(body=body) if inv_refund.payment_term_id.id: inv_refund._onchange_payment_term_date_invoice() created_inv.append(inv_refund.id) @@ -107,15 +109,20 @@ class AccountInvoiceRefund(models.TransientModel): inv.type == 'out_refund' and 'action_invoice_tree1' or \ inv.type == 'in_invoice' and 'action_invoice_in_refund' or \ inv.type == 'in_refund' and 'action_invoice_tree2' - # Put the reason in the chatter - subject = _("Credit Note") - body = description - refund.message_post(body=body, subject=subject) if xml_id: result = self.env.ref('account.%s' % (xml_id)).read()[0] - invoice_domain = safe_eval(result['domain']) - invoice_domain.append(('id', 'in', created_inv)) - result['domain'] = invoice_domain + if mode == 'modify': + # When refund method is `modify` then it will directly open the new draft bill/invoice in form view + if inv_refund.type == 'in_invoice': + view_ref = self.env.ref('account.invoice_supplier_form') + else: + view_ref = self.env.ref('account.invoice_form') + result['views'] = [(view_ref.id, 'form')] + result['res_id'] = inv_refund.id + else: + invoice_domain = safe_eval(result['domain']) + invoice_domain.append(('id', 'in', created_inv)) + result['domain'] = invoice_domain return result return True diff --git a/addons/account_bank_statement_import/account_bank_statement_import_view.xml b/addons/account_bank_statement_import/account_bank_statement_import_view.xml index 27d945d64e9..e9ea56243c4 100644 --- a/addons/account_bank_statement_import/account_bank_statement_import_view.xml +++ b/addons/account_bank_statement_import/account_bank_statement_import_view.xml @@ -45,7 +45,7 @@ Import Statement - + Import Statement