|
|
for line in self:
account_type = line.general_account_id.account_type or ''
if (
account_type.split('_')[0] == 'expense'
or account_type in ['asset_current', 'asset_non_current', 'asset_fixed']
or (not account_type and line.category not in ['invoice', 'other'])
or (not account_type and line.category == 'other' and line.amount < 0)
):
line.analytic_profitability = 'loss'
elif (
account_type.split('_')[0] == 'income'
or (not account_type and line.category == 'other' and line.amount > 0)
):
line.analytic_profitability = 'revenue'
else:
line.analytic_profitability = 'uncategorized'
|
|