From aca0e700ac6b3cdb63d6de3ef021cb6fce1cbb47 Mon Sep 17 00:00:00 2001 From: wan Date: Wed, 7 Aug 2019 07:48:29 +0000 Subject: [PATCH] [FIX] account: show partner in invoice list view The customers were removed from the invoice list view in https://github.com/odoo/odoo/commit/317802d69e6236a43b2249b38d2f352813644f20 This was probably because the name of the variables invoice_vendor_display_name was missleading as it was only for vendors beofre but also for customers now. So this commit also renames related variables. While we are at renaming things, I also renamed the type in variables supsense -> suspense. closes odoo/odoo#35531 Signed-off-by: Laurent Smet --- addons/account/models/account_move.py | 24 ++++++++++----------- addons/account/views/account_move_views.xml | 9 ++++---- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index f0e007d5e6c..79f8202c9d1 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -222,8 +222,8 @@ class AccountMove(models.Model): string='Vendor Bill', help="Auto-complete from a past bill.") invoice_source_email = fields.Char(string='Source Email', tracking=True) - invoice_vendor_display_name = fields.Char(compute='_compute_invoice_vendor_display_info', store=True) - invoice_vendor_icon = fields.Char(compute='_compute_invoice_vendor_display_info', store=False) + invoice_partner_display_name = fields.Char(compute='_compute_invoice_partner_display_info', store=True) + invoice_partner_icon = fields.Char(compute='_compute_invoice_partner_display_info', store=False) # ==== Cash rounding fields ==== invoice_cash_rounding_id = fields.Many2one('account.cash.rounding', string='Cash Rounding Method', @@ -241,7 +241,7 @@ class AccountMove(models.Model): invoice_filter_type_domain = fields.Char(compute='_compute_invoice_filter_type_domain', help="Technical field used to have a dynamic domain on journal / taxes in the form view.") bank_partner_id = fields.Many2one('res.partner', help='Technical field to get the domain on the bank', compute='_compute_bank_partner_id') - invoice_has_matching_supsense_amount = fields.Boolean(compute='_compute_has_matching_suspense_amount', + invoice_has_matching_suspense_amount = fields.Boolean(compute='_compute_has_matching_suspense_amount', groups='account.group_account_invoice', help="Technical field used to display an alert on invoices if there is at least a matching amount in any supsense account.") # Technical field to hide Reconciled Entries stat button @@ -977,7 +977,7 @@ class AccountMove(models.Model): move.write({'line_ids': to_write}) - def _get_domain_matching_supsense_moves(self): + def _get_domain_matching_suspense_moves(self): self.ensure_one() domain = self.env['account.move.line']._get_suspense_moves_domain() domain += ['|', ('partner_id', '=?', self.partner_id.id), ('partner_id', '=', False)] @@ -991,32 +991,32 @@ class AccountMove(models.Model): for r in self: res = False if r.state == 'posted' and r.is_invoice() and r.invoice_payment_state == 'not_paid': - domain = r._get_domain_matching_supsense_moves() + domain = r._get_domain_matching_suspense_moves() #there are more than one but less than 5 suspense moves matching the residual amount if (0 < self.env['account.move.line'].search_count(domain) < 5): domain2 = [ ('invoice_payment_state', '=', 'not_paid'), - ('state', '=', 'open'), + ('state', '=', 'posted'), ('amount_residual', '=', r.amount_residual), ('type', '=', r.type)] #there are less than 5 other open invoices of the same type with the same residual if self.env['account.move'].search_count(domain2) < 5: res = True - r.invoice_has_matching_supsense_amount = res + r.invoice_has_matching_suspense_amount = res @api.depends('partner_id', 'invoice_source_email') - def _compute_invoice_vendor_display_info(self): + def _compute_invoice_partner_display_info(self): for move in self: vendor_display_name = move.partner_id.name move.invoice_icon = '' if not vendor_display_name: if move.invoice_source_email: vendor_display_name = _('From: ') + move.invoice_source_email - move.invoice_vendor_icon = '@' + move.invoice_partner_icon = '@' else: vendor_display_name = _('Created by: %s') % move.sudo().create_uid.name - move.invoice_vendor_icon = '#' - move.invoice_vendor_display_name = vendor_display_name + move.invoice_partner_icon = '#' + move.invoice_partner_display_name = vendor_display_name @api.depends('state', 'journal_id', 'invoice_date') def _compute_invoice_sequence_number_next(self): @@ -1976,7 +1976,7 @@ class AccountMove(models.Model): def action_open_matching_suspense_moves(self): self.ensure_one() - domain = self._get_domain_matching_supsense_moves() + domain = self._get_domain_matching_suspense_moves() ids = self.env['account.move.line'].search(domain).mapped('statement_line_id').ids action_context = {'show_mode_selector': False, 'company_ids': self.mapped('company_id').ids} action_context.update({'suspense_moves_mode': True}) diff --git a/addons/account/views/account_move_views.xml b/addons/account/views/account_move_views.xml index 04379da153c..47dffb8fd17 100644 --- a/addons/account/views/account_move_views.xml +++ b/addons/account/views/account_move_views.xml @@ -356,8 +356,9 @@ - - + + + @@ -480,7 +481,7 @@ @@ -513,7 +514,7 @@ - +