[REM] stock: latest inventories and moves report

The functionaility is available through a filter on the inventory
adjustment view or through the stock moves of a product.
This commit is contained in:
Pratima Gupta
2017-03-16 17:53:28 +01:00
committed by Simon Lejeune
parent 02a76becf7
commit 2560feec04
6 changed files with 1 additions and 104 deletions
-1
View File
@@ -52,7 +52,6 @@ Dashboard / Reports for Inventory Management will include:
'report/report_stock_forecast.xml',
'report/stock_report_views.xml',
'report/report_stock_view.xml',
'report/report_package_barcode.xml',
'report/report_lot_barcode.xml',
'report/report_location_barcode.xml',
-1
View File
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import report_stock
import report_stock_forecast
-39
View File
@@ -1,39 +0,0 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models
from odoo.tools.sql import drop_view_if_exists
class ReportStockLinesDate(models.Model):
_name = "report.stock.lines.date"
_description = "Dates of Inventories and latest Moves"
_auto = False
_order = "date"
id = fields.Integer('Product Id', readonly=True)
product_id = fields.Many2one('product.product', 'Product', readonly=True, index=True)
date = fields.Datetime('Date of latest Inventory', readonly=True)
move_date = fields.Datetime('Date of latest Stock Move', readonly=True)
active = fields.Boolean("Active", readonly=True)
@api.model_cr
def init(self):
drop_view_if_exists(self._cr, 'report_stock_lines_date')
self._cr.execute("""
create or replace view report_stock_lines_date as (
select
p.id as id,
p.id as product_id,
max(s.date) as date,
max(m.date) as move_date,
p.active as active
from
product_product p
left join (
stock_inventory_line l
inner join stock_inventory s on (l.inventory_id=s.id and s.state = 'done')
) on (p.id=l.product_id)
left join stock_move m on (m.product_id=p.id and m.state = 'done')
group by p.id
)""")
-61
View File
@@ -1,61 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<!-- report , stock inventories date... start -->
<record model="ir.ui.view" id="report_stock_lines_date_tree">
<field name="name">report.stock.lines.date.tree</field>
<field name="model">report.stock.lines.date</field>
<field name="arch" type="xml">
<tree string="Dates of Inventories" create="false">
<field name="product_id"/>
<field name="date" />
<field name="move_date"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="report_stock_lines_date_search">
<field name="name">report.stock.lines.date.search</field>
<field name="model">report.stock.lines.date</field>
<field name="arch" type="xml">
<search string="Dates of Inventories &amp; Moves">
<field name="date"/>
<filter name="stockable" string="Stockable" domain="[('product_id.type','=', 'product')]"/>
<filter string="Consumable" domain="[('product_id.type','=', 'consu')]"/>
<separator/>
<filter string="No Inventory yet" domain="[('date','=', False)]"/>
<filter string="No Stock Move yet" domain="[('move_date','=', False)]"/>
<field name="product_id"/>
</search>
</field>
</record>
<record model="ir.ui.view" id="report_stock_lines_date_form">
<field name="name">report.stock.lines.date.form</field>
<field name="model">report.stock.lines.date</field>
<field name="arch" type="xml">
<form string="Dates of Inventories &amp; Moves">
<group>
<field name="product_id"/>
<field name="date"/>
<field name="move_date"/>
</group>
</form>
</field>
</record>
<record model="ir.actions.act_window" id="action_stock_line_date">
<field name="name">Latest Inventories &amp; Moves</field>
<field name="res_model">report.stock.lines.date</field>
<field name="view_type">form</field>
<field name="context">{'search_default_stockable':1}</field>
<field name="view_mode">tree,form</field>
<field name="help">Display the latest Inventories and Moves done on your products and easily sort them with specific filtering criteria. If you do frequent and partial inventories, you need this report in order to ensure that the stock of each product is controlled at least once a year. This also lets you find out which products have seen little move lately and may deserve special measures (discounted sale, quality control...)</field>
</record>
<menuitem parent="menu_warehouse_report" action="action_stock_line_date" id="menu_report_stock_line_date" sequence="2"
groups="base.group_no_one"/>
</data>
</odoo>
@@ -20,8 +20,6 @@ access_stock_inventory_manager,stock.inventory manager,model_stock_inventory,sto
access_stock_inventory_line_user,stock.inventory.line user,model_stock_inventory_line,stock.group_stock_user,1,1,1,0
access_stock_inventory_line_manager,stock.inventory.line manager,model_stock_inventory_line,stock.group_stock_manager,1,1,1,1
access_stock_location_stock_manager,stock.location stock manager,model_stock_location,stock.group_stock_manager,1,0,0,0
access_stock_lines_date_user,report.stock.lines.date user,model_report_stock_lines_date,stock.group_stock_user,1,0,0,0
access_stock_lines_date_manager,report.stock.lines.date manager,model_report_stock_lines_date,stock.group_stock_manager,1,1,1,1
access_product_product_stock_user,product_product_stock_user,product.model_product_product,stock.group_stock_user,1,0,0,0
access_product_template_stock_user,product.template stock user,product.model_product_template,stock.group_stock_user,1,0,0,0
access_product_uom_categ_stock_manager,product.uom.categ stock_manager,product.model_product_uom_categ,stock.group_stock_manager,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
20 access_stock_inventory_line_user stock.inventory.line user model_stock_inventory_line stock.group_stock_user 1 1 1 0
21 access_stock_inventory_line_manager stock.inventory.line manager model_stock_inventory_line stock.group_stock_manager 1 1 1 1
22 access_stock_location_stock_manager stock.location stock manager model_stock_location stock.group_stock_manager 1 0 0 0
access_stock_lines_date_user report.stock.lines.date user model_report_stock_lines_date stock.group_stock_user 1 0 0 0
access_stock_lines_date_manager report.stock.lines.date manager model_report_stock_lines_date stock.group_stock_manager 1 1 1 1
23 access_product_product_stock_user product_product_stock_user product.model_product_product stock.group_stock_user 1 0 0 0
24 access_product_template_stock_user product.template stock user product.model_product_template stock.group_stock_user 1 0 0 0
25 access_product_uom_categ_stock_manager product.uom.categ stock_manager product.model_product_uom_categ stock.group_stock_manager 1 1 1 1
@@ -22,6 +22,7 @@
<field name="name" string="Inventory Reference"/>
<field name="date"/>
<field name="company_id" groups="base.group_multi_company"/>
<field name="product_id" string="Inventory Product" filter_domain="['|', ('product_id', 'ilike', self), ('line_ids.product_id','ilike',self)]"/>
<group expand="0" string="Group By">
<filter string="Status" domain="[]" context="{'group_by':'state'}"/>
<filter string="Inventories Month" domain="[]" context="{'group_by':'date'}" help="Physical Inventories by Month"/>