[IMP] account,* : Change type field to move_type in account.move
task-id: 2028z813
This commit is contained in:
committed by
Jigar Vaghela
parent
8f6bf2087e
commit
d675dbaa4c
@@ -12,7 +12,7 @@ class PortalAccount(CustomerPortal):
|
||||
def _prepare_portal_layout_values(self):
|
||||
values = super(PortalAccount, self)._prepare_portal_layout_values()
|
||||
invoice_count = request.env['account.move'].search_count([
|
||||
('type', 'in', ('out_invoice', 'in_invoice', 'out_refund', 'in_refund', 'out_receipt', 'in_receipt')),
|
||||
('move_type', 'in', ('out_invoice', 'in_invoice', 'out_refund', 'in_refund', 'out_receipt', 'in_receipt')),
|
||||
])
|
||||
values['invoice_count'] = invoice_count
|
||||
return values
|
||||
@@ -33,7 +33,7 @@ class PortalAccount(CustomerPortal):
|
||||
values = self._prepare_portal_layout_values()
|
||||
AccountInvoice = request.env['account.move']
|
||||
|
||||
domain = [('type', 'in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt'))]
|
||||
domain = [('move_type', 'in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt'))]
|
||||
|
||||
searchbar_sortings = {
|
||||
'date': {'label': _('Invoice Date'), 'order': 'invoice_date desc'},
|
||||
|
||||
@@ -1100,7 +1100,7 @@ class AccountJournal(models.Model):
|
||||
if self.company_id != self.env.ref('base.main_company'):
|
||||
alias_name += '-' + str(self.company_id.name)
|
||||
return {
|
||||
'alias_defaults': {'type': type == 'purchase' and 'in_invoice' or 'out_invoice', 'company_id': self.company_id.id, 'journal_id': self.id},
|
||||
'alias_defaults': {'move_type': type == 'purchase' and 'in_invoice' or 'out_invoice', 'company_id': self.company_id.id, 'journal_id': self.id},
|
||||
'alias_parent_thread_id': self.id,
|
||||
'alias_name': alias_name,
|
||||
}
|
||||
@@ -1568,10 +1568,10 @@ class AccountTax(models.Model):
|
||||
def _search(self, args, offset=0, limit=None, order=None, count=False, access_rights_uid=None):
|
||||
context = self._context or {}
|
||||
|
||||
if context.get('type'):
|
||||
if context.get('type') in ('out_invoice', 'out_refund'):
|
||||
if context.get('move_type'):
|
||||
if context.get('move_type') in ('out_invoice', 'out_refund'):
|
||||
args += [('type_tax_use', '=', 'sale')]
|
||||
elif context.get('type') in ('in_invoice', 'in_refund'):
|
||||
elif context.get('move_type') in ('in_invoice', 'in_refund'):
|
||||
args += [('type_tax_use', '=', 'purchase')]
|
||||
|
||||
if context.get('journal_id'):
|
||||
|
||||
@@ -592,7 +592,7 @@ class AccountBankStatementLine(models.Model):
|
||||
if self.ref:
|
||||
ref = move_ref + ' - ' + self.ref if move_ref else self.ref
|
||||
data = {
|
||||
'type': 'entry',
|
||||
'move_type': 'entry',
|
||||
'journal_id': self.statement_id.journal_id.id,
|
||||
'currency_id': self.statement_id.currency_id.id,
|
||||
'date': self.statement_id.accounting_date or self.date,
|
||||
|
||||
@@ -210,7 +210,7 @@ class account_journal(models.Model):
|
||||
WHERE move.journal_id = %(journal_id)s
|
||||
AND move.state = 'posted'
|
||||
AND move.payment_state in ('not_paid', 'partial')
|
||||
AND move.type IN %(invoice_types)s
|
||||
AND move.move_type IN %(invoice_types)s
|
||||
''', {
|
||||
'invoice_types': tuple(self.env['account.move'].get_invoice_types(True)),
|
||||
'journal_id': self.id
|
||||
@@ -252,7 +252,7 @@ class account_journal(models.Model):
|
||||
#TODO need to check if all invoices are in the same currency than the journal!!!!
|
||||
elif self.type in ['sale', 'purchase']:
|
||||
title = _('Bills to pay') if self.type == 'purchase' else _('Invoices owed to you')
|
||||
self.env['account.move'].flush(['amount_residual', 'currency_id', 'type', 'invoice_date', 'company_id', 'journal_id', 'date', 'state', 'payment_state'])
|
||||
self.env['account.move'].flush(['amount_residual', 'currency_id', 'move_type', 'invoice_date', 'company_id', 'journal_id', 'date', 'state', 'payment_state'])
|
||||
|
||||
(query, query_args) = self._get_open_bills_to_pay_query()
|
||||
self.env.cr.execute(query, query_args)
|
||||
@@ -265,9 +265,9 @@ class account_journal(models.Model):
|
||||
today = fields.Date.today()
|
||||
query = '''
|
||||
SELECT
|
||||
(CASE WHEN type IN ('out_refund', 'in_refund') THEN -1 ELSE 1 END) * amount_residual AS amount_total,
|
||||
(CASE WHEN move_type IN ('out_refund', 'in_refund') THEN -1 ELSE 1 END) * amount_residual AS amount_total,
|
||||
currency_id AS currency,
|
||||
type,
|
||||
move_type,
|
||||
invoice_date,
|
||||
company_id
|
||||
FROM account_move move
|
||||
@@ -275,7 +275,7 @@ class account_journal(models.Model):
|
||||
AND date <= %s
|
||||
AND state = 'posted'
|
||||
AND payment_state in ('not_paid', 'partial')
|
||||
AND type IN ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt');
|
||||
AND move_type IN ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt');
|
||||
'''
|
||||
self.env.cr.execute(query, (self.id, today))
|
||||
late_query_results = self.env.cr.dictfetchall()
|
||||
@@ -324,16 +324,16 @@ class account_journal(models.Model):
|
||||
"""
|
||||
return ('''
|
||||
SELECT
|
||||
(CASE WHEN move.type IN ('out_refund', 'in_refund') THEN -1 ELSE 1 END) * move.amount_residual AS amount_total,
|
||||
(CASE WHEN move.move_type IN ('out_refund', 'in_refund') THEN -1 ELSE 1 END) * move.amount_residual AS amount_total,
|
||||
move.currency_id AS currency,
|
||||
move.type,
|
||||
move.move_type,
|
||||
move.invoice_date,
|
||||
move.company_id
|
||||
FROM account_move move
|
||||
WHERE move.journal_id = %(journal_id)s
|
||||
AND move.state = 'posted'
|
||||
AND move.payment_state in ('not_paid', 'partial')
|
||||
AND move.type IN ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt');
|
||||
AND move.move_type IN ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt');
|
||||
''', {'journal_id': self.id})
|
||||
|
||||
def _get_draft_bills_query(self):
|
||||
@@ -344,16 +344,16 @@ class account_journal(models.Model):
|
||||
"""
|
||||
return ('''
|
||||
SELECT
|
||||
(CASE WHEN move.type IN ('out_refund', 'in_refund') THEN -1 ELSE 1 END) * move.amount_total AS amount_total,
|
||||
(CASE WHEN move.move_type IN ('out_refund', 'in_refund') THEN -1 ELSE 1 END) * move.amount_total AS amount_total,
|
||||
move.currency_id AS currency,
|
||||
move.type,
|
||||
move.move_type,
|
||||
move.invoice_date,
|
||||
move.company_id
|
||||
FROM account_move move
|
||||
WHERE move.journal_id = %(journal_id)s
|
||||
AND move.state = 'draft'
|
||||
AND move.payment_state in ('not_paid', 'partial')
|
||||
AND move.type IN ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt');
|
||||
AND move.move_type IN ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt');
|
||||
''', {'journal_id': self.id})
|
||||
|
||||
def _count_results_and_sum_amounts(self, results_dict, target_currency, curr_cache=None):
|
||||
@@ -388,11 +388,11 @@ class account_journal(models.Model):
|
||||
ctx = self._context.copy()
|
||||
ctx['default_journal_id'] = self.id
|
||||
if self.type == 'sale':
|
||||
ctx['default_type'] = 'out_refund' if ctx.get('refund') else 'out_invoice'
|
||||
ctx['default_move_type'] = 'out_refund' if ctx.get('refund') else 'out_invoice'
|
||||
elif self.type == 'purchase':
|
||||
ctx['default_type'] = 'in_refund' if ctx.get('refund') else 'in_invoice'
|
||||
ctx['default_move_type'] = 'in_refund' if ctx.get('refund') else 'in_invoice'
|
||||
else:
|
||||
ctx['default_type'] = 'entry'
|
||||
ctx['default_move_type'] = 'entry'
|
||||
ctx['view_no_maturity'] = True
|
||||
return {
|
||||
'name': _('Create invoice/bill'),
|
||||
@@ -466,7 +466,7 @@ class account_journal(models.Model):
|
||||
'search_default_journal_id': self.id,
|
||||
})
|
||||
|
||||
domain_type_field = action['res_model'] == 'account.move.line' and 'move_id.type' or 'type' # The model can be either account.move or account.move.line
|
||||
domain_type_field = action['res_model'] == 'account.move.line' and 'move_id.move_type' or 'move_type' # The model can be either account.move or account.move.line
|
||||
|
||||
if self.type == 'sale':
|
||||
action['domain'] = [(domain_type_field, 'in', ('out_invoice', 'out_refund', 'out_receipt'))]
|
||||
|
||||
@@ -54,7 +54,7 @@ class AccountMove(models.Model):
|
||||
It could either be passed through the context using the 'default_journal_id' key containing its id,
|
||||
either be determined by the default type.
|
||||
'''
|
||||
move_type = self._context.get('default_type', 'entry')
|
||||
move_type = self._context.get('default_move_type', 'entry')
|
||||
journal_type = 'general'
|
||||
if move_type in self.get_sale_types(include_receipts=True):
|
||||
journal_type = 'sale'
|
||||
@@ -89,7 +89,7 @@ class AccountMove(models.Model):
|
||||
|
||||
@api.model
|
||||
def _get_default_invoice_date(self):
|
||||
return fields.Date.today() if self._context.get('default_type', 'entry') in ('in_invoice', 'in_refund', 'in_receipt') else False
|
||||
return fields.Date.today() if self._context.get('default_move_type', 'entry') in ('in_invoice', 'in_refund', 'in_receipt') else False
|
||||
|
||||
@api.model
|
||||
def _get_default_currency(self):
|
||||
@@ -118,7 +118,7 @@ class AccountMove(models.Model):
|
||||
], string='Status', required=True, readonly=True, copy=False, tracking=True,
|
||||
default='draft')
|
||||
posted_before = fields.Boolean(help="Technical field for knowing if the move has been posted before", copy=False)
|
||||
type = fields.Selection(selection=[
|
||||
move_type = fields.Selection(selection=[
|
||||
('entry', 'Journal Entry'),
|
||||
('out_invoice', 'Customer Invoice'),
|
||||
('out_refund', 'Customer Credit Note'),
|
||||
@@ -379,7 +379,7 @@ class AccountMove(models.Model):
|
||||
self.invoice_vendor_bill_id = False
|
||||
self._recompute_dynamic_lines()
|
||||
|
||||
@api.onchange('type')
|
||||
@api.onchange('move_type')
|
||||
def _onchange_type(self):
|
||||
''' Onchange made to filter the partners depending of the type. '''
|
||||
if self.is_sale_document(include_receipts=True):
|
||||
@@ -484,7 +484,7 @@ class AccountMove(models.Model):
|
||||
quantity=quantity,
|
||||
product=base_line.product_id,
|
||||
partner=base_line.partner_id,
|
||||
is_refund=self.type in ('out_refund', 'in_refund'),
|
||||
is_refund=self.move_type in ('out_refund', 'in_refund'),
|
||||
)
|
||||
|
||||
if base_line.currency_id:
|
||||
@@ -495,7 +495,7 @@ class AccountMove(models.Model):
|
||||
quantity=quantity,
|
||||
product=base_line.product_id,
|
||||
partner=base_line.partner_id,
|
||||
is_refund=self.type in ('out_refund', 'in_refund'),
|
||||
is_refund=self.move_type in ('out_refund', 'in_refund'),
|
||||
)
|
||||
for b_tax_res, ac_tax_res in zip(balance_taxes_res['taxes'], amount_currency_taxes_res['taxes']):
|
||||
tax = self.env['account.tax'].browse(b_tax_res['id'])
|
||||
@@ -775,7 +775,7 @@ class AccountMove(models.Model):
|
||||
# Search new account.
|
||||
domain = [
|
||||
('company_id', '=', self.company_id.id),
|
||||
('internal_type', '=', 'receivable' if self.type in ('out_invoice', 'out_refund', 'out_receipt') else 'payable'),
|
||||
('internal_type', '=', 'receivable' if self.move_type in ('out_invoice', 'out_refund', 'out_receipt') else 'payable'),
|
||||
]
|
||||
return self.env['account.account'].search(domain, limit=1)
|
||||
|
||||
@@ -964,10 +964,10 @@ class AccountMove(models.Model):
|
||||
param['date'] = self.date
|
||||
|
||||
if self.journal_id.refund_sequence:
|
||||
if self.type in ('out_refund', 'in_refund'):
|
||||
where_string += " AND type IN ('out_refund', 'in_refund') "
|
||||
if self.move_type in ('out_refund', 'in_refund'):
|
||||
where_string += " AND move_type IN ('out_refund', 'in_refund') "
|
||||
else:
|
||||
where_string += " AND type NOT IN ('out_refund', 'in_refund') "
|
||||
where_string += " AND move_type NOT IN ('out_refund', 'in_refund') "
|
||||
|
||||
return where_string, param
|
||||
|
||||
@@ -989,21 +989,21 @@ class AccountMove(models.Model):
|
||||
return '%s%04d%s%02d%s%s%s' % (sequence.group('prefix1'), self.date.year, sequence.group('prefix2'), self.date.month, sequence.group('prefix3'), "0" * len(sequence.group('seq')), sequence.group('suffix'))
|
||||
|
||||
starting_sequence = "%s/%04d/%02d/0000" % (self.journal_id.code, self.date.year, self.date.month)
|
||||
if self.journal_id.refund_sequence and self.type in ('out_refund', 'in_refund'):
|
||||
if self.journal_id.refund_sequence and self.move_type in ('out_refund', 'in_refund'):
|
||||
starting_sequence = "R" + starting_sequence
|
||||
return starting_sequence
|
||||
|
||||
@api.depends('type')
|
||||
@api.depends('move_type')
|
||||
def _compute_type_name(self):
|
||||
type_name_mapping = {k: v for k, v in
|
||||
self._fields['type']._description_selection(self.env)}
|
||||
self._fields['move_type']._description_selection(self.env)}
|
||||
replacements = {'out_invoice': _('Invoice'), 'out_refund': _('Credit Note')}
|
||||
|
||||
for record in self:
|
||||
name = type_name_mapping[record.type]
|
||||
record.type_name = replacements.get(record.type, name)
|
||||
name = type_name_mapping[record.move_type]
|
||||
record.type_name = replacements.get(record.move_type, name)
|
||||
|
||||
@api.depends('type')
|
||||
@api.depends('move_type')
|
||||
def _compute_invoice_filter_type_domain(self):
|
||||
for move in self:
|
||||
if move.is_sale_document(include_receipts=True):
|
||||
@@ -1111,7 +1111,7 @@ class AccountMove(models.Model):
|
||||
total += line.balance
|
||||
total_currency += line.amount_currency
|
||||
|
||||
if move.type == 'entry' or move.is_outbound():
|
||||
if move.move_type == 'entry' or move.is_outbound():
|
||||
sign = 1
|
||||
else:
|
||||
sign = -1
|
||||
@@ -1121,13 +1121,13 @@ class AccountMove(models.Model):
|
||||
move.amount_residual = -sign * (total_residual_currency if len(currencies) == 1 else total_residual)
|
||||
move.amount_untaxed_signed = -total_untaxed
|
||||
move.amount_tax_signed = -total_tax
|
||||
move.amount_total_signed = abs(total) if move.type == 'entry' else -total
|
||||
move.amount_total_signed = abs(total) if move.move_type == 'entry' else -total
|
||||
move.amount_residual_signed = total_residual
|
||||
|
||||
currency = len(currencies) == 1 and currencies.pop() or move.company_id.currency_id
|
||||
|
||||
# Compute 'payment_state'.
|
||||
new_pmt_state = 'not_paid' if move.type != 'entry' else False
|
||||
new_pmt_state = 'not_paid' if move.move_type != 'entry' else False
|
||||
|
||||
if move.is_invoice(include_receipts=True) and move.state == 'posted':
|
||||
|
||||
@@ -1139,9 +1139,9 @@ class AccountMove(models.Model):
|
||||
elif currency.compare_amounts(total_to_pay, total_residual) != 0:
|
||||
new_pmt_state = 'partial'
|
||||
|
||||
if new_pmt_state == 'paid' and move.type in ('in_invoice', 'out_invoice', 'entry'):
|
||||
reverse_type = move.type == 'in_invoice' and 'in_refund' or move.type == 'out_invoice' and 'out_refund' or 'entry'
|
||||
reverse_moves = self.env['account.move'].search([('reversed_entry_id', '=', move.id), ('state', '=', 'posted'), ('type', '=', reverse_type)])
|
||||
if new_pmt_state == 'paid' and move.move_type in ('in_invoice', 'out_invoice', 'entry'):
|
||||
reverse_type = move.move_type == 'in_invoice' and 'in_refund' or move.move_type == 'out_invoice' and 'out_refund' or 'entry'
|
||||
reverse_moves = self.env['account.move'].search([('reversed_entry_id', '=', move.id), ('state', '=', 'posted'), ('move_type', '=', reverse_type)])
|
||||
|
||||
# We only set 'reversed' state in cas of 1 to 1 full reconciliation with a reverse entry; otherwise, we use the regular 'paid' state
|
||||
reverse_moves_full_recs = reverse_moves.mapped('line_ids.full_reconcile_id')
|
||||
@@ -1152,7 +1152,7 @@ class AccountMove(models.Model):
|
||||
|
||||
def _inverse_amount_total(self):
|
||||
for move in self:
|
||||
if len(move.line_ids) != 2 or move.type != 'entry':
|
||||
if len(move.line_ids) != 2 or move.move_type != 'entry':
|
||||
continue
|
||||
|
||||
to_write = []
|
||||
@@ -1195,7 +1195,7 @@ class AccountMove(models.Model):
|
||||
('payment_state', '=', 'not_paid'),
|
||||
('state', '=', 'posted'),
|
||||
('amount_residual', '=', r.amount_residual),
|
||||
('type', '=', r.type)]
|
||||
('move_type', '=', r.move_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
|
||||
@@ -1299,7 +1299,7 @@ class AccountMove(models.Model):
|
||||
})
|
||||
return reconciled_vals
|
||||
|
||||
@api.depends('type', 'line_ids.amount_residual')
|
||||
@api.depends('move_type', 'line_ids.amount_residual')
|
||||
def _compute_payments_widget_reconciled_info(self):
|
||||
for move in self:
|
||||
if move.state != 'posted' or not move.is_invoice(include_receipts=True):
|
||||
@@ -1393,7 +1393,7 @@ class AccountMove(models.Model):
|
||||
INNER JOIN account_move move2 ON
|
||||
move2.name = move.name
|
||||
AND move2.journal_id = move.journal_id
|
||||
AND move2.type = move.type
|
||||
AND move2.move_type = move.move_type
|
||||
AND move2.id != move.id
|
||||
WHERE move.id IN %s AND move2.state = 'posted'
|
||||
''', [tuple(moves.ids)])
|
||||
@@ -1402,14 +1402,14 @@ class AccountMove(models.Model):
|
||||
raise ValidationError(_('Posted journal entry must have an unique sequence number per company.\n'
|
||||
'Problematic numbers: %s\n') % ', '.join(r[1] for r in res))
|
||||
|
||||
@api.constrains('ref', 'type', 'partner_id', 'journal_id', 'invoice_date')
|
||||
@api.constrains('ref', 'move_type', 'partner_id', 'journal_id', 'invoice_date')
|
||||
def _check_duplicate_supplier_reference(self):
|
||||
moves = self.filtered(lambda move: move.is_purchase_document() and move.ref)
|
||||
if not moves:
|
||||
return
|
||||
|
||||
self.env["account.move"].flush([
|
||||
"ref", "type", "invoice_date", "journal_id",
|
||||
"ref", "move_type", "invoice_date", "journal_id",
|
||||
"company_id", "partner_id", "commercial_partner_id",
|
||||
])
|
||||
self.env["account.journal"].flush(["company_id"])
|
||||
@@ -1425,7 +1425,7 @@ class AccountMove(models.Model):
|
||||
move2.ref = move.ref
|
||||
AND move2.company_id = journal.company_id
|
||||
AND move2.commercial_partner_id = partner.commercial_partner_id
|
||||
AND move2.type = move.type
|
||||
AND move2.move_type = move.move_type
|
||||
AND (move.invoice_date is NULL OR move2.invoice_date = move.invoice_date)
|
||||
AND move2.id != move.id
|
||||
WHERE move.id IN %s
|
||||
@@ -1539,12 +1539,12 @@ class AccountMove(models.Model):
|
||||
vals.pop('invoice_line_ids', None)
|
||||
new_vals_list.append(vals)
|
||||
continue
|
||||
if not vals.get('type') and not self._context.get('default_type'):
|
||||
if not vals.get('move_type') and not self._context.get('default_move_type'):
|
||||
vals.pop('invoice_line_ids', None)
|
||||
new_vals_list.append(vals)
|
||||
continue
|
||||
vals['type'] = vals.get('type', self._context.get('default_type', 'entry'))
|
||||
if not vals['type'] in self.get_invoice_types(include_receipts=True):
|
||||
vals['move_type'] = vals.get('move_type', self._context.get('default_move_type', 'entry'))
|
||||
if not vals['move_type'] in self.get_invoice_types(include_receipts=True):
|
||||
new_vals_list.append(vals)
|
||||
continue
|
||||
|
||||
@@ -1553,7 +1553,7 @@ class AccountMove(models.Model):
|
||||
if vals.get('invoice_date') and not vals.get('date'):
|
||||
vals['date'] = vals['invoice_date']
|
||||
|
||||
ctx_vals = {'default_type': vals.get('type') or self._context.get('default_type')}
|
||||
ctx_vals = {'default_move_type': vals.get('move_type') or self._context.get('default_move_type')}
|
||||
if vals.get('journal_id'):
|
||||
ctx_vals['default_journal_id'] = vals['journal_id']
|
||||
# reorder the companies in the context so that the company of the journal
|
||||
@@ -1587,7 +1587,7 @@ class AccountMove(models.Model):
|
||||
|
||||
vals['line_ids'] = vals.pop('invoice_line_ids')
|
||||
for invoice in self:
|
||||
invoice_new = invoice.with_context(default_type=invoice.type, default_journal_id=invoice.journal_id.id).new(origin=invoice)
|
||||
invoice_new = invoice.with_context(default_move_type=invoice.move_type, default_journal_id=invoice.journal_id.id).new(origin=invoice)
|
||||
invoice_new.update(vals)
|
||||
values = invoice_new._move_autocomplete_invoice_lines_values()
|
||||
values.pop('invoice_line_ids', None)
|
||||
@@ -1683,7 +1683,7 @@ class AccountMove(models.Model):
|
||||
|
||||
def _creation_subtype(self):
|
||||
# OVERRIDE
|
||||
if self.type in ('out_invoice', 'out_refund', 'out_receipt'):
|
||||
if self.move_type in ('out_invoice', 'out_refund', 'out_receipt'):
|
||||
return self.env.ref('account.mt_invoice_created')
|
||||
else:
|
||||
return super(AccountMove, self)._creation_subtype()
|
||||
@@ -1712,7 +1712,7 @@ class AccountMove(models.Model):
|
||||
'in_refund': _('Credit Note Created'),
|
||||
'out_receipt': _('Sales Receipt Created'),
|
||||
'in_receipt': _('Purchase Receipt Created'),
|
||||
}[self.type]
|
||||
}[self.move_type]
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# BUSINESS METHODS
|
||||
@@ -1723,35 +1723,35 @@ class AccountMove(models.Model):
|
||||
return ['out_invoice', 'out_refund', 'in_refund', 'in_invoice'] + (include_receipts and ['out_receipt', 'in_receipt'] or [])
|
||||
|
||||
def is_invoice(self, include_receipts=False):
|
||||
return self.type in self.get_invoice_types(include_receipts)
|
||||
return self.move_type in self.get_invoice_types(include_receipts)
|
||||
|
||||
@api.model
|
||||
def get_sale_types(self, include_receipts=False):
|
||||
return ['out_invoice', 'out_refund'] + (include_receipts and ['out_receipt'] or [])
|
||||
|
||||
def is_sale_document(self, include_receipts=False):
|
||||
return self.type in self.get_sale_types(include_receipts)
|
||||
return self.move_type in self.get_sale_types(include_receipts)
|
||||
|
||||
@api.model
|
||||
def get_purchase_types(self, include_receipts=False):
|
||||
return ['in_invoice', 'in_refund'] + (include_receipts and ['in_receipt'] or [])
|
||||
|
||||
def is_purchase_document(self, include_receipts=False):
|
||||
return self.type in self.get_purchase_types(include_receipts)
|
||||
return self.move_type in self.get_purchase_types(include_receipts)
|
||||
|
||||
@api.model
|
||||
def get_inbound_types(self, include_receipts=True):
|
||||
return ['out_invoice', 'in_refund'] + (include_receipts and ['out_receipt'] or [])
|
||||
|
||||
def is_inbound(self, include_receipts=True):
|
||||
return self.type in self.get_inbound_types(include_receipts)
|
||||
return self.move_type in self.get_inbound_types(include_receipts)
|
||||
|
||||
@api.model
|
||||
def get_outbound_types(self, include_receipts=True):
|
||||
return ['in_invoice', 'out_refund'] + (include_receipts and ['in_receipt'] or [])
|
||||
|
||||
def is_outbound(self, include_receipts=True):
|
||||
return self.type in self.get_outbound_types(include_receipts)
|
||||
return self.move_type in self.get_outbound_types(include_receipts)
|
||||
|
||||
def _affect_tax_report(self):
|
||||
return any(line._affect_tax_report() for line in self.line_ids)
|
||||
@@ -1816,6 +1816,7 @@ class AccountMove(models.Model):
|
||||
else:
|
||||
raise UserError(_('The combination of reference model and reference type on the journal is not implemented'))
|
||||
|
||||
|
||||
def _get_move_display_name(self, show_ref=False):
|
||||
''' Helper to get the display name of an invoice depending of its type.
|
||||
:param show_ref: A flag indicating of the display name must include or not the journal entry reference.
|
||||
@@ -1832,7 +1833,7 @@ class AccountMove(models.Model):
|
||||
'out_receipt': _('Draft Sales Receipt'),
|
||||
'in_receipt': _('Draft Purchase Receipt'),
|
||||
'entry': _('Draft Entry'),
|
||||
}[self.type]
|
||||
}[self.move_type]
|
||||
if not self.name or self.name == '/':
|
||||
draft_name += ' (* %s)' % str(self.id)
|
||||
else:
|
||||
@@ -1907,7 +1908,7 @@ class AccountMove(models.Model):
|
||||
mapping = {}
|
||||
|
||||
# Do nothing if the move is not a credit note.
|
||||
if move_vals['type'] not in ('out_refund', 'in_refund'):
|
||||
if move_vals['move_type'] not in ('out_refund', 'in_refund'):
|
||||
return mapping
|
||||
|
||||
for line_command in move_vals.get('line_ids', []):
|
||||
@@ -1944,7 +1945,7 @@ class AccountMove(models.Model):
|
||||
'credit': balance < 0.0 and -balance or 0.0,
|
||||
})
|
||||
|
||||
if move_vals['type'] not in ('out_refund', 'in_refund'):
|
||||
if move_vals['move_type'] not in ('out_refund', 'in_refund'):
|
||||
continue
|
||||
|
||||
# ==== Map tax repartition lines ====
|
||||
@@ -2012,7 +2013,7 @@ class AccountMove(models.Model):
|
||||
move_vals_list = []
|
||||
for move, default_values in zip(self, default_values_list):
|
||||
default_values.update({
|
||||
'type': reverse_type_map[move.type],
|
||||
'move_type': reverse_type_map[move.move_type],
|
||||
'reversed_entry_id': move.id,
|
||||
})
|
||||
move_vals_list.append(move._reverse_move_vals(default_values, cancel=cancel))
|
||||
@@ -2047,7 +2048,7 @@ class AccountMove(models.Model):
|
||||
def message_new(self, msg_dict, custom_values=None):
|
||||
# OVERRIDE
|
||||
# Add custom behavior when receiving a new invoice through the mail's gateway.
|
||||
if custom_values.get('type', 'entry') not in ('out_invoice', 'in_invoice'):
|
||||
if custom_values.get('move_type', 'entry') not in ('out_invoice', 'in_invoice'):
|
||||
return False
|
||||
|
||||
def is_internal_partner(partner):
|
||||
@@ -2083,7 +2084,7 @@ class AccountMove(models.Model):
|
||||
'invoice_source_email': from_mail_addresses[0],
|
||||
'partner_id': partners and partners[0].id or False,
|
||||
}
|
||||
move_ctx = self.with_context(default_type=custom_values['type'], default_journal_id=custom_values['journal_id'])
|
||||
move_ctx = self.with_context(default_move_type=custom_values['move_type'], default_journal_id=custom_values['journal_id'])
|
||||
move = super(AccountMove, move_ctx).message_new(msg_dict, custom_values=values)
|
||||
|
||||
# Assign followers.
|
||||
@@ -2176,7 +2177,7 @@ class AccountMove(models.Model):
|
||||
:rtype bool
|
||||
'''
|
||||
self.ensure_one()
|
||||
return self.type == 'out_invoice' and not self.invoice_payment_ref
|
||||
return self.move_type == 'out_invoice' and not self.invoice_payment_ref
|
||||
|
||||
def action_reverse(self):
|
||||
action = self.env.ref('account.action_view_account_move_reversal').read()[0]
|
||||
@@ -2323,7 +2324,7 @@ class AccountMove(models.Model):
|
||||
.action_register_payment()
|
||||
|
||||
def action_switch_invoice_into_refund_credit_note(self):
|
||||
if any(move.type not in ('in_invoice', 'out_invoice') for move in self):
|
||||
if any(move.move_type not in ('in_invoice', 'out_invoice') for move in self):
|
||||
raise ValidationError(_("This action isn't available for this document."))
|
||||
|
||||
for move in self:
|
||||
@@ -2342,7 +2343,7 @@ class AccountMove(models.Model):
|
||||
'credit' : line_vals['debit']
|
||||
})
|
||||
move.write({
|
||||
'type': move.type.replace('invoice', 'refund'),
|
||||
'move_type': move.move_type.replace('invoice', 'refund'),
|
||||
'invoice_line_ids' : [(5, 0, 0)],
|
||||
'invoice_partner_bank_id': False,
|
||||
})
|
||||
@@ -2696,7 +2697,7 @@ class AccountMoveLine(models.Model):
|
||||
product=product or self.product_id,
|
||||
partner=partner or self.partner_id,
|
||||
taxes=taxes or self.tax_ids,
|
||||
move_type=move_type or self.move_id.type,
|
||||
move_type=move_type or self.move_id.move_type,
|
||||
)
|
||||
|
||||
@api.model
|
||||
@@ -2733,7 +2734,7 @@ class AccountMoveLine(models.Model):
|
||||
self.ensure_one()
|
||||
return self._get_fields_onchange_subtotal_model(
|
||||
price_subtotal=price_subtotal or self.price_subtotal,
|
||||
move_type=move_type or self.move_id.type,
|
||||
move_type=move_type or self.move_id.move_type,
|
||||
currency=currency or self.currency_id,
|
||||
company=company or self.move_id.company_id,
|
||||
date=date or self.move_id.date,
|
||||
@@ -2781,7 +2782,7 @@ class AccountMoveLine(models.Model):
|
||||
quantity=quantity or self.quantity,
|
||||
discount=discount or self.discount,
|
||||
balance=balance or self.balance,
|
||||
move_type=move_type or self.move_id.type,
|
||||
move_type=move_type or self.move_id.move_type,
|
||||
currency=currency or self.currency_id or self.move_id.currency_id,
|
||||
taxes=taxes or self.tax_ids,
|
||||
price_subtotal=price_subtotal or self.price_subtotal,
|
||||
@@ -3247,13 +3248,13 @@ class AccountMoveLine(models.Model):
|
||||
self.env['product.product'].browse(vals.get('product_id')),
|
||||
partner,
|
||||
taxes,
|
||||
move.type,
|
||||
move.move_type,
|
||||
).get('price_subtotal', 0.0)
|
||||
vals.update(self._get_fields_onchange_balance_model(
|
||||
vals.get('quantity', 0.0),
|
||||
vals.get('discount', 0.0),
|
||||
balance,
|
||||
move.type,
|
||||
move.move_type,
|
||||
currency,
|
||||
taxes,
|
||||
price_subtotal
|
||||
@@ -3266,7 +3267,7 @@ class AccountMoveLine(models.Model):
|
||||
self.env['product.product'].browse(vals.get('product_id')),
|
||||
partner,
|
||||
taxes,
|
||||
move.type,
|
||||
move.move_type,
|
||||
))
|
||||
elif any(vals.get(field) for field in BUSINESS_FIELDS):
|
||||
vals.update(self._get_price_total_and_subtotal_model(
|
||||
@@ -3277,11 +3278,11 @@ class AccountMoveLine(models.Model):
|
||||
self.env['product.product'].browse(vals.get('product_id')),
|
||||
partner,
|
||||
taxes,
|
||||
move.type,
|
||||
move.move_type,
|
||||
))
|
||||
vals.update(self._get_fields_onchange_subtotal_model(
|
||||
vals['price_subtotal'],
|
||||
move.type,
|
||||
move.move_type,
|
||||
currency,
|
||||
move.company_id,
|
||||
move.date,
|
||||
@@ -3489,14 +3490,14 @@ class AccountMoveLine(models.Model):
|
||||
if 'account_id' in default_fields \
|
||||
and (self._context.get('journal_id') or self._context.get('default_journal_id')) \
|
||||
and not values.get('account_id') \
|
||||
and self._context.get('default_type') in self.move_id.get_inbound_types():
|
||||
and self._context.get('default_move_type') in self.move_id.get_inbound_types():
|
||||
# Fill missing 'account_id'.
|
||||
journal = self.env['account.journal'].browse(self._context.get('default_journal_id') or self._context['journal_id'])
|
||||
values['account_id'] = journal.default_credit_account_id.id
|
||||
elif 'account_id' in default_fields \
|
||||
and (self._context.get('journal_id') or self._context.get('default_journal_id')) \
|
||||
and not values.get('account_id') \
|
||||
and self._context.get('default_type') in self.move_id.get_outbound_types():
|
||||
and self._context.get('default_move_type') in self.move_id.get_outbound_types():
|
||||
# Fill missing 'account_id'.
|
||||
journal = self.env['account.journal'].browse(self._context.get('default_journal_id') or self._context['journal_id'])
|
||||
values['account_id'] = journal.default_debit_account_id.id
|
||||
@@ -3654,7 +3655,7 @@ class AccountMoveLine(models.Model):
|
||||
# Eventually create a journal entry to book the difference due to foreign currency's exchange rate that fluctuates
|
||||
if to_balance and any([not float_is_zero(residual, precision_rounding=digits_rounding_precision) for aml, residual in to_balance.values()]):
|
||||
if not self.env.context.get('no_exchange_difference'):
|
||||
exchange_move = self.env['account.move'].with_context(default_type='entry').create(
|
||||
exchange_move = self.env['account.move'].with_context(default_move_type='entry').create(
|
||||
self.env['account.full.reconcile']._prepare_exchange_diff_move(move_date=maxdate, company=amls[0].company_id))
|
||||
part_reconcile = self.env['account.partial.reconcile']
|
||||
for aml_to_balance, total in to_balance.values():
|
||||
|
||||
@@ -111,14 +111,14 @@ class account_payment(models.Model):
|
||||
if not invoices or any(invoice.state != 'posted' for invoice in invoices):
|
||||
raise UserError(_("You can only register payments for open invoices"))
|
||||
# Check if, in batch payments, there are not negative invoices and positive invoices
|
||||
dtype = invoices[0].type
|
||||
dtype = invoices[0].move_type
|
||||
for inv in invoices[1:]:
|
||||
if inv.type != dtype:
|
||||
if ((dtype == 'in_refund' and inv.type == 'in_invoice') or
|
||||
(dtype == 'in_invoice' and inv.type == 'in_refund')):
|
||||
if inv.move_type != dtype:
|
||||
if ((dtype == 'in_refund' and inv.move_type == 'in_invoice') or
|
||||
(dtype == 'in_invoice' and inv.move_type == 'in_refund')):
|
||||
raise UserError(_("You cannot register payments for vendor bills and supplier refunds at the same time."))
|
||||
if ((dtype == 'out_refund' and inv.type == 'out_invoice') or
|
||||
(dtype == 'out_invoice' and inv.type == 'out_refund')):
|
||||
if ((dtype == 'out_refund' and inv.move_type == 'out_invoice') or
|
||||
(dtype == 'out_invoice' and inv.move_type == 'out_refund')):
|
||||
raise UserError(_("You cannot register payments for customer invoices and credit notes at the same time."))
|
||||
|
||||
amount = self._compute_payment_amount(invoices, invoices[0].currency_id, invoices[0].journal_id, rec.get('payment_date') or fields.Date.today())
|
||||
@@ -127,7 +127,7 @@ class account_payment(models.Model):
|
||||
'amount': abs(amount),
|
||||
'payment_type': 'inbound' if amount > 0 else 'outbound',
|
||||
'partner_id': invoices[0].commercial_partner_id.id,
|
||||
'partner_type': MAP_INVOICE_TYPE_PARTNER_TYPE[invoices[0].type],
|
||||
'partner_type': MAP_INVOICE_TYPE_PARTNER_TYPE[invoices[0].move_type],
|
||||
'communication': invoices[0].invoice_payment_ref or invoices[0].ref or invoices[0].name,
|
||||
'invoice_ids': [(6, 0, invoices.ids)],
|
||||
})
|
||||
@@ -299,13 +299,13 @@ class account_payment(models.Model):
|
||||
if not invoices:
|
||||
return 0.0
|
||||
|
||||
self.env['account.move'].flush(['type', 'currency_id'])
|
||||
self.env['account.move'].flush(['move_type', 'currency_id'])
|
||||
self.env['account.move.line'].flush(['amount_residual', 'amount_residual_currency', 'move_id', 'account_id'])
|
||||
self.env['account.account'].flush(['user_type_id'])
|
||||
self.env['account.account.type'].flush(['type'])
|
||||
self._cr.execute('''
|
||||
SELECT
|
||||
move.type AS type,
|
||||
move.move_type AS type,
|
||||
move.currency_id AS currency_id,
|
||||
SUM(line.amount_residual) AS amount_residual,
|
||||
SUM(line.amount_residual_currency) AS residual_currency
|
||||
@@ -315,7 +315,7 @@ class account_payment(models.Model):
|
||||
LEFT JOIN account_account_type account_type ON account_type.id = account.user_type_id
|
||||
WHERE move.id IN %s
|
||||
AND account_type.type IN ('receivable', 'payable')
|
||||
GROUP BY move.id, move.type
|
||||
GROUP BY move.id, move.move_type
|
||||
''', [tuple(invoices.ids)])
|
||||
query_res = self._cr.dictfetchall()
|
||||
|
||||
@@ -637,7 +637,7 @@ class account_payment(models.Model):
|
||||
If invoice_ids is not empty, there will be one reconcilable move line per invoice to reconcile with.
|
||||
If the payment is a transfer, a second journal entry is created in the destination journal to receive money from the transfer account.
|
||||
"""
|
||||
AccountMove = self.env['account.move'].with_context(default_type='entry')
|
||||
AccountMove = self.env['account.move'].with_context(default_move_type='entry')
|
||||
for rec in self:
|
||||
|
||||
if rec.state != 'draft':
|
||||
@@ -790,7 +790,7 @@ class payment_register(models.TransientModel):
|
||||
'amount': abs(amount),
|
||||
'currency_id': invoices[0].currency_id.id,
|
||||
'partner_id': invoices[0].commercial_partner_id.id,
|
||||
'partner_type': MAP_INVOICE_TYPE_PARTNER_TYPE[invoices[0].type],
|
||||
'partner_type': MAP_INVOICE_TYPE_PARTNER_TYPE[invoices[0].move_type],
|
||||
'partner_bank_account_id': invoices[0].invoice_partner_bank_id.id,
|
||||
}
|
||||
return values
|
||||
@@ -803,7 +803,7 @@ class payment_register(models.TransientModel):
|
||||
grouped = defaultdict(lambda: self.env["account.move"])
|
||||
for inv in self.invoice_ids:
|
||||
if self.group_payment:
|
||||
grouped[(inv.commercial_partner_id, inv.currency_id, inv.invoice_partner_bank_id, MAP_INVOICE_TYPE_PARTNER_TYPE[inv.type])] += inv
|
||||
grouped[(inv.commercial_partner_id, inv.currency_id, inv.invoice_partner_bank_id, MAP_INVOICE_TYPE_PARTNER_TYPE[inv.move_type])] += inv
|
||||
else:
|
||||
grouped[inv.id] += inv
|
||||
return [self._prepare_payment_vals(invoices) for invoices in grouped.values()]
|
||||
|
||||
@@ -451,7 +451,7 @@ class ResCompany(models.Model):
|
||||
"\nPlease go to Configuration > Journals.")
|
||||
raise RedirectWarning(msg, action.id, _("Go to the journal configuration"))
|
||||
|
||||
sample_invoice = self.env['account.move'].with_context(default_type='out_invoice', default_journal_id=journal.id).create({
|
||||
sample_invoice = self.env['account.move'].with_context(default_move_type='out_invoice', default_journal_id=journal.id).create({
|
||||
'invoice_payment_ref': _('Sample invoice'),
|
||||
'partner_id': partner.id,
|
||||
'invoice_line_ids': [
|
||||
|
||||
@@ -311,7 +311,7 @@ class ResPartner(models.Model):
|
||||
# generate where clause to include multicompany rules
|
||||
where_query = account_invoice_report._where_calc([
|
||||
('partner_id', 'in', all_partner_ids), ('state', 'not in', ['draft', 'cancel']),
|
||||
('type', 'in', ('out_invoice', 'out_refund'))
|
||||
('move_type', 'in', ('out_invoice', 'out_refund'))
|
||||
])
|
||||
account_invoice_report._apply_ir_rules(where_query, 'read')
|
||||
from_clause, where_clause, where_clause_params = where_query.get_sql()
|
||||
@@ -465,11 +465,11 @@ class ResPartner(models.Model):
|
||||
self.ensure_one()
|
||||
action = self.env.ref('account.action_move_out_invoice_type').read()[0]
|
||||
action['domain'] = [
|
||||
('type', 'in', ('out_invoice', 'out_refund')),
|
||||
('move_type', 'in', ('out_invoice', 'out_refund')),
|
||||
('state', '=', 'posted'),
|
||||
('partner_id', 'child_of', self.id),
|
||||
]
|
||||
action['context'] = {'default_type':'out_invoice', 'type':'out_invoice', 'journal_type': 'sale', 'search_default_unpaid': 1}
|
||||
action['context'] = {'default_move_type':'out_invoice', 'move_type':'out_invoice', 'journal_type': 'sale', 'search_default_unpaid': 1}
|
||||
return action
|
||||
|
||||
def can_edit_vat(self):
|
||||
@@ -478,7 +478,7 @@ class ResPartner(models.Model):
|
||||
if not can_edit_vat:
|
||||
return can_edit_vat
|
||||
has_invoice = self.env['account.move'].search([
|
||||
('type', 'in', ['out_invoice', 'out_refund']),
|
||||
('move_type', 'in', ['out_invoice', 'out_refund']),
|
||||
('partner_id', 'child_of', self.commercial_partner_id.id),
|
||||
('state', '=', 'posted')
|
||||
], limit=1)
|
||||
|
||||
@@ -21,7 +21,7 @@ class AccountInvoiceReport(models.Model):
|
||||
commercial_partner_id = fields.Many2one('res.partner', string='Partner Company', help="Commercial Entity")
|
||||
country_id = fields.Many2one('res.country', string="Country")
|
||||
invoice_user_id = fields.Many2one('res.users', string='Salesperson', readonly=True)
|
||||
type = fields.Selection([
|
||||
move_type = fields.Selection([
|
||||
('out_invoice', 'Customer Invoice'),
|
||||
('in_invoice', 'Vendor Bill'),
|
||||
('out_refund', 'Customer Credit Note'),
|
||||
@@ -58,7 +58,7 @@ class AccountInvoiceReport(models.Model):
|
||||
|
||||
_depends = {
|
||||
'account.move': [
|
||||
'name', 'state', 'type', 'partner_id', 'invoice_user_id', 'fiscal_position_id',
|
||||
'name', 'state', 'move_type', 'partner_id', 'invoice_user_id', 'fiscal_position_id',
|
||||
'invoice_date', 'invoice_date_due', 'invoice_payment_term_id', 'invoice_partner_bank_id',
|
||||
],
|
||||
'account.move.line': [
|
||||
@@ -88,7 +88,7 @@ class AccountInvoiceReport(models.Model):
|
||||
line.partner_id AS commercial_partner_id,
|
||||
move.name,
|
||||
move.state,
|
||||
move.type,
|
||||
move.move_type,
|
||||
move.partner_id,
|
||||
move.invoice_user_id,
|
||||
move.fiscal_position_id,
|
||||
@@ -148,7 +148,7 @@ class AccountInvoiceReport(models.Model):
|
||||
@api.model
|
||||
def _where(self):
|
||||
return '''
|
||||
WHERE move.type IN ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt')
|
||||
WHERE move.move_type IN ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt')
|
||||
AND line.account_id IS NOT NULL
|
||||
AND NOT line.exclude_from_invoice_tab
|
||||
'''
|
||||
@@ -168,7 +168,7 @@ class AccountInvoiceReport(models.Model):
|
||||
line.partner_id,
|
||||
move.name,
|
||||
move.state,
|
||||
move.type,
|
||||
move.move_type,
|
||||
move.amount_residual_signed,
|
||||
move.amount_total_signed,
|
||||
move.partner_id,
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
<record id="filter_invoice_refund" model="ir.filters">
|
||||
<field name="name">By Credit Note</field>
|
||||
<field name="model_id">account.invoice.report</field>
|
||||
<field name="domain">[('type', '=', 'out_refund')]</field>
|
||||
<field name="domain">[('move_type', '=', 'out_refund')]</field>
|
||||
<field name="user_id" eval="False"/>
|
||||
<field name="context">{'group_by': ['invoice_date:month', 'invoice_user_id']}</field>
|
||||
</record>
|
||||
@@ -73,11 +73,11 @@
|
||||
<filter string="To Invoice" name="toinvoice" domain="[('state','=','draft')]" help = "Draft Invoices"/>
|
||||
<filter string="Invoiced" name="current" domain="[('state','not in', ('draft','cancel'))]"/>
|
||||
<separator/>
|
||||
<filter string="Customers" name="customer" domain="['|', ('type','=','out_invoice'),('type','=','out_refund')]"/>
|
||||
<filter string="Vendors" name="supplier" domain="['|', ('type','=','in_invoice'),('type','=','in_refund')]"/>
|
||||
<filter string="Customers" name="customer" domain="['|', ('move_type','=','out_invoice'),('move_type','=','out_refund')]"/>
|
||||
<filter string="Vendors" name="supplier" domain="['|', ('move_type','=','in_invoice'),('move_type','=','in_refund')]"/>
|
||||
<separator/>
|
||||
<filter string="Invoices" name="invoice" domain="['|', ('type','=','out_invoice'),('type','=','in_invoice')]"/>
|
||||
<filter string="Credit Notes" name="creditnote" domain="['|', ('type','=','out_refund'),('type','=','in_refund')]"/>
|
||||
<filter string="Invoices" name="invoice" domain="['|', ('move_type','=','out_invoice'),('move_type','=','in_invoice')]"/>
|
||||
<filter string="Credit Notes" name="creditnote" domain="['|', ('move_type','=','out_refund'),('move_type','=','in_refund')]"/>
|
||||
<field name="partner_id" operator="child_of"/>
|
||||
<field name="invoice_user_id" />
|
||||
<field name="product_id" />
|
||||
|
||||
@@ -231,14 +231,14 @@
|
||||
<record id="account_invoice_rule_portal" model="ir.rule">
|
||||
<field name="name">Portal Personal Account Invoices</field>
|
||||
<field name="model_id" ref="account.model_account_move"/>
|
||||
<field name="domain_force">[('type', 'in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund')), ('message_partner_ids','child_of',[user.commercial_partner_id.id])]</field>
|
||||
<field name="domain_force">[('move_type', 'in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund')), ('message_partner_ids','child_of',[user.commercial_partner_id.id])]</field>
|
||||
<field name="groups" eval="[(4, ref('base.group_portal'))]"/>
|
||||
</record>
|
||||
|
||||
<record id="account_invoice_line_rule_portal" model="ir.rule">
|
||||
<field name="name">Portal Invoice Lines</field>
|
||||
<field name="model_id" ref="account.model_account_move_line"/>
|
||||
<field name="domain_force">[('move_id.type', 'in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund')), ('move_id.message_partner_ids','child_of',[user.commercial_partner_id.id])]</field>
|
||||
<field name="domain_force">[('move_id.move_type', 'in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund')), ('move_id.message_partner_ids','child_of',[user.commercial_partner_id.id])]</field>
|
||||
<field name="groups" eval="[(4, ref('base.group_portal'))]"/>
|
||||
</record>
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@ odoo.define('account.dashboard.kanban', function (require) {
|
||||
}),
|
||||
/**
|
||||
* We override _onUpload (from the upload bill mixin) to pass default_journal_id
|
||||
* and default_type in context.
|
||||
* and default_move_type in context.
|
||||
*
|
||||
* @override
|
||||
*/
|
||||
@@ -109,9 +109,9 @@ odoo.define('account.dashboard.kanban', function (require) {
|
||||
var kanbanRecord = $(event.currentTarget).closest('.o_kanban_record').data('record');
|
||||
this.initialState.context['default_journal_id'] = kanbanRecord.id;
|
||||
if ($(event.currentTarget).attr('journal_type') == 'sale') {
|
||||
this.initialState.context['default_type'] = 'out_invoice'
|
||||
this.initialState.context['default_move_type'] = 'out_invoice'
|
||||
} else if ($(event.currentTarget).attr('journal_type') == 'purchase') {
|
||||
this.initialState.context['default_type'] = 'in_invoice'
|
||||
this.initialState.context['default_move_type'] = 'in_invoice'
|
||||
}
|
||||
UploadBillMixin._onUpload.apply(this, arguments);
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ odoo.define('account.tax_group', function (require) {
|
||||
var creditAmount = 0;
|
||||
var amount_currency = 0;
|
||||
if (line_id.data.currency_id) { // If multi currency enable
|
||||
if (this.record.data.type === "in_invoice") {
|
||||
if (this.record.data.move_type === "in_invoice") {
|
||||
amount_currency = line_id.data.amount_currency - deltaAmount;
|
||||
} else {
|
||||
amount_currency = line_id.data.amount_currency + deltaAmount;
|
||||
@@ -45,7 +45,7 @@ odoo.define('account.tax_group', function (require) {
|
||||
} else {
|
||||
var balance = line_id.data.price_subtotal;
|
||||
balance -= deltaAmount;
|
||||
if (this.record.data.type === "in_invoice") { // For vendor bill
|
||||
if (this.record.data.move_type === "in_invoice") { // For vendor bill
|
||||
if (balance > 0) {
|
||||
debitAmount = balance;
|
||||
} else if (balance < 0) {
|
||||
@@ -76,7 +76,7 @@ odoo.define('account.tax_group', function (require) {
|
||||
* @returns boolean (true if the invoice is a purchase document)
|
||||
*/
|
||||
_isPurchaseDocument: function () {
|
||||
return this.record.data.type === "in_invoice" || this.record.data.type === 'in_refund';
|
||||
return this.record.data.move_type === "in_invoice" || this.record.data.move_type === 'in_refund';
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -901,7 +901,7 @@ class AccountTestInvoicingCommon(SavepointCase):
|
||||
|
||||
@classmethod
|
||||
def init_invoice(cls, move_type):
|
||||
move_form = Form(cls.env['account.move'].with_context(default_type=move_type))
|
||||
move_form = Form(cls.env['account.move'].with_context(default_move_type=move_type))
|
||||
move_form.invoice_date = fields.Date.from_string('2019-01-01')
|
||||
move_form.partner_id = cls.partner_a
|
||||
with move_form.invoice_line_ids.new() as line_form:
|
||||
@@ -1080,7 +1080,7 @@ class TestAccountReconciliationCommon(AccountTestCommon):
|
||||
date_invoice = date_invoice or time.strftime('%Y') + '-07-01'
|
||||
|
||||
invoice_vals = {
|
||||
'type': type,
|
||||
'move_type': type,
|
||||
'partner_id': partner_id or self.partner_agrolait_id,
|
||||
'invoice_date': date_invoice,
|
||||
'date': date_invoice,
|
||||
@@ -1098,7 +1098,7 @@ class TestAccountReconciliationCommon(AccountTestCommon):
|
||||
if currency_id:
|
||||
invoice_vals['currency_id'] = currency_id
|
||||
|
||||
invoice = self.env['account.move'].with_context(default_type=type).create(invoice_vals)
|
||||
invoice = self.env['account.move'].with_context(default_move_type=type).create(invoice_vals)
|
||||
if auto_validate:
|
||||
invoice.post()
|
||||
return invoice
|
||||
|
||||
@@ -21,7 +21,7 @@ class TestAccountAccount(AccountTestInvoicingCommon):
|
||||
''' Ensure you can't change the company of an account.account if there are some journal entries '''
|
||||
|
||||
self.env['account.move'].create({
|
||||
'type': 'entry',
|
||||
'move_type': 'entry',
|
||||
'date': '2019-01-01',
|
||||
'line_ids': [
|
||||
(0, 0, {
|
||||
|
||||
@@ -31,7 +31,7 @@ class TestAccountAnalyticAccount(AccountTestInvoicingCommon):
|
||||
''' Ensure you can't change the company of an account.analytic.account if there are some journal entries '''
|
||||
|
||||
self.env['account.move'].create({
|
||||
'type': 'entry',
|
||||
'move_type': 'entry',
|
||||
'date': '2019-01-01',
|
||||
'line_ids': [
|
||||
(0, 0, {
|
||||
|
||||
@@ -16,7 +16,7 @@ class TestAccountInvoiceReport(AccountTestInvoicingCommon):
|
||||
|
||||
cls.invoices = cls.env['account.move'].create([
|
||||
{
|
||||
'type': 'out_invoice',
|
||||
'move_type': 'out_invoice',
|
||||
'partner_id': cls.partner_a.id,
|
||||
'invoice_date': fields.Date.from_string('2016-01-01'),
|
||||
'currency_id': cls.currency_data['currency'].id,
|
||||
@@ -34,7 +34,7 @@ class TestAccountInvoiceReport(AccountTestInvoicingCommon):
|
||||
]
|
||||
},
|
||||
{
|
||||
'type': 'out_receipt',
|
||||
'move_type': 'out_receipt',
|
||||
'invoice_date': fields.Date.from_string('2016-01-01'),
|
||||
'currency_id': cls.currency_data['currency'].id,
|
||||
'invoice_line_ids': [
|
||||
@@ -46,7 +46,7 @@ class TestAccountInvoiceReport(AccountTestInvoicingCommon):
|
||||
]
|
||||
},
|
||||
{
|
||||
'type': 'out_refund',
|
||||
'move_type': 'out_refund',
|
||||
'partner_id': cls.partner_a.id,
|
||||
'invoice_date': fields.Date.from_string('2017-01-01'),
|
||||
'currency_id': cls.currency_data['currency'].id,
|
||||
@@ -59,7 +59,7 @@ class TestAccountInvoiceReport(AccountTestInvoicingCommon):
|
||||
]
|
||||
},
|
||||
{
|
||||
'type': 'in_invoice',
|
||||
'move_type': 'in_invoice',
|
||||
'partner_id': cls.partner_a.id,
|
||||
'invoice_date': fields.Date.from_string('2016-01-01'),
|
||||
'currency_id': cls.currency_data['currency'].id,
|
||||
@@ -72,7 +72,7 @@ class TestAccountInvoiceReport(AccountTestInvoicingCommon):
|
||||
]
|
||||
},
|
||||
{
|
||||
'type': 'in_receipt',
|
||||
'move_type': 'in_receipt',
|
||||
'partner_id': cls.partner_a.id,
|
||||
'invoice_date': fields.Date.from_string('2016-01-01'),
|
||||
'currency_id': cls.currency_data['currency'].id,
|
||||
@@ -85,7 +85,7 @@ class TestAccountInvoiceReport(AccountTestInvoicingCommon):
|
||||
]
|
||||
},
|
||||
{
|
||||
'type': 'in_refund',
|
||||
'move_type': 'in_refund',
|
||||
'partner_id': cls.partner_a.id,
|
||||
'invoice_date': fields.Date.from_string('2017-01-01'),
|
||||
'currency_id': cls.currency_data['currency'].id,
|
||||
|
||||
@@ -21,7 +21,7 @@ class TestAccountJournal(AccountTestInvoicingCommon):
|
||||
''' Ensure you can't change the company of an account.journal if there are some journal entries '''
|
||||
|
||||
self.env['account.move'].create({
|
||||
'type': 'entry',
|
||||
'move_type': 'entry',
|
||||
'date': '2019-01-01',
|
||||
'journal_id': self.company_data['default_journal_sale'].id,
|
||||
})
|
||||
|
||||
@@ -30,7 +30,7 @@ class TestAccountJournalDashboard(AccountTestUsersCommon):
|
||||
})
|
||||
|
||||
invoice = self.env['account.move'].create({
|
||||
'type': 'out_invoice',
|
||||
'move_type': 'out_invoice',
|
||||
'journal_id': journal.id,
|
||||
'partner_id': res_partner_3.id,
|
||||
'invoice_date': date_invoice,
|
||||
@@ -44,7 +44,7 @@ class TestAccountJournalDashboard(AccountTestUsersCommon):
|
||||
})]
|
||||
})
|
||||
refund = self.env['account.move'].create({
|
||||
'type': 'out_refund',
|
||||
'move_type': 'out_refund',
|
||||
'journal_id': journal.id,
|
||||
'partner_id': res_partner_3.id,
|
||||
'invoice_date': '2019-01-21',
|
||||
|
||||
@@ -20,7 +20,7 @@ class TestAccountMove(AccountTestInvoicingCommon):
|
||||
tax_repartition_line = cls.company_data['default_tax_sale'].invoice_repartition_line_ids\
|
||||
.filtered(lambda line: line.repartition_type == 'tax')
|
||||
cls.test_move = cls.env['account.move'].create({
|
||||
'type': 'entry',
|
||||
'move_type': 'entry',
|
||||
'date': fields.Date.from_string('2016-01-01'),
|
||||
'line_ids': [
|
||||
(0, None, {
|
||||
@@ -241,7 +241,7 @@ class TestAccountMove(AccountTestInvoicingCommon):
|
||||
def test_misc_draft_reconciled_entries_1(self):
|
||||
draft_moves = self.env['account.move'].create([
|
||||
{
|
||||
'type': 'entry',
|
||||
'move_type': 'entry',
|
||||
'line_ids': [
|
||||
(0, None, {
|
||||
'name': 'move 1 receivable line',
|
||||
@@ -258,7 +258,7 @@ class TestAccountMove(AccountTestInvoicingCommon):
|
||||
]
|
||||
},
|
||||
{
|
||||
'type': 'entry',
|
||||
'move_type': 'entry',
|
||||
'line_ids': [
|
||||
(0, None, {
|
||||
'name': 'move 2 receivable line',
|
||||
|
||||
@@ -222,7 +222,7 @@ class TestAccountMoveInInvoiceOnchanges(AccountTestInvoicingCommon):
|
||||
'supplier_taxes_id': [(6, 0, tax_price_include.ids)],
|
||||
})
|
||||
|
||||
move_form = Form(self.env['account.move'].with_context(default_type='in_invoice'))
|
||||
move_form = Form(self.env['account.move'].with_context(default_move_type='in_invoice'))
|
||||
move_form.partner_id = self.partner_a
|
||||
move_form.invoice_date = fields.Date.from_string('2019-01-01')
|
||||
move_form.currency_id = self.currency_data['currency']
|
||||
@@ -367,7 +367,7 @@ class TestAccountMoveInInvoiceOnchanges(AccountTestInvoicingCommon):
|
||||
'supplier_taxes_id': [(6, 0, tax_price_include_1.ids)],
|
||||
})
|
||||
|
||||
move_form = Form(self.env['account.move'].with_context(default_type='in_invoice'))
|
||||
move_form = Form(self.env['account.move'].with_context(default_move_type='in_invoice'))
|
||||
move_form.partner_id = self.partner_a
|
||||
move_form.invoice_date = fields.Date.from_string('2019-01-01')
|
||||
move_form.currency_id = self.currency_data['currency']
|
||||
@@ -1333,7 +1333,7 @@ class TestAccountMoveInInvoiceOnchanges(AccountTestInvoicingCommon):
|
||||
def test_in_invoice_create_1(self):
|
||||
# Test creating an account_move with the least information.
|
||||
move = self.env['account.move'].create({
|
||||
'type': 'in_invoice',
|
||||
'move_type': 'in_invoice',
|
||||
'partner_id': self.partner_a.id,
|
||||
'invoice_date': fields.Date.from_string('2019-01-01'),
|
||||
'currency_id': self.currency_data['currency'].id,
|
||||
@@ -1383,7 +1383,7 @@ class TestAccountMoveInInvoiceOnchanges(AccountTestInvoicingCommon):
|
||||
def test_in_invoice_write_1(self):
|
||||
# Test creating an account_move with the least information.
|
||||
move = self.env['account.move'].create({
|
||||
'type': 'in_invoice',
|
||||
'move_type': 'in_invoice',
|
||||
'partner_id': self.partner_a.id,
|
||||
'invoice_date': fields.Date.from_string('2019-01-01'),
|
||||
'currency_id': self.currency_data['currency'].id,
|
||||
@@ -1445,7 +1445,7 @@ class TestAccountMoveInInvoiceOnchanges(AccountTestInvoicingCommon):
|
||||
def test_in_invoice_switch_in_refund_1(self):
|
||||
# Test creating an account_move with an in_invoice_type and switch it in an in_refund.
|
||||
move = self.env['account.move'].create({
|
||||
'type': 'in_invoice',
|
||||
'move_type': 'in_invoice',
|
||||
'partner_id': self.partner_a.id,
|
||||
'invoice_date': fields.Date.from_string('2019-01-01'),
|
||||
'currency_id': self.currency_data['currency'].id,
|
||||
@@ -1457,7 +1457,7 @@ class TestAccountMoveInInvoiceOnchanges(AccountTestInvoicingCommon):
|
||||
})
|
||||
move.action_switch_invoice_into_refund_credit_note()
|
||||
|
||||
self.assertRecordValues(move, [{'type': 'in_refund'}])
|
||||
self.assertRecordValues(move, [{'move_type': 'in_refund'}])
|
||||
self.assertInvoiceValues(move, [
|
||||
{
|
||||
**self.product_line_vals_1,
|
||||
@@ -1506,7 +1506,7 @@ class TestAccountMoveInInvoiceOnchanges(AccountTestInvoicingCommon):
|
||||
modified_product_line_vals_2 = self.product_line_vals_2.copy()
|
||||
modified_product_line_vals_2.update({'quantity': -modified_product_line_vals_2['quantity']})
|
||||
move = self.env['account.move'].create({
|
||||
'type': 'in_invoice',
|
||||
'move_type': 'in_invoice',
|
||||
'partner_id': self.partner_a.id,
|
||||
'invoice_date': fields.Date.from_string('2019-01-01'),
|
||||
'currency_id': self.currency_data['currency'].id,
|
||||
@@ -1577,7 +1577,7 @@ class TestAccountMoveInInvoiceOnchanges(AccountTestInvoicingCommon):
|
||||
})
|
||||
move.action_switch_invoice_into_refund_credit_note()
|
||||
|
||||
self.assertRecordValues(move, [{'type': 'in_refund'}])
|
||||
self.assertRecordValues(move, [{'move_type': 'in_refund'}])
|
||||
self.assertInvoiceValues(move, [
|
||||
{
|
||||
**self.product_line_vals_1,
|
||||
@@ -1624,7 +1624,7 @@ class TestAccountMoveInInvoiceOnchanges(AccountTestInvoicingCommon):
|
||||
|
||||
def test_in_invoice_change_period_accrual_1(self):
|
||||
move = self.env['account.move'].create({
|
||||
'type': 'in_invoice',
|
||||
'move_type': 'in_invoice',
|
||||
'date': '2017-01-01',
|
||||
'partner_id': self.partner_a.id,
|
||||
'invoice_date': fields.Date.from_string('2017-01-01'),
|
||||
|
||||
@@ -824,7 +824,7 @@ class TestAccountMoveInRefundOnchanges(AccountTestInvoicingCommon):
|
||||
def test_in_refund_create_1(self):
|
||||
# Test creating an account_move with the least information.
|
||||
move = self.env['account.move'].create({
|
||||
'type': 'in_refund',
|
||||
'move_type': 'in_refund',
|
||||
'partner_id': self.partner_a.id,
|
||||
'invoice_date': fields.Date.from_string('2019-01-01'),
|
||||
'currency_id': self.currency_data['currency'].id,
|
||||
@@ -874,7 +874,7 @@ class TestAccountMoveInRefundOnchanges(AccountTestInvoicingCommon):
|
||||
def test_in_refund_write_1(self):
|
||||
# Test creating an account_move with the least information.
|
||||
move = self.env['account.move'].create({
|
||||
'type': 'in_refund',
|
||||
'move_type': 'in_refund',
|
||||
'partner_id': self.partner_a.id,
|
||||
'invoice_date': fields.Date.from_string('2019-01-01'),
|
||||
'currency_id': self.currency_data['currency'].id,
|
||||
|
||||
@@ -224,7 +224,7 @@ class TestAccountMoveOutInvoiceOnchanges(AccountTestInvoicingCommon):
|
||||
'taxes_id': [(6, 0, tax_price_include.ids)],
|
||||
})
|
||||
|
||||
move_form = Form(self.env['account.move'].with_context(default_type='out_invoice'))
|
||||
move_form = Form(self.env['account.move'].with_context(default_move_type='out_invoice'))
|
||||
move_form.partner_id = self.partner_a
|
||||
move_form.invoice_date = fields.Date.from_string('2019-01-01')
|
||||
move_form.currency_id = self.currency_data['currency']
|
||||
@@ -369,7 +369,7 @@ class TestAccountMoveOutInvoiceOnchanges(AccountTestInvoicingCommon):
|
||||
'taxes_id': [(6, 0, tax_price_include_1.ids)],
|
||||
})
|
||||
|
||||
move_form = Form(self.env['account.move'].with_context(default_type='out_invoice'))
|
||||
move_form = Form(self.env['account.move'].with_context(default_move_type='out_invoice'))
|
||||
move_form.partner_id = self.partner_a
|
||||
move_form.invoice_date = fields.Date.from_string('2019-01-01')
|
||||
move_form.currency_id = self.currency_data['currency']
|
||||
@@ -1726,7 +1726,7 @@ class TestAccountMoveOutInvoiceOnchanges(AccountTestInvoicingCommon):
|
||||
def test_out_invoice_create_1(self):
|
||||
# Test creating an account_move with the least information.
|
||||
move = self.env['account.move'].create({
|
||||
'type': 'out_invoice',
|
||||
'move_type': 'out_invoice',
|
||||
'partner_id': self.partner_a.id,
|
||||
'invoice_date': fields.Date.from_string('2019-01-01'),
|
||||
'currency_id': self.currency_data['currency'].id,
|
||||
@@ -1776,7 +1776,7 @@ class TestAccountMoveOutInvoiceOnchanges(AccountTestInvoicingCommon):
|
||||
def test_out_invoice_write_1(self):
|
||||
# Test creating an account_move with the least information.
|
||||
move = self.env['account.move'].create({
|
||||
'type': 'out_invoice',
|
||||
'move_type': 'out_invoice',
|
||||
'partner_id': self.partner_a.id,
|
||||
'invoice_date': fields.Date.from_string('2019-01-01'),
|
||||
'currency_id': self.currency_data['currency'].id,
|
||||
@@ -1830,7 +1830,7 @@ class TestAccountMoveOutInvoiceOnchanges(AccountTestInvoicingCommon):
|
||||
def test_out_invoice_write_2(self):
|
||||
''' Ensure to not messing the invoice when writing a bad account type. '''
|
||||
move = self.env['account.move'].create({
|
||||
'type': 'out_invoice',
|
||||
'move_type': 'out_invoice',
|
||||
'partner_id': self.partner_a.id,
|
||||
'invoice_line_ids': [
|
||||
(0, None, self.product_line_vals_1),
|
||||
@@ -1857,7 +1857,7 @@ class TestAccountMoveOutInvoiceOnchanges(AccountTestInvoicingCommon):
|
||||
with patch.object(fields.Date, 'today', lambda *args, **kwargs: frozen_today), patch.object(fields.Date, 'context_today', lambda *args, **kwargs: frozen_today):
|
||||
# Create an invoice with rate 1/3.
|
||||
move = self.env['account.move'].create({
|
||||
'type': 'out_invoice',
|
||||
'move_type': 'out_invoice',
|
||||
'partner_id': self.partner_a.id,
|
||||
'invoice_date': fields.Date.from_string('2016-01-01'),
|
||||
'currency_id': self.currency_data['currency'].id,
|
||||
@@ -1943,7 +1943,7 @@ class TestAccountMoveOutInvoiceOnchanges(AccountTestInvoicingCommon):
|
||||
''' Check the date will be set automatically at the next available post date due to the tax lock date. '''
|
||||
# Create an invoice with rate 1/3.
|
||||
move = self.env['account.move'].create({
|
||||
'type': 'out_invoice',
|
||||
'move_type': 'out_invoice',
|
||||
'partner_id': self.partner_a.id,
|
||||
'invoice_date': fields.Date.from_string('2016-01-01'),
|
||||
'date': fields.Date.from_string('2015-01-01'),
|
||||
@@ -2047,7 +2047,7 @@ class TestAccountMoveOutInvoiceOnchanges(AccountTestInvoicingCommon):
|
||||
def test_out_invoice_switch_out_refund_1(self):
|
||||
# Test creating an account_move with an out_invoice_type and switch it in an out_refund.
|
||||
move = self.env['account.move'].create({
|
||||
'type': 'out_invoice',
|
||||
'move_type': 'out_invoice',
|
||||
'partner_id': self.partner_a.id,
|
||||
'invoice_date': fields.Date.from_string('2019-01-01'),
|
||||
'currency_id': self.currency_data['currency'].id,
|
||||
@@ -2059,7 +2059,7 @@ class TestAccountMoveOutInvoiceOnchanges(AccountTestInvoicingCommon):
|
||||
})
|
||||
move.action_switch_invoice_into_refund_credit_note()
|
||||
|
||||
self.assertRecordValues(move, [{'type': 'out_refund'}])
|
||||
self.assertRecordValues(move, [{'move_type': 'out_refund'}])
|
||||
self.assertInvoiceValues(move, [
|
||||
{
|
||||
**self.product_line_vals_1,
|
||||
@@ -2108,7 +2108,7 @@ class TestAccountMoveOutInvoiceOnchanges(AccountTestInvoicingCommon):
|
||||
modified_product_line_vals_2 = self.product_line_vals_2.copy()
|
||||
modified_product_line_vals_2.update({'quantity': -modified_product_line_vals_2['quantity']})
|
||||
move = self.env['account.move'].create({
|
||||
'type': 'out_invoice',
|
||||
'move_type': 'out_invoice',
|
||||
'partner_id': self.partner_a.id,
|
||||
'invoice_date': fields.Date.from_string('2019-01-01'),
|
||||
'currency_id': self.currency_data['currency'].id,
|
||||
@@ -2180,7 +2180,7 @@ class TestAccountMoveOutInvoiceOnchanges(AccountTestInvoicingCommon):
|
||||
|
||||
move.action_switch_invoice_into_refund_credit_note()
|
||||
|
||||
self.assertRecordValues(move, [{'type': 'out_refund'}])
|
||||
self.assertRecordValues(move, [{'move_type': 'out_refund'}])
|
||||
self.assertInvoiceValues(move, [
|
||||
{
|
||||
**self.product_line_vals_1,
|
||||
@@ -2227,7 +2227,7 @@ class TestAccountMoveOutInvoiceOnchanges(AccountTestInvoicingCommon):
|
||||
|
||||
def test_out_invoice_change_period_accrual_1(self):
|
||||
move = self.env['account.move'].create({
|
||||
'type': 'out_invoice',
|
||||
'move_type': 'out_invoice',
|
||||
'date': '2017-01-01',
|
||||
'partner_id': self.partner_a.id,
|
||||
'invoice_date': fields.Date.from_string('2017-01-01'),
|
||||
@@ -2361,7 +2361,7 @@ class TestAccountMoveOutInvoiceOnchanges(AccountTestInvoicingCommon):
|
||||
})
|
||||
|
||||
invoice = self.env['account.move'].create({
|
||||
'type': 'out_invoice',
|
||||
'move_type': 'out_invoice',
|
||||
'partner_id': self.partner_a.id,
|
||||
'invoice_date': fields.Date.from_string('2019-01-01'),
|
||||
'invoice_payment_term_id': zero_balance_payment_term.id,
|
||||
|
||||
@@ -807,7 +807,7 @@ class TestAccountMoveOutRefundOnchanges(AccountTestInvoicingCommon):
|
||||
def test_out_refund_create_1(self):
|
||||
# Test creating an account_move with the least information.
|
||||
move = self.env['account.move'].create({
|
||||
'type': 'out_refund',
|
||||
'move_type': 'out_refund',
|
||||
'partner_id': self.partner_a.id,
|
||||
'invoice_date': fields.Date.from_string('2019-01-01'),
|
||||
'currency_id': self.currency_data['currency'].id,
|
||||
@@ -857,7 +857,7 @@ class TestAccountMoveOutRefundOnchanges(AccountTestInvoicingCommon):
|
||||
def test_out_refund_write_1(self):
|
||||
# Test creating an account_move with the least information.
|
||||
move = self.env['account.move'].create({
|
||||
'type': 'out_refund',
|
||||
'move_type': 'out_refund',
|
||||
'partner_id': self.partner_a.id,
|
||||
'invoice_date': fields.Date.from_string('2019-01-01'),
|
||||
'currency_id': self.currency_data['currency'].id,
|
||||
|
||||
@@ -30,7 +30,7 @@ class TestAccountMovePartnerCount(TransactionCase):
|
||||
})
|
||||
self.move = self.env['account.move'].with_env(env).create({
|
||||
'partner_id': self.partner.id,
|
||||
'type': 'out_invoice',
|
||||
'move_type': 'out_invoice',
|
||||
'journal_id': self.journal.id,
|
||||
'currency_id': self.env.user.company_id.currency_id.id,
|
||||
})
|
||||
|
||||
@@ -24,7 +24,7 @@ class TestAccountTax(AccountTestInvoicingCommon):
|
||||
self.company_data['default_tax_sale'].name = 'test_changing_account_company'
|
||||
|
||||
self.env['account.move'].create({
|
||||
'type': 'out_invoice',
|
||||
'move_type': 'out_invoice',
|
||||
'date': '2019-01-01',
|
||||
'invoice_line_ids': [
|
||||
(0, 0, {
|
||||
|
||||
@@ -57,7 +57,7 @@ class TestBankStatementReconciliation(AccountTestCommon):
|
||||
def create_invoice(self, amount):
|
||||
""" Return the move line that gets to be reconciled (the one in the receivable account) """
|
||||
move = self.env['account.move'].create({
|
||||
'type': 'out_invoice',
|
||||
'move_type': 'out_invoice',
|
||||
'partner_id': self.partner.id,
|
||||
'invoice_line_ids': [(0, 0, {
|
||||
'quantity': 1,
|
||||
|
||||
@@ -50,7 +50,7 @@ class TestInvoiceTaxes(AccountTestCommon, SavepointCaseWithUserDemo):
|
||||
|
||||
:param taxes_per_line: A list of tuple (price_unit, account.tax recordset)
|
||||
'''
|
||||
self_ctx = self.env['account.move'].with_context(default_type=inv_type)
|
||||
self_ctx = self.env['account.move'].with_context(default_move_type=inv_type)
|
||||
invoice_form = Form(self_ctx)
|
||||
invoice_form.partner_id = self.partner_demo
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ class TestPayment(AccountTestCommon):
|
||||
def create_invoice(self, amount=100, type='out_invoice', currency_id=None, partner=None, account_id=None):
|
||||
""" Returns an open invoice """
|
||||
invoice = self.env['account.move'].create({
|
||||
'type': type,
|
||||
'move_type': type,
|
||||
'partner_id': partner or self.partner_agrolait.id,
|
||||
'currency_id': currency_id or self.currency_eur_id,
|
||||
'invoice_date': time.strftime('%Y') + '-06-26',
|
||||
@@ -596,7 +596,7 @@ class TestPayment(AccountTestCommon):
|
||||
'company_id': self.env.ref('base.main_company').id
|
||||
})
|
||||
inv1 = self.env['account.move'].create({
|
||||
'type': 'out_invoice',
|
||||
'move_type': 'out_invoice',
|
||||
'partner_id': self.partner_agrolait.id,
|
||||
'currency_id': self.currency_usd_id,
|
||||
'invoice_date': time.strftime('%Y') + '-01-01',
|
||||
|
||||
@@ -132,8 +132,8 @@ class TestReconciliationExec(TestAccountReconciliationCommon):
|
||||
def test_statement_euro_invoice_usd_transaction_euro_full(self):
|
||||
# Create a customer invoice of 50 USD.
|
||||
partner = self.env['res.partner'].create({'name': 'test'})
|
||||
move = self.env['account.move'].with_context(default_type='out_invoice').create({
|
||||
'type': 'out_invoice',
|
||||
move = self.env['account.move'].with_context(default_move_type='out_invoice').create({
|
||||
'move_type': 'out_invoice',
|
||||
'partner_id': partner.id,
|
||||
'invoice_date': '%s-07-01' % time.strftime('%Y'),
|
||||
'date': '%s-07-01' % time.strftime('%Y'),
|
||||
@@ -204,7 +204,7 @@ class TestReconciliationExec(TestAccountReconciliationCommon):
|
||||
'currency_id': self.currency_usd_id,
|
||||
'name': 'Foreign invoice with exchange gain',
|
||||
'account_id': self.account_rcv_id,
|
||||
'type': 'out_invoice',
|
||||
'move_type': 'out_invoice',
|
||||
'invoice_date': time.strftime('%Y-%m-%d'),
|
||||
'date': time.strftime('%Y-%m-%d'),
|
||||
'journal_id': self.bank_journal_usd_id,
|
||||
@@ -502,8 +502,8 @@ class TestReconciliationExec(TestAccountReconciliationCommon):
|
||||
'company_id': self.company.id})
|
||||
|
||||
# Preparing Invoices (from vendor)
|
||||
invoice_a = self.env['account.move'].with_context(default_type='in_invoice').create({
|
||||
'type': 'in_invoice',
|
||||
invoice_a = self.env['account.move'].with_context(default_move_type='in_invoice').create({
|
||||
'move_type': 'in_invoice',
|
||||
'partner_id': self.partner_agrolait_id,
|
||||
'currency_id': self.currency_usd_id,
|
||||
'invoice_date': '%s-07-01' % time.strftime('%Y'),
|
||||
@@ -512,8 +512,8 @@ class TestReconciliationExec(TestAccountReconciliationCommon):
|
||||
(0, 0, {'product_id': self.product.id, 'quantity': 1, 'price_unit': 50.0})
|
||||
],
|
||||
})
|
||||
invoice_b = self.env['account.move'].with_context(default_type='in_invoice').create({
|
||||
'type': 'in_invoice',
|
||||
invoice_b = self.env['account.move'].with_context(default_move_type='in_invoice').create({
|
||||
'move_type': 'in_invoice',
|
||||
'partner_id': self.partner_agrolait_id,
|
||||
'currency_id': self.currency_usd_id,
|
||||
'invoice_date': '%s-08-01' % time.strftime('%Y'),
|
||||
@@ -811,8 +811,8 @@ class TestReconciliationExec(TestAccountReconciliationCommon):
|
||||
'rate': 2,
|
||||
})
|
||||
|
||||
invoice_cust_1 = self.env['account.move'].with_context(default_type='out_invoice').create({
|
||||
'type': 'out_invoice',
|
||||
invoice_cust_1 = self.env['account.move'].with_context(default_move_type='out_invoice').create({
|
||||
'move_type': 'out_invoice',
|
||||
'partner_id': self.partner_agrolait_id,
|
||||
'invoice_date': '%s-01-01' % time.strftime('%Y'),
|
||||
'date': '%s-01-01' % time.strftime('%Y'),
|
||||
@@ -1650,7 +1650,7 @@ class TestReconciliationExec(TestAccountReconciliationCommon):
|
||||
'company_id': self.company.id,
|
||||
})
|
||||
|
||||
move_form = Form(self.env['account.move'].with_context(default_type='out_invoice'))
|
||||
move_form = Form(self.env['account.move'].with_context(default_move_type='out_invoice'))
|
||||
move_form.partner_id = self.partner_agrolait
|
||||
move_form.currency_id = self.env.ref('base.USD')
|
||||
move_form.invoice_date = time.strftime('%Y') + '-07-01'
|
||||
|
||||
@@ -99,7 +99,7 @@ class TestReconciliationMatchingRules(AccountTestCommon):
|
||||
@classmethod
|
||||
def _create_invoice_line(cls, amount, partner, type):
|
||||
''' Create an invoice on the fly.'''
|
||||
invoice_form = Form(cls.env['account.move'].with_context(default_type=type, default_invoice_date='2019-09-01', default_date='2019-09-01'))
|
||||
invoice_form = Form(cls.env['account.move'].with_context(default_move_type=type, default_invoice_date='2019-09-01', default_date='2019-09-01'))
|
||||
invoice_form.partner_id = partner
|
||||
with invoice_form.invoice_line_ids.new() as invoice_line_form:
|
||||
invoice_line_form.name = 'xxxx'
|
||||
|
||||
@@ -158,7 +158,7 @@ class TaxReportTest(AccountTestInvoicingCommon):
|
||||
})
|
||||
|
||||
test_invoice = self.env['account.move'].create({
|
||||
'type': 'out_invoice',
|
||||
'move_type': 'out_invoice',
|
||||
'partner_id': self.partner_a.id,
|
||||
'date': '1992-12-22',
|
||||
'invoice_line_ids': [
|
||||
|
||||
@@ -404,13 +404,13 @@
|
||||
<field name="name"/>
|
||||
<field name="partner_id" invisible="1"/>
|
||||
<field name="invoice_source_email" invisible="1"/>
|
||||
<field name="invoice_partner_display_name" invisible="context.get('default_type') not in ('in_invoice', 'in_refund','in_receipt')" groups="base.group_user" string="Vendor" />
|
||||
<field name="invoice_partner_display_name" invisible="context.get('default_type') not in ('out_invoice', 'out_refund','out_receipt')" groups="base.group_user" string="Customer" />
|
||||
<field name="invoice_date" optional="show" invisible="context.get('default_type') not in ('in_invoice', 'in_refund','in_receipt')" string="Bill Date"/>
|
||||
<field name="invoice_date" optional="show" invisible="context.get('default_type') not in ('out_invoice', 'out_refund','out_receipt')" string="Invoice Date"/>
|
||||
<field name="invoice_partner_display_name" invisible="context.get('default_move_type') not in ('in_invoice', 'in_refund','in_receipt')" groups="base.group_user" string="Vendor" />
|
||||
<field name="invoice_partner_display_name" invisible="context.get('default_move_type') not in ('out_invoice', 'out_refund','out_receipt')" groups="base.group_user" string="Customer" />
|
||||
<field name="invoice_date" optional="show" invisible="context.get('default_move_type') not in ('in_invoice', 'in_refund','in_receipt')" string="Bill Date"/>
|
||||
<field name="invoice_date" optional="show" invisible="context.get('default_move_type') not in ('out_invoice', 'out_refund','out_receipt')" string="Invoice Date"/>
|
||||
<field name="invoice_origin" optional="hide" string="Source Document"/>
|
||||
<field name="invoice_payment_ref" optional="hide" invisible="context.get('default_type') in ('out_invoice', 'out_refund','out_receipt')"/>
|
||||
<field name="invoice_user_id" optional="hide" invisible="context.get('default_type') not in ('out_invoice', 'out_refund','out_receipt')" string="Sales Person"/>
|
||||
<field name="invoice_payment_ref" optional="hide" invisible="context.get('default_move_type') in ('out_invoice', 'out_refund','out_receipt')"/>
|
||||
<field name="invoice_user_id" optional="hide" invisible="context.get('default_move_type') not in ('out_invoice', 'out_refund','out_receipt')" string="Sales Person"/>
|
||||
<field name="company_id" groups="base.group_multi_company" options="{'no_create': True}" optional="show"/>
|
||||
<field name="invoice_date_due" optional="show"/>
|
||||
<field name="amount_untaxed_signed" string="Tax Excluded" sum="Total" optional="show"/>
|
||||
@@ -421,7 +421,7 @@
|
||||
<field name="company_currency_id" invisible="1"/>
|
||||
<field name="state" optional="hide"/>
|
||||
<field name="payment_state"/>
|
||||
<field name="type" invisible="context.get('default_type', True)"/>
|
||||
<field name="move_type" invisible="context.get('default_move_type', True)"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
@@ -483,33 +483,33 @@
|
||||
<button name="action_invoice_sent"
|
||||
type="object"
|
||||
string="Send & Print"
|
||||
attrs="{'invisible':['|', '|', ('state', '!=', 'posted'), ('invoice_sent', '=', True), ('type', 'not in', ('out_invoice', 'out_refund'))]}"
|
||||
attrs="{'invisible':['|', '|', ('state', '!=', 'posted'), ('invoice_sent', '=', True), ('move_type', 'not in', ('out_invoice', 'out_refund'))]}"
|
||||
class="oe_highlight"
|
||||
groups="account.group_account_invoice"/>
|
||||
<button name="action_invoice_sent"
|
||||
type="object"
|
||||
string="Send & Print"
|
||||
attrs="{'invisible':['|', '|', ('state', '!=', 'posted'), ('invoice_sent', '=', False), ('type', 'not in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund'))]}"
|
||||
attrs="{'invisible':['|', '|', ('state', '!=', 'posted'), ('invoice_sent', '=', False), ('move_type', 'not in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund'))]}"
|
||||
groups="account.group_account_invoice"/>
|
||||
<!-- Register Payment (only invoices / receipts) -->
|
||||
<button name="action_invoice_register_payment" id="account_invoice_payment_btn"
|
||||
type="object" class="oe_highlight"
|
||||
attrs="{'invisible': ['|', '|', ('state', '!=', 'posted'), ('payment_state', 'not in', ('not_paid', 'partial')), ('type', 'not in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt'))]}"
|
||||
attrs="{'invisible': ['|', '|', ('state', '!=', 'posted'), ('payment_state', 'not in', ('not_paid', 'partial')), ('move_type', 'not in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt'))]}"
|
||||
string="Register Payment"
|
||||
groups="account.group_account_invoice"/>
|
||||
<!-- Preview (only customer invoices) -->
|
||||
<button name="preview_invoice" type="object" string="Preview"
|
||||
attrs="{'invisible': [('type', 'not in', ('out_invoice', 'out_refund'))]}"/>
|
||||
attrs="{'invisible': [('move_type', 'not in', ('out_invoice', 'out_refund'))]}"/>
|
||||
<!-- Reverse -->
|
||||
<button name="%(action_view_account_move_reversal)d" string="Reverse Entry"
|
||||
type="action" groups="account.group_account_invoice"
|
||||
attrs="{'invisible': ['|', ('type', '!=', 'entry'), '|', ('state', '!=', 'posted'), ('payment_state', '=', 'reversed')]}"/>
|
||||
attrs="{'invisible': ['|', ('move_type', '!=', 'entry'), '|', ('state', '!=', 'posted'), ('payment_state', '=', 'reversed')]}"/>
|
||||
<button name="action_reverse" string='Add Credit Note'
|
||||
type='object' groups="account.group_account_invoice"
|
||||
attrs="{'invisible': ['|', ('type', 'not in', ('out_invoice', 'in_invoice')), ('state', '!=', 'posted')]}"/>
|
||||
attrs="{'invisible': ['|', ('move_type', 'not in', ('out_invoice', 'in_invoice')), ('state', '!=', 'posted')]}"/>
|
||||
<!-- Duplicate -->
|
||||
<button name="action_duplicate" string="Duplicate" type="object" groups="account.group_account_invoice"
|
||||
attrs="{'invisible': [('type', '!=', 'entry')]}"/>
|
||||
attrs="{'invisible': [('move_type', '!=', 'entry')]}"/>
|
||||
<!-- Cancel -->
|
||||
<button name="button_cancel" string="Cancel Entry" type="object" groups="account.group_account_invoice"
|
||||
attrs="{'invisible' : ['|', ('id', '=', False), ('state', '!=', 'draft')]}"/>
|
||||
@@ -525,12 +525,12 @@
|
||||
</div>
|
||||
<div groups="account.group_account_invoice,account.group_account_readonly"
|
||||
class="alert alert-info" role="alert" style="margin-bottom:0px;"
|
||||
attrs="{'invisible': ['|', '|', ('type', 'not in', ('out_invoice', 'out_refund')), ('invoice_has_outstanding', '=', False), ('payment_state', 'not in', ('not_paid', 'partial'))]}">
|
||||
attrs="{'invisible': ['|', '|', ('move_type', 'not in', ('out_invoice', 'out_refund')), ('invoice_has_outstanding', '=', False), ('payment_state', 'not in', ('not_paid', 'partial'))]}">
|
||||
You have <bold><a class="alert-link" href="#outstanding" role="button">outstanding payments</a></bold> for this customer. You can allocate them to mark this invoice as paid.
|
||||
</div>
|
||||
<div groups="account.group_account_invoice,account.group_account_readonly"
|
||||
class="alert alert-info" role="alert" style="margin-bottom:0px;"
|
||||
attrs="{'invisible': ['|', '|', ('type', 'not in', ('in_invoice', 'in_refund')), ('invoice_has_outstanding', '=', False), ('payment_state', 'not in', ('not_paid', 'partial'))]}">
|
||||
attrs="{'invisible': ['|', '|', ('move_type', 'not in', ('in_invoice', 'in_refund')), ('invoice_has_outstanding', '=', False), ('payment_state', 'not in', ('not_paid', 'partial'))]}">
|
||||
You have <bold><a class="alert-link" href="#outstanding" role="button">outstanding debits</a></bold> for this supplier. You can allocate them to mark this bill as paid.
|
||||
</div>
|
||||
<sheet>
|
||||
@@ -539,18 +539,18 @@
|
||||
class="oe_stat_button"
|
||||
icon="fa-bars"
|
||||
type="object"
|
||||
attrs="{'invisible': ['|', '|', ('type', '!=', 'entry'), ('id', '=', False), ('has_reconciled_entries', '=', False)]}"
|
||||
attrs="{'invisible': ['|', '|', ('move_type', '!=', 'entry'), ('id', '=', False), ('has_reconciled_entries', '=', False)]}"
|
||||
string="Reconciled Entries">
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- Payment status for invoices / receipts -->
|
||||
<widget name="web_ribbon" title="Paid"
|
||||
attrs="{'invisible': ['|', ('payment_state', '!=', 'paid'), ('type', 'not in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt'))]}"/>
|
||||
attrs="{'invisible': ['|', ('payment_state', '!=', 'paid'), ('move_type', 'not in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt'))]}"/>
|
||||
<widget name="web_ribbon" title="In Payment"
|
||||
attrs="{'invisible': ['|', ('payment_state', '!=', 'in_payment'), ('type', 'not in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt'))]}"/>
|
||||
attrs="{'invisible': ['|', ('payment_state', '!=', 'in_payment'), ('move_type', 'not in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt'))]}"/>
|
||||
<widget name="web_ribbon" title="Partial"
|
||||
attrs="{'invisible': ['|', ('payment_state', '!=', 'partial'), ('type', 'not in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt'))]}"/>
|
||||
attrs="{'invisible': ['|', ('payment_state', '!=', 'partial'), ('move_type', 'not in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt'))]}"/>
|
||||
<widget name="web_ribbon" title="Reversed"
|
||||
bg_color="bg-danger"
|
||||
attrs="{'invisible': [('payment_state', '!=', 'reversed')]}"/>
|
||||
@@ -563,7 +563,7 @@
|
||||
<field name="id" invisible="1"/>
|
||||
<field name="show_name_warning" invisible="1"/>
|
||||
<field name="posted_before" invisible="1"/>
|
||||
<field name="type" invisible="1"/>
|
||||
<field name="move_type" invisible="1"/>
|
||||
<field name="payment_state" invisible="1" force_save="1"/>
|
||||
<field name="invoice_filter_type_domain" invisible="1"/>
|
||||
<field name="company_currency_id" invisible="1"/>
|
||||
@@ -578,7 +578,7 @@
|
||||
|
||||
<div class="oe_title">
|
||||
<!-- Invoice draft header -->
|
||||
<span class="o_form_label"><field name="type" attrs="{'invisible': [('type', '=', 'entry')]}" readonly="1" nolabel="1"/></span>
|
||||
<span class="o_form_label"><field name="move_type" attrs="{'invisible': [('move_type', '=', 'entry')]}" readonly="1" nolabel="1"/></span>
|
||||
<h1>
|
||||
<span attrs="{'invisible': ['|', ('state', '!=', 'draft'), ('name', '!=', '/')]}">Draft</span>
|
||||
</h1>
|
||||
@@ -594,21 +594,21 @@
|
||||
<group id="header_left_group">
|
||||
<div class="o_td_label">
|
||||
<label for="partner_id" string="Customer" style="font-weight:bold;"
|
||||
attrs="{'invisible': [('type', 'not in', ('out_invoice', 'out_refund', 'out_receipt'))]}"/>
|
||||
attrs="{'invisible': [('move_type', 'not in', ('out_invoice', 'out_refund', 'out_receipt'))]}"/>
|
||||
<label for="partner_id" string="Vendor" style="font-weight:bold;"
|
||||
attrs="{'invisible': [('type', 'not in', ('in_invoice', 'in_refund', 'in_receipt'))]}"/>
|
||||
attrs="{'invisible': [('move_type', 'not in', ('in_invoice', 'in_refund', 'in_receipt'))]}"/>
|
||||
</div>
|
||||
<field name="partner_id" widget="res_partner_many2one" nolabel="1"
|
||||
context="{
|
||||
'res_partner_search_mode': (context.get('default_type', 'entry') in ('out_invoice', 'out_refund', 'out_receipt') and 'customer') or (context.get('default_type', 'entry') in ('in_invoice', 'in_refund', 'in_receipt') and 'supplier') or False,
|
||||
'res_partner_search_mode': (context.get('default_move_type', 'entry') in ('out_invoice', 'out_refund', 'out_receipt') and 'customer') or (context.get('default_move_type', 'entry') in ('in_invoice', 'in_refund', 'in_receipt') and 'supplier') or False,
|
||||
'show_address': 1, 'default_is_company': True, 'show_vat': True}"
|
||||
options='{"always_reload": True, "no_quick_create": True}'
|
||||
attrs="{'invisible': [('type', 'not in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt'))]}"/>
|
||||
attrs="{'invisible': [('move_type', 'not in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt'))]}"/>
|
||||
|
||||
<field name="ref"/>
|
||||
<field name="invoice_vendor_bill_id"
|
||||
attrs="{'invisible': ['|', ('state', '!=', 'draft'), ('type', '!=', 'in_invoice')]}"
|
||||
domain="[('company_id', '=', company_id), ('partner_id','child_of', [partner_id]), ('type','=','in_invoice')]"
|
||||
attrs="{'invisible': ['|', ('state', '!=', 'draft'), ('move_type', '!=', 'in_invoice')]}"
|
||||
domain="[('company_id', '=', company_id), ('partner_id','child_of', [partner_id]), ('move_type','=','in_invoice')]"
|
||||
string="Auto-Complete" placeholder="Select an old vendor bill"
|
||||
options="{'no_create': True}" context="{'show_total_amount': True}"/>
|
||||
</group>
|
||||
@@ -616,32 +616,32 @@
|
||||
<!-- Invoice date (only invoices / receipts) -->
|
||||
<div class="o_td_label">
|
||||
<label for="invoice_date" string="Invoice Date" style="font-weight:bold;"
|
||||
attrs="{'invisible': [('type', 'not in', ('out_invoice', 'out_refund', 'out_receipt'))]}"/>
|
||||
attrs="{'invisible': [('move_type', 'not in', ('out_invoice', 'out_refund', 'out_receipt'))]}"/>
|
||||
<label for="invoice_date" string="Bill Date" style="font-weight:bold;"
|
||||
attrs="{'invisible': [('type', 'not in', ('in_invoice', 'in_refund', 'in_receipt'))]}"/>
|
||||
attrs="{'invisible': [('move_type', 'not in', ('in_invoice', 'in_refund', 'in_receipt'))]}"/>
|
||||
</div>
|
||||
<field name="invoice_date" nolabel="1" options="{'datepicker': {'warn_future': true}}"
|
||||
attrs="{'invisible': [('type', 'not in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt'))]}"/>
|
||||
attrs="{'invisible': [('move_type', 'not in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt'))]}"/>
|
||||
|
||||
<field name="date" string="Accounting Date"
|
||||
attrs="{'invisible': [('type', 'in', ('out_invoice', 'out_refund', 'out_receipt'))]}"/>
|
||||
attrs="{'invisible': [('move_type', 'in', ('out_invoice', 'out_refund', 'out_receipt'))]}"/>
|
||||
|
||||
<!-- Invoice payment terms (only invoices) + due date (only invoices / receipts) -->
|
||||
<label for="invoice_payment_term_id"
|
||||
attrs="{'invisible': [('type', 'not in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt'))]}"/>
|
||||
<div class="d-flex" attrs="{'invisible': [('type', 'not in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt'))]}">
|
||||
attrs="{'invisible': [('move_type', 'not in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt'))]}"/>
|
||||
<div class="d-flex" attrs="{'invisible': [('move_type', 'not in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt'))]}">
|
||||
<field name="invoice_payment_term_id"
|
||||
placeholder="Terms"
|
||||
attrs="{'invisible': [('type', 'not in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt'))]}"/>
|
||||
attrs="{'invisible': [('move_type', 'not in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt'))]}"/>
|
||||
<span class="o_form_label mx-3 oe_edit_only"
|
||||
attrs="{'invisible': [ '|', '|', ('state', '!=', 'draft'), ('invoice_payment_term_id', '!=', False), ('type', 'not in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt'))]}"> or </span>
|
||||
attrs="{'invisible': [ '|', '|', ('state', '!=', 'draft'), ('invoice_payment_term_id', '!=', False), ('move_type', 'not in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt'))]}"> or </span>
|
||||
<field name="invoice_date_due" force_save="1"
|
||||
placeholder="Date"
|
||||
attrs="{'invisible': ['|', ('invoice_payment_term_id', '!=', False), ('type', 'not in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt'))]}"/>
|
||||
attrs="{'invisible': ['|', ('invoice_payment_term_id', '!=', False), ('move_type', 'not in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt'))]}"/>
|
||||
</div>
|
||||
|
||||
<field name="journal_id"
|
||||
invisible="context.get('default_journal_id') and context.get('type', 'entry') != 'entry'"
|
||||
invisible="context.get('default_journal_id') and context.get('move_type', 'entry') != 'entry'"
|
||||
groups="account.group_account_readonly"
|
||||
options="{'no_create': True}"
|
||||
domain="[('type', '=?', invoice_filter_type_domain)]"
|
||||
@@ -651,13 +651,13 @@
|
||||
|
||||
<field name="currency_id"
|
||||
groups="base.group_multi_currency"
|
||||
attrs="{'invisible': [('type', 'not in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund'))]}"/>
|
||||
attrs="{'invisible': [('move_type', 'not in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund'))]}"/>
|
||||
</group>
|
||||
</group>
|
||||
<notebook>
|
||||
<page id="invoice_tab"
|
||||
string="Invoice Lines"
|
||||
attrs="{'invisible': [('type', '=', 'entry')]}">
|
||||
attrs="{'invisible': [('move_type', '=', 'entry')]}">
|
||||
<field name="invoice_line_ids"
|
||||
widget="section_and_note_one2many"
|
||||
mode="tree,kanban"
|
||||
@@ -673,7 +673,7 @@
|
||||
<field name="sequence" widget="handle"/>
|
||||
<field name="move_name" invisible="1"/>
|
||||
<field name="product_id" optional="show" domain="['|', ('company_id', '=', False), ('company_id', '=', parent.company_id)]"/>
|
||||
<field name="name" widget="section_and_note_text" attrs="{'required': [('parent.type', 'not in', ('in_invoice', 'in_refund','in_receipt'))]}"/>
|
||||
<field name="name" widget="section_and_note_text" attrs="{'required': [('parent.move_type', 'not in', ('in_invoice', 'in_refund','in_receipt'))]}"/>
|
||||
<field name="account_id"
|
||||
groups="account.group_account_readonly"
|
||||
domain="[('deprecated', '=', False), ('user_type_id.type', 'not in', ('receivable', 'payable')), ('company_id', '=', parent.company_id)]"
|
||||
@@ -836,7 +836,7 @@
|
||||
<!-- Totals (only invoices / receipts) -->
|
||||
<group class="oe_right">
|
||||
<group class="oe_subtotal_footer"
|
||||
attrs="{'invisible': ['|', ('type', 'not in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt')),
|
||||
attrs="{'invisible': ['|', ('move_type', 'not in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt')),
|
||||
('payment_state' ,'=', 'invoicing_legacy')]}">
|
||||
<field name="amount_tax" invisible="1"/>
|
||||
<field name="amount_untaxed" attrs="{'invisible': [('amount_tax', '=', 0)]}"/>
|
||||
@@ -852,7 +852,7 @@
|
||||
<group class="oe_invoice_outstanding_credits_debits" style="width: 350px !important;">
|
||||
<field name="invoice_outstanding_credits_debits_widget"
|
||||
colspan="2" nolabel="1" widget="payment"
|
||||
attrs="{'invisible': ['|', ('state', '!=', 'posted'), ('type', 'in', ('out_receipt', 'in_receipt'))]}"/>
|
||||
attrs="{'invisible': ['|', ('state', '!=', 'posted'), ('move_type', 'in', ('out_receipt', 'in_receipt'))]}"/>
|
||||
</group>
|
||||
|
||||
</group>
|
||||
@@ -860,12 +860,12 @@
|
||||
<field name="narration" placeholder="Terms and Conditions" nolabel="1" height="50"/>
|
||||
</page>
|
||||
<page id="aml_tab" string="Journal Items" groups="account.group_account_readonly">
|
||||
<div class="alert alert-info text-center mb-0" role="alert" attrs="{'invisible': ['|', ('payment_state', '!=', 'invoicing_legacy'), ('type', '=', 'entry')]}">
|
||||
<div class="alert alert-info text-center mb-0" role="alert" attrs="{'invisible': ['|', ('payment_state', '!=', 'invoicing_legacy'), ('move_type', '=', 'entry')]}">
|
||||
<span>This entry has been generated through the Invoicing app, before installing Accounting. Its balance has been imported separately.</span>
|
||||
</div>
|
||||
<field name="line_ids"
|
||||
context="{'line_ids': line_ids, 'journal_id': journal_id, 'default_partner_id': commercial_partner_id, 'default_currency_id': currency_id != company_currency_id and currency_id or False}"
|
||||
attrs="{'invisible': [('payment_state', '=', 'invoicing_legacy'), ('type', '!=', 'entry')]}">
|
||||
attrs="{'invisible': [('payment_state', '=', 'invoicing_legacy'), ('move_type', '!=', 'entry')]}">
|
||||
<tree editable="bottom" string="Journal Items" decoration-muted="display_type in ('line_section', 'line_note')" default_order="sequence, date desc, move_name desc, id">
|
||||
<!-- Displayed fields -->
|
||||
<field name="account_id"
|
||||
@@ -875,7 +875,7 @@
|
||||
}"/>
|
||||
<field name="partner_id"
|
||||
domain="['|', ('parent_id', '=', False), ('is_company', '=', True)]"
|
||||
attrs="{'column_invisible': [('parent.type', '!=', 'entry')]}"/>
|
||||
attrs="{'column_invisible': [('parent.move_type', '!=', 'entry')]}"/>
|
||||
<field name="name" widget="section_and_note_text" optional="show"/>
|
||||
<field name="analytic_account_id"
|
||||
optional="hide"
|
||||
@@ -896,7 +896,7 @@
|
||||
optional="hide"/>
|
||||
<field name="currency_id" options="{'no_create': True}"
|
||||
groups="base.group_multi_currency"
|
||||
attrs="{'column_invisible': [('parent.type', '!=', 'entry')]}"/>
|
||||
attrs="{'column_invisible': [('parent.move_type', '!=', 'entry')]}"/>
|
||||
<field name="tax_ids" widget="many2many_tags"
|
||||
optional="hide"
|
||||
domain="[('type_tax_use', '=?', parent.invoice_filter_type_domain)]"
|
||||
@@ -908,7 +908,7 @@
|
||||
('display_type', 'in', ('line_section', 'line_note')),
|
||||
('tax_line_id', '!=', False),
|
||||
'&',
|
||||
('parent.type', 'in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt')),
|
||||
('parent.move_type', 'in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt')),
|
||||
('account_internal_type', 'in', ('receivable', 'payable')),
|
||||
]}"/>
|
||||
<field name="debit"
|
||||
@@ -971,30 +971,30 @@
|
||||
</field>
|
||||
</page>
|
||||
<page id="other_tab" string="Other Info" name="other_info"
|
||||
attrs="{'invisible': [('type', 'not in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund'))]}">
|
||||
attrs="{'invisible': [('move_type', 'not in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund'))]}">
|
||||
<group id="other_tab_group">
|
||||
<group string="Invoice"
|
||||
name="sale_info_group"
|
||||
attrs="{'invisible': [('type', 'not in', ('out_invoice', 'out_refund'))]}">
|
||||
attrs="{'invisible': [('move_type', 'not in', ('out_invoice', 'out_refund'))]}">
|
||||
<field name="invoice_user_id"/>
|
||||
<field name="invoice_origin" string="Source Document"
|
||||
attrs="{'invisible': [('invoice_origin', '=', False)]}"/>
|
||||
</group>
|
||||
<group string="Accounting"
|
||||
name="accounting_info_group"
|
||||
attrs="{'invisible': [('type', 'not in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund'))]}">
|
||||
attrs="{'invisible': [('move_type', 'not in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund'))]}">
|
||||
<field name="invoice_incoterm_id"/>
|
||||
<field name="fiscal_position_id"/>
|
||||
<field name="invoice_cash_rounding_id" groups="account.group_cash_rounding"/>
|
||||
<field name="invoice_source_email"
|
||||
widget="email"
|
||||
attrs="{'invisible': ['|', ('type', 'not in', ('in_invoice', 'in_refund')), ('invoice_source_email', '=', False)]}"/>
|
||||
attrs="{'invisible': ['|', ('move_type', 'not in', ('in_invoice', 'in_refund')), ('invoice_source_email', '=', False)]}"/>
|
||||
<field name="to_check"/>
|
||||
</group>
|
||||
<group string="Payments"
|
||||
name="payments_info_group"
|
||||
attrs="{'invisible': [('type', 'not in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund'))]}">
|
||||
<field name="invoice_payment_ref" attrs="{'readonly': [('state', '=', 'paid'), ('type', 'in', ('in_invoice', 'in_refund'))]}"/>
|
||||
attrs="{'invisible': [('move_type', 'not in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund'))]}">
|
||||
<field name="invoice_payment_ref" attrs="{'readonly': [('state', '=', 'paid'), ('move_type', 'in', ('in_invoice', 'in_refund'))]}"/>
|
||||
<field name="invoice_partner_bank_id"
|
||||
context="{'default_partner_id': commercial_partner_id}"
|
||||
domain="[('partner_id', '=', bank_partner_id)]"
|
||||
@@ -1003,15 +1003,15 @@
|
||||
</group>
|
||||
</page>
|
||||
<page id="other_tab_entry" string="Other Info" name="other_info"
|
||||
attrs="{'invisible': [('type', '!=', 'entry')]}">
|
||||
attrs="{'invisible': [('move_type', '!=', 'entry')]}">
|
||||
<group id="other_tab_entry_group">
|
||||
<group name="misc_group">
|
||||
<field name="auto_post"
|
||||
attrs="{'invisible': [('type', '!=', 'entry')], 'readonly': [('reversed_entry_id', '!=', False)]}"/>
|
||||
attrs="{'invisible': [('move_type', '!=', 'entry')], 'readonly': [('reversed_entry_id', '!=', False)]}"/>
|
||||
<field name="reversed_entry_id"
|
||||
attrs="{'invisible': [('type', '!=', 'entry')]}"/>
|
||||
attrs="{'invisible': [('move_type', '!=', 'entry')]}"/>
|
||||
<field name="to_check"
|
||||
attrs="{'invisible': [('type', '!=', 'entry')]}" />
|
||||
attrs="{'invisible': [('move_type', '!=', 'entry')]}" />
|
||||
</group>
|
||||
<group>
|
||||
<field name="company_id" groups="base.group_multi_company" required="1"/>
|
||||
@@ -1025,7 +1025,7 @@
|
||||
<!-- Attachment preview -->
|
||||
<div class="o_attachment_preview"
|
||||
attrs="{'invisible': ['|',
|
||||
('type', 'not in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund')),
|
||||
('move_type', 'not in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund')),
|
||||
('state', '!=', 'draft')]}" />
|
||||
<!-- Chatter -->
|
||||
<div class="oe_chatter">
|
||||
@@ -1261,7 +1261,7 @@
|
||||
<field name="view_mode">tree,kanban,form</field>
|
||||
<field name="view_id" ref="view_move_tree"/>
|
||||
<field name="search_view_id" ref="view_account_move_filter"/>
|
||||
<field name="context">{'default_type': 'entry', 'search_default_misc_filter':1, 'view_no_maturity': True}</field>
|
||||
<field name="context">{'default_move_type': 'entry', 'search_default_misc_filter':1, 'view_no_maturity': True}</field>
|
||||
<field name="help" type="html">
|
||||
<p class="o_view_nocontent_smiling_face">
|
||||
Create a journal entry
|
||||
@@ -1278,8 +1278,8 @@
|
||||
<field name="view_mode">tree,kanban,form</field>
|
||||
<field name="view_id" ref="view_invoice_tree"/>
|
||||
<field name="search_view_id" ref="view_account_invoice_filter"/>
|
||||
<field name="domain">[('type', '=', 'out_invoice')]</field>
|
||||
<field name="context">{'default_type': 'out_invoice'}</field>
|
||||
<field name="domain">[('move_type', '=', 'out_invoice')]</field>
|
||||
<field name="context">{'default_move_type': 'out_invoice'}</field>
|
||||
<field name="help" type="html">
|
||||
<p class="o_view_nocontent_smiling_face">
|
||||
Create a customer invoice
|
||||
@@ -1295,8 +1295,8 @@
|
||||
<field name="view_mode">tree,kanban,form</field>
|
||||
<field name="view_id" ref="view_invoice_tree"/>
|
||||
<field name="search_view_id" ref="view_account_invoice_filter"/>
|
||||
<field name="domain">[('type', '=', 'out_refund')]</field>
|
||||
<field name="context">{'default_type': 'out_refund'}</field>
|
||||
<field name="domain">[('move_type', '=', 'out_refund')]</field>
|
||||
<field name="context">{'default_move_type': 'out_refund'}</field>
|
||||
<field name="help" type="html">
|
||||
<p class="o_view_nocontent_smiling_face">
|
||||
Create a credit note
|
||||
@@ -1313,8 +1313,8 @@
|
||||
<field name="view_mode">tree,kanban,form</field>
|
||||
<field name="view_id" ref="view_invoice_tree"/>
|
||||
<field name="search_view_id" ref="view_account_invoice_filter"/>
|
||||
<field name="domain">[('type', '=', 'in_invoice')]</field>
|
||||
<field name="context">{'default_type': 'in_invoice'}</field>
|
||||
<field name="domain">[('move_type', '=', 'in_invoice')]</field>
|
||||
<field name="context">{'default_move_type': 'in_invoice'}</field>
|
||||
<field name="help" type="html">
|
||||
<p class="o_view_nocontent_smiling_face">
|
||||
Create a vendor bill
|
||||
@@ -1330,8 +1330,8 @@
|
||||
<field name="view_mode">tree,kanban,form</field>
|
||||
<field name="view_id" ref="view_invoice_tree"/>
|
||||
<field name="search_view_id" ref="view_account_invoice_filter"/>
|
||||
<field name="domain">[('type', '=', 'in_refund')]</field>
|
||||
<field name="context">{'default_type': 'in_refund'}</field>
|
||||
<field name="domain">[('tmove_ype', '=', 'in_refund')]</field>
|
||||
<field name="context">{'default_move_type': 'in_refund'}</field>
|
||||
<field name="help" type="html">
|
||||
<p class="o_view_nocontent_smiling_face">
|
||||
Create a vendor credit note
|
||||
@@ -1347,8 +1347,8 @@
|
||||
<field name="view_mode">tree,kanban,form</field>
|
||||
<field name="view_id" ref="view_invoice_tree"/>
|
||||
<field name="search_view_id" ref="view_account_invoice_filter"/>
|
||||
<field name="domain">[('type', '=', 'out_receipt')]</field>
|
||||
<field name="context">{'default_type': 'out_receipt'}</field>
|
||||
<field name="domain">[('move_type', '=', 'out_receipt')]</field>
|
||||
<field name="context">{'default_move_type': 'out_receipt'}</field>
|
||||
<field name="help" type="html">
|
||||
<p class="o_view_nocontent_smiling_face">
|
||||
Create a new sales receipt
|
||||
@@ -1365,8 +1365,8 @@
|
||||
<field name="view_mode">tree,kanban,form</field>
|
||||
<field name="view_id" ref="view_invoice_tree"/>
|
||||
<field name="search_view_id" ref="view_account_invoice_filter"/>
|
||||
<field name="domain">[('type', '=', 'in_receipt')]</field>
|
||||
<field name="context">{'default_type': 'in_receipt'}</field>
|
||||
<field name="domain">[('move_type', '=', 'in_receipt')]</field>
|
||||
<field name="context">{'default_move_type': 'in_receipt'}</field>
|
||||
<field name="help" type="html">
|
||||
<p class="o_view_nocontent_smiling_face">
|
||||
Register a new purchase receipt
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
<span class="badge badge-pill badge-warning"><i class="fa fa-fw fa-remove" aria-label="Cancelled" title="Cancelled" role="img"></i><span class="d-none d-md-inline"> Cancelled</span></span>
|
||||
</t>
|
||||
</td>
|
||||
<td class="text-right"><span t-esc="-invoice.amount_residual if invoice.type == 'out_refund' else invoice.amount_residual" t-options='{"widget": "monetary", "display_currency": invoice.currency_id}'/></td>
|
||||
<td class="text-right"><span t-esc="-invoice.amount_residual if invoice.move_type == 'out_refund' else invoice.amount_residual" t-options='{"widget": "monetary", "display_currency": invoice.currency_id}'/></td>
|
||||
</tr>
|
||||
</t>
|
||||
</tbody>
|
||||
@@ -89,7 +89,7 @@
|
||||
<b t-if="invoice.amount_residual > 0" t-field="invoice.amount_residual"/>
|
||||
<b t-else="1" t-field="invoice.amount_total"/>
|
||||
</h2>
|
||||
<div class="small" t-if="invoice.state != 'paid' and invoice.type == 'out_invoice'"><i class="fa fa-clock-o"/><span class="o_portal_sidebar_timeago ml4" t-att-datetime="invoice.invoice_date_due"/></div>
|
||||
<div class="small" t-if="invoice.state != 'paid' and invoice.move_type == 'out_invoice'"><i class="fa fa-clock-o"/><span class="o_portal_sidebar_timeago ml4" t-att-datetime="invoice.invoice_date_due"/></div>
|
||||
</t>
|
||||
|
||||
<t t-set="entries">
|
||||
|
||||
@@ -12,12 +12,12 @@
|
||||
</t>
|
||||
<div class="page">
|
||||
<h2>
|
||||
<span t-if="o.type == 'out_invoice' and o.state == 'posted'">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'">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-if="o.move_type == 'out_invoice' and o.state == 'posted'">Invoice</span>
|
||||
<span t-if="o.move_type == 'out_invoice' and o.state == 'draft'">Draft Invoice</span>
|
||||
<span t-if="o.move_type == 'out_invoice' and o.state == 'cancel'">Cancelled Invoice</span>
|
||||
<span t-if="o.move_type == 'out_refund'">Credit Note</span>
|
||||
<span t-if="o.move_type == 'in_refund'">Vendor Credit Note</span>
|
||||
<span t-if="o.move_type == 'in_invoice'">Vendor Bill</span>
|
||||
<span t-if="o.name != '/'" t-field="o.name"/>
|
||||
</h2>
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
<strong>Invoice Date:</strong>
|
||||
<p class="m-0" t-field="o.invoice_date"/>
|
||||
</div>
|
||||
<div class="col-auto mw-100 mb-2" t-if="o.invoice_date_due and o.type == 'out_invoice' and o.state == 'posted'" name="due_date">
|
||||
<div class="col-auto mw-100 mb-2" t-if="o.invoice_date_due and o.move_type == 'out_invoice' and o.state == 'posted'" name="due_date">
|
||||
<strong>Due Date:</strong>
|
||||
<p class="m-0" t-field="o.invoice_date_due"/>
|
||||
</div>
|
||||
@@ -165,7 +165,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p t-if="o.type in ('out_invoice', 'in_refund') and o.invoice_payment_ref">
|
||||
<p t-if="o.move_type in ('out_invoice', 'in_refund') and o.invoice_payment_ref">
|
||||
Please use the following communication for your payment : <b><span t-field="o.invoice_payment_ref"/></b>
|
||||
</p>
|
||||
<p t-if="o.invoice_payment_term_id" name="payment_term">
|
||||
@@ -219,7 +219,7 @@
|
||||
<template id="report_invoice">
|
||||
<t t-call="web.html_container">
|
||||
<t t-foreach="docs" t-as="o">
|
||||
<t t-set="lang" t-value="o.invoice_user_id.sudo().lang if o.type in ('in_invoice', 'in_refund') else o.partner_id.lang"/>
|
||||
<t t-set="lang" t-value="o.invoice_user_id.sudo().lang if o.move_type in ('in_invoice', 'in_refund') else o.partner_id.lang"/>
|
||||
<t t-call="account.report_invoice_document" t-lang="lang"/>
|
||||
</t>
|
||||
</t>
|
||||
@@ -228,7 +228,7 @@
|
||||
<template id="report_invoice_with_payments">
|
||||
<t t-call="web.html_container">
|
||||
<t t-foreach="docs" t-as="o">
|
||||
<t t-set="lang" t-value="o.invoice_user_id.sudo().lang if o.type in ('in_invoice', 'in_refund') else o.partner_id.lang"/>
|
||||
<t t-set="lang" t-value="o.invoice_user_id.sudo().lang if o.move_type in ('in_invoice', 'in_refund') else o.partner_id.lang"/>
|
||||
<t t-call="account.report_invoice_document_with_payments" t-lang="lang"/>
|
||||
</t>
|
||||
</t>
|
||||
|
||||
@@ -35,7 +35,7 @@ class AccountMoveReversal(models.TransientModel):
|
||||
if any(move.state != "posted" for move in move_ids):
|
||||
raise UserError(_('You can only reverse posted moves.'))
|
||||
res['move_ids'] = [(6, 0, move_ids.ids)]
|
||||
res['refund_method'] = (len(move_ids) > 1 or move_ids.type == 'entry') and 'cancel' or 'refund'
|
||||
res['refund_method'] = (len(move_ids) > 1 or move_ids.move_type == 'entry') and 'cancel' or 'refund'
|
||||
return res
|
||||
|
||||
@api.depends('move_ids')
|
||||
@@ -44,7 +44,7 @@ class AccountMoveReversal(models.TransientModel):
|
||||
move_ids = record.move_ids
|
||||
record.residual = len(move_ids) == 1 and move_ids.amount_residual or 0
|
||||
record.currency_id = len(move_ids.currency_id) == 1 and move_ids.currency_id or False
|
||||
record.move_type = move_ids.type if len(move_ids) == 1 else (any(move.type in ('in_invoice', 'out_invoice') for move in move_ids) and 'some_invoice' or False)
|
||||
record.move_type = move_ids.move_type if len(move_ids) == 1 else (any(move.move_type in ('in_invoice', 'out_invoice') for move in move_ids) and 'some_invoice' or False)
|
||||
|
||||
def _prepare_default_reversal(self, move):
|
||||
return {
|
||||
|
||||
@@ -165,8 +165,8 @@ class AccountPayment(models.Model):
|
||||
multi_stub = self.company_id.account_check_printing_multi_stub
|
||||
|
||||
invoices = self.reconciled_invoice_ids.sorted(key=lambda r: r.invoice_date_due)
|
||||
debits = invoices.filtered(lambda r: r.type == 'in_invoice')
|
||||
credits = invoices.filtered(lambda r: r.type == 'in_refund')
|
||||
debits = invoices.filtered(lambda r: r.move_type == 'in_invoice')
|
||||
credits = invoices.filtered(lambda r: r.move_type == 'in_refund')
|
||||
|
||||
# Prepare the stub lines
|
||||
if not credits:
|
||||
@@ -200,7 +200,7 @@ class AccountPayment(models.Model):
|
||||
""" Return the dict used to display an invoice/refund in the stub
|
||||
"""
|
||||
# Find the account.partial.reconcile which are common to the invoice and the payment
|
||||
if invoice.type in ['in_invoice', 'out_refund']:
|
||||
if invoice.move_type in ['in_invoice', 'out_refund']:
|
||||
invoice_sign = 1
|
||||
invoice_payment_reconcile = invoice.line_ids.mapped('matched_debit_ids').filtered(lambda r: r.debit_move_id in self.move_line_ids)
|
||||
else:
|
||||
|
||||
@@ -32,7 +32,7 @@ class TestPrintCheck(AccountTestCommon):
|
||||
cls.bank_journal.check_manual_sequencing = True
|
||||
|
||||
def create_invoice(self, amount=100, is_refund=False):
|
||||
invoice = self.env['account.move'].with_context(default_type=is_refund and 'out_refund' or 'in_invoice').create({
|
||||
invoice = self.env['account.move'].with_context(default_move_type=is_refund and 'out_refund' or 'in_invoice').create({
|
||||
'partner_id': self.partner_axelor.id,
|
||||
'invoice_date': time.strftime('%Y') + '-06-26',
|
||||
'date': time.strftime('%Y') + '-06-26',
|
||||
|
||||
@@ -23,7 +23,7 @@ class TestAccountDebitNote(AccountTestInvoicingCommon):
|
||||
debit_note = self.env['account.move'].search([('debit_origin_id', '=', invoice.id)])
|
||||
debit_note.ensure_one()
|
||||
self.assertEqual(len(debit_note.invoice_line_ids), 2, "Should have copied the invoice lines")
|
||||
self.assertEqual(debit_note.type, 'out_invoice', 'Type of debit note should be the same as the original invoice')
|
||||
self.assertEqual(debit_note.move_type, 'out_invoice', 'Type of debit note should be the same as the original invoice')
|
||||
self.assertEqual(debit_note.state, 'draft', 'We should create debit notes in draft state')
|
||||
|
||||
def test_10_debit_note_in_refund(self):
|
||||
@@ -42,5 +42,5 @@ class TestAccountDebitNote(AccountTestInvoicingCommon):
|
||||
debit_note.ensure_one()
|
||||
|
||||
self.assertFalse(debit_note.invoice_line_ids, 'We should not copy lines by default on debit notes')
|
||||
self.assertEqual(debit_note.type, 'in_invoice', 'Type of debit note should not be refund anymore')
|
||||
self.assertEqual(debit_note.move_type, 'in_invoice', 'Type of debit note should not be refund anymore')
|
||||
self.assertEqual(debit_note.state, 'draft', 'We should create debit notes in draft state')
|
||||
@@ -10,7 +10,7 @@
|
||||
<button name="%(action_view_account_move_debit)d" string='Add Debit Note'
|
||||
type='action' groups="account.group_account_invoice"
|
||||
attrs="{'invisible': ['|', '|', ('debit_origin_id', '!=', False),
|
||||
('type', 'not in', ('out_invoice', 'in_invoice', 'out_refund', 'in_refund')), ('state', '!=', 'posted')]}"/>
|
||||
('move_type', 'not in', ('out_invoice', 'in_invoice', 'out_refund', 'in_refund')), ('state', '!=', 'posted')]}"/>
|
||||
</button>
|
||||
<div class="oe_button_box" position="inside">
|
||||
<button type="object" class="oe_stat_button" name="action_view_debit_notes" icon="fa-plus" attrs="{'invisible': [('debit_note_count', '=', 0)]}">
|
||||
|
||||
@@ -39,14 +39,14 @@ class AccountDebitNote(models.TransientModel):
|
||||
def _compute_from_moves(self):
|
||||
for record in self:
|
||||
move_ids = record.move_ids
|
||||
record.move_type = move_ids[0].type if len(move_ids) == 1 or not any(m.type != move_ids[0].type for m in move_ids) else False
|
||||
record.move_type = move_ids[0].move_type if len(move_ids) == 1 or not any(m.move_type != move_ids[0].move_type for m in move_ids) else False
|
||||
record.journal_type = record.move_type in ['in_refund', 'in_invoice'] and 'purchase' or 'sale'
|
||||
|
||||
def _prepare_default_values(self, move):
|
||||
if move.type in ('in_refund', 'out_refund'):
|
||||
type = 'in_invoice' if move.type == 'in_refund' else 'out_invoice'
|
||||
if move.move_type in ('in_refund', 'out_refund'):
|
||||
type = 'in_invoice' if move.move_type == 'in_refund' else 'out_invoice'
|
||||
else:
|
||||
type = move.type
|
||||
type = move.move_type
|
||||
default_values = {
|
||||
'ref': '%s, %s' % (move.name, self.reason) if self.reason else move.name,
|
||||
'date': self.date or move.date,
|
||||
@@ -54,9 +54,9 @@ class AccountDebitNote(models.TransientModel):
|
||||
'journal_id': self.journal_id and self.journal_id.id or move.journal_id.id,
|
||||
'invoice_payment_term_id': None,
|
||||
'debit_origin_id': move.id,
|
||||
'type': type,
|
||||
'move_type': type,
|
||||
}
|
||||
if not self.copy_lines or move.type in [('in_refund', 'out_refund')]:
|
||||
if not self.copy_lines or move.move_type in [('in_refund', 'out_refund')]:
|
||||
default_values['line_ids'] = [(5, 0, 0)]
|
||||
return default_values
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
quantity=line.quantity,
|
||||
product=line.product_id,
|
||||
partner=record.partner_id,
|
||||
is_refund=line.move_id.type in ('in_refund', 'out_refund'))"/>
|
||||
is_refund=line.move_id.move_type in ('in_refund', 'out_refund'))"/>
|
||||
<ram:GrossPriceProductTradePrice>
|
||||
<ram:ChargeAmount
|
||||
t-att-currencyID="currency.name"
|
||||
@@ -119,7 +119,7 @@
|
||||
<!-- Document Headers. -->
|
||||
<rsm:ExchangedDocument>
|
||||
<ram:ID t-esc="record.ref"/>
|
||||
<ram:TypeCode t-esc="'381' if 'refund' in record.type else '380'"/>
|
||||
<ram:TypeCode t-esc="'381' if 'refund' in record.move_type else '380'"/>
|
||||
<ram:IssueDateTime>
|
||||
<udt:DateTimeString format="102" t-esc="format_date(record.invoice_date)"/>
|
||||
</ram:IssueDateTime>
|
||||
|
||||
@@ -58,12 +58,12 @@ class AccountMove(models.Model):
|
||||
if self._context.get('default_journal_id'):
|
||||
journal = self.env['account.journal'].browse(self.env.context['default_journal_id'])
|
||||
default_type = 'out_invoice' if journal.type == 'sale' else 'in_invoice'
|
||||
elif self._context.get('default_type'):
|
||||
default_type = self._context['default_type']
|
||||
elif self.type in self.env['account.move'].get_invoice_types(include_receipts=True):
|
||||
elif self._context.get('default_move_type'):
|
||||
default_type = self._context['default_move_type']
|
||||
elif self.move_type in self.env['account.move'].get_invoice_types(include_receipts=True):
|
||||
# in case an attachment is saved on a draft invoice previously created, we might
|
||||
# have lost the default value in context but the type was already set
|
||||
default_type = self.type
|
||||
default_type = self.move_type
|
||||
|
||||
if not default_type:
|
||||
raise UserError(_("No information about the journal or the type of invoice is passed"))
|
||||
@@ -93,10 +93,10 @@ class AccountMove(models.Model):
|
||||
refund_sign = -1 if 'refund' in default_type else 1
|
||||
|
||||
# Write the type as the journal entry is already created.
|
||||
self.type = default_type
|
||||
self.move_type = default_type
|
||||
|
||||
# self could be a single record (editing) or be empty (new).
|
||||
with Form(self.with_context(default_type=default_type)) as invoice_form:
|
||||
with Form(self.with_context(default_move_type=default_type)) as invoice_form:
|
||||
# Partner (first step to avoid warning 'Warning! You must first select a partner.').
|
||||
partner_type = invoice_form.journal_id.type == 'purchase' and 'SellerTradeParty' or 'BuyerTradeParty'
|
||||
elements = tree.xpath('//ram:'+partner_type+'/ram:SpecifiedTaxRegistration/ram:ID', namespaces=tree.nsmap)
|
||||
@@ -231,7 +231,7 @@ class AccountMove(models.Model):
|
||||
res = super(AccountMove, self).message_post(**kwargs)
|
||||
|
||||
if not self.env.context.get('no_new_invoice') and len(self) == 1 and self.state == 'draft' and (
|
||||
self.env.context.get('default_type', self.type) in self.env['account.move'].get_invoice_types(include_receipts=True)
|
||||
self.env.context.get('default_move_type', self.move_type) in self.env['account.move'].get_invoice_types(include_receipts=True)
|
||||
or self.env['account.journal'].browse(self.env.context.get('default_journal_id')).type in ('sale', 'purchase')
|
||||
):
|
||||
for attachment in self.env['ir.attachment'].browse(kwargs.get('attachment_ids', [])):
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<td class="text-center">
|
||||
<t t-set="tx_ids" t-value="invoice.transaction_ids.filtered(lambda tx: tx.state in ('pending', 'authorized', 'done'))"/>
|
||||
<t t-set="pending_manual_txs" t-value="tx_ids.filtered(lambda tx: tx.state == 'pending' and tx.acquirer_id.provider in ('transfer', 'manual'))"/>
|
||||
<a t-if="invoice.state == 'posted' and invoice.payment_state in ('not_paid', 'partial') and invoice.amount_total and invoice.type == 'out_invoice' and (pending_manual_txs or not tx_ids)"
|
||||
<a t-if="invoice.state == 'posted' and invoice.payment_state in ('not_paid', 'partial') and invoice.amount_total and invoice.move_type == 'out_invoice' and (pending_manual_txs or not tx_ids)"
|
||||
t-att-href="invoice.get_portal_url(anchor='portal_pay')" title="Pay Now" aria-label="Pay now" class="btn btn-sm btn-primary" role="button">
|
||||
<i class="fa fa-arrow-circle-right"/><span class='d-none d-md-inline'> Pay Now</span>
|
||||
</a>
|
||||
@@ -71,7 +71,8 @@
|
||||
<t t-set="tx_ids" t-value="invoice.transaction_ids.filtered(lambda tx: tx.state in ('pending', 'authorized', 'done'))"/>
|
||||
<t t-set="pending_manual_txs" t-value="tx_ids.filtered(lambda tx: tx.state == 'pending' and tx.acquirer_id.provider in ('transfer', 'manual'))"/>
|
||||
<div>
|
||||
<a href="#" t-if="invoice.state == 'posted' and invoice.payment_state in ('not_paid', 'partial') and invoice.amount_total and invoice.type == 'out_invoice' and (pending_manual_txs or not tx_ids)"
|
||||
<a href="#" t-if="invoice.state == 'posted' and invoice.payment_state in ('not_paid', 'partial') and invoice.amount_total and invoice.move_type == 'out_invoice' and (pending_manual_txs or not tx_ids)"
|
||||
|
||||
class="btn btn-primary btn-block mb-2" data-toggle="modal" data-target="#pay_with">
|
||||
<i class="fa fa-fw fa-arrow-circle-right"/> Pay Now
|
||||
</a>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<field name="model_id" ref="account.model_account_invoice_report"/>
|
||||
<field name="field_id" ref="account.field_account_invoice_report__price_subtotal"/>
|
||||
<field name="field_date_id" ref="account.field_account_invoice_report__invoice_date"/>
|
||||
<field name="domain">[('state','!=','cancel'),('invoice_user_id','=',user.id),('type','=','out_invoice')]</field>
|
||||
<field name="domain">[('state','!=','cancel'),('invoice_user_id','=',user.id),('move_type','=','out_invoice')]</field>
|
||||
</record>
|
||||
|
||||
<record model="gamification.goal.definition" id="definition_crm_nbr_new_leads">
|
||||
@@ -76,7 +76,7 @@
|
||||
<field name="suffix">orders</field>
|
||||
<field name="model_id" ref="account.model_account_invoice_report"/>
|
||||
<field name="field_date_id" ref="account.field_account_invoice_report__invoice_date"/>
|
||||
<field name="domain">[('state','=','paid'),('invoice_user_id','=',user.id),('type','=','out_invoice')]</field>
|
||||
<field name="domain">[('state','=','paid'),('invoice_user_id','=',user.id),('move_type','=','out_invoice')]</field>
|
||||
</record>
|
||||
<record model="gamification.goal.definition" id="definition_crm_tot_paid_sale_order">
|
||||
<field name="name">Total Paid Sales Orders</field>
|
||||
@@ -86,7 +86,7 @@
|
||||
<field name="model_id" ref="account.model_account_invoice_report"/>
|
||||
<field name="field_id" ref="account.field_account_invoice_report__price_subtotal"/>
|
||||
<field name="field_date_id" ref="account.field_account_invoice_report__invoice_date"/>
|
||||
<field name="domain">[('state','=','paid'),('invoice_user_id','=',user.id),('type','=','out_invoice')]</field>
|
||||
<field name="domain">[('state','=','paid'),('invoice_user_id','=',user.id),('move_type','=','out_invoice')]</field>
|
||||
</record>
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@
|
||||
<field name="suffix">invoices</field>
|
||||
<field name="model_id" ref="account.model_account_invoice_report"/>
|
||||
<field name="field_date_id" ref="account.field_account_invoice_report__invoice_date"/>
|
||||
<field name="domain">[('state','!=','cancel'),('invoice_user_id','=',user.id),('type','=','out_refund')]</field>
|
||||
<field name="domain">[('state','!=','cancel'),('invoice_user_id','=',user.id),('move_type','=','out_refund')]</field>
|
||||
</record>
|
||||
<record model="gamification.goal.definition" id="definition_crm_tot_customer_refunds">
|
||||
<field name="name">Total Customer Credit Notes</field>
|
||||
@@ -109,7 +109,7 @@
|
||||
<field name="model_id" ref="account.model_account_invoice_report"/>
|
||||
<field name="field_id" ref="account.field_account_invoice_report__price_subtotal"/>
|
||||
<field name="field_date_id" ref="account.field_account_invoice_report__invoice_date"/>
|
||||
<field name="domain">[('state','!=','cancel'),('invoice_user_id','=',user.id),('type','=','out_refund')]</field>
|
||||
<field name="domain">[('state','!=','cancel'),('invoice_user_id','=',user.id),('move_type','=','out_refund')]</field>
|
||||
</record>
|
||||
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
</p>
|
||||
</xpath>
|
||||
<xpath expr="//h2/span" position="before">
|
||||
<span t-if="o.company_id.country_id.code == 'AE' and o.type in ['out_invoice', 'out_refund']">Tax</span>
|
||||
<span t-if="o.company_id.country_id.code == 'AE' and o.move_type in ['out_invoice', 'out_refund']">Tax</span>
|
||||
</xpath>
|
||||
|
||||
<xpath expr="//div[hasclass('clearfix')]" position="after">
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<field name="partner_id" ref="res_partner_gritti_agrimensura"/>
|
||||
<field name="invoice_user_id" ref="base.user_demo"/>
|
||||
<field name="invoice_payment_term_id" ref="account.account_payment_term_end_following_month"/>
|
||||
<field name="type">out_invoice</field>
|
||||
<field name="move_type">out_invoice</field>
|
||||
<field name="invoice_date" eval="time.strftime('%Y-%m')+'-01'"/>
|
||||
<field name="company_id" ref="company_ri"/>
|
||||
<field name="invoice_line_ids" eval="[
|
||||
@@ -21,7 +21,7 @@
|
||||
<field name="partner_id" ref="res_partner_cmr"/>
|
||||
<field name="invoice_user_id" ref="base.user_demo"/>
|
||||
<field name="invoice_payment_term_id" ref="account.account_payment_term_end_following_month"/>
|
||||
<field name="type">out_invoice</field>
|
||||
<field name="move_type">out_invoice</field>
|
||||
<field name="invoice_date" eval="time.strftime('%Y-%m')+'-05'"/>
|
||||
<field name="company_id" ref="company_ri"/>
|
||||
<field name="invoice_line_ids" eval="[
|
||||
@@ -36,7 +36,7 @@
|
||||
<field name="partner_id" ref="l10n_ar.res_partner_adhoc"/>
|
||||
<field name="invoice_user_id" ref="base.user_demo"/>
|
||||
<field name="invoice_payment_term_id" ref="account.account_payment_term_end_following_month"/>
|
||||
<field name="type">out_invoice</field>
|
||||
<field name="move_type">out_invoice</field>
|
||||
<field name="invoice_date" eval="time.strftime('%Y-%m')+'-12'"/>
|
||||
<field name="company_id" ref="company_ri"/>
|
||||
<field name="invoice_line_ids" eval="[
|
||||
@@ -50,7 +50,7 @@
|
||||
<field name="partner_id" ref="l10n_ar.res_partner_adhoc"/>
|
||||
<field name="invoice_user_id" ref="base.user_demo"/>
|
||||
<field name="invoice_payment_term_id" ref="account.account_payment_term_end_following_month"/>
|
||||
<field name="type">out_invoice</field>
|
||||
<field name="move_type">out_invoice</field>
|
||||
<field name="invoice_date" eval="time.strftime('%Y-%m')+'-12'"/>
|
||||
<field name="company_id" ref="company_ri"/>
|
||||
<field name="invoice_line_ids" eval="[
|
||||
@@ -64,7 +64,7 @@
|
||||
<field name="partner_id" ref="l10n_ar.res_partner_adhoc"/>
|
||||
<field name="invoice_user_id" ref="base.user_demo"/>
|
||||
<field name="invoice_payment_term_id" ref="account.account_payment_term_end_following_month"/>
|
||||
<field name="type">out_invoice</field>
|
||||
<field name="move_type">out_invoice</field>
|
||||
<field name="invoice_date" eval="time.strftime('%Y-%m')+'-13'"/>
|
||||
<field name="company_id" ref="company_ri"/>
|
||||
<field name="invoice_line_ids" eval="[
|
||||
@@ -83,7 +83,7 @@
|
||||
<field name="journal_id" ref="l10n_ar.sale_expo_journal_ri"/>
|
||||
<field name="invoice_user_id" ref="base.user_demo"/>
|
||||
<field name="invoice_payment_term_id" ref="account.account_payment_term_end_following_month"/>
|
||||
<field name="type">out_invoice</field>
|
||||
<field name="move_type">out_invoice</field>
|
||||
<field name="invoice_date" eval="time.strftime('%Y-%m')+'-03'"/>
|
||||
<field name="company_id" ref="company_ri"/>
|
||||
<field name="invoice_incoterm_id" ref="account.incoterm_EXW"/>
|
||||
@@ -103,7 +103,7 @@
|
||||
<field name="journal_id" ref="l10n_ar.sale_expo_journal_ri"/>
|
||||
<field name="invoice_user_id" ref="base.user_demo"/>
|
||||
<field name="invoice_payment_term_id" ref="account.account_payment_term_end_following_month"/>
|
||||
<field name="type">out_invoice</field>
|
||||
<field name="move_type">out_invoice</field>
|
||||
<field name="invoice_date" eval="time.strftime('%Y-%m')+'-03'"/>
|
||||
<field name="company_id" ref="company_ri"/>
|
||||
<field name="invoice_incoterm_id" ref="account.incoterm_EXW"/>
|
||||
@@ -122,7 +122,7 @@
|
||||
<field name="partner_id" ref="l10n_ar.par_cfa"/>
|
||||
<field name="invoice_user_id" ref="base.user_demo"/>
|
||||
<field name="invoice_payment_term_id" ref="account.account_payment_term_end_following_month"/>
|
||||
<field name="type">out_invoice</field>
|
||||
<field name="move_type">out_invoice</field>
|
||||
<field name="invoice_date" eval="time.strftime('%Y-%m')+'-13'"/>
|
||||
<field name="company_id" ref="company_ri"/>
|
||||
<field name="invoice_line_ids" eval="[
|
||||
@@ -135,7 +135,7 @@
|
||||
<field name="partner_id" ref="l10n_ar.res_partner_adhoc"/>
|
||||
<field name="invoice_user_id" ref="base.user_demo"/>
|
||||
<field name="invoice_payment_term_id" ref="account.account_payment_term_end_following_month"/>
|
||||
<field name="type">out_invoice</field>
|
||||
<field name="move_type">out_invoice</field>
|
||||
<field name="invoice_date" eval="time.strftime('%Y-%m')+'-13'"/>
|
||||
<field name="company_id" ref="company_ri"/>
|
||||
<field name="invoice_line_ids" eval="[
|
||||
@@ -149,7 +149,7 @@
|
||||
<field name="partner_id" ref="l10n_ar.res_partner_adhoc"/>
|
||||
<field name="invoice_user_id" ref="base.user_demo"/>
|
||||
<field name="invoice_payment_term_id" ref="account.account_payment_term_end_following_month"/>
|
||||
<field name="type">out_invoice</field>
|
||||
<field name="move_type">out_invoice</field>
|
||||
<field name="invoice_date" eval="time.strftime('%Y-%m')+'-13'"/>
|
||||
<field name="company_id" ref="company_ri"/>
|
||||
<field name="invoice_line_ids" eval="[
|
||||
@@ -165,7 +165,7 @@
|
||||
<field name="partner_id" ref="l10n_ar.res_partner_adhoc"/>
|
||||
<field name="invoice_user_id" ref="base.user_demo"/>
|
||||
<field name="invoice_payment_term_id" ref="account.account_payment_term_end_following_month"/>
|
||||
<field name="type">out_invoice</field>
|
||||
<field name="move_type">out_invoice</field>
|
||||
<field name="invoice_date" eval="time.strftime('%Y-%m')+'-13'"/>
|
||||
<field name="company_id" ref="company_ri"/>
|
||||
<field name="invoice_line_ids" eval="[
|
||||
@@ -181,7 +181,7 @@
|
||||
<field name="partner_id" ref="l10n_ar.res_partner_adhoc"/>
|
||||
<field name="invoice_user_id" ref="base.user_demo"/>
|
||||
<field name="invoice_payment_term_id" ref="account.account_payment_term_end_following_month"/>
|
||||
<field name="type">out_invoice</field>
|
||||
<field name="move_type">out_invoice</field>
|
||||
<field name="invoice_date" eval="time.strftime('%Y-%m')+'-13'"/>
|
||||
<field name="company_id" ref="company_ri"/>
|
||||
<field name="invoice_line_ids" eval="[
|
||||
@@ -202,7 +202,7 @@
|
||||
<field name="journal_id" ref="l10n_ar.sale_expo_journal_ri"/>
|
||||
<field name="invoice_user_id" ref="base.user_demo"/>
|
||||
<field name="invoice_payment_term_id" ref="account.account_payment_term_end_following_month"/>
|
||||
<field name="type">out_invoice</field>
|
||||
<field name="move_type">out_invoice</field>
|
||||
<field name="invoice_date" eval="time.strftime('%Y-%m')+'-20'"/>
|
||||
<field name="company_id" ref="company_ri"/>
|
||||
<field name="invoice_incoterm_id" ref="account.incoterm_EXW"/>
|
||||
@@ -217,7 +217,7 @@
|
||||
<field name="journal_id" ref="l10n_ar.sale_expo_journal_ri"/>
|
||||
<field name="invoice_user_id" ref="base.user_demo"/>
|
||||
<field name="invoice_payment_term_id" ref="account.account_payment_term_end_following_month"/>
|
||||
<field name="type">out_invoice</field>
|
||||
<field name="move_type">out_invoice</field>
|
||||
<field name="invoice_date" eval="time.strftime('%Y-%m')+'-20'"/>
|
||||
<field name="company_id" ref="company_ri"/>
|
||||
<field name="invoice_incoterm_id" ref="account.incoterm_EXW"/>
|
||||
@@ -232,7 +232,7 @@
|
||||
<field name="journal_id" ref="l10n_ar.sale_expo_journal_ri"/>
|
||||
<field name="invoice_user_id" ref="base.user_demo"/>
|
||||
<field name="invoice_payment_term_id" ref="account.account_payment_term_end_following_month"/>
|
||||
<field name="type">out_invoice</field>
|
||||
<field name="move_type">out_invoice</field>
|
||||
<field name="invoice_date" eval="time.strftime('%Y-%m')+'-22'"/>
|
||||
<field name="company_id" ref="company_ri"/>
|
||||
<field name="invoice_incoterm_id" ref="account.incoterm_EXW"/>
|
||||
@@ -246,7 +246,7 @@
|
||||
<field name="partner_id" ref="l10n_ar.res_partner_adhoc"/>
|
||||
<field name="invoice_user_id" ref="base.user_demo"/>
|
||||
<field name="invoice_payment_term_id" ref="account.account_payment_term_end_following_month"/>
|
||||
<field name="type">out_invoice</field>
|
||||
<field name="move_type">out_invoice</field>
|
||||
<field name="invoice_date" eval="time.strftime('%Y-%m')+'-13'"/>
|
||||
<field name="company_id" ref="company_ri"/>
|
||||
<field name="invoice_line_ids" eval="[
|
||||
@@ -259,7 +259,7 @@
|
||||
<field name="partner_id" ref="l10n_ar.res_partner_adhoc"/>
|
||||
<field name="invoice_user_id" ref="base.user_demo"/>
|
||||
<field name="invoice_payment_term_id" ref="account.account_payment_term_end_following_month"/>
|
||||
<field name="type">out_invoice</field>
|
||||
<field name="move_type">out_invoice</field>
|
||||
<field name="invoice_date" eval="time.strftime('%Y-%m')+'-13'"/>
|
||||
<field name="company_id" ref="company_ri"/>
|
||||
<field name="invoice_line_ids" eval="[
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<field name="partner_id" ref="res_partner_gritti_agrimensura"/>
|
||||
<field name="invoice_user_id" ref="base.user_demo"/>
|
||||
<field name="invoice_payment_term_id" ref="account.account_payment_term_end_following_month"/>
|
||||
<field name="type">in_invoice</field>
|
||||
<field name="move_type">in_invoice</field>
|
||||
<field name="invoice_date" eval="time.strftime('%Y-%m')+'-01'"/>
|
||||
<field name="company_id" ref="company_ri"/>
|
||||
<field name="invoice_line_ids" eval="[
|
||||
@@ -26,7 +26,7 @@
|
||||
<field name="partner_id" ref="res_partner_foreign"/>
|
||||
<field name="invoice_user_id" ref="base.user_demo"/>
|
||||
<field name="invoice_payment_term_id" ref="account.account_payment_term_end_following_month"/>
|
||||
<field name="type">in_invoice</field>
|
||||
<field name="move_type">in_invoice</field>
|
||||
<field name="invoice_date" eval="time.strftime('%Y-%m')+'-01'"/>
|
||||
<field name="company_id" ref="company_ri"/>
|
||||
<field name="invoice_line_ids" eval="[
|
||||
@@ -42,7 +42,7 @@
|
||||
<field name="partner_id" ref="res_partner_foreign"/>
|
||||
<field name="invoice_user_id" ref="base.user_demo"/>
|
||||
<field name="invoice_payment_term_id" ref="account.account_payment_term_end_following_month"/>
|
||||
<field name="type">in_invoice</field>
|
||||
<field name="move_type">in_invoice</field>
|
||||
<field name="invoice_date" eval="time.strftime('%Y-%m')+'-11'"/>
|
||||
<field name="company_id" ref="company_ri"/>
|
||||
<field name="invoice_line_ids" eval="[
|
||||
@@ -57,7 +57,7 @@
|
||||
<field name="partner_id" ref="res_partner_foreign"/>
|
||||
<field name="invoice_user_id" ref="base.user_demo"/>
|
||||
<field name="invoice_payment_term_id" ref="account.account_payment_term_end_following_month"/>
|
||||
<field name="type">in_invoice</field>
|
||||
<field name="move_type">in_invoice</field>
|
||||
<field name="invoice_date" eval="time.strftime('%Y-%m')+'-15'"/>
|
||||
<field name="company_id" ref="company_ri"/>
|
||||
<field name="invoice_line_ids" eval="[
|
||||
@@ -72,7 +72,7 @@
|
||||
<field name="partner_id" ref="res_partner_foreign"/>
|
||||
<field name="invoice_user_id" ref="base.user_demo"/>
|
||||
<field name="invoice_payment_term_id" ref="account.account_payment_term_end_following_month"/>
|
||||
<field name="type">in_invoice</field>
|
||||
<field name="move_type">in_invoice</field>
|
||||
<field name="invoice_date" eval="time.strftime('%Y-%m')+'-18'"/>
|
||||
<field name="company_id" ref="company_ri"/>
|
||||
<field name="invoice_line_ids" eval="[
|
||||
@@ -91,7 +91,7 @@
|
||||
<field name="partner_id" ref="res_partner_odoo"/>
|
||||
<field name="invoice_user_id" ref="base.user_demo"/>
|
||||
<field name="invoice_payment_term_id" ref="account.account_payment_term_end_following_month"/>
|
||||
<field name="type">in_invoice</field>
|
||||
<field name="move_type">in_invoice</field>
|
||||
<field name="invoice_date" eval="time.strftime('%Y-%m')+'-26'"/>
|
||||
<field name="company_id" ref="company_ri"/>
|
||||
<field name="invoice_line_ids" eval="[
|
||||
@@ -105,7 +105,7 @@
|
||||
<field name="partner_id" ref="res_partner_odoo"/>
|
||||
<field name="invoice_user_id" ref="base.user_demo"/>
|
||||
<field name="invoice_payment_term_id" ref="account.account_payment_term_end_following_month"/>
|
||||
<field name="type">in_invoice</field>
|
||||
<field name="move_type">in_invoice</field>
|
||||
<field name="invoice_date" eval="time.strftime('%Y-%m')+'-27'"/>
|
||||
<field name="company_id" ref="company_ri"/>
|
||||
<field name="invoice_line_ids" eval="[
|
||||
@@ -120,7 +120,7 @@
|
||||
<field name="partner_id" ref="l10n_ar.partner_afip"/>
|
||||
<field name="invoice_user_id" ref="base.user_demo"/>
|
||||
<field name="invoice_payment_term_id" ref="account.account_payment_term_end_following_month"/>
|
||||
<field name="type">in_invoice</field>
|
||||
<field name="move_type">in_invoice</field>
|
||||
<!-- as we create lines separatelly we need to set journal, if not, misc journal is selected -->
|
||||
<field name="journal_id" model="account.journal" search="[('type', '=', 'purchase'), ('company_id', '=', obj().env.company.id)]"/>
|
||||
<field name="invoice_date" eval="time.strftime('%Y-%m')+'-13'"/>
|
||||
|
||||
@@ -84,7 +84,7 @@ class AccountMove(models.Model):
|
||||
for inv in self.filtered(lambda x: x.company_id.l10n_ar_company_requires_vat):
|
||||
purchase_aliquots = 'not_zero'
|
||||
# we require a single vat on each invoice line except from some purchase documents
|
||||
if inv.type in ['in_invoice', 'in_refund'] and inv.l10n_latam_document_type_id.purchase_aliquots == 'zero':
|
||||
if inv.move_type in ['in_invoice', 'in_refund'] and inv.l10n_latam_document_type_id.purchase_aliquots == 'zero':
|
||||
purchase_aliquots = 'zero'
|
||||
for line in inv.mapped('invoice_line_ids').filtered(lambda x: x.display_type not in ('line_section', 'line_note')):
|
||||
vat_taxes = line.tax_ids.filtered(lambda x: x.tax_group_id.l10n_ar_vat_afip_code)
|
||||
|
||||
@@ -44,9 +44,9 @@ class AccountMove(models.Model):
|
||||
else:
|
||||
type = 'in_invoice'
|
||||
|
||||
default_journal = self.with_context(default_type=type)._get_default_journal()
|
||||
default_journal = self.with_context(default_move_type=type)._get_default_journal()
|
||||
|
||||
with Form(self.with_context(default_type=type, default_journal_id=default_journal.id)) as invoice_form:
|
||||
with Form(self.with_context(default_move_type=type, default_journal_id=default_journal.id)) as invoice_form:
|
||||
# Reference
|
||||
elements = tree.xpath('//cbc:ID', namespaces=namespaces)
|
||||
if elements:
|
||||
|
||||
@@ -16,7 +16,7 @@ class TestUBL(common.TransactionCase):
|
||||
def test_ubl_invoice_import(self):
|
||||
xml_file_path = get_module_resource('l10n_be_edi', 'test_xml_file', 'efff_test.xml')
|
||||
xml_file = open(xml_file_path, 'rb').read()
|
||||
invoice = self.env['account.move'].with_context(default_type='in_invoice').create({})
|
||||
invoice = self.env['account.move'].with_context(default_move_type='in_invoice').create({})
|
||||
|
||||
attachment_id = self.env['ir.attachment'].create({
|
||||
'name': 'efff_test.xml',
|
||||
|
||||
@@ -141,14 +141,14 @@ class AccountMove(models.Model):
|
||||
record.l10n_ch_isr_optical_line = left + '>' + record.l10n_ch_isr_number + '+ ' + record.l10n_ch_isr_subscription + '>'
|
||||
|
||||
@api.depends(
|
||||
'type', 'name', 'currency_id.name',
|
||||
'move_type', 'name', 'currency_id.name',
|
||||
'invoice_partner_bank_id.l10n_ch_postal',
|
||||
'invoice_partner_bank_id.l10n_ch_isr_subscription_eur',
|
||||
'invoice_partner_bank_id.l10n_ch_isr_subscription_chf')
|
||||
def _compute_l10n_ch_isr_valid(self):
|
||||
"""Returns True if all the data required to generate the ISR are present"""
|
||||
for record in self:
|
||||
record.l10n_ch_isr_valid = record.type == 'out_invoice' and\
|
||||
record.l10n_ch_isr_valid = record.move_type == 'out_invoice' and\
|
||||
record.name and \
|
||||
record.l10n_ch_isr_subscription and \
|
||||
record.invoice_partner_bank_id.l10n_ch_postal and \
|
||||
|
||||
@@ -13,8 +13,8 @@ class ISRTest(AccountTestCommon):
|
||||
|
||||
def create_invoice(self, currency_to_use='base.CHF'):
|
||||
""" Generates a test invoice """
|
||||
invoice = self.env['account.move'].with_context(default_type='out_invoice').create({
|
||||
'type': 'out_invoice',
|
||||
invoice = self.env['account.move'].with_context(default_move_type='out_invoice').create({
|
||||
'move_type': 'out_invoice',
|
||||
'partner_id': self.env.ref("base.res_partner_2").id,
|
||||
'currency_id': self.env.ref(currency_to_use).id,
|
||||
'invoice_date': time.strftime('%Y') + '-12-22',
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
string="Print ISR"
|
||||
type="object"
|
||||
attrs="{'invisible':['|', '|', '|', '|',
|
||||
('type', 'not in', ('out_invoice', 'out_refund')),
|
||||
('move_type', 'not in', ('out_invoice', 'out_refund')),
|
||||
('l10n_ch_isr_sent', '=', True),
|
||||
('state', '!=', 'posted'),
|
||||
('payment_state', 'not in', ('not_paid', 'partial')),
|
||||
@@ -33,7 +33,7 @@
|
||||
string="Print ISR"
|
||||
type="object"
|
||||
attrs="{'invisible':['|', '|', '|', '|',
|
||||
('type', 'not in', ('out_invoice', 'out_refund')),
|
||||
('move_type', 'not in', ('out_invoice', 'out_refund')),
|
||||
('l10n_ch_isr_sent', '=', False),
|
||||
('state', '!=', 'posted'),
|
||||
('payment_state', 'not in', ('not_paid', 'partial')),
|
||||
|
||||
@@ -18,7 +18,7 @@ class AccountMove(models.Model):
|
||||
domain = super()._get_l10n_latam_documents_domain()
|
||||
if (self.journal_id.l10n_latam_use_documents and
|
||||
self.journal_id.company_id.country_id == self.env.ref('base.cl')):
|
||||
if self.type in ['in_invoice', 'in_refund']:
|
||||
if self.move_type in ['in_invoice', 'in_refund']:
|
||||
if self.partner_id.l10n_cl_sii_taxpayer_type == '2':
|
||||
domain += [('code', '=', '71')]
|
||||
return domain
|
||||
@@ -28,7 +28,7 @@ class AccountMove(models.Model):
|
||||
domain += [('code', 'in', ['35', '38', '39', '41', '56', '61'])]
|
||||
return domain
|
||||
|
||||
@api.constrains('type', 'l10n_latam_document_type_id')
|
||||
@api.constrains('move_type', 'l10n_latam_document_type_id')
|
||||
def _check_invoice_type_document_type(self):
|
||||
super()._check_invoice_type_document_type()
|
||||
for rec in self.filtered(lambda r: r.company_id.country_id == self.env.ref(
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<field name="l10n_latam_internal_type" invisible="1"/>
|
||||
</form>
|
||||
<field name="ref" position="attributes">
|
||||
<attribute name="attrs">{'invisible': [('type', '=', 'out_invoice'), ('l10n_latam_internal_type', '!=', 'debit_note')], 'required': [('l10n_latam_internal_type', '=', 'debit_note')]}</attribute>
|
||||
<attribute name="attrs">{'invisible': [('move_type', '=', 'out_invoice'), ('l10n_latam_internal_type', '!=', 'debit_note')], 'required': [('l10n_latam_internal_type', '=', 'debit_note')]}</attribute>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
@@ -27,7 +27,7 @@
|
||||
<field name="invoice_date_due" optional="show"/>
|
||||
<field name="date" string="Accounting Date" optional="show"/>
|
||||
<field name="invoice_payment_ref" optional="hide"/>
|
||||
<field name="invoice_user_id" optional="show" invisible="context.get('default_type') not in ('out_invoice', 'out_refund','out_receipt')" string="Sales Person"/>
|
||||
<field name="invoice_user_id" optional="show" invisible="context.get('default_move_type') not in ('out_invoice', 'out_refund','out_receipt')" string="Sales Person"/>
|
||||
<field name="company_id" groups="base.group_multi_company" options="{'no_create': True}" optional="show"/>
|
||||
<field name="invoice_origin" optional="show" string="Source Document"/>
|
||||
<field name="amount_untaxed_signed" string="Amount Untaxed" sum="Total" optional="show"/>
|
||||
@@ -38,7 +38,7 @@
|
||||
<field name="company_currency_id" invisible="1"/>
|
||||
<field name="state" optional="show"/>
|
||||
<field name="payment_state" optional="hide"/>
|
||||
<field name="type" invisible="context.get('default_type', True)"/>
|
||||
<field name="move_type" invisible="context.get('default_move_type', True)"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
@@ -47,8 +47,8 @@
|
||||
<field name="name">Sale Invoices and Credit Notes</field>
|
||||
<field name="view_id" ref="view_complete_invoice_refund_tree"/>
|
||||
<field name="res_model">account.move</field>
|
||||
<field name="domain">[('type', 'in', ['out_invoice', 'out_refund'])]</field>
|
||||
<field name="context">{'default_type': 'out_invoice'}</field>
|
||||
<field name="domain">[('move_type', 'in', ['out_invoice', 'out_refund'])]</field>
|
||||
<field name="context">{'default_move_type': 'out_invoice'}</field>
|
||||
<field name="target">current</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
@@ -57,8 +57,8 @@
|
||||
<field name="name">Vendor Bills and Refunds</field>
|
||||
<field name="view_id" ref="view_complete_invoice_refund_tree"/>
|
||||
<field name="res_model">account.move</field>
|
||||
<field name="domain">[('type', 'in', ['in_invoice', 'in_refund'])]</field>
|
||||
<field name="context">{'default_type': 'in_invoice'}</field>
|
||||
<field name="domain">[('move_type', 'in', ['in_invoice', 'in_refund'])]</field>
|
||||
<field name="context">{'default_move_type': 'in_invoice'}</field>
|
||||
<field name="target">current</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<data noupdate="1">
|
||||
<!-- ==== Invoice Demo 1 with attachment ==== -->
|
||||
<record id="demo_invoice_1" model="account.move">
|
||||
<field name="type">out_invoice</field>
|
||||
<field name="move_type">out_invoice</field>
|
||||
<field name="partner_id" ref="base.res_partner_12"/>
|
||||
<field name="invoice_user_id" ref="base.user_demo"/>
|
||||
<field name="invoice_payment_term_id" ref="account.account_payment_term_end_following_month"/>
|
||||
@@ -16,18 +16,18 @@
|
||||
|
||||
<!-- ==== Invoice Demo 2 ==== -->
|
||||
<record id="demo_invoice_2" model="account.move">
|
||||
<field name="type">out_invoice</field>
|
||||
<field name="move_type">out_invoice</field>
|
||||
<field name="partner_id" ref="base.res_partner_2"/>
|
||||
<field name="invoice_date" eval="time.strftime('%Y-%m')+'-08'"/>
|
||||
<field name="invoice_line_ids" eval="[
|
||||
(0, 0, {'product_id': ref('product.consu_delivery_03'), 'price_unit': 50.0, 'quantity': 5}),
|
||||
(0, 0, {'product_id': ref('product.consu_delivery_01'), 'price_unit': 25.0, 'quantity': 20}),
|
||||
|
||||
]"/>
|
||||
</record>
|
||||
|
||||
<!-- ==== Invoice Demo 3 ==== -->
|
||||
<record id="demo_invoice_3" model="account.move">
|
||||
<field name="type">out_invoice</field>
|
||||
<field name="move_type">out_invoice</field>
|
||||
<field name="partner_id" ref="base.res_partner_2"/>
|
||||
<field name="invoice_date" eval="time.strftime('%Y-%m')+'-08'"/>
|
||||
<field name="invoice_line_ids" eval="[
|
||||
@@ -38,10 +38,11 @@
|
||||
|
||||
<!-- ==== Invoice Demo 4 - Create an invoice that will generate a followup ==== -->
|
||||
<record id="demo_invoice_followup" model="account.move">
|
||||
<field name="type">out_invoice</field>
|
||||
<field name="move_type">out_invoice</field>
|
||||
<field name="partner_id" ref="base.res_partner_2"/>
|
||||
<field name="invoice_user_id" ref="base.user_demo"/>
|
||||
<field name="invoice_payment_term_id" ref="account.account_payment_term_immediate"/>
|
||||
|
||||
<field name="invoice_date" eval="(datetime.today() + timedelta(days=-15)).strftime('%Y-%m-%d')"/>
|
||||
<field name="invoice_line_ids" eval="[
|
||||
(0, 0, {'product_id': ref('product.consu_delivery_02'), 'price_unit': 642.0, 'quantity': 5}),
|
||||
@@ -51,7 +52,7 @@
|
||||
|
||||
<!-- ==== Invoice Demo 5 - Draft Vendor Bill ==== -->
|
||||
<record id="demo_invoice_5" model="account.move">
|
||||
<field name="type">in_invoice</field>
|
||||
<field name="move_type">in_invoice</field>
|
||||
<field name="partner_id" ref="base.res_partner_12"/>
|
||||
<field name="invoice_user_id" ref="base.user_demo"/>
|
||||
<field name="invoice_payment_term_id" ref="account.account_payment_term_end_following_month"/>
|
||||
@@ -64,14 +65,14 @@
|
||||
|
||||
<!-- ==== Invoice Demo 6 - Draft Vendor Bill for OCR ==== -->
|
||||
|
||||
<record id="demo_invoice_extract" model="account.move" context="{'default_type': 'in_invoice'}">
|
||||
<field name="type">in_invoice</field>
|
||||
<record id="demo_invoice_extract" model="account.move" context="{'default_move_type': 'in_invoice'}">
|
||||
<field name="move_type">in_invoice</field>
|
||||
<field name="invoice_user_id" ref="base.user_demo"/>
|
||||
</record>
|
||||
|
||||
<!-- ==== Invoice Demo 7 - Posted vendor bill ==== -->
|
||||
<record id="demo_invoice_equipment_purchase" model="account.move">
|
||||
<field name="type">in_invoice</field>
|
||||
<field name="move_type">in_invoice</field>
|
||||
<field name="ref">INV/2018/0057</field>
|
||||
<field name="partner_id" ref="base.res_partner_12"/>
|
||||
<field name="invoice_date">2018-09-17</field>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
<!-- Demo of B2B (business-to-business) Taxable supplies made to other registered person.-->
|
||||
<record id="demo_invoice_b2b" model="account.move">
|
||||
<field name="type">out_invoice</field>
|
||||
<field name="move_type">out_invoice</field>
|
||||
<field name="partner_id" ref="l10n_in.res_partner_registered_customer"/>
|
||||
<field name="l10n_in_reseller_partner_id" ref="l10n_in.res_partner_reseller"/>
|
||||
<field name="invoice_user_id" ref="base.user_demo"/>
|
||||
@@ -48,7 +48,7 @@
|
||||
|
||||
<!-- Demo of B2CS (business to consumer small) Taxable supplies made to other unregistered Person and below INR 2.5 lakhs invoice value.-->
|
||||
<record id="demo_invoice_b2cs" model="account.move">
|
||||
<field name="type">out_invoice</field>
|
||||
<field name="move_type">out_invoice</field>
|
||||
<field name="partner_id" ref="l10n_in.res_partner_unregistered_customer"/>
|
||||
<field name="invoice_user_id" ref="base.user_demo"/>
|
||||
<field name="invoice_payment_term_id" ref="account.account_payment_term_end_following_month"/>
|
||||
@@ -95,7 +95,7 @@
|
||||
|
||||
<!-- Demo of B2CL (business to consumer - Large) Taxable supplies made to other unregistered Person and invoice value is more than INR 2.5 lakhs.-->
|
||||
<record id="demo_invoice_b2cl" model="account.move">
|
||||
<field name="type">out_invoice</field>
|
||||
<field name="move_type">out_invoice</field>
|
||||
<field name="partner_id" ref="l10n_in.res_partner_unregistered_customer_out_state"/>
|
||||
<field name="invoice_user_id" ref="base.user_demo"/>
|
||||
<field name="invoice_payment_term_id" ref="account.account_payment_term_end_following_month"/>
|
||||
@@ -115,7 +115,7 @@
|
||||
|
||||
<!-- Demo of EXP(Export) supplies including supplies to SEZ/SEZ Developer or deemed exports.-->
|
||||
<record id="demo_invoice_exp" model="account.move">
|
||||
<field name="type">out_invoice</field>
|
||||
<field name="move_type">out_invoice</field>
|
||||
<field name="partner_id" ref="base.res_partner_3"/>
|
||||
<field name="invoice_user_id" ref="base.user_demo"/>
|
||||
<field name="invoice_payment_term_id" ref="account.account_payment_term_end_following_month"/>
|
||||
@@ -145,7 +145,7 @@
|
||||
|
||||
<!-- Demo of exemp(Nil Rated, Exempted and Non GST supplies). Set Nill rated and Exempted tax in line.-->
|
||||
<record id="demo_invoice_nill" model="account.move">
|
||||
<field name="type">out_invoice</field>
|
||||
<field name="move_type">out_invoice</field>
|
||||
<field name="partner_id" ref="l10n_in.res_partner_registered_customer"/>
|
||||
<field name="invoice_user_id" ref="base.user_demo"/>
|
||||
<field name="invoice_payment_term_id" ref="account.account_payment_term_end_following_month"/>
|
||||
@@ -172,7 +172,7 @@
|
||||
|
||||
<!-- Demo of cdnr(Credit/ Debit Note for registered person). Create credit note for demo b2b invoice.-->
|
||||
<record id="demo_invoice_cdnr" model="account.move">
|
||||
<field name="type">out_refund</field>
|
||||
<field name="move_type">out_refund</field>
|
||||
<field name="partner_id" ref="l10n_in.res_partner_registered_customer"/>
|
||||
<field name="l10n_in_reseller_partner_id" ref="l10n_in.res_partner_reseller"/>
|
||||
<field name="invoice_user_id" ref="base.user_demo"/>
|
||||
@@ -218,7 +218,7 @@
|
||||
|
||||
<!-- Demo of cdnr(Credit/ Debit Note for unregistered person). Create credit note for demo b2cl invoice.-->
|
||||
<record id="demo_invoice_cdnur" model="account.move">
|
||||
<field name="type">out_refund</field>
|
||||
<field name="move_type">out_refund</field>
|
||||
<field name="partner_id" ref="l10n_in.res_partner_unregistered_customer"/>
|
||||
<field name="invoice_user_id" ref="base.user_demo"/>
|
||||
<field name="invoice_payment_term_id" ref="account.account_payment_term_end_following_month"/>
|
||||
@@ -240,7 +240,7 @@
|
||||
<!-- Demo of atadj(Advance adjustments). When invoice is reconcile against Advance payment.
|
||||
Reconciled invoice consideration for which payment have been received in the past months.-->
|
||||
<record id="demo_invoice_atadj" model="account.move">
|
||||
<field name="type">out_invoice</field>
|
||||
<field name="move_type">out_invoice</field>
|
||||
<field name="partner_id" ref="l10n_in.res_partner_registered_customer"/>
|
||||
<field name="invoice_user_id" ref="base.user_demo"/>
|
||||
<field name="invoice_payment_term_id" ref="account.account_payment_term_end_following_month"/>
|
||||
|
||||
@@ -126,7 +126,7 @@ class L10nInAccountInvoiceReport(models.Model):
|
||||
am.amount_total AS total,
|
||||
am.journal_id,
|
||||
aj.company_id,
|
||||
am.type AS move_type,
|
||||
am.move_type AS move_type,
|
||||
am.reversed_entry_id AS reversed_entry_id,
|
||||
p.vat AS partner_vat,
|
||||
CASE WHEN rp.vat IS NULL THEN '' ELSE rp.vat END AS ecommerce_vat,
|
||||
@@ -140,7 +140,7 @@ class L10nInAccountInvoiceReport(models.Model):
|
||||
THEN concat(cps.l10n_in_tin,'-',cps.name)
|
||||
ELSE ''
|
||||
END) AS place_of_supply,
|
||||
(CASE WHEN am.type in ('out_refund', 'in_refund') and refund_am.date <= to_date('2017-07-01', 'YYYY-MM-DD')
|
||||
(CASE WHEN am.move_type in ('out_refund', 'in_refund') and refund_am.date <= to_date('2017-07-01', 'YYYY-MM-DD')
|
||||
THEN 'Y'
|
||||
ELSE 'N'
|
||||
END) as is_pre_gst,
|
||||
@@ -187,9 +187,9 @@ class L10nInAccountInvoiceReport(models.Model):
|
||||
WHEN am.l10n_in_export_type = 'sez_without_igst'
|
||||
THEN 'SEZ without IGST payment'
|
||||
END) AS b2b_type,
|
||||
(CASE WHEN am.type = 'out_refund'
|
||||
(CASE WHEN am.move_type = 'out_refund'
|
||||
THEN 'C'
|
||||
WHEN am.type = 'in_refund'
|
||||
WHEN am.move_type = 'in_refund'
|
||||
THEN 'D'
|
||||
ELSE ''
|
||||
END) as refund_invoice_type,
|
||||
@@ -232,7 +232,7 @@ class L10nInAccountInvoiceReport(models.Model):
|
||||
THEN NULL
|
||||
ELSE (CASE WHEN aml.tax_base_amount <> 0 THEN aml.tax_base_amount ELSE NULL END)
|
||||
END AS price_total,
|
||||
(CASE WHEN aj.type = 'sale' AND (am.type IS NULL OR am.type != 'out_refund') THEN -1 ELSE 1 END) AS amount_sign,
|
||||
(CASE WHEN aj.type = 'sale' AND (am.move_type IS NULL OR am.move_type != 'out_refund') THEN -1 ELSE 1 END) AS amount_sign,
|
||||
(CASE WHEN atr.parent_tax IS NOT NULL THEN atr.parent_tax
|
||||
ELSE at.id END) AS tax_id,
|
||||
(CASE WHEN atr.parent_tax IS NOT NULL THEN parent_at.amount
|
||||
|
||||
@@ -9,19 +9,19 @@
|
||||
<group string="Import/Export India">
|
||||
<field name="l10n_in_import_export" invisible="1"/>
|
||||
<field name="l10n_in_export_type"
|
||||
attrs="{'invisible': [('l10n_in_import_export', '!=', True), ('type', 'not in', ('out_invoice', 'out_refund'))]}"/>
|
||||
attrs="{'invisible': [('l10n_in_import_export', '!=', True), ('move_type', 'not in', ('out_invoice', 'out_refund'))]}"/>
|
||||
<field name="l10n_in_shipping_bill_number"
|
||||
attrs="{'invisible': [('l10n_in_import_export', '!=', True), ('type', 'not in', ('out_invoice', 'out_refund'))]}"/>
|
||||
attrs="{'invisible': [('l10n_in_import_export', '!=', True), ('move_type', 'not in', ('out_invoice', 'out_refund'))]}"/>
|
||||
<field name="l10n_in_shipping_bill_date"
|
||||
attrs="{'invisible': [('l10n_in_import_export', '!=', True), ('type', 'not in', ('out_invoice', 'out_refund'))]}"/>
|
||||
attrs="{'invisible': [('l10n_in_import_export', '!=', True), ('move_type', 'not in', ('out_invoice', 'out_refund'))]}"/>
|
||||
<field name="l10n_in_shipping_port_code_id"
|
||||
attrs="{'invisible': [('l10n_in_import_export', '!=', True), ('type', 'not in', ('out_invoice', 'out_refund'))]}"/>
|
||||
attrs="{'invisible': [('l10n_in_import_export', '!=', True), ('move_type', 'not in', ('out_invoice', 'out_refund'))]}"/>
|
||||
</group>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='partner_id']" position="after">
|
||||
<field name="l10n_in_reseller_partner_id"
|
||||
groups="l10n_in.group_l10n_in_reseller"
|
||||
attrs="{'invisible': [('type', 'not in', ('out_invoice', 'out_refund'))]}"
|
||||
attrs="{'invisible': [('move_type', 'not in', ('out_invoice', 'out_refund'))]}"
|
||||
/>
|
||||
</xpath>
|
||||
</field>
|
||||
|
||||
@@ -26,12 +26,12 @@
|
||||
|
||||
<xpath expr="//h2" position="replace">
|
||||
<h2>
|
||||
<span t-if="o.type == 'out_invoice' and o.state in ('open', 'in_payment', 'paid')" t-field="o.journal_id.name"/>
|
||||
<span t-if="o.type == 'out_invoice' and o.state == 'draft'">Draft <span t-field="o.journal_id.name"/></span>
|
||||
<span t-if="o.type == 'out_invoice' and o.state == 'cancel'">Cancelled <span t-field="o.journal_id.name"/></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-if="o.move_type == 'out_invoice' and o.state in ('open', 'in_payment', 'paid')" t-field="o.journal_id.name"/>
|
||||
<span t-if="o.move_type == 'out_invoice' and o.state == 'draft'">Draft <span t-field="o.journal_id.name"/></span>
|
||||
<span t-if="o.move_type == 'out_invoice' and o.state == 'cancel'">Cancelled <span t-field="o.journal_id.name"/></span>
|
||||
<span t-if="o.move_type == 'out_refund'">Credit Note</span>
|
||||
<span t-if="o.move_type == 'in_refund'">Vendor Credit Note</span>
|
||||
<span t-if="o.move_type == 'in_invoice'">Vendor Bill</span>
|
||||
<span t-field="o.name"/>
|
||||
</h2>
|
||||
</xpath>
|
||||
|
||||
@@ -161,7 +161,7 @@ class AccountMove(models.Model):
|
||||
invoice.l10n_it_einvoice_name = report_name
|
||||
|
||||
data = b"<?xml version='1.0' encoding='UTF-8'?>" + invoice._export_as_xml()
|
||||
description = _('Italian invoice: %s') % invoice.type
|
||||
description = _('Italian invoice: %s') % invoice.move_type
|
||||
invoice.l10n_it_einvoice_id = self.env['ir.attachment'].create({
|
||||
'name': report_name,
|
||||
'res_id': invoice.id,
|
||||
@@ -226,9 +226,9 @@ class AccountMove(models.Model):
|
||||
if len(self.commercial_partner_id.l10n_it_pa_index or '1') == 6:
|
||||
formato_trasmissione = "FPA12"
|
||||
|
||||
if self.type == 'out_invoice':
|
||||
if self.move_type == 'out_invoice':
|
||||
document_type = 'TD01'
|
||||
elif self.type == 'out_refund':
|
||||
elif self.move_type == 'out_refund':
|
||||
document_type = 'TD04'
|
||||
else:
|
||||
document_type = 'TD0X'
|
||||
@@ -320,9 +320,9 @@ class AccountMove(models.Model):
|
||||
|
||||
elements = tree.xpath('//DatiGeneraliDocumento/TipoDocumento', namespaces=tree.nsmap)
|
||||
if elements and elements[0].text and elements[0].text == 'TD01':
|
||||
self_ctx = self.with_context(default_type='in_invoice')
|
||||
self_ctx = self.with_context(default_move_type='in_invoice')
|
||||
elif elements and elements[0].text and elements[0].text == 'TD04':
|
||||
self_ctx = self.with_context(default_type='in_refund')
|
||||
self_ctx = self.with_context(default_move_type='in_refund')
|
||||
else:
|
||||
_logger.info(_('Document type not managed: %s.') % (elements[0].text))
|
||||
|
||||
@@ -361,7 +361,7 @@ class AccountMove(models.Model):
|
||||
elif elements and elements[0].text and elements[0].text == 'TD04':
|
||||
type = 'in_refund'
|
||||
# self could be a single record (editing) or be empty (new).
|
||||
with Form(self.with_context(default_type=type)) as invoice_form:
|
||||
with Form(self.with_context(default_move_type=type)) as invoice_form:
|
||||
message_to_log = []
|
||||
|
||||
# Partner (first step to avoid warning 'Warning! You must first select a partner.'). <1.2>
|
||||
|
||||
@@ -153,31 +153,31 @@
|
||||
<data>
|
||||
<xpath expr="//button[@name='preview_invoice']" position="after">
|
||||
<button name="post" type="object" icon="fa-envelope-o" class="btn btn-primary" string="Resend"
|
||||
attrs="{'invisible': ['|', ('type', 'not in', ('out_invoice', 'out_refund')), ('l10n_it_send_state', '!=', 'invalid')]}"/>
|
||||
attrs="{'invisible': ['|', ('move_type', 'not in', ('out_invoice', 'out_refund')), ('l10n_it_send_state', '!=', 'invalid')]}"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='type']" position="before">
|
||||
<xpath expr="//field[@name='move_type']" position="before">
|
||||
<div class="alert alert-success" role="alert"
|
||||
attrs="{'invisible': ['|', ('type', 'not in', ('out_invoice', 'out_refund')), ('l10n_it_send_state', 'not in', ['delivered', 'delivered_accepted', 'delivered_refused', 'delivered_expired', 'failed_delivery'])]}">
|
||||
attrs="{'invisible': ['|', ('move_type', 'not in', ('out_invoice', 'out_refund')), ('l10n_it_send_state', 'not in', ['delivered', 'delivered_accepted', 'delivered_refused', 'delivered_expired', 'failed_delivery'])]}">
|
||||
<i class="fa fa-check" aria-label="Delivered" title="Delivered"></i> <field name="l10n_it_send_state" readonly="1"/>
|
||||
</div>
|
||||
<div class="alert alert-warning" role="alert"
|
||||
attrs="{'invisible': ['|', ('type', 'not in', ('out_invoice', 'out_refund')), ('l10n_it_send_state', '!=', 'sent')]}">
|
||||
attrs="{'invisible': ['|', ('move_type', 'not in', ('out_invoice', 'out_refund')), ('l10n_it_send_state', '!=', 'sent')]}">
|
||||
<i class="fa fa-paper-plane-o"/> E-Invoice sent, waiting for a response
|
||||
</div>
|
||||
<div class="alert alert-danger" role="alert"
|
||||
attrs="{'invisible': ['|', ('type', 'not in', ('out_invoice', 'out_refund')), ('l10n_it_send_state', '!=', 'invalid')]}">
|
||||
attrs="{'invisible': ['|', ('move_type', 'not in', ('out_invoice', 'out_refund')), ('l10n_it_send_state', '!=', 'invalid')]}">
|
||||
<i class="fa fa-exclamation-triangle"/> E-Invoice check failed. You can modify the invoice, and resend it.
|
||||
</div>
|
||||
</xpath>
|
||||
<xpath expr="//page[@name='other_info']" position="after">
|
||||
<page string="Electronic Invoicing"
|
||||
name="electronic_invoicing"
|
||||
attrs="{'invisible': [('type', 'not in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund'))]}">
|
||||
attrs="{'invisible': [('move_type', 'not in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund'))]}">
|
||||
<group>
|
||||
<group>
|
||||
<field name="l10n_it_stamp_duty"/>
|
||||
<field name="l10n_it_ddt_id"
|
||||
attrs="{'invisible': [('type', 'not in', ('out_invoice', 'out_refund'))]}"/>
|
||||
attrs="{'invisible': [('move_type', 'not in', ('out_invoice', 'out_refund'))]}"/>
|
||||
</group>
|
||||
</group>
|
||||
</page>
|
||||
|
||||
@@ -64,7 +64,7 @@ class AccountMove(models.Model):
|
||||
|
||||
def post(self):
|
||||
for rec in self.filtered(lambda x: x.l10n_latam_use_documents and (not x.name or x.name == '/')):
|
||||
if rec.type in ('in_receipt', 'out_receipt'):
|
||||
if rec.move_type in ('in_receipt', 'out_receipt'):
|
||||
raise UserError(_('We do not accept the usage of document types on receipts yet. '))
|
||||
return super().post()
|
||||
|
||||
@@ -94,11 +94,11 @@ class AccountMove(models.Model):
|
||||
raise ValidationError(_('The document number on the following invoices is not correct %s.' % (
|
||||
without_number.ids)))
|
||||
|
||||
@api.constrains('type', 'l10n_latam_document_type_id')
|
||||
@api.constrains('move_type', 'l10n_latam_document_type_id')
|
||||
def _check_invoice_type_document_type(self):
|
||||
for rec in self.filtered('l10n_latam_document_type_id.internal_type'):
|
||||
internal_type = rec.l10n_latam_document_type_id.internal_type
|
||||
invoice_type = rec.type
|
||||
invoice_type = rec.tmove_ype
|
||||
if internal_type in ['debit_note', 'invoice'] and invoice_type in ['out_refund', 'in_refund']:
|
||||
raise ValidationError(_('You can not use a %s document type with a refund invoice') % internal_type)
|
||||
elif internal_type == 'credit_note' and invoice_type in ['out_invoice', 'in_invoice']:
|
||||
@@ -106,13 +106,13 @@ class AccountMove(models.Model):
|
||||
|
||||
def _get_l10n_latam_documents_domain(self):
|
||||
self.ensure_one()
|
||||
if self.type in ['out_refund', 'in_refund']:
|
||||
if self.move_type in ['out_refund', 'in_refund']:
|
||||
internal_types = ['credit_note']
|
||||
else:
|
||||
internal_types = ['invoice', 'debit_note']
|
||||
return [('internal_type', 'in', internal_types), ('country_id', '=', self.company_id.country_id.id)]
|
||||
|
||||
@api.depends('journal_id', 'partner_id', 'company_id', 'type')
|
||||
@api.depends('journal_id', 'partner_id', 'company_id', 'move_type')
|
||||
def _compute_l10n_latam_available_document_types(self):
|
||||
self.l10n_latam_available_document_type_ids = False
|
||||
for rec in self.filtered(lambda x: x.journal_id and x.l10n_latam_use_documents and x.partner_id):
|
||||
@@ -165,7 +165,7 @@ class AccountMove(models.Model):
|
||||
bills because the uniqueness must be per partner """
|
||||
for rec in self.filtered(lambda x: x.is_purchase_document() and x.l10n_latam_use_documents):
|
||||
domain = [
|
||||
('type', '=', rec.type),
|
||||
('move_type', '=', rec.move_type),
|
||||
# by validating name we validate l10n_latam_document_type_id
|
||||
('name', '=', rec.name),
|
||||
('company_id', '=', rec.company_id.id),
|
||||
|
||||
@@ -23,7 +23,7 @@ class L10nLatamDocumentType(models.Model):
|
||||
report_name = fields.Char('Name on Reports', help='Name that will be printed in reports, for example "CREDIT NOTE"')
|
||||
internal_type = fields.Selection(
|
||||
[('invoice', 'Invoices'), ('debit_note', 'Debit Notes'), ('credit_note', 'Credit Notes')], index=True,
|
||||
help='Analog to odoo account.move.type but with more options allowing to identify the kind of document we are'
|
||||
help='Analog to odoo account.move.move_type but with more options allowing to identify the kind of document we are'
|
||||
' working with. (not only related to account.move, could be for documents of other models like stock.picking)')
|
||||
|
||||
def _format_document_number(self, document_number):
|
||||
|
||||
@@ -38,7 +38,7 @@ class AccountMoveReversal(models.TransientModel):
|
||||
|
||||
if record.l10n_latam_use_documents:
|
||||
refund = record.env['account.move'].new({
|
||||
'type': record._reverse_type_map(record.move_ids.type),
|
||||
'move_type': record._reverse_type_map(record.move_ids.move_type),
|
||||
'journal_id': record.move_ids.journal_id.id,
|
||||
'partner_id': record.move_ids.partner_id.id,
|
||||
'company_id': record.move_ids.company_id.id,
|
||||
|
||||
@@ -44,7 +44,7 @@ class MassMailing(models.Model):
|
||||
}
|
||||
action['domain'] = [
|
||||
('id', 'in', moves.ids),
|
||||
('type', 'in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt')),
|
||||
('move_type', 'in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt')),
|
||||
('state', 'not in', ['draft', 'cancel'])
|
||||
]
|
||||
action['context'] = {'create': False}
|
||||
|
||||
@@ -13,7 +13,7 @@ class AccountMove(models.Model):
|
||||
# OVERRIDE to update the cancel date.
|
||||
res = super(AccountMove, self).button_draft()
|
||||
for move in self:
|
||||
if move.type == 'out_invoice':
|
||||
if move.move_type == 'out_invoice':
|
||||
self.env['membership.membership_line'].search([
|
||||
('account_invoice_line', 'in', move.mapped('invoice_line_ids').ids)
|
||||
]).write({'date_cancel': False})
|
||||
@@ -23,7 +23,7 @@ class AccountMove(models.Model):
|
||||
# OVERRIDE to update the cancel date.
|
||||
res = super(AccountMove, self).button_cancel()
|
||||
for move in self:
|
||||
if move.type == 'out_invoice':
|
||||
if move.move_type == 'out_invoice':
|
||||
self.env['membership.membership_line'].search([
|
||||
('account_invoice_line', 'in', move.mapped('invoice_line_ids').ids)
|
||||
]).write({'date_cancel': fields.Date.today()})
|
||||
@@ -46,7 +46,7 @@ class AccountMoveLine(models.Model):
|
||||
# OVERRIDE
|
||||
res = super(AccountMoveLine, self).write(vals)
|
||||
|
||||
to_process = self.filtered(lambda line: line.move_id.type == 'out_invoice' and line.product_id.membership)
|
||||
to_process = self.filtered(lambda line: line.move_id.move_type == 'out_invoice' and line.product_id.membership)
|
||||
|
||||
# Nothing to process, break.
|
||||
if not to_process:
|
||||
@@ -82,7 +82,7 @@ class AccountMoveLine(models.Model):
|
||||
def create(self, vals_list):
|
||||
# OVERRIDE
|
||||
lines = super(AccountMoveLine, self).create(vals_list)
|
||||
to_process = lines.filtered(lambda line: line.move_id.type == 'out_invoice' and line.product_id.membership)
|
||||
to_process = lines.filtered(lambda line: line.move_id.move_type == 'out_invoice' and line.product_id.membership)
|
||||
|
||||
# Nothing to process, break.
|
||||
if not to_process:
|
||||
|
||||
@@ -125,7 +125,7 @@ class Partner(models.Model):
|
||||
raise UserError(_("Partner doesn't have an address to make the invoice."))
|
||||
|
||||
invoice_vals_list.append({
|
||||
'type': 'out_invoice',
|
||||
'move_type': 'out_invoice',
|
||||
'partner_id': partner.id,
|
||||
'invoice_line_ids': [
|
||||
(0, None, {'product_id': product.id, 'quantity': 1, 'price_unit': amount, 'tax_ids': [(6, 0, product.taxes_id.ids)]})
|
||||
|
||||
@@ -625,7 +625,7 @@ class PaymentTransaction(models.Model):
|
||||
payment_id = fields.Many2one('account.payment', string='Payment', readonly=True)
|
||||
invoice_ids = fields.Many2many('account.move', 'account_invoice_transaction_rel', 'transaction_id', 'invoice_id',
|
||||
string='Invoices', copy=False, readonly=True,
|
||||
domain=[('type', 'in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund'))])
|
||||
domain=[('move_type', 'in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund'))])
|
||||
invoice_ids_nbr = fields.Integer(compute='_compute_invoice_ids_nbr', string='# of Invoices')
|
||||
|
||||
_sql_constraints = [
|
||||
|
||||
@@ -10,17 +10,17 @@
|
||||
The user must capture/void the authorized transactions before registering a new payment.
|
||||
-->
|
||||
<xpath expr="//button[@id='account_invoice_payment_btn']" position="attributes">
|
||||
<attribute name="attrs">{'invisible': ['|', '|', '|', ('state', '!=', 'posted'), ('payment_state', 'not in', ('partial', 'not_paid')), ('type', 'not in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt')), ('authorized_transaction_ids', '!=', [])]}</attribute>
|
||||
<attribute name="attrs">{'invisible': ['|', '|', '|', ('state', '!=', 'posted'), ('payment_state', 'not in', ('partial', 'not_paid')), ('move_type', 'not in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt')), ('authorized_transaction_ids', '!=', [])]}</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//button[@id='account_invoice_payment_btn']" position="after">
|
||||
<field name="authorized_transaction_ids" invisible="1"/>
|
||||
<button name="payment_action_capture" type="object"
|
||||
string="Capture Transaction" class="oe_highlight"
|
||||
attrs="{'invisible': ['|', '|', ('type', 'not in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund')), ('state', '!=', 'posted'), ('authorized_transaction_ids', '=', [])]}"/>
|
||||
attrs="{'invisible': ['|', '|', ('move_type', 'not in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund')), ('state', '!=', 'posted'), ('authorized_transaction_ids', '=', [])]}"/>
|
||||
<button name="payment_action_void" type="object"
|
||||
string="Void Transaction"
|
||||
confirm="Are you sure you want to void the authorized transaction? This action can't be undone."
|
||||
attrs="{'invisible': ['|', '|', ('type', 'not in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund')), ('state', '!=', 'posted'), ('authorized_transaction_ids', '=', [])]}"/>
|
||||
attrs="{'invisible': ['|', '|', ('move_type', 'not in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund')), ('state', '!=', 'posted'), ('authorized_transaction_ids', '=', [])]}"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -11,15 +11,15 @@ class AccountMove(models.Model):
|
||||
|
||||
def _stock_account_get_last_step_stock_moves(self):
|
||||
stock_moves = super(AccountMove, self)._stock_account_get_last_step_stock_moves()
|
||||
for invoice in self.filtered(lambda x: x.type == 'out_invoice'):
|
||||
for invoice in self.filtered(lambda x: x.move_type == 'out_invoice'):
|
||||
stock_moves += invoice.sudo().mapped('pos_order_ids.picking_ids.move_lines').filtered(lambda x: x.state == 'done' and x.location_dest_id.usage == 'customer')
|
||||
for invoice in self.filtered(lambda x: x.type == 'out_refund'):
|
||||
for invoice in self.filtered(lambda x: x.move_type == 'out_refund'):
|
||||
stock_moves += invoice.sudo().mapped('pos_order_ids.picking_ids.move_lines').filtered(lambda x: x.state == 'done' and x.location_id.usage == 'customer')
|
||||
return stock_moves
|
||||
|
||||
def _compute_amount(self):
|
||||
super(AccountMove, self)._compute_amount()
|
||||
pos_invoices = self.filtered(lambda i: i.type in ['out_invoice', 'out_refund'] and i.pos_order_ids)
|
||||
pos_invoices = self.filtered(lambda i: i.move_type in ['out_invoice', 'out_refund'] and i.pos_order_ids)
|
||||
for invoice in pos_invoices:
|
||||
invoice.payment_state = 'paid'
|
||||
|
||||
|
||||
@@ -351,7 +351,7 @@ class PosOrder(models.Model):
|
||||
'view_mode': 'form',
|
||||
'view_id': self.env.ref('account.view_move_form').id,
|
||||
'res_model': 'account.move',
|
||||
'context': "{'type':'out_invoice'}",
|
||||
'context': "{'move_type':'out_invoice'}",
|
||||
'type': 'ir.actions.act_window',
|
||||
'res_id': self.account_move.id,
|
||||
}
|
||||
@@ -387,7 +387,7 @@ class PosOrder(models.Model):
|
||||
'invoice_payment_ref': order.name,
|
||||
'invoice_origin': order.name,
|
||||
'journal_id': order.session_id.config_id.invoice_journal_id.id,
|
||||
'type': 'out_invoice' if order.amount_total >= 0 else 'out_refund',
|
||||
'move_type': 'out_invoice' if order.amount_total >= 0 else 'out_refund',
|
||||
'ref': order.name,
|
||||
'partner_id': order.partner_id.id,
|
||||
'narration': order.note or '',
|
||||
@@ -401,7 +401,7 @@ class PosOrder(models.Model):
|
||||
}
|
||||
new_move = moves.sudo()\
|
||||
.with_company(order.company_id)\
|
||||
.with_context(default_type=move_vals['type'])\
|
||||
.with_context(default_move_type=move_vals['move_type'])\
|
||||
.create(move_vals)
|
||||
message = _("This invoice has been created from the point of sale session: <a href=# data-oe-model=pos.order data-oe-id=%d>%s</a>") % (order.id, order.name)
|
||||
new_move.message_post(body=message)
|
||||
@@ -417,7 +417,7 @@ class PosOrder(models.Model):
|
||||
'view_mode': 'form',
|
||||
'view_id': self.env.ref('account.view_move_form').id,
|
||||
'res_model': 'account.move',
|
||||
'context': "{'type':'out_invoice'}",
|
||||
'context': "{'move_type':'out_invoice'}",
|
||||
'type': 'ir.actions.act_window',
|
||||
'nodestroy': True,
|
||||
'target': 'current',
|
||||
|
||||
@@ -7,7 +7,7 @@ class AccountMove(models.Model):
|
||||
_inherit = 'account.move'
|
||||
|
||||
def invoice_validate_send_email(self):
|
||||
for invoice in self.filtered(lambda x: x.type == 'out_invoice'):
|
||||
for invoice in self.filtered(lambda x: x.move_type == 'out_invoice'):
|
||||
# send template only on customer invoice
|
||||
# subscribe the partner to the invoice
|
||||
if invoice.partner_id not in invoice.message_partner_ids:
|
||||
|
||||
@@ -104,7 +104,7 @@ class ProductProduct(models.Model):
|
||||
|
||||
#Cost price is calculated afterwards as it is a property
|
||||
self.env['account.move.line'].flush(['price_unit', 'quantity', 'balance', 'product_id', 'display_type'])
|
||||
self.env['account.move'].flush(['state', 'payment_state', 'type', 'invoice_date', 'company_id'])
|
||||
self.env['account.move'].flush(['state', 'payment_state', 'move_type', 'invoice_date', 'company_id'])
|
||||
self.env['product.template'].flush(['list_price'])
|
||||
sqlstr = """
|
||||
WITH currency_rate AS ({})
|
||||
@@ -125,7 +125,7 @@ class ProductProduct(models.Model):
|
||||
WHERE l.product_id = %s
|
||||
AND i.state IN %s
|
||||
AND i.payment_state IN %s
|
||||
AND i.type IN %s
|
||||
AND i.move_type IN %s
|
||||
AND i.invoice_date BETWEEN %s AND %s
|
||||
AND i.company_id = %s
|
||||
AND l.display_type IS NULL
|
||||
|
||||
@@ -12,7 +12,7 @@ class TestProductMargin(AccountTestCommon):
|
||||
def create_account_invoice(self, invoice_type, partner, product, quantity=0.0, price_unit=0.0):
|
||||
""" Create an invoice as in a view by triggering its onchange methods"""
|
||||
|
||||
invoice_form = Form(self.env['account.move'].with_context(default_type=invoice_type))
|
||||
invoice_form = Form(self.env['account.move'].with_context(default_move_type=invoice_type))
|
||||
invoice_form.partner_id = partner
|
||||
with invoice_form.invoice_line_ids.new() as line:
|
||||
line.product_id = product
|
||||
|
||||
@@ -409,7 +409,7 @@ class PurchaseOrder(models.Model):
|
||||
create_bill = self.env.context.get('create_bill', False)
|
||||
# override the context to get rid of the default filtering
|
||||
result['context'] = {
|
||||
'default_type': 'in_invoice',
|
||||
'default_move_type': 'in_invoice',
|
||||
'default_company_id': self.company_id.id,
|
||||
'default_purchase_id': self.id,
|
||||
}
|
||||
@@ -532,9 +532,9 @@ class PurchaseOrderLine(models.Model):
|
||||
qty = 0.0
|
||||
for inv_line in line.invoice_lines:
|
||||
if inv_line.move_id.state not in ['cancel']:
|
||||
if inv_line.move_id.type == 'in_invoice':
|
||||
if inv_line.move_id.move_type == 'in_invoice':
|
||||
qty += inv_line.product_uom_id._compute_quantity(inv_line.quantity, line.product_uom)
|
||||
elif inv_line.move_id.type == 'in_refund':
|
||||
elif inv_line.move_id.move_type == 'in_refund':
|
||||
qty -= inv_line.product_uom_id._compute_quantity(inv_line.quantity, line.product_uom)
|
||||
line.qty_invoiced = qty
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ class res_partner(models.Model):
|
||||
|
||||
supplier_invoice_groups = self.env['account.move'].read_group(
|
||||
domain=[('partner_id', 'in', all_partners.ids),
|
||||
('type', 'in', ('in_invoice', 'in_refund'))],
|
||||
('move_type', 'in', ('in_invoice', 'in_refund'))],
|
||||
fields=['partner_id'], groupby=['partner_id']
|
||||
)
|
||||
partners = self.browse()
|
||||
|
||||
@@ -29,7 +29,7 @@ class PurchaseBillUnion(models.Model):
|
||||
id as vendor_bill_id, NULL as purchase_order_id
|
||||
FROM account_move
|
||||
WHERE
|
||||
type='in_invoice' and state = 'posted'
|
||||
move_type='in_invoice' and state = 'posted'
|
||||
UNION
|
||||
SELECT
|
||||
-id, name, partner_ref as reference, partner_id, date_order::date as date, amount_untaxed as amount, currency_id, company_id,
|
||||
|
||||
@@ -55,7 +55,7 @@ class TestPurchaseOrderReport(AccountTestCommon):
|
||||
})
|
||||
po.button_confirm()
|
||||
|
||||
f = Form(self.env['account.move'].with_context(default_type='in_invoice'))
|
||||
f = Form(self.env['account.move'].with_context(default_move_type='in_invoice'))
|
||||
f.partner_id = po.partner_id
|
||||
f.purchase_id = po
|
||||
invoice = f.save()
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<field name="invoice_vendor_bill_id" position="after">
|
||||
<field name="purchase_id" invisible="1"/>
|
||||
<field name="purchase_vendor_bill_id"
|
||||
attrs="{'invisible': ['|', '|', ('state','not in',['draft']), ('state', '=', 'purchase'), ('type', '!=', 'in_invoice')]}"
|
||||
attrs="{'invisible': ['|', '|', ('state','not in',['draft']), ('state', '=', 'purchase'), ('move_type', '!=', 'in_invoice')]}"
|
||||
class="oe_edit_only"
|
||||
domain="[('company_id', '=', company_id), ('partner_id','child_of', [partner_id])]"
|
||||
placeholder="Select a purchase order or an old bill"
|
||||
|
||||
@@ -50,8 +50,8 @@
|
||||
<field name="name">Vendor Bills</field>
|
||||
<field name="res_model">account.move</field>
|
||||
<field name="view_mode">tree,form,graph</field>
|
||||
<field name="domain">[('type','in',('in_invoice', 'in_refund'))]</field>
|
||||
<field name="context">{'search_default_partner_id': active_id, 'default_type': 'in_invoice', 'default_partner_id': active_id}</field>
|
||||
<field name="domain">[('move_type','in',('in_invoice', 'in_refund'))]</field>
|
||||
<field name="context">{'search_default_partner_id': active_id, 'default_move_type': 'in_invoice', 'default_partner_id': active_id}</field>
|
||||
<field name="help" type="html">
|
||||
<p class="o_view_nocontent_smiling_face">
|
||||
Record a new vendor bill
|
||||
|
||||
@@ -37,7 +37,7 @@ class AccountMove(models.Model):
|
||||
lines_vals_list = []
|
||||
|
||||
for move in self:
|
||||
if move.type not in ('in_invoice', 'in_refund', 'in_receipt') or not move.company_id.anglo_saxon_accounting:
|
||||
if move.move_type not in ('in_invoice', 'in_refund', 'in_receipt') or not move.company_id.anglo_saxon_accounting:
|
||||
continue
|
||||
|
||||
for line in move.invoice_line_ids.filtered(lambda line: line.product_id.type == 'product' and line.product_id.valuation == 'real_time'):
|
||||
@@ -61,7 +61,7 @@ class AccountMove(models.Model):
|
||||
('state', '=', 'done'),
|
||||
('product_qty', '!=', 0.0),
|
||||
])
|
||||
if move.type == 'in_refund':
|
||||
if move.move_type == 'in_refund':
|
||||
valuation_stock_moves = valuation_stock_moves.filtered(lambda stock_move: stock_move._is_out())
|
||||
else:
|
||||
valuation_stock_moves = valuation_stock_moves.filtered(lambda stock_move: stock_move._is_in())
|
||||
@@ -110,7 +110,7 @@ class AccountMove(models.Model):
|
||||
price_unit = line.price_unit * (1 - (line.discount or 0.0) / 100.0)
|
||||
if line.tax_ids:
|
||||
price_unit = line.tax_ids.compute_all(
|
||||
price_unit, currency=move.currency_id, quantity=1.0, is_refund=move.type == 'in_refund')['total_excluded']
|
||||
price_unit, currency=move.currency_id, quantity=1.0, is_refund=move.move_type == 'in_refund')['total_excluded']
|
||||
|
||||
if float_compare(valuation_price_unit, price_unit, precision_digits=invoice_cur_prec) != 0 \
|
||||
and float_compare(line['price_unit'], line.price_unit, precision_digits=invoice_cur_prec) == 0:
|
||||
@@ -169,8 +169,8 @@ class AccountMove(models.Model):
|
||||
""" Overridden from stock_account.
|
||||
Returns the stock moves associated to this invoice."""
|
||||
rslt = super(AccountMove, self)._stock_account_get_last_step_stock_moves()
|
||||
for invoice in self.filtered(lambda x: x.type == 'in_invoice'):
|
||||
for invoice in self.filtered(lambda x: x.move_type == 'in_invoice'):
|
||||
rslt += invoice.mapped('invoice_line_ids.purchase_line_id.move_ids').filtered(lambda x: x.state == 'done' and x.location_id.usage == 'supplier')
|
||||
for invoice in self.filtered(lambda x: x.type == 'in_refund'):
|
||||
for invoice in self.filtered(lambda x: x.move_type == 'in_refund'):
|
||||
rslt += invoice.mapped('invoice_line_ids.purchase_line_id.move_ids').filtered(lambda x: x.state == 'done' and x.location_dest_id.usage == 'supplier')
|
||||
return rslt
|
||||
|
||||
@@ -44,7 +44,7 @@ class TestValuationReconciliation(ValuationReconciliationTestCommon):
|
||||
return rslt
|
||||
|
||||
def _create_invoice_for_po(self, purchase_order, date):
|
||||
move_form = Form(self.env['account.move'].with_context(default_type='in_invoice'))
|
||||
move_form = Form(self.env['account.move'].with_context(default_move_type='in_invoice'))
|
||||
move_form.invoice_date = date
|
||||
move_form.partner_id = self.test_partner
|
||||
move_form.currency_id = self.currency_two
|
||||
|
||||
@@ -76,7 +76,7 @@ class TestPurchaseOrder(AccountTestCommon):
|
||||
self.picking.button_validate()
|
||||
self.assertEqual(self.po.order_line.mapped('qty_received'), [5.0, 5.0], 'Purchase: all products should be received"')
|
||||
|
||||
move_form = Form(self.env['account.move'].with_context(default_type='in_invoice'))
|
||||
move_form = Form(self.env['account.move'].with_context(default_move_type='in_invoice'))
|
||||
move_form.partner_id = self.partner_id
|
||||
move_form.purchase_id = self.po
|
||||
self.invoice = move_form.save()
|
||||
@@ -108,7 +108,7 @@ class TestPurchaseOrder(AccountTestCommon):
|
||||
self.assertEqual(self.po.order_line.mapped('qty_received'), [5.0, 5.0], 'Purchase: all products should be received"')
|
||||
|
||||
#After Receiving all products create vendor bill.
|
||||
move_form = Form(self.env['account.move'].with_context(default_type='in_invoice'))
|
||||
move_form = Form(self.env['account.move'].with_context(default_move_type='in_invoice'))
|
||||
move_form.partner_id = self.partner_id
|
||||
move_form.purchase_id = self.po
|
||||
self.invoice = move_form.save()
|
||||
@@ -138,7 +138,7 @@ class TestPurchaseOrder(AccountTestCommon):
|
||||
# Check Received quantity
|
||||
self.assertEqual(self.po.order_line[0].qty_received, 3.0, 'Purchase: delivered quantity should be 3.0 instead of "%s" after picking return' % self.po.order_line[0].qty_received)
|
||||
#Create vendor bill for refund qty
|
||||
move_form = Form(self.env['account.move'].with_context(default_type='in_refund'))
|
||||
move_form = Form(self.env['account.move'].with_context(default_move_type='in_refund'))
|
||||
move_form.partner_id = self.partner_id
|
||||
move_form.purchase_id = self.po
|
||||
self.invoice = move_form.save()
|
||||
|
||||
@@ -376,7 +376,7 @@ class TestStockValuationWithCOA(AccountTestCommon):
|
||||
receipt_po1.move_lines.quantity_done = 10
|
||||
receipt_po1.button_validate()
|
||||
|
||||
move_form = Form(self.env['account.move'].with_context(default_type='in_invoice'))
|
||||
move_form = Form(self.env['account.move'].with_context(default_move_type='in_invoice'))
|
||||
move_form.partner_id = self.partner_id
|
||||
move_form.purchase_id = po1
|
||||
invoice_po1 = move_form.save()
|
||||
@@ -401,7 +401,7 @@ class TestStockValuationWithCOA(AccountTestCommon):
|
||||
receipt_po2.move_lines.quantity_done = 10
|
||||
receipt_po2.button_validate()
|
||||
|
||||
move_form = Form(self.env['account.move'].with_context(default_type='in_invoice'))
|
||||
move_form = Form(self.env['account.move'].with_context(default_move_type='in_invoice'))
|
||||
move_form.partner_id = self.partner_id
|
||||
move_form.purchase_id = po2
|
||||
invoice_po2 = move_form.save()
|
||||
@@ -425,7 +425,7 @@ class TestStockValuationWithCOA(AccountTestCommon):
|
||||
self.assertEqual(self.product1.value_svl, 200)
|
||||
|
||||
# create a credit note for po2
|
||||
move_form = Form(self.env['account.move'].with_context(default_type='in_refund'))
|
||||
move_form = Form(self.env['account.move'].with_context(default_move_type='in_refund'))
|
||||
move_form.partner_id = self.partner_id
|
||||
move_form.purchase_id = po2
|
||||
with move_form.invoice_line_ids.edit(0) as line_form:
|
||||
@@ -460,7 +460,7 @@ class TestStockValuationWithCOA(AccountTestCommon):
|
||||
receipt.button_validate()
|
||||
|
||||
# Create an invoice with a different price
|
||||
move_form = Form(self.env['account.move'].with_context(default_type='in_invoice'))
|
||||
move_form = Form(self.env['account.move'].with_context(default_move_type='in_invoice'))
|
||||
move_form.partner_id = order.partner_id
|
||||
move_form.purchase_id = order
|
||||
with move_form.invoice_line_ids.edit(0) as line_form:
|
||||
@@ -575,8 +575,8 @@ class TestStockValuationWithCOA(AccountTestCommon):
|
||||
})
|
||||
po.button_confirm()
|
||||
|
||||
inv = self.env['account.move'].with_context(default_type='in_invoice').create({
|
||||
'type': 'in_invoice',
|
||||
inv = self.env['account.move'].with_context(default_move_type='in_invoice').create({
|
||||
'move_type': 'in_invoice',
|
||||
'invoice_date': date_po,
|
||||
'date': date_po,
|
||||
'currency_id': self.eur_currency.id,
|
||||
@@ -708,8 +708,8 @@ class TestStockValuationWithCOA(AccountTestCommon):
|
||||
line_product_average = po.order_line.filtered(lambda l: l.product_id == self.product1)
|
||||
line_product_standard = po.order_line.filtered(lambda l: l.product_id == product_standard)
|
||||
|
||||
inv = self.env['account.move'].with_context(default_type='in_invoice').create({
|
||||
'type': 'in_invoice',
|
||||
inv = self.env['account.move'].with_context(default_move_type='in_invoice').create({
|
||||
'move_type': 'in_invoice',
|
||||
'invoice_date': date_invoice,
|
||||
'date': date_invoice,
|
||||
'currency_id': self.eur_currency.id,
|
||||
@@ -883,8 +883,8 @@ class TestStockValuationWithCOA(AccountTestCommon):
|
||||
self.assertAlmostEqual(product_avg.standard_price, 42.86)
|
||||
|
||||
today = date_invoice
|
||||
inv = self.env['account.move'].with_context(default_type='in_invoice').create({
|
||||
'type': 'in_invoice',
|
||||
inv = self.env['account.move'].with_context(default_move_type='in_invoice').create({
|
||||
'move_type': 'in_invoice',
|
||||
'invoice_date': date_invoice,
|
||||
'date': date_invoice,
|
||||
'currency_id': self.eur_currency.id,
|
||||
@@ -1060,8 +1060,8 @@ class TestStockValuationWithCOA(AccountTestCommon):
|
||||
self.assertAlmostEqual(product_avg.standard_price, 42.86)
|
||||
|
||||
today = date_invoice
|
||||
inv = self.env['account.move'].with_context(default_type='in_invoice').create({
|
||||
'type': 'in_invoice',
|
||||
inv = self.env['account.move'].with_context(default_move_type='in_invoice').create({
|
||||
'move_type': 'in_invoice',
|
||||
'invoice_date': date_invoice,
|
||||
'date': date_invoice,
|
||||
'currency_id': self.eur_currency.id,
|
||||
@@ -1090,8 +1090,8 @@ class TestStockValuationWithCOA(AccountTestCommon):
|
||||
self.assertAlmostEqual(product_avg.standard_price, 40.18)
|
||||
|
||||
today = date_invoice1
|
||||
inv1 = self.env['account.move'].with_context(default_type='in_invoice').create({
|
||||
'type': 'in_invoice',
|
||||
inv1 = self.env['account.move'].with_context(default_move_type='in_invoice').create({
|
||||
'move_type': 'in_invoice',
|
||||
'invoice_date': date_invoice1,
|
||||
'date': date_invoice1,
|
||||
'currency_id': self.eur_currency.id,
|
||||
@@ -1215,7 +1215,7 @@ class TestStockValuationWithCOA(AccountTestCommon):
|
||||
receipt.button_validate()
|
||||
|
||||
# Create an invoice with a different price and a discount
|
||||
invoice_form = Form(self.env['account.move'].with_context(default_type='in_invoice'))
|
||||
invoice_form = Form(self.env['account.move'].with_context(default_move_type='in_invoice'))
|
||||
invoice_form.purchase_id = order
|
||||
with invoice_form.invoice_line_ids.edit(0) as line_form:
|
||||
line_form.price_unit = 100.0
|
||||
@@ -1262,7 +1262,7 @@ class TestStockValuationWithCOA(AccountTestCommon):
|
||||
receipt.button_validate()
|
||||
|
||||
# Create an invoice with a different price and a discount
|
||||
invoice_form = Form(self.env['account.move'].with_context(default_type='in_invoice'))
|
||||
invoice_form = Form(self.env['account.move'].with_context(default_move_type='in_invoice'))
|
||||
invoice_form.purchase_id = order
|
||||
with invoice_form.invoice_line_ids.edit(0) as line_form:
|
||||
line_form.tax_ids.clear()
|
||||
@@ -1309,7 +1309,7 @@ class TestStockValuationWithCOA(AccountTestCommon):
|
||||
receipt.button_validate()
|
||||
|
||||
# Create an invoice with a different price and a discount
|
||||
invoice_form = Form(self.env['account.move'].with_context(default_type='in_invoice'))
|
||||
invoice_form = Form(self.env['account.move'].with_context(default_move_type='in_invoice'))
|
||||
invoice_form.purchase_id = order
|
||||
with invoice_form.invoice_line_ids.edit(0) as line_form:
|
||||
line_form.price_unit = 100.0
|
||||
|
||||
@@ -89,7 +89,7 @@ class Repair(models.Model):
|
||||
invoice_id = fields.Many2one(
|
||||
'account.move', 'Invoice',
|
||||
copy=False, readonly=True, tracking=True,
|
||||
domain=[('type', '=', 'out_invoice')])
|
||||
domain=[('move_type', '=', 'out_invoice')])
|
||||
move_id = fields.Many2one(
|
||||
'stock.move', 'Move',
|
||||
copy=False, readonly=True, tracking=True, check_company=True,
|
||||
@@ -318,7 +318,7 @@ class Repair(models.Model):
|
||||
if not group or len(current_invoices_list) == 0:
|
||||
fpos = self.env['account.fiscal.position'].get_fiscal_position(partner_invoice.id, delivery_id=repair.address_id.id)
|
||||
invoice_vals = {
|
||||
'type': 'out_invoice',
|
||||
'move_type': 'out_invoice',
|
||||
'partner_id': partner_invoice.id,
|
||||
'currency_id': currency.id,
|
||||
'narration': narration,
|
||||
@@ -430,7 +430,7 @@ class Repair(models.Model):
|
||||
for company_id, invoices_vals_list in invoices_vals_list_per_company.items():
|
||||
# VFE TODO remove the default_company_id ctxt key ?
|
||||
# Account fallbacks on self.env.company, which is correct with with_company
|
||||
self.env['account.move'].with_company(company_id).with_context(default_company_id=company_id, default_type='out_invoice').create(invoices_vals_list)
|
||||
self.env['account.move'].with_company(company_id).with_context(default_company_id=company_id, default_move_type='out_invoice').create(invoices_vals_list)
|
||||
|
||||
repairs.write({'invoiced': True})
|
||||
repairs.mapped('operations').filtered(lambda op: op.type == 'add').write({'invoiced': True})
|
||||
|
||||
@@ -29,6 +29,6 @@ class MakeInvoice(models.TransientModel):
|
||||
'res_model': 'account.move',
|
||||
'view_id': False,
|
||||
'views': [(self.env.ref('account.view_move_tree').id, 'tree'), (self.env.ref('account.view_move_form').id, 'form')],
|
||||
'context': "{'type':'out_invoice'}",
|
||||
'context': "{'move_type':'out_invoice'}",
|
||||
'type': 'ir.actions.act_window'
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ class AccountMove(models.Model):
|
||||
res = super(AccountMove, self)._onchange_partner_id()
|
||||
|
||||
# Recompute 'narration' based on 'company.invoice_terms'.
|
||||
if self.type == 'out_invoice':
|
||||
if self.move_type == 'out_invoice':
|
||||
self.narration = self.company_id.with_context(lang=self.partner_id.lang).invoice_terms
|
||||
|
||||
return res
|
||||
|
||||
+11
-11
@@ -59,7 +59,7 @@ class SaleOrder(models.Model):
|
||||
# existing invoices. This is necessary since such a refund is not
|
||||
# directly linked to the SO.
|
||||
for order in self:
|
||||
invoices = order.order_line.invoice_lines.move_id.filtered(lambda r: r.type in ('out_invoice', 'out_refund'))
|
||||
invoices = order.order_line.invoice_lines.move_id.filtered(lambda r: r.move_type in ('out_invoice', 'out_refund'))
|
||||
order.invoice_ids = invoices
|
||||
order.invoice_count = len(invoices)
|
||||
|
||||
@@ -119,7 +119,7 @@ class SaleOrder(models.Model):
|
||||
order.order_line._compute_tax_id()
|
||||
|
||||
def _search_invoice_ids(self, operator, value):
|
||||
return ['&', ('order_line.invoice_lines.move_id.type', 'in', ('out_invoice', 'out_refund')), ('order_line.invoice_lines.move_id', operator, value)]
|
||||
return ['&', ('order_line.invoice_lines.move_id.move_type', 'in', ('out_invoice', 'out_refund')), ('order_line.invoice_lines.move_id', operator, value)]
|
||||
|
||||
name = fields.Char(string='Order Reference', required=True, copy=False, readonly=True, states={'draft': [('readonly', False)]}, index=True, default=lambda self: _('New'))
|
||||
origin = fields.Char(string='Source Document', help="Reference of the document that generated this sales order request.")
|
||||
@@ -526,13 +526,13 @@ class SaleOrder(models.Model):
|
||||
"""
|
||||
self.ensure_one()
|
||||
self = self.with_company(self.company_id)
|
||||
journal = self.env['account.move'].with_company(self.company_id).with_context(default_type='out_invoice')._get_default_journal()
|
||||
journal = self.env['account.move'].with_company(self.company_id).with_context(default_move_type='out_invoice')._get_default_journal()
|
||||
if not journal:
|
||||
raise UserError(_('Please define an accounting sales journal for the company %s (%s).') % (self.company_id.name, self.company_id.id))
|
||||
|
||||
invoice_vals = {
|
||||
'ref': self.client_order_ref or '',
|
||||
'type': 'out_invoice',
|
||||
'move_type': 'out_invoice',
|
||||
'narration': self.note,
|
||||
'currency_id': self.pricelist_id.currency_id.id,
|
||||
'campaign_id': self.campaign_id.id,
|
||||
@@ -569,7 +569,7 @@ class SaleOrder(models.Model):
|
||||
action = {'type': 'ir.actions.act_window_close'}
|
||||
|
||||
context = {
|
||||
'default_type': 'out_invoice',
|
||||
'default_move_type': 'out_invoice',
|
||||
}
|
||||
if len(self) == 1:
|
||||
context.update({
|
||||
@@ -656,7 +656,7 @@ class SaleOrder(models.Model):
|
||||
# 3) Create invoices.
|
||||
# Manage the creation of invoices in sudo because a salesperson must be able to generate an invoice from a
|
||||
# sale order without "billing" access rights. However, he should not be able to create an invoice from scratch.
|
||||
moves = self.env['account.move'].sudo().with_context(default_type='out_invoice').create(invoice_vals_list)
|
||||
moves = self.env['account.move'].sudo().with_context(default_move_type='out_invoice').create(invoice_vals_list)
|
||||
# 4) Some moves might actually be refunds: convert them if the total amount is negative
|
||||
# We do this after the moves have been created since we need taxes, etc. to know if the total
|
||||
# is actually negative or not
|
||||
@@ -1076,9 +1076,9 @@ class SaleOrderLine(models.Model):
|
||||
qty_invoiced = 0.0
|
||||
for invoice_line in line.invoice_lines:
|
||||
if invoice_line.move_id.state != 'cancel':
|
||||
if invoice_line.move_id.type == 'out_invoice':
|
||||
if invoice_line.move_id.move_type == 'out_invoice':
|
||||
qty_invoiced += invoice_line.product_uom_id._compute_quantity(invoice_line.quantity, line.product_uom)
|
||||
elif invoice_line.move_id.type == 'out_refund' :
|
||||
elif invoice_line.move_id.move_type == 'out_refund':
|
||||
if not line.is_downpayment or line.untaxed_amount_to_invoice == 0 :
|
||||
qty_invoiced -= invoice_line.product_uom_id._compute_quantity(invoice_line.quantity, line.product_uom)
|
||||
line.qty_invoiced = qty_invoiced
|
||||
@@ -1360,7 +1360,7 @@ class SaleOrderLine(models.Model):
|
||||
else:
|
||||
line.qty_delivered_manual = 0.0
|
||||
|
||||
@api.depends('invoice_lines', 'invoice_lines.price_total', 'invoice_lines.move_id.state', 'invoice_lines.move_id.type')
|
||||
@api.depends('invoice_lines', 'invoice_lines.price_total', 'invoice_lines.move_id.state', 'invoice_lines.move_id.move_type')
|
||||
def _compute_untaxed_amount_invoiced(self):
|
||||
""" Compute the untaxed amount already invoiced from the sale order line, taking the refund attached
|
||||
the so line into account. This amount is computed as
|
||||
@@ -1374,9 +1374,9 @@ class SaleOrderLine(models.Model):
|
||||
for invoice_line in line.invoice_lines:
|
||||
if invoice_line.move_id.state == 'posted':
|
||||
invoice_date = invoice_line.move_id.invoice_date or fields.Date.today()
|
||||
if invoice_line.move_id.type == 'out_invoice':
|
||||
if invoice_line.move_id.move_type == 'out_invoice':
|
||||
amount_invoiced += invoice_line.currency_id._convert(invoice_line.price_subtotal, line.currency_id, line.company_id, invoice_date)
|
||||
elif invoice_line.move_id.type == 'out_refund':
|
||||
elif invoice_line.move_id.move_type == 'out_refund':
|
||||
amount_invoiced -= invoice_line.currency_id._convert(invoice_line.price_subtotal, line.currency_id, line.company_id, invoice_date)
|
||||
line.untaxed_amount_invoiced = amount_invoiced
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ class CrmTeam(models.Model):
|
||||
SUM(-line.balance) AS amount_untaxed_signed
|
||||
FROM account_move move
|
||||
LEFT JOIN account_move_line line ON line.move_id = move.id
|
||||
WHERE move.type IN ('out_invoice', 'out_refund', 'in_invoice', 'in_refund')
|
||||
WHERE move.move_type IN ('out_invoice', 'out_refund', 'in_invoice', 'in_refund')
|
||||
AND move.payment_state IN ('in_payment', 'paid')
|
||||
AND move.state = 'posted'
|
||||
AND move.team_id IN %s
|
||||
|
||||
@@ -22,13 +22,13 @@ class UtmCampaign(models.Model):
|
||||
|
||||
def _compute_sale_invoiced_amount(self):
|
||||
self.env['account.move.line'].flush(['balance', 'move_id', 'account_id', 'exclude_from_invoice_tab'])
|
||||
self.env['account.move'].flush(['state', 'campaign_id', 'type'])
|
||||
self.env['account.move'].flush(['state', 'campaign_id', 'move_type'])
|
||||
query = """SELECT move.campaign_id, -SUM(line.balance) as price_subtotal
|
||||
FROM account_move_line line
|
||||
INNER JOIN account_move move ON line.move_id = move.id
|
||||
WHERE move.state not in ('draft', 'cancel')
|
||||
AND move.campaign_id IN %s
|
||||
AND move.type IN ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt')
|
||||
AND move.move_type IN ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt')
|
||||
AND line.account_id IS NOT NULL
|
||||
AND NOT line.exclude_from_invoice_tab
|
||||
GROUP BY move.campaign_id
|
||||
@@ -61,7 +61,7 @@ class UtmCampaign(models.Model):
|
||||
}
|
||||
action['domain'] = [
|
||||
('id', 'in', invoices.ids),
|
||||
('type', 'in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt')),
|
||||
('move_type', 'in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt')),
|
||||
('state', 'not in', ['draft', 'cancel'])
|
||||
]
|
||||
return action
|
||||
|
||||
@@ -163,14 +163,14 @@
|
||||
<record id="account_invoice_rule_see_personal" model="ir.rule">
|
||||
<field name="name">Personal Invoices</field>
|
||||
<field name="model_id" ref="model_account_move"/>
|
||||
<field name="domain_force">[('type', 'in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund')), '|', ('invoice_user_id', '=', user.id), ('invoice_user_id', '=', False)]</field>
|
||||
<field name="domain_force">[('move_type', 'in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund')), '|', ('invoice_user_id', '=', user.id), ('invoice_user_id', '=', False)]</field>
|
||||
<field name="groups" eval="[(4, ref('sales_team.group_sale_salesman'))]"/>
|
||||
</record>
|
||||
|
||||
<record id="account_invoice_rule_see_all" model="ir.rule">
|
||||
<field name="name">All Invoices</field>
|
||||
<field name="model_id" ref="model_account_move"/>
|
||||
<field name="domain_force">[('type', 'in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund'))]</field>
|
||||
<field name="domain_force">[('move_type', 'in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund'))]</field>
|
||||
<field name="groups" eval="[(4, ref('sales_team.group_sale_salesman_all_leads'))]"/>
|
||||
</record>
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ class TestReInvoice(TestCommonSaleNoChart):
|
||||
'analytic_account_id': cls.analytic_account.id,
|
||||
})
|
||||
|
||||
cls.AccountMove = cls.env['account.move'].with_context(default_type='in_invoice', mail_notrack=True, mail_create_nolog=True)
|
||||
cls.AccountMove = cls.env['account.move'].with_context(default_move_type='in_invoice', mail_notrack=True, mail_create_nolog=True)
|
||||
|
||||
def test_at_cost(self):
|
||||
""" Test vendor bill at cost for product based on ordered and delivered quantities. """
|
||||
|
||||
@@ -209,7 +209,7 @@ class TestSaleOrder(TestCommonSaleNoChart):
|
||||
so.action_confirm()
|
||||
so._create_analytic_account()
|
||||
|
||||
inv = self.env['account.move'].with_context(default_type='in_invoice').create({
|
||||
inv = self.env['account.move'].with_context(default_move_type='in_invoice').create({
|
||||
'partner_id': self.partner_customer_usd.id,
|
||||
'invoice_line_ids': [
|
||||
(0, 0, {
|
||||
|
||||
@@ -108,11 +108,11 @@ class TestSaleToInvoice(TestCommonSaleNoChart):
|
||||
invoice_refund = self.sale_order.invoice_ids.sorted(key=lambda inv: inv.id, reverse=False)[-1] # the first invoice, its refund, and the new invoice
|
||||
|
||||
# Check invoice's type and number
|
||||
self.assertEqual(invoice_refund.type, 'out_refund', 'The last created invoiced should be a refund')
|
||||
self.assertEqual(invoice_refund.move_type, 'out_refund', 'The last created invoiced should be a refund')
|
||||
self.assertEqual(invoice_refund.state, 'draft', 'Last Customer invoices should be in draft')
|
||||
self.assertEqual(self.sale_order.invoice_count, 2, "The SO should have 2 related invoices: the original, the new refund")
|
||||
self.assertEqual(len(self.sale_order.invoice_ids.filtered(lambda inv: inv.type == 'out_refund')), 1, "The SO should be linked to only one refund")
|
||||
self.assertEqual(len(self.sale_order.invoice_ids.filtered(lambda inv: inv.type == 'out_invoice')), 1, "The SO should be linked to only one customer invoices")
|
||||
self.assertEqual(len(self.sale_order.invoice_ids.filtered(lambda inv: inv.move_type == 'out_refund')), 1, "The SO should be linked to only one refund")
|
||||
self.assertEqual(len(self.sale_order.invoice_ids.filtered(lambda inv: inv.move_type == 'out_invoice')), 1, "The SO should be linked to only one customer invoices")
|
||||
|
||||
# At this time, the invoice 1 is opend (validated) and its refund is in draft, so the amounts invoiced are not zero for
|
||||
# invoiced sale line. The amounts only take validated invoice/refund into account.
|
||||
@@ -198,11 +198,11 @@ class TestSaleToInvoice(TestCommonSaleNoChart):
|
||||
invoice_refund = self.env['account.move'].browse(credit_note_wizard.reverse_moves()['res_id'])
|
||||
|
||||
# Check invoice's type and number
|
||||
self.assertEqual(invoice_refund.type, 'out_refund', 'The last created invoiced should be a customer invoice')
|
||||
self.assertEqual(invoice_refund.move_type, 'out_refund', 'The last created invoiced should be a customer invoice')
|
||||
self.assertEqual(invoice_refund.payment_state, 'paid', 'Last Customer creadit note should be in paid state')
|
||||
self.assertEqual(self.sale_order.invoice_count, 2, "The SO should have 3 related invoices: the original, the refund, and the new one")
|
||||
self.assertEqual(len(self.sale_order.invoice_ids.filtered(lambda inv: inv.type == 'out_refund')), 1, "The SO should be linked to only one refund")
|
||||
self.assertEqual(len(self.sale_order.invoice_ids.filtered(lambda inv: inv.type == 'out_invoice')), 1, "The SO should be linked to only one customer invoices")
|
||||
self.assertEqual(len(self.sale_order.invoice_ids.filtered(lambda inv: inv.move_type == 'out_refund')), 1, "The SO should be linked to only one refund")
|
||||
self.assertEqual(len(self.sale_order.invoice_ids.filtered(lambda inv: inv.move_type == 'out_invoice')), 1, "The SO should be linked to only one customer invoices")
|
||||
|
||||
# At this time, the invoice 1 is opened (validated) and its refund validated too, so the amounts invoiced are zero for
|
||||
# all sale line. All invoiceable Sale lines have
|
||||
@@ -260,11 +260,11 @@ class TestSaleToInvoice(TestCommonSaleNoChart):
|
||||
invoice_refund = self.env['account.move'].browse(credit_note_wizard.reverse_moves()['res_id'])
|
||||
|
||||
# Check invoice's type and number
|
||||
self.assertEqual(invoice_refund.type, 'out_invoice', 'The last created invoiced should be a customer invoice')
|
||||
self.assertEqual(invoice_refund.move_type, 'out_invoice', 'The last created invoiced should be a customer invoice')
|
||||
self.assertEqual(invoice_refund.state, 'draft', 'Last Customer invoices should be in draft')
|
||||
self.assertEqual(self.sale_order.invoice_count, 3, "The SO should have 3 related invoices: the original, the refund, and the new one")
|
||||
self.assertEqual(len(self.sale_order.invoice_ids.filtered(lambda inv: inv.type == 'out_refund')), 1, "The SO should be linked to only one refund")
|
||||
self.assertEqual(len(self.sale_order.invoice_ids.filtered(lambda inv: inv.type == 'out_invoice')), 2, "The SO should be linked to two customer invoices")
|
||||
self.assertEqual(len(self.sale_order.invoice_ids.filtered(lambda inv: inv.move_type == 'out_refund')), 1, "The SO should be linked to only one refund")
|
||||
self.assertEqual(len(self.sale_order.invoice_ids.filtered(lambda inv: inv.move_type == 'out_invoice')), 2, "The SO should be linked to two customer invoices")
|
||||
|
||||
# At this time, the invoice 1 and its refund are confirmed, so the amounts invoiced are zero. The third invoice
|
||||
# (2nd customer inv) is in draft state.
|
||||
|
||||
@@ -1151,7 +1151,7 @@
|
||||
<field name="inherit_id" ref="account.view_invoice_tree"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="invoice_user_id" position="after">
|
||||
<field name="team_id" invisible="context.get('default_type') not in ('out_invoice', 'out_refund','out_receipt')" optional="hide"/>
|
||||
<field name="team_id" invisible="context.get('default_move_type') not in ('out_invoice', 'out_refund','out_receipt')" optional="hide"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
@@ -1166,7 +1166,7 @@
|
||||
<xpath expr="//field[@name='partner_id']" position="after">
|
||||
<field name="partner_shipping_id"
|
||||
groups="sale.group_delivery_invoice_address"
|
||||
attrs="{'invisible': [('type', 'not in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund'))]}"/>
|
||||
attrs="{'invisible': [('move_type', 'not in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund'))]}"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='invoice_line_ids']//field[@name='discount']" position="attributes">
|
||||
<attribute name="groups">product.group_discount_per_so_line</attribute>
|
||||
@@ -1178,7 +1178,7 @@
|
||||
<group string="Marketing"
|
||||
name="utm_link"
|
||||
groups="base.group_no_one"
|
||||
attrs="{'invisible': [('type', 'not in', ('out_invoice', 'out_refund'))]}">
|
||||
attrs="{'invisible': [('move_type', 'not in', ('out_invoice', 'out_refund'))]}">
|
||||
<field name="campaign_id"/>
|
||||
<field name="medium_id"/>
|
||||
<field name="source_id"/>
|
||||
@@ -1251,12 +1251,12 @@
|
||||
<field name="view_id" ref="account.view_move_tree"/>
|
||||
<field name="domain">[
|
||||
('state', '=', 'posted'),
|
||||
('type', 'in', ['out_invoice', 'out_refund'])]</field>
|
||||
('move_type', 'in', ['out_invoice', 'out_refund'])]</field>
|
||||
<field name="context">{
|
||||
'search_default_team_id': [active_id],
|
||||
'default_team_id': active_id,
|
||||
'default_type':'out_invoice',
|
||||
'type':'out_invoice',
|
||||
'default_move_type':'out_invoice',
|
||||
'move_type':'out_invoice',
|
||||
'journal_type': 'sale',
|
||||
}
|
||||
</field>
|
||||
|
||||
@@ -72,7 +72,7 @@ class SaleAdvancePaymentInv(models.TransientModel):
|
||||
|
||||
def _prepare_invoice_values(self, order, name, amount, so_line):
|
||||
invoice_vals = {
|
||||
'type': 'out_invoice',
|
||||
'move_type': 'out_invoice',
|
||||
'invoice_origin': order.name,
|
||||
'invoice_user_id': order.user_id.id,
|
||||
'narration': order.note,
|
||||
|
||||
@@ -45,15 +45,15 @@ class CrmLead(models.Model):
|
||||
('state', '=', 'posted'),
|
||||
('invoice_user_id', '=', self.env.uid),
|
||||
('invoice_date', '>=', date_today.replace(day=1) - relativedelta(months=+1)),
|
||||
('type', 'in', ['out_invoice', 'out_refund'])
|
||||
('move_type', 'in', ['out_invoice', 'out_refund'])
|
||||
]
|
||||
|
||||
invoice_data = self.env['account.move'].search_read(account_invoice_domain, ['invoice_date', 'amount_untaxed', 'type'])
|
||||
invoice_data = self.env['account.move'].search_read(account_invoice_domain, ['invoice_date', 'amount_untaxed', 'move_type'])
|
||||
|
||||
for invoice in invoice_data:
|
||||
if invoice['invoice_date']:
|
||||
invoice_date = fields.Date.from_string(invoice['invoice_date'])
|
||||
sign = 1 if invoice['type'] == 'out_invoice' else -1
|
||||
sign = 1 if invoice['move_type'] == 'out_invoice' else -1
|
||||
if invoice_date <= date_today and invoice_date >= date_today.replace(day=1):
|
||||
res['invoiced']['this_month'] += sign * invoice['amount_untaxed']
|
||||
elif invoice_date < date_today.replace(day=1) and invoice_date >= date_today.replace(day=1) - relativedelta(months=+1):
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
<!-- add needaction_menu_ref to reload quotation needaction when opportunity needaction is reloaded -->
|
||||
<record id="crm.crm_lead_opportunities" model="ir.actions.act_window">
|
||||
<field name="context">{'default_type': 'opportunity', 'default_user_id': uid}</field>
|
||||
<field name="context">{'default_move_type': 'opportunity', 'default_user_id': uid}</field>
|
||||
</record>
|
||||
|
||||
<record id="sales_team.mail_activity_type_action_config_sales" model="ir.actions.act_window">
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user