diff options
| author | Arnaud Baes <arb@odoo.com> | 2019-08-12 12:50:27 +0000 |
|---|---|---|
| committer | Arnaud Baes <arb@odoo.com> | 2019-08-14 13:12:58 +0000 |
| commit | a587493a310fda5833b630e0ff7cb201e7d79cdc (patch) | |
| tree | a17d1e9d430356511c37c5f91baca2f78beb8024 | |
| parent | f60120ff85f9c7b9459339ee9caa3ba99e699541 (diff) | |
[IMP] stock: Forecast Report cleanup
| -rw-r--r-- | addons/stock/models/product.py | 10 | ||||
| -rw-r--r-- | addons/stock/report/report_stock_quantity.xml | 3 | ||||
| -rw-r--r-- | addons/stock/views/product_views.xml | 12 |
3 files changed, 18 insertions, 7 deletions
diff --git a/addons/stock/models/product.py b/addons/stock/models/product.py index 66941e1ddc6..9ae063cc7a7 100644 --- a/addons/stock/models/product.py +++ b/addons/stock/models/product.py @@ -497,6 +497,11 @@ class Product(models.Model): def action_update_quantity_on_hand(self): return self.product_tmpl_id.with_context({'default_product_id': self.id}).action_update_quantity_on_hand() + def action_product_forecast_report(self): + action = self.env.ref('stock.report_stock_quantity_action_product').read()[0] + action['domain'] = [('product_id', '=', self.id)] + return action + @api.model def get_theoretical_quantity(self, product_id, location_id, lot_id=None, package_id=None, owner_id=None, to_uom=None): product_id = self.env['product.product'].browse(product_id) @@ -759,6 +764,11 @@ class ProductTemplate(models.Model): return action + def action_product_tmpl_forecast_report(self): + action = self.env.ref('stock.report_stock_quantity_action').read()[0] + action['domain'] = [('product_id', 'in', self.product_variant_ids.ids)] + return action + class ProductCategory(models.Model): _inherit = 'product.category' diff --git a/addons/stock/report/report_stock_quantity.xml b/addons/stock/report/report_stock_quantity.xml index 39a030e3e14..f9a2e1c00bb 100644 --- a/addons/stock/report/report_stock_quantity.xml +++ b/addons/stock/report/report_stock_quantity.xml @@ -25,6 +25,7 @@ <filter string="Forecasted Stock" name="filter_forecast" domain="[('state', '=', 'forecast')]"/> <filter string="Forecasted Receipts" name="filter_in" domain="[('state', '=', 'in')]"/> <filter string="Forecasted Deliveries" name="filter_out" domain="[('state', '=', 'out')]"/> + <filter string="Date" name="filter_date" date="date"/> </group> <group expand="0" string="Group By"> <filter string="Date" name="groupby_date" domain="[]" context="{'group_by':'date:day'}"/> @@ -39,7 +40,7 @@ <field name="view_mode">graph</field> <field name="context">{ 'search_default_filter_forecast': 1, - 'graph_groupbys': ['date:day', 'state'], + 'graph_groupbys': ['date:day', 'state', 'product_id'], }</field> </record> diff --git a/addons/stock/views/product_views.xml b/addons/stock/views/product_views.xml index 34a9c821b46..1d5155175a3 100644 --- a/addons/stock/views/product_views.xml +++ b/addons/stock/views/product_views.xml @@ -225,10 +225,10 @@ <span class="o_stat_text">On Hand</span> </div> </button> - <button type="action" - name="%(stock.report_stock_quantity_action_product)d" + <button type="object" + name="action_product_forecast_report" attrs="{'invisible':[('type', '!=', 'product')]}" - context="{'search_default_product_id': id, 'default_product_id': id}" + context="{'default_product_id': id}" class="oe_stat_button" icon="fa-cubes"> <div class="o_field_widget o_stat_info"> <span class="o_stat_value"> @@ -317,10 +317,10 @@ <span class="o_stat_text">On Hand</span> </div> </button> - <button type="action" - name="%(stock.report_stock_quantity_action_product)d" + <button type="object" + name="action_product_tmpl_forecast_report" attrs="{'invisible':[('type', '!=', 'product')]}" - context="{'search_default_product_tmpl_id': id, 'default_product_tmpl_id': id}" + context="{'default_product_tmpl_id': id}" class="oe_stat_button" icon="fa-cubes"> <div class="o_field_widget o_stat_info"> <span class="o_stat_value"> |
