[MERGE] lp:~numerigraphe-team/openobject-addons/7.0-stock-latest-move
lp bug: https://launchpad.net/bugs/1291986 fixed bzr revid: ls@numerigraphe.com-20140314134834-uiz992gxz3ldj9kw
This commit is contained in:
commit
c5ff05e64e
|
@ -25,13 +25,15 @@ from openerp.tools.sql import drop_view_if_exists
|
|||
|
||||
class report_stock_lines_date(osv.osv):
|
||||
_name = "report.stock.lines.date"
|
||||
_description = "Dates of Inventories"
|
||||
_description = "Dates of Inventories and latest Moves"
|
||||
_auto = False
|
||||
_order = "date"
|
||||
_columns = {
|
||||
'id': fields.integer('Inventory Line Id', readonly=True),
|
||||
'id': fields.integer('Product Id', readonly=True),
|
||||
'product_id': fields.many2one('product.product', 'Product', readonly=True, select=True),
|
||||
'date': fields.datetime('Latest Inventory Date'),
|
||||
'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),
|
||||
}
|
||||
def init(self, cr):
|
||||
drop_view_if_exists(cr, 'report_stock_lines_date')
|
||||
|
@ -40,13 +42,16 @@ class report_stock_lines_date(osv.osv):
|
|||
select
|
||||
p.id as id,
|
||||
p.id as product_id,
|
||||
max(s.date) as date
|
||||
max(s.date) as date,
|
||||
max(m.date) as move_date,
|
||||
p.active as active
|
||||
from
|
||||
product_product p
|
||||
left outer join stock_inventory_line l on (p.id=l.product_id)
|
||||
left join stock_inventory s on (l.inventory_id=s.id)
|
||||
and s.state = 'done'
|
||||
where p.active='true'
|
||||
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
|
||||
)""")
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
<tree string="Dates of Inventories" create="false">
|
||||
<field name="product_id"/>
|
||||
<field name="date" />
|
||||
<field name="move_date"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
@ -18,12 +19,13 @@
|
|||
<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">
|
||||
<search string="Dates of Inventories & Moves">
|
||||
<field name="date"/>
|
||||
<filter icon="terp-accessories-archiver" name="stockable" string="Stockable" domain="[('product_id.type','=', 'product')]"/>
|
||||
<filter icon="terp-accessories-archiver" string="Consumable" domain="[('product_id.type','=', 'consu')]"/>
|
||||
<separator/>
|
||||
<filter icon="terp-accessories-archiver-minus" string="Non Inv" domain="[('date','=', False)]"/>
|
||||
<filter icon="terp-accessories-archiver-minus" string="No Inventory yet" domain="[('date','=', False)]"/>
|
||||
<filter icon="terp-accessories-archiver-minus" string="No Stock Move yet" domain="[('move_date','=', False)]"/>
|
||||
<field name="product_id"/>
|
||||
</search>
|
||||
</field>
|
||||
|
@ -33,22 +35,23 @@
|
|||
<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" version="7.0">
|
||||
<form string="Dates of Inventories & Moves" version="7.0">
|
||||
<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">Last Product Inventories</field>
|
||||
<field name="name">Latest Inventories & 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 last inventories 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.</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="next_id_61" action="action_stock_line_date" id="menu_report_stock_line_date" sequence="2"/>
|
||||
|
|
Loading…
Reference in New Issue