Browse Source

[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/802/head
Pedro M. Baeza 3 years ago
parent
commit
c595af1012
  1. 2
      mis_builder_cash_flow/models/mis_cash_flow_forecast_line.py
  2. 5
      mis_builder_cash_flow/report/mis_cash_flow.py

2
mis_builder_cash_flow/models/mis_cash_flow_forecast_line.py

@ -23,7 +23,7 @@ class MisCashFlowForecastLine(models.Model):
"res.company",
string="Company",
required=True,
default=lambda self: self.env.user.company_id.id,
default=lambda self: self.env.company,
index=True,
)

5
mis_builder_cash_flow/report/mis_cash_flow.py

@ -57,7 +57,7 @@ class MisCashFlow(models.Model):
-- we use negative id to avoid duplicates and we don't use
-- ROW_NUMBER() because the performance was very poor
-aml.id as id,
CAST('move_line' AS varchar) as line_type,
'move_line' as line_type,
aml.id as move_line_id,
aml.account_id as account_id,
CASE
@ -77,10 +77,11 @@ class MisCashFlow(models.Model):
aml.name as name,
COALESCE(aml.date_maturity, aml.date) as date
FROM account_move_line as aml
WHERE aml.parent_state != 'cancel'
UNION ALL
SELECT
fl.id as id,
CAST('forecast_line' AS varchar) as line_type,
'forecast_line' as line_type,
NULL as move_line_id,
fl.account_id as account_id,
CASE

Loading…
Cancel
Save