[IMP] account: rename 'Refund' to 'Credit Note'
This commit is contained in:
@@ -106,7 +106,7 @@
|
||||
<field name="padding">4</field>
|
||||
</record>
|
||||
<record id="sequence_payment_customer_refund" model="ir.sequence">
|
||||
<field name="name">Payments customer refunds sequence</field>
|
||||
<field name="name">Payments customer credit notes sequence</field>
|
||||
<field name="code">account.payment.customer.refund</field>
|
||||
<field name="prefix">CUST.OUT/%(range_year)s/</field>
|
||||
<field eval="1" name="number_next"/>
|
||||
@@ -126,7 +126,7 @@
|
||||
<field name="padding">4</field>
|
||||
</record>
|
||||
<record id="sequence_payment_supplier_refund" model="ir.sequence">
|
||||
<field name="name">Payments supplier refunds sequence</field>
|
||||
<field name="name">Payments supplier credit notes sequence</field>
|
||||
<field name="code">account.payment.supplier.refund</field>
|
||||
<field name="prefix">SUPP.IN/%(range_year)s/</field>
|
||||
<field eval="1" name="number_next"/>
|
||||
|
||||
@@ -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.")
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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: <a href=# data-oe-model=account.invoice data-oe-id=%d>%s</a>") % (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'),
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
<field name="context">{'group_by': ['date:month', 'categ_id'], 'residual_invisible':True}</field>
|
||||
</record>
|
||||
<record id="filter_invoice_refund" model="ir.filters">
|
||||
<field name="name">By Refund</field>
|
||||
<field name="name">By Credit Note</field>
|
||||
<field name="model_id">account.invoice.report</field>
|
||||
<field name="domain">[('type', '=', 'out_refund')]</field>
|
||||
<field name="user_id" eval="False"/>
|
||||
@@ -81,7 +81,7 @@
|
||||
<filter string="Vendor" name="supplier" domain="['|', ('type','=','in_invoice'),('type','=','in_refund')]"/>
|
||||
<separator/>
|
||||
<filter string="Invoice" domain="['|', ('type','=','out_invoice'),('type','=','in_invoice')]"/>
|
||||
<filter string="Refund" domain="['|', ('type','=','out_refund'),('type','=','in_refund')]"/>
|
||||
<filter string="Credit Note" domain="['|', ('type','=','out_refund'),('type','=','in_refund')]"/>
|
||||
<field name="partner_id" operator="child_of"/>
|
||||
<field name="user_id" />
|
||||
<field name="categ_id" filter_domain="[('categ_id', 'child_of', self)]"/>
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -219,7 +219,7 @@
|
||||
<header>
|
||||
<button name="action_invoice_open" type="object" states="draft" string="Validate" class="oe_highlight" groups="account.group_account_invoice"/>
|
||||
<button name="%(action_account_invoice_payment)d" type="action" states="open" string="Register Payment" groups="account.group_account_invoice" class="oe_highlight"/>
|
||||
<button name="%(action_account_invoice_refund)d" type='action' string='Ask Refund' groups="account.group_account_invoice" attrs="{'invisible': ['|',('type', 'in', ['in_refund','out_refund']),('state','not in',('open','paid'))]}"/>
|
||||
<button name="%(action_account_invoice_refund)d" type='action' string='Ask for a Credit Note' groups="account.group_account_invoice" attrs="{'invisible': ['|',('type', 'in', ['in_refund','out_refund']),('state','not in',('open','paid'))]}"/>
|
||||
<button name="action_invoice_cancel" type="object" states="draft" string="Cancel Bill" groups="account.group_account_invoice"/>
|
||||
<button name="action_invoice_draft" states="cancel" string="Set to Draft" type="object" groups="account.group_account_invoice"/>
|
||||
<field name="state" widget="statusbar" statusbar_visible="draft,open,paid" />
|
||||
@@ -231,9 +231,9 @@
|
||||
<sheet string="Vendor Bill">
|
||||
<div>
|
||||
<label string="Draft Bill" attrs="{'invisible': ['|',('state','!=','draft'), ('type','!=','in_invoice')]}"/>
|
||||
<label string="Draft Refund" attrs="{'invisible': ['|',('state','!=','draft'), ('type','!=','in_refund')]}"/>
|
||||
<label string="Draft Credit Note" attrs="{'invisible': ['|',('state','!=','draft'), ('type','!=','in_refund')]}"/>
|
||||
<label string="Bill " attrs="{'invisible': ['|',('state', '=', 'draft'), ('type','!=','in_invoice')]}"/>
|
||||
<label string="Refund " attrs="{'invisible': ['|',('state', '=', 'draft'), ('type','!=','in_refund')]}"/>
|
||||
<label string="Credit Note " attrs="{'invisible': ['|',('state', '=', 'draft'), ('type','!=','in_refund')]}"/>
|
||||
<h1 class="mt0">
|
||||
<field name="number" class="oe_inline" attrs="{'invisible': [('state', '=', 'draft')]}"/>
|
||||
</h1>
|
||||
@@ -354,7 +354,7 @@
|
||||
<button name="invoice_print" string="Print Invoice" type="object" attrs="{'invisible':['|',('sent','=',False), ('state', '!=', 'open')]}" groups="base.group_user"/>
|
||||
<button name="%(action_account_invoice_payment)d" id="account_invoice_payment_btn" type="action" states="open" string="Register Payment" groups="account.group_account_invoice" class="oe_highlight"/>
|
||||
<button name="action_invoice_open" type="object" states="draft" string="Validate" class="oe_highlight" groups="account.group_account_invoice"/>
|
||||
<button name="%(action_account_invoice_refund)d" type='action' string='Refund Invoice' groups="account.group_account_invoice" attrs="{'invisible': ['|',('type', '=', 'out_refund'), ('state', 'not in', ('open','paid'))]}"/>
|
||||
<button name="%(action_account_invoice_refund)d" type='action' string='Add Credit Note' groups="account.group_account_invoice" attrs="{'invisible': ['|',('type', '=', 'out_refund'), ('state', 'not in', ('open','paid'))]}"/>
|
||||
<button name="action_invoice_cancel" type="object" states="draft,open" string="Cancel Invoice" groups="base.group_no_one"/>
|
||||
<button name="action_invoice_draft" states="cancel" string="Reset to Draft" type="object" groups="account.group_account_invoice"/>
|
||||
<field name="state" widget="statusbar" nolabel="1" statusbar_visible="draft,open,paid"/>
|
||||
@@ -364,10 +364,10 @@
|
||||
</div>
|
||||
<field name="has_outstanding" invisible="1"/>
|
||||
<sheet string="Invoice">
|
||||
<label string="Refund" attrs="{'invisible': ['|',('state','=','draft'), ('type','!=','out_refund')]}"/>
|
||||
<label string="Credit Note" attrs="{'invisible': ['|',('state','=','draft'), ('type','!=','out_refund')]}"/>
|
||||
<h1 class="mt0">
|
||||
<label string="Draft Invoice" attrs="{'invisible': ['|',('state','not in',('draft',)), ('type','!=','out_invoice')]}"/>
|
||||
<label string="Draft Refund" attrs="{'invisible': ['|',('state','not in',('draft',)), ('type','!=','out_refund')]}"/>
|
||||
<label string="Draft Credit Note" attrs="{'invisible': ['|',('state','not in',('draft',)), ('type','!=','out_refund')]}"/>
|
||||
<field name="number" readonly="1" class="oe_inline" attrs="{'invisible': [('state','in',('draft',))]}"/>
|
||||
</h1>
|
||||
<field name="type" invisible="1"/>
|
||||
@@ -511,7 +511,7 @@
|
||||
<field name="journal_id" />
|
||||
<filter name="draft" string="Draft" domain="[('state','=','draft')]"/>
|
||||
<filter name="invoices" string="Invoices" domain="['&', ('state','in',['open','paid']),('type','in',('out_invoice','in_invoice'))]"/>
|
||||
<filter name="refunds" string="Refunds" domain="['&', ('state','in',['open','paid']),('type','in',('out_refund','in_refund'))]"/>
|
||||
<filter name="refunds" string="Credit Notes" domain="['&', ('state','in',['open','paid']),('type','in',('out_refund','in_refund'))]"/>
|
||||
<separator/>
|
||||
<filter name="unpaid" string="Not Paid" domain="[('state','=','open')]"/>
|
||||
<filter name="late" string="Overdue" domain="['&', ('date_due', '<', time.strftime('%%Y-%%m-%%d')), ('state', '=', 'open')]" help="Overdue invoices, maturity date passed"/>
|
||||
|
||||
@@ -124,8 +124,8 @@
|
||||
</div>
|
||||
<div>
|
||||
<a type="object" name="open_action" context="{'use_domain': [('type','in',('out_refund','in_refund'))], 'invoice_type': 'refund'}">
|
||||
<span t-if="journal_type == 'sale'">Refunds</span>
|
||||
<span t-if="journal_type == 'purchase'">Refunds</span>
|
||||
<span t-if="journal_type == 'sale'">Credit Notes</span>
|
||||
<span t-if="journal_type == 'purchase'">Credit Notes</span>
|
||||
</a>
|
||||
</div>
|
||||
<div>
|
||||
@@ -148,8 +148,8 @@
|
||||
</div>
|
||||
<div>
|
||||
<a type="object" name="action_create_new" context="{'refund':True}">
|
||||
<span t-if="journal_type == 'sale'">Refund</span>
|
||||
<span t-if="journal_type == 'purchase'">Bill Refund</span>
|
||||
<span t-if="journal_type == 'sale'">Credit Note</span>
|
||||
<span t-if="journal_type == 'purchase'">Credit Note Bill</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -16,12 +16,12 @@
|
||||
<record id="account_invoices" model="ir.actions.report.xml">
|
||||
<field name="print_report_name">(object.type == 'out_invoice' and object.state == 'draft' and 'Draft Invoice' or
|
||||
object.type == 'out_invoice' and object.state in ('open','paid') and 'Invoice'+'-'+(object.number) or
|
||||
object.type == 'out_refund' and object.state == 'draft' and 'Refund' or
|
||||
object.type == 'out_refund' and 'Refund'+'-'+(object.number) or
|
||||
object.type == 'out_refund' and object.state == 'draft' and 'Credit Note' or
|
||||
object.type == 'out_refund' and 'Credit Note'+'-'+(object.number) or
|
||||
object.type == 'in_invoice' and object.state == 'draft' and 'Vendor Bill' or
|
||||
object.type == 'in_invoice' and object.state in ('open','paid') and 'Vendor Bill'+'-'+(object.number) or
|
||||
object.type == 'in_refund' and object.state == 'draft' and 'Vendor Refund' or
|
||||
object.type == 'in_refund' and 'Vendor Refund'+'-'+(object.number))</field>
|
||||
object.type == 'in_refund' and object.state == 'draft' and 'Vendor Credit Note' or
|
||||
object.type == 'in_refund' and 'Vendor Credit Note'+'-'+(object.number))</field>
|
||||
</record>
|
||||
|
||||
<report
|
||||
@@ -36,12 +36,12 @@
|
||||
<record id="account_invoice_action_report_duplicate" model="ir.actions.report.xml">
|
||||
<field name="print_report_name">(object.type == 'out_invoice' and object.state == 'draft' and 'Duplicate Invoice' or
|
||||
object.type == 'out_invoice' and object.state in ('open','paid') and 'Duplicate Invoice'+'-'+(object.number) or
|
||||
object.type == 'out_refund' and object.state == 'draft' and 'Duplicate Refund' or
|
||||
object.type == 'out_refund' and 'Duplicate Refund'+'-'+(object.number) or
|
||||
object.type == 'out_refund' and object.state == 'draft' and 'Duplicate Credit Note' or
|
||||
object.type == 'out_refund' and 'Duplicate Credit Note'+'-'+(object.number) or
|
||||
object.type == 'in_invoice' and object.state == 'draft' and 'Duplicate Vendor Bill' or
|
||||
object.type == 'in_invoice' and object.state in ('open','paid') and 'Duplicate Vendor Bill'+'-'+(object.number) or
|
||||
object.type == 'in_refund' and object.state == 'draft' and 'Duplicate Vendor Refund' or
|
||||
object.type == 'in_refund' and 'Duplicate Vendor Refund'+'-'+(object.number))</field>
|
||||
object.type == 'in_refund' and object.state == 'draft' and 'Duplicate Vendor Credit Note' or
|
||||
object.type == 'in_refund' and 'Duplicate Vendor Credit Note'+'-'+(object.number))</field>
|
||||
</record>
|
||||
|
||||
<report
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
<span t-if="o.type == 'out_invoice' and (o.state == 'open' or o.state == 'paid')">Invoice</span>
|
||||
<span t-if="o.type == 'out_invoice' and o.state == 'draft'">Draft Invoice</span>
|
||||
<span t-if="o.type == 'out_invoice' and o.state == 'cancel'">Cancelled Invoice</span>
|
||||
<span t-if="o.type == 'out_refund'">Refund</span>
|
||||
<span t-if="o.type == 'in_refund'">Vendor Refund</span>
|
||||
<span t-if="o.type == 'out_refund'">Credit Note</span>
|
||||
<span t-if="o.type == 'in_refund'">Vendor Credit Note</span>
|
||||
<span t-if="o.type == 'in_invoice'">Vendor Bill</span>
|
||||
<span t-field="o.number"/>
|
||||
</h2>
|
||||
@@ -175,7 +175,7 @@
|
||||
<xpath expr="//h2" position="replace">
|
||||
<h2>
|
||||
<span>Duplicate</span>
|
||||
<span t-if="o.type == 'out_refund'">refund</span>
|
||||
<span t-if="o.type == 'out_refund'">credit note</span>
|
||||
<span t-if="o.type == 'out_invoice'">invoice</span>
|
||||
<span t-field="o.number"/>
|
||||
</h2>
|
||||
|
||||
@@ -6,10 +6,10 @@ from odoo.exceptions import UserError
|
||||
|
||||
|
||||
class AccountInvoiceRefund(models.TransientModel):
|
||||
"""Refunds invoice"""
|
||||
"""Credit Notes"""
|
||||
|
||||
_name = "account.invoice.refund"
|
||||
_description = "Invoice Refund"
|
||||
_description = "Credit Note"
|
||||
|
||||
@api.model
|
||||
def _get_reason(self):
|
||||
@@ -20,11 +20,11 @@ class AccountInvoiceRefund(models.TransientModel):
|
||||
return inv.name
|
||||
return ''
|
||||
|
||||
date_invoice = fields.Date(string='Refund Date', default=fields.Date.context_today, required=True)
|
||||
date_invoice = fields.Date(string='Credit Note Date', default=fields.Date.context_today, required=True)
|
||||
date = fields.Date(string='Accounting Date')
|
||||
description = fields.Char(string='Reason', required=True, default=_get_reason)
|
||||
refund_only = fields.Boolean(string='Technical field to hide filter_refund in case invoice is partially paid', compute='_get_refund_only')
|
||||
filter_refund = fields.Selection([('refund', 'Create a draft refund'), ('cancel', 'Cancel: create refund and reconcile'), ('modify', 'Modify: create refund, reconcile and create a new draft invoice')],
|
||||
filter_refund = fields.Selection([('refund', 'Create a draft credit note'), ('cancel', 'Cancel: create credit note and reconcile'), ('modify', 'Modify: create credit note, reconcile and create a new draft invoice')],
|
||||
default='refund', string='Refund Method', required=True, help='Refund base on this type. You can not Modify and Cancel if the invoice is already reconciled')
|
||||
|
||||
@api.depends('date_invoice')
|
||||
@@ -51,9 +51,9 @@ class AccountInvoiceRefund(models.TransientModel):
|
||||
description = False
|
||||
for inv in inv_obj.browse(context.get('active_ids')):
|
||||
if inv.state in ['draft', 'cancel']:
|
||||
raise UserError(_('Cannot refund draft/cancelled invoice.'))
|
||||
raise UserError(_('Cannot create credit note for the draft/cancelled invoice.'))
|
||||
if inv.reconciled and mode in ('cancel', 'modify'):
|
||||
raise UserError(_('Cannot refund invoice which is already reconciled, invoice should be unreconciled first. You can only refund this invoice.'))
|
||||
raise UserError(_('Cannot create a credit note for the invoice which is already reconciled, invoice should be unreconciled first, then only you can add credit note for this invoice.'))
|
||||
|
||||
date = form.date or False
|
||||
description = form.description or inv.name
|
||||
@@ -112,7 +112,7 @@ class AccountInvoiceRefund(models.TransientModel):
|
||||
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 = _("Invoice refund")
|
||||
subject = _("Credit Note")
|
||||
body = description
|
||||
refund.message_post(body=body, subject=subject)
|
||||
if xml_id:
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
</group>
|
||||
</group>
|
||||
<footer>
|
||||
<button string='Create Refund' name="invoice_refund" type="object" class="btn-primary"/>
|
||||
<button string='Add Credit Note' name="invoice_refund" type="object" class="btn-primary"/>
|
||||
<button string="Cancel" class="btn-default" special="cancel"/>
|
||||
</footer>
|
||||
</form>
|
||||
@@ -48,7 +48,7 @@
|
||||
</record>
|
||||
|
||||
<record id="action_account_invoice_refund" model="ir.actions.act_window">
|
||||
<field name="name">Refund Invoice</field>
|
||||
<field name="name">Credit Note</field>
|
||||
<field name="res_model">account.invoice.refund</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
|
||||
@@ -92,8 +92,8 @@
|
||||
|
||||
|
||||
<record model="gamification.goal.definition" id="definition_crm_nbr_customer_refunds">
|
||||
<field name="name">Customer Refunds</field>
|
||||
<field name="description">Refund the least customers (lower than)</field>
|
||||
<field name="name">Customer Credit Notes</field>
|
||||
<field name="description">Add credit note to the least customers (lower than)</field>
|
||||
<field name="computation_mode">count</field>
|
||||
<field name="condition">lower</field>
|
||||
<field name="suffix">invoices</field>
|
||||
@@ -102,8 +102,8 @@
|
||||
<field name="domain">[('state','!=','cancel'),('user_id','=',user.id),('type','=','out_refund')]</field>
|
||||
</record>
|
||||
<record model="gamification.goal.definition" id="definition_crm_tot_customer_refunds">
|
||||
<field name="name">Total Customer Refunds</field>
|
||||
<field name="description">The total refunded value is a negative value. Validated when higher (min refunded).</field>
|
||||
<field name="name">Total Customer Credit Notes</field>
|
||||
<field name="description">The total credit note value is negative. Validated when higher (min credit note value).</field>
|
||||
<field name="computation_mode">sum</field>
|
||||
<field name="condition">higher</field>
|
||||
<field name="monetary">True</field>
|
||||
|
||||
@@ -34,11 +34,11 @@ class ProductTemplate(models.Model):
|
||||
description_purchase = fields.Text(
|
||||
'Purchase Description', translate=True,
|
||||
help="A description of the Product that you want to communicate to your vendors. "
|
||||
"This description will be copied to every Purchase Order, Receipt and Vendor Bill/Refund.")
|
||||
"This description will be copied to every Purchase Order, Receipt and Vendor Bill/Credit Note.")
|
||||
description_sale = fields.Text(
|
||||
'Sale Description', translate=True,
|
||||
help="A description of the Product that you want to communicate to your customers. "
|
||||
"This description will be copied to every Sales Order, Delivery Order and Customer Invoice/Refund")
|
||||
"This description will be copied to every Sales Order, Delivery Order and Customer Invoice/Credit Note")
|
||||
type = fields.Selection([
|
||||
('consu', _('Consumable')),
|
||||
('service', _('Service'))], string='Product Type', default='consu', required=True,
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
<span t-if="o.type == 'out_invoice' and (o.state == 'open' or o.state == 'paid')">Invoice</span>
|
||||
<span t-if="o.type == 'out_invoice' and o.state == 'draft'">Draft Invoice</span>
|
||||
<span t-if="o.type == 'out_invoice' and o.state == 'cancel'">Cancelled Invoice</span>
|
||||
<span t-if="o.type == 'out_refund'">Refund</span>
|
||||
<span t-if="o.type == 'in_refund'">Vendor Refund</span>
|
||||
<span t-if="o.type == 'out_refund'">Credit Note</span>
|
||||
<span t-if="o.type == 'in_refund'">Vendor Credit Note</span>
|
||||
<span t-if="o.type == 'in_invoice'">Vendor Bill</span>
|
||||
<span t-field="o.number"/>
|
||||
</h2>
|
||||
|
||||
@@ -11,11 +11,11 @@
|
||||
<record id="account_intrastatinvoices" model="ir.actions.report.xml">
|
||||
<field name="print_report_name">(object.type == 'out_invoice' and object.state == 'draft' and 'Intrastat Invoice' or
|
||||
object.type == 'out_invoice' and object.state in ('open','paid') and 'Intrastat Invoice'+'-'+(object.number) or
|
||||
object.type == 'out_refund' and object.state == 'draft' and 'Intrastat Refund' or
|
||||
object.type == 'out_refund' and 'Intrastat Refund'+'-'+(object.number) or
|
||||
object.type == 'out_refund' and object.state == 'draft' and 'Intrastat Credit Note' or
|
||||
object.type == 'out_refund' and 'Intrastat Credit Note'+'-'+(object.number) or
|
||||
object.type == 'in_invoice' and object.state == 'draft' and 'Intrastat Vendor Bill' or
|
||||
object.type == 'in_invoice' and object.state in ('open','paid') and 'Intrastat Vendor Bill'+'-'+(object.number) or
|
||||
object.type == 'in_refund' and object.state == 'draft' and 'Intrastat Vendor Refund' or
|
||||
object.type == 'in_refund' and 'Intrastat Vendor Refund'+'-'+(object.number))</field>
|
||||
object.type == 'in_refund' and object.state == 'draft' and 'Intrastat Vendor Credit Note' or
|
||||
object.type == 'in_refund' and 'Intrastat Vendor Credit Note'+'-'+(object.number))</field>
|
||||
</record>
|
||||
</odoo>
|
||||
|
||||
Reference in New Issue
Block a user