[FIX] mis_builder_cash_flow: Proper SQL expression + default for v13
- On v13, invoices are journal entries, so we have to explicitly exclude cancelled invoices from the expression. We leave draft ones, as they are good for forecasting. - Default value for the company of the forecast line doesn't follow new specification, putting an incorrect value. - Extra improvement: avoid a non needed casting of the fixed column type.pull/865/head
parent
d03968cc8d
commit
49281e7d22
|
@ -23,7 +23,7 @@ class MisCashFlowForecastLine(models.Model):
|
||||||
"res.company",
|
"res.company",
|
||||||
string="Company",
|
string="Company",
|
||||||
required=True,
|
required=True,
|
||||||
default=lambda self: self.env.user.company_id.id,
|
default=lambda self: self.env.company,
|
||||||
index=True,
|
index=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ class MisCashFlow(models.Model):
|
||||||
-- we use negative id to avoid duplicates and we don't use
|
-- we use negative id to avoid duplicates and we don't use
|
||||||
-- ROW_NUMBER() because the performance was very poor
|
-- ROW_NUMBER() because the performance was very poor
|
||||||
-aml.id as id,
|
-aml.id as id,
|
||||||
CAST('move_line' AS varchar) as line_type,
|
'move_line' as line_type,
|
||||||
aml.id as move_line_id,
|
aml.id as move_line_id,
|
||||||
aml.account_id as account_id,
|
aml.account_id as account_id,
|
||||||
CASE
|
CASE
|
||||||
|
@ -77,10 +77,11 @@ class MisCashFlow(models.Model):
|
||||||
aml.name as name,
|
aml.name as name,
|
||||||
COALESCE(aml.date_maturity, aml.date) as date
|
COALESCE(aml.date_maturity, aml.date) as date
|
||||||
FROM account_move_line as aml
|
FROM account_move_line as aml
|
||||||
|
WHERE aml.parent_state != 'cancel'
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT
|
SELECT
|
||||||
fl.id as id,
|
fl.id as id,
|
||||||
CAST('forecast_line' AS varchar) as line_type,
|
'forecast_line' as line_type,
|
||||||
NULL as move_line_id,
|
NULL as move_line_id,
|
||||||
fl.account_id as account_id,
|
fl.account_id as account_id,
|
||||||
CASE
|
CASE
|
||||||
|
|
Loading…
Reference in New Issue