[FIX] account: do not store account internal type on aml
It was removed here https://github.com/odoo/odoo/pull/32303 but readded later. We still don't want it for the same reasons. Having it on related (non stored) is enough.
This commit is contained in:
@@ -2722,7 +2722,7 @@ class AccountMoveLine(models.Model):
|
||||
domain="[('deprecated', '=', False), ('company_id', '=', company_id)]",
|
||||
check_company=True,
|
||||
tracking=True)
|
||||
account_internal_type = fields.Selection(related='account_id.user_type_id.type', string="Internal Type", store=True, readonly=True)
|
||||
account_internal_type = fields.Selection(related='account_id.user_type_id.type', string="Internal Type", readonly=True)
|
||||
account_root_id = fields.Many2one(related='account_id.root_id', string="Account Root", store=True, readonly=True)
|
||||
sequence = fields.Integer(default=10)
|
||||
name = fields.Text(string='Label', tracking=True)
|
||||
|
||||
@@ -439,16 +439,17 @@ class AccountPayment(models.Model):
|
||||
FROM account_payment payment
|
||||
JOIN account_move move ON move.id = payment.move_id
|
||||
JOIN account_move_line line ON line.move_id = move.id
|
||||
JOIN account_partial_reconcile part ON
|
||||
part.debit_move_id = line.id
|
||||
OR
|
||||
JOIN account_partial_reconcile part ON
|
||||
part.debit_move_id = line.id
|
||||
OR
|
||||
part.credit_move_id = line.id
|
||||
JOIN account_move_line counterpart_line ON
|
||||
JOIN account_move_line counterpart_line ON
|
||||
part.debit_move_id = counterpart_line.id
|
||||
OR
|
||||
OR
|
||||
part.credit_move_id = counterpart_line.id
|
||||
JOIN account_move invoice ON invoice.id = counterpart_line.move_id
|
||||
WHERE line.account_internal_type IN ('receivable', 'payable')
|
||||
JOIN account_account account ON account.id = line.account_id
|
||||
WHERE account.internal_type IN ('receivable', 'payable')
|
||||
AND line.id != counterpart_line.id
|
||||
AND invoice.move_type in ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt')
|
||||
GROUP BY payment.id
|
||||
@@ -469,13 +470,13 @@ class AccountPayment(models.Model):
|
||||
JOIN account_journal journal ON journal.id = move.journal_id
|
||||
JOIN account_move_line line ON line.move_id = move.id
|
||||
JOIN account_account account ON account.id = line.account_id
|
||||
JOIN account_partial_reconcile part ON
|
||||
part.debit_move_id = line.id
|
||||
OR
|
||||
JOIN account_partial_reconcile part ON
|
||||
part.debit_move_id = line.id
|
||||
OR
|
||||
part.credit_move_id = line.id
|
||||
JOIN account_move_line counterpart_line ON
|
||||
JOIN account_move_line counterpart_line ON
|
||||
part.debit_move_id = counterpart_line.id
|
||||
OR
|
||||
OR
|
||||
part.credit_move_id = counterpart_line.id
|
||||
WHERE (account.id = journal.payment_debit_account_id OR account.id = journal.payment_credit_account_id)
|
||||
AND line.id != counterpart_line.id
|
||||
|
||||
@@ -78,7 +78,8 @@ class CrmTeam(models.Model):
|
||||
move.team_id AS team_id,
|
||||
SUM(-line.balance) AS amount_untaxed_signed
|
||||
FROM account_move move
|
||||
LEFT JOIN account_move_line line ON line.move_id = move.id
|
||||
JOIN account_move_line line ON line.move_id = move.id
|
||||
JOIN account_account account ON account.id = line.account_id
|
||||
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'
|
||||
@@ -86,7 +87,7 @@ class CrmTeam(models.Model):
|
||||
AND move.date BETWEEN %s AND %s
|
||||
AND line.tax_line_id IS NULL
|
||||
AND line.display_type IS NULL
|
||||
AND line.account_internal_type NOT IN ('receivable', 'payable')
|
||||
AND account.internal_type NOT IN ('receivable', 'payable')
|
||||
GROUP BY move.team_id
|
||||
'''
|
||||
today = fields.Date.today()
|
||||
|
||||
Reference in New Issue
Block a user