Browse Source

[IMP] - set date_invoice as default group by for forecast pivot view

pull/283/head
sbejaoui 6 years ago
parent
commit
ac208c3d46
  1. 5
      contract_forecast/models/contract.py
  2. 6
      contract_forecast/views/contract_line_forecast_period.xml

5
contract_forecast/models/contract.py

@ -11,11 +11,14 @@ class AccountAnalyticAccount(models.Model):
@api.multi @api.multi
def action_show_contract_forecast(self): def action_show_contract_forecast(self):
self.ensure_one() self.ensure_one()
context = {'search_default_groupby_date_invoice': True}
context.update(self.env.context)
return { return {
"type": "ir.actions.act_window", "type": "ir.actions.act_window",
"name": _("Contract Forecast"), "name": _("Contract Forecast"),
"res_model": "contract.line.forecast.period", "res_model": "contract.line.forecast.period",
"domain": [("contract_id", "=", self.id)], "domain": [("contract_id", "=", self.id)],
"view_mode": "pivot,tree", "view_mode": "pivot,tree",
"context": self.env.context,
"context": context,
} }

6
contract_forecast/views/contract_line_forecast_period.xml

@ -19,7 +19,7 @@
<filter string="Date End" name="groupby_date_end" <filter string="Date End" name="groupby_date_end"
context="{'group_by':'date_end'}"/> context="{'group_by':'date_end'}"/>
<filter string="Date Invoice" name="groupby_date_invoice" <filter string="Date Invoice" name="groupby_date_invoice"
context="{'group_by':'date_invoice'}"/>
context="{'group_by':'date_invoice:day'}"/>
</group> </group>
</search> </search>
</field> </field>
@ -48,8 +48,8 @@
<field name="model">contract.line.forecast.period</field> <field name="model">contract.line.forecast.period</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<pivot string="Contract Forecast"> <pivot string="Contract Forecast">
<field name="product_id" type="row"/>
<field name="date_invoice" type="col"/>
<field name="product_id" type="col"/>
<field name="date_invoice" type="row"/>
<field name="price_subtotal" type="measure"/> <field name="price_subtotal" type="measure"/>
</pivot> </pivot>
</field> </field>

Loading…
Cancel
Save