From 4b074ca11c840d5df9a2bb9eaedd677f11f7b686 Mon Sep 17 00:00:00 2001 From: dbh Date: Thu, 4 May 2017 16:05:32 +0200 Subject: [PATCH] [IMP] account: rename 'Refund' to 'Credit Note' --- addons/account/data/account_data.xml | 4 +- addons/account/models/account.py | 10 ++-- .../account/models/account_bank_statement.py | 2 +- addons/account/models/account_invoice.py | 46 +++++++++---------- addons/account/models/account_move.py | 2 +- addons/account/models/account_payment.py | 4 +- .../account/report/account_invoice_report.py | 6 +-- .../report/account_invoice_report_view.xml | 4 +- .../tests/test_account_customer_invoice.py | 6 +-- addons/account/views/account_invoice_view.xml | 14 +++--- .../views/account_journal_dashboard_view.xml | 8 ++-- addons/account/views/account_report.xml | 16 +++---- addons/account/views/report_invoice.xml | 6 +-- .../account/wizard/account_invoice_refund.py | 14 +++--- .../wizard/account_invoice_refund_view.xml | 4 +- .../data/gamification_sale_crm_data.xml | 8 ++-- addons/product/models/product_template.py | 4 +- .../report_intrastat_invoice_template.xml | 4 +- .../report/report_intrastat_report.xml | 8 ++-- 19 files changed, 85 insertions(+), 85 deletions(-) diff --git a/addons/account/data/account_data.xml b/addons/account/data/account_data.xml index 09daa42bbeb..e245314448a 100644 --- a/addons/account/data/account_data.xml +++ b/addons/account/data/account_data.xml @@ -106,7 +106,7 @@ 4 - Payments customer refunds sequence + Payments customer credit notes sequence account.payment.customer.refund CUST.OUT/%(range_year)s/ @@ -126,7 +126,7 @@ 4 - Payments supplier refunds sequence + Payments supplier credit notes sequence account.payment.supplier.refund SUPP.IN/%(range_year)s/ diff --git a/addons/account/models/account.py b/addons/account/models/account.py index a626a410582..0f1ea103ecb 100644 --- a/addons/account/models/account.py +++ b/addons/account/models/account.py @@ -214,8 +214,8 @@ class AccountJournal(models.Model): help="If this box is checked, the system will try to group the accounting lines when generating them from invoices.") sequence_id = fields.Many2one('ir.sequence', string='Entry Sequence', help="This field contains the information related to the numbering of the journal entries of this journal.", required=True, copy=False) - refund_sequence_id = fields.Many2one('ir.sequence', string='Refund Entry Sequence', - help="This field contains the information related to the numbering of the refund entries of this journal.", copy=False) + refund_sequence_id = fields.Many2one('ir.sequence', string='Credit Note Entry Sequence', + help="This field contains the information related to the numbering of the credit note entries of this journal.", copy=False) sequence = fields.Integer(help='Used to order Journals in the dashboard view', default=10) #groups_id = fields.Many2many('res.groups', 'account_journal_group_rel', 'journal_id', 'group_id', string='Groups') @@ -223,7 +223,7 @@ class AccountJournal(models.Model): company_id = fields.Many2one('res.company', string='Company', required=True, index=True, default=lambda self: self.env.user.company_id, help="Company related to this journal") - refund_sequence = fields.Boolean(string='Dedicated Refund Sequence', help="Check this box if you don't want to share the same sequence for invoices and refunds made from this journal", default=False) + refund_sequence = fields.Boolean(string='Dedicated Credit Note Sequence', help="Check this box if you don't want to share the same sequence for invoices and credit notes made from this journal", default=False) inbound_payment_method_ids = fields.Many2many('account.payment.method', 'account_journal_inbound_payment_method_rel', 'journal_id', 'inbound_payment_method', domain=[('payment_type', '=', 'inbound')], string='Debit Methods', default=lambda self: self._default_inbound_payment_methods(), @@ -536,8 +536,8 @@ class AccountTax(models.Model): amount = fields.Float(required=True, digits=(16, 4)) account_id = fields.Many2one('account.account', domain=[('deprecated', '=', False)], string='Tax Account', ondelete='restrict', help="Account that will be set on invoice tax lines for invoices. Leave empty to use the expense account.", oldname='account_collected_id') - refund_account_id = fields.Many2one('account.account', domain=[('deprecated', '=', False)], string='Tax Account on Refunds', ondelete='restrict', - help="Account that will be set on invoice tax lines for refunds. Leave empty to use the expense account.", oldname='account_paid_id') + refund_account_id = fields.Many2one('account.account', domain=[('deprecated', '=', False)], string='Tax Account on Credit Notes', ondelete='restrict', + help="Account that will be set on invoice tax lines for credit notes. Leave empty to use the expense account.", oldname='account_paid_id') description = fields.Char(string='Label on Invoices', translate=True) price_include = fields.Boolean(string='Included in Price', default=False, help="Check this if the price you use on the product and invoices includes this tax.") diff --git a/addons/account/models/account_bank_statement.py b/addons/account/models/account_bank_statement.py index 2d7569f2c56..0a510fe0c9c 100644 --- a/addons/account/models/account_bank_statement.py +++ b/addons/account/models/account_bank_statement.py @@ -829,7 +829,7 @@ class AccountBankStatementLine(models.Model): st_line.process_reconciliation(new_aml_dicts=[vals]) def process_reconciliation(self, counterpart_aml_dicts=None, payment_aml_rec=None, new_aml_dicts=None): - """ Match statement lines with existing payments (eg. checks) and/or payables/receivables (eg. invoices and refunds) and/or new move lines (eg. write-offs). + """ Match statement lines with existing payments (eg. checks) and/or payables/receivables (eg. invoices and credit notes) and/or new move lines (eg. write-offs). If any new journal item needs to be created (via new_aml_dicts or counterpart_aml_dicts), a new journal entry will be created and will contain those items, as well as a journal item for the bank statement line. Finally, mark the statement line as reconciled by putting the matched moves ids in the column journal_entry_ids. diff --git a/addons/account/models/account_invoice.py b/addons/account/models/account_invoice.py index 00f0dff1ff7..2e1528b4d8d 100644 --- a/addons/account/models/account_invoice.py +++ b/addons/account/models/account_invoice.py @@ -27,8 +27,8 @@ TYPE2JOURNAL = { TYPE2REFUND = { 'out_invoice': 'out_refund', # Customer Invoice 'in_invoice': 'in_refund', # Vendor Bill - 'out_refund': 'out_invoice', # Customer Refund - 'in_refund': 'in_invoice', # Vendor Refund + 'out_refund': 'out_invoice', # Customer Credit Note + 'in_refund': 'in_invoice', # Vendor Credit Note } MAGIC_COLUMNS = ('id', 'create_uid', 'create_date', 'write_uid', 'write_date') @@ -206,13 +206,13 @@ class AccountInvoice(models.Model): type = fields.Selection([ ('out_invoice','Customer Invoice'), ('in_invoice','Vendor Bill'), - ('out_refund','Customer Refund'), - ('in_refund','Vendor Refund'), + ('out_refund','Customer Credit Note'), + ('in_refund','Vendor Credit Note'), ], readonly=True, index=True, change_default=True, default=lambda self: self._context.get('type', 'out_invoice'), track_visibility='always') - refund_invoice_id = fields.Many2one('account.invoice', string="Invoice for which this invoice is the refund") + refund_invoice_id = fields.Many2one('account.invoice', string="Invoice for which this invoice is the credit note") number = fields.Char(related='move_id.name', store=True, readonly=True, copy=False) move_name = fields.Char(string='Journal Entry Name', readonly=False, default=False, copy=False, @@ -282,10 +282,10 @@ class AccountInvoice(models.Model): store=True, readonly=True, compute='_compute_amount') amount_total_signed = fields.Monetary(string='Total in Invoice Currency', currency_field='currency_id', store=True, readonly=True, compute='_compute_amount', - help="Total amount in the currency of the invoice, negative for refunds.") + help="Total amount in the currency of the invoice, negative for credit notes.") amount_total_company_signed = fields.Monetary(string='Total in Company Currency', currency_field='company_currency_id', store=True, readonly=True, compute='_compute_amount', - help="Total amount in the currency of the company, negative for refunds.") + help="Total amount in the currency of the company, negative for credit notes.") currency_id = fields.Many2one('res.currency', string='Currency', required=True, readonly=True, states={'draft': [('readonly', False)]}, default=_default_currency, track_visibility='always') @@ -301,7 +301,7 @@ class AccountInvoice(models.Model): reconciled = fields.Boolean(string='Paid/Reconciled', store=True, readonly=True, compute='_compute_residual', help="It indicates that the invoice has been paid and the journal entry of the invoice has been reconciled with one or several journal entries of payment.") partner_bank_id = fields.Many2one('res.partner.bank', string='Bank Account', - help='Bank Account Number to which the invoice will be paid. A Company bank account if this is a Customer Invoice or Vendor Refund, otherwise a Partner bank account number.', + help='Bank Account Number to which the invoice will be paid. A Company bank account if this is a Customer Invoice or Vendor Credit Note, otherwise a Partner bank account number.', readonly=True, states={'draft': [('readonly', False)]}) #Default value computed in default_get for out_invoices residual = fields.Monetary(string='Amount Due', @@ -466,7 +466,7 @@ class AccountInvoice(models.Model): def unlink(self): for invoice in self: if invoice.state not in ('draft', 'cancel'): - raise UserError(_('You cannot delete an invoice which is not draft or cancelled. You should refund it instead.')) + raise UserError(_('You cannot delete an invoice which is not draft or cancelled. You should create a credit note instead.')) elif invoice.move_name: raise UserError(_('You cannot delete an invoice after it has been validated (and received a number). You can set it back to "Draft" state and modify its content, then re-confirm it.')) return super(AccountInvoice, self).unlink() @@ -927,11 +927,11 @@ class AccountInvoice(models.Model): @api.multi def _check_duplicate_supplier_reference(self): for invoice in self: - #refuse to validate a vendor bill/refund if there already exists one with the same reference for the same partner, - #because it's probably a double encoding of the same bill/refund + # refuse to validate a vendor bill/credit note if there already exists one with the same reference for the same partner, + # because it's probably a double encoding of the same bill/credit note if invoice.type in ('in_invoice', 'in_refund') and invoice.reference: if self.search([('type', '=', invoice.type), ('reference', '=', invoice.reference), ('company_id', '=', invoice.company_id.id), ('commercial_partner_id', '=', invoice.commercial_partner_id.id), ('id', '!=', invoice.id)]): - raise UserError(_("Duplicated vendor reference detected. You probably encoded twice the same vendor bill/refund.")) + raise UserError(_("Duplicated vendor reference detected. You probably encoded twice the same vendor bill/credit note.")) @api.multi def invoice_validate(self): @@ -989,8 +989,8 @@ class AccountInvoice(models.Model): TYPES = { 'out_invoice': _('Invoice'), 'in_invoice': _('Vendor Bill'), - 'out_refund': _('Refund'), - 'in_refund': _('Vendor Refund'), + 'out_refund': _('Credit Note'), + 'in_refund': _('Vendor Credit note'), } result = [] for inv in self: @@ -1031,17 +1031,17 @@ class AccountInvoice(models.Model): @api.model def _prepare_refund(self, invoice, date_invoice=None, date=None, description=None, journal_id=None): - """ Prepare the dict of values to create the new refund from the invoice. + """ Prepare the dict of values to create the new credit note from the invoice. This method may be overridden to implement custom - refund generation (making sure to call super() to establish + credit note generation (making sure to call super() to establish a clean extension chain). - :param record invoice: invoice to refund - :param string date_invoice: refund creation date from the wizard + :param record invoice: invoice as credit note + :param string date_invoice: credit note creation date from the wizard :param integer date: force date from the wizard - :param string description: description of the refund from the wizard + :param string description: description of the credit note from the wizard :param integer journal_id: account.journal from the wizard - :return: dict of value to create() the refund + :return: dict of value to create() the credit note """ values = {} for field in ['name', 'reference', 'comment', 'date_due', 'partner_id', 'company_id', @@ -1086,8 +1086,8 @@ class AccountInvoice(models.Model): values = self._prepare_refund(invoice, date_invoice=date_invoice, date=date, description=description, journal_id=journal_id) refund_invoice = self.create(values) - invoice_type = {'out_invoice': ('customer invoices refund'), - 'in_invoice': ('vendor bill refund')} + 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) refund_invoice.message_post(body=message) new_invoices += refund_invoice @@ -1224,7 +1224,7 @@ class AccountInvoiceLine(models.Model): store=True, readonly=True, compute='_compute_price') price_subtotal_signed = fields.Monetary(string='Amount Signed', currency_field='company_currency_id', store=True, readonly=True, compute='_compute_price', - help="Total amount in the currency of the company, negative for refunds.") + help="Total amount in the currency of the company, negative for credit note.") quantity = fields.Float(string='Quantity', digits=dp.get_precision('Product Unit of Measure'), required=True, default=1) discount = fields.Float(string='Discount (%)', digits=dp.get_precision('Discount'), diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index 8bac68560cc..99c1b61d636 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -148,7 +148,7 @@ class AccountMove(models.Model): sequence = journal.sequence_id if invoice and invoice.type in ['out_refund', 'in_refund'] and journal.refund_sequence: if not journal.refund_sequence_id: - raise UserError(_('Please define a sequence for the refunds')) + raise UserError(_('Please define a sequence for the credit notes')) sequence = journal.refund_sequence_id new_name = sequence.with_context(ir_sequence_date=move.date).next_by_id() diff --git a/addons/account/models/account_payment.py b/addons/account/models/account_payment.py index 8acbf9da317..81d7d07a0de 100644 --- a/addons/account/models/account_payment.py +++ b/addons/account/models/account_payment.py @@ -531,10 +531,10 @@ class account_payment(models.Model): if self.payment_type == 'inbound': name += _("Customer Payment") elif self.payment_type == 'outbound': - name += _("Customer Refund") + name += _("Customer Credit Note") elif self.partner_type == 'supplier': if self.payment_type == 'inbound': - name += _("Vendor Refund") + name += _("Vendor Credit Note") elif self.payment_type == 'outbound': name += _("Vendor Payment") if invoice: diff --git a/addons/account/report/account_invoice_report.py b/addons/account/report/account_invoice_report.py index cf9b5738a47..042455837ce 100644 --- a/addons/account/report/account_invoice_report.py +++ b/addons/account/report/account_invoice_report.py @@ -50,8 +50,8 @@ class AccountInvoiceReport(models.Model): type = fields.Selection([ ('out_invoice', 'Customer Invoice'), ('in_invoice', 'Vendor Bill'), - ('out_refund', 'Customer Refund'), - ('in_refund', 'Vendor Refund'), + ('out_refund', 'Customer Credit Note'), + ('in_refund', 'Vendor Credit Note'), ], readonly=True) state = fields.Selection([ ('draft', 'Draft'), @@ -132,7 +132,7 @@ class AccountInvoiceReport(models.Model): LEFT JOIN product_uom u ON u.id = ail.uom_id LEFT JOIN product_uom u2 ON u2.id = pt.uom_id JOIN ( - -- Temporary table to decide if the qty should be added or retrieved (Invoice vs Refund) + -- Temporary table to decide if the qty should be added or retrieved (Invoice vs Credit Note) SELECT id,(CASE WHEN ai.type::text = ANY (ARRAY['out_refund'::character varying::text, 'in_invoice'::character varying::text]) THEN -1 diff --git a/addons/account/report/account_invoice_report_view.xml b/addons/account/report/account_invoice_report_view.xml index 5bd391a2f62..14df1502065 100644 --- a/addons/account/report/account_invoice_report_view.xml +++ b/addons/account/report/account_invoice_report_view.xml @@ -47,7 +47,7 @@ {'group_by': ['date:month', 'categ_id'], 'residual_invisible':True} - By Refund + By Credit Note account.invoice.report [('type', '=', 'out_refund')] @@ -81,7 +81,7 @@ - + diff --git a/addons/account/tests/test_account_customer_invoice.py b/addons/account/tests/test_account_customer_invoice.py index 201d973673c..2f7142e67d2 100644 --- a/addons/account/tests/test_account_customer_invoice.py +++ b/addons/account/tests/test_account_customer_invoice.py @@ -91,13 +91,13 @@ class TestAccountCustomerInvoice(AccountTestUsers): total_after_confirm = self.partner3.total_invoiced self.assertEquals(total_after_confirm - total_before_confirm, self.account_invoice_customer0.amount_untaxed_signed) - # I refund the invoice Using Refund Button + # I created a credit note Using Add Credit Note Button invoice_refund_obj = self.env['account.invoice.refund'] self.account_invoice_refund_0 = invoice_refund_obj.create(dict( - description='Refund To China Export', + description='Credit Note for China Export', date=datetime.date.today(), filter_refund='refund' )) - # I clicked on refund button. + # I clicked on Add Credit Note button. self.account_invoice_refund_0.invoice_refund() diff --git a/addons/account/views/account_invoice_view.xml b/addons/account/views/account_invoice_view.xml index 3dc37f3b735..f14f80f4494 100644 --- a/addons/account/views/account_invoice_view.xml +++ b/addons/account/views/account_invoice_view.xml @@ -219,7 +219,7 @@