[IMP] WIP removed 1000 lines of code

bzr revid: fp@tinyerp.com-20130630085503-ubn247ylue58wa1u
This commit is contained in:
Fabien Pinckaers 2013-06-30 10:55:03 +02:00
parent 863ef7cf7a
commit 8f49a3d4c7
27 changed files with 377 additions and 1215 deletions

View File

@ -2675,7 +2675,7 @@ msgid "Scrap Move"
msgstr ""
#. module: stock
#: help:stock.move,prodlot_id:0
#: help:stock.move,lot_id:0
msgid "Serial number is used to put a serial number on the production"
msgstr ""
@ -2790,7 +2790,7 @@ msgstr ""
#. module: stock
#: view:report.stock.inventory:0
#: field:report.stock.inventory,prodlot_id:0
#: field:report.stock.inventory,lot_id:0
#: report:stock.picking.list:0
msgid "Lot"
msgstr ""
@ -3453,21 +3453,21 @@ msgstr ""
#: model:ir.model,name:stock.model_stock_production_lot
#: model:ir.ui.menu,name:stock.menu_action_production_lot_form
#: model:res.request.link,name:stock.req_link_tracking
#: field:stock.change.product.qty,prodlot_id:0
#: field:stock.change.product.qty,lot_id:0
#: field:stock.inventory.line,prod_lot_id:0
#: field:stock.inventory.line.split.lines,name:0
#: field:stock.inventory.line.split.lines,prodlot_id:0
#: field:stock.move,prodlot_id:0
#: field:stock.inventory.line.split.lines,lot_id:0
#: field:stock.move,lot_id:0
#: view:stock.move.split:0
#: field:stock.move.split.lines,name:0
#: field:stock.move.split.lines,prodlot_id:0
#: field:stock.partial.move.line,prodlot_id:0
#: field:stock.partial.picking.line,prodlot_id:0
#: field:stock.move.split.lines,lot_id:0
#: field:stock.partial.move.line,lot_id:0
#: field:stock.partial.picking.line,lot_id:0
#: report:stock.picking.list:0
#: view:stock.production.lot:0
#: field:stock.production.lot,name:0
#: field:stock.production.lot.revision,lot_id:0
#: field:stock.report.prodlots,prodlot_id:0
#: field:stock.report.prodlots,lot_id:0
msgid "Serial Number"
msgstr ""

View File

@ -29,7 +29,6 @@ class res_partner(osv.osv):
relation='stock.location',
string="Customer Location",
help="This stock location will be used, instead of the default one, as the destination location for goods you send to this partner"),
'property_stock_supplier': fields.property(
type='many2one',
relation='stock.location',
@ -37,5 +36,3 @@ class res_partner(osv.osv):
help="This stock location will be used, instead of the default one, as the source location for goods you receive from the current partner"),
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -313,11 +313,11 @@ class product_product(osv.osv):
where += where_add
prodlot_id = context.get('prodlot_id', False)
lot_id = context.get('lot_id', False)
prodlot_clause = ''
if prodlot_id:
prodlot_clause = ' and prodlot_id = %s '
where += [prodlot_id]
if lot_id:
prodlot_clause = ' and lot_id = %s '
where += [lot_id]
# TODO: perhaps merge in one query.
if 'in' in what:

View File

@ -246,7 +246,7 @@
<para style="terp_default_9"><font face="Helvetica" size="9.0">[[ get_product_desc(move_lines) ]] </font></para>
</td>
<td>
<para style="terp_default_Centre_9">[[ (move_lines.prodlot_id and move_lines.prodlot_id.name) or '' ]]</para>
<para style="terp_default_Centre_9">[[ (move_lines.lot_id and move_lines.lot_id.name) or '' ]]</para>
</td>
<td>
<para style="terp_default_9">Waiting Availability[[ move_lines.state == 'confirmed' and ' ' or removeParentNode('para') ]]</para>
@ -276,7 +276,7 @@
<para style="terp_default_9"><font face="Helvetica" size="9.0">[[ get_product_desc(move_lines) ]] </font></para>
</td>
<td>
<para style="terp_default_Centre_9">[[ (move_lines.prodlot_id and move_lines.prodlot_id.name) or '' ]]</para>
<para style="terp_default_Centre_9">[[ (move_lines.lot_id and move_lines.lot_id.name) or '' ]]</para>
</td>
<td>
<para style="terp_default_9">[[ (picking.type == 'in' or removeParentNode('para')) ]][[ move_lines.state == 'done' and 'Received' or move_lines.state]]</para>

View File

@ -21,118 +21,8 @@
from openerp.osv import fields, osv
from openerp.tools.translate import _
from openerp import tools
from openerp.tools.sql import drop_view_if_exists
class stock_report_prodlots(osv.osv):
_name = "stock.report.prodlots"
_description = "Stock report by serial number"
_auto = False
_columns = {
'qty': fields.float('Quantity', readonly=True),
'location_id': fields.many2one('stock.location', 'Location', readonly=True, select=True),
'product_id': fields.many2one('product.product', 'Product', readonly=True, select=True),
'prodlot_id': fields.many2one('stock.production.lot', 'Serial Number', readonly=True, select=True),
}
def init(self, cr):
drop_view_if_exists(cr, 'stock_report_prodlots')
cr.execute("""
create or replace view stock_report_prodlots as (
select max(id) as id,
location_id,
product_id,
prodlot_id,
sum(qty) as qty
from (
select -max(sm.id) as id,
sm.location_id,
sm.product_id,
sm.prodlot_id,
-sum(sm.product_qty /uo.factor) as qty
from stock_move as sm
left join stock_location sl
on (sl.id = sm.location_id)
left join product_uom uo
on (uo.id=sm.product_uom)
where state = 'done'
group by sm.location_id, sm.product_id, sm.product_uom, sm.prodlot_id
union all
select max(sm.id) as id,
sm.location_dest_id as location_id,
sm.product_id,
sm.prodlot_id,
sum(sm.product_qty /uo.factor) as qty
from stock_move as sm
left join stock_location sl
on (sl.id = sm.location_dest_id)
left join product_uom uo
on (uo.id=sm.product_uom)
where sm.state = 'done'
group by sm.location_dest_id, sm.product_id, sm.product_uom, sm.prodlot_id
) as report
group by location_id, product_id, prodlot_id
)""")
def unlink(self, cr, uid, ids, context=None):
raise osv.except_osv(_('Error!'), _('You cannot delete any record!'))
class stock_report_tracklots(osv.osv):
_name = "stock.report.tracklots"
_description = "Stock report by logistic serial number"
_auto = False
_columns = {
'name': fields.float('Quantity', readonly=True),
'location_id': fields.many2one('stock.location', 'Location', readonly=True, select=True),
'product_id': fields.many2one('product.product', 'Product', readonly=True, select=True),
'tracking_id': fields.many2one('stock.tracking', 'Logistic Serial Number', readonly=True, select=True),
}
def init(self, cr):
drop_view_if_exists(cr, 'stock_report_tracklots')
cr.execute("""
create or replace view stock_report_tracklots as (
select max(id) as id,
location_id,
product_id,
tracking_id,
sum(qty) as name
from (
select -max(sm.id) as id,
sm.location_id,
sm.product_id,
sm.tracking_id,
-sum(sm.product_qty /uo.factor) as qty
from stock_move as sm
left join stock_location sl
on (sl.id = sm.location_id)
left join product_uom uo
on (uo.id=sm.product_uom)
where state = 'done'
group by sm.location_id, sm.product_id, sm.product_uom, sm.tracking_id
union all
select max(sm.id) as id,
sm.location_dest_id as location_id,
sm.product_id,
sm.tracking_id,
sum(sm.product_qty /uo.factor) as qty
from stock_move as sm
left join stock_location sl
on (sl.id = sm.location_dest_id)
left join product_uom uo
on (uo.id=sm.product_uom)
where sm.state = 'done'
group by sm.location_dest_id, sm.product_id, sm.product_uom, sm.tracking_id
) as report
group by location_id, product_id, tracking_id
)""")
def unlink(self, cr, uid, ids, context=None):
raise osv.except_osv(_('Error!'), _('You cannot delete any record!'))
class report_stock_lines_date(osv.osv):
_name = "report.stock.lines.date"
_description = "Dates of Inventories"

View File

@ -52,8 +52,6 @@ class report_stock_move(osv.osv):
'day_diff':fields.float('Execution Lead Time (Days)',readonly=True, digits_compute=dp.get_precision('Shipping Delay'), group_operator="avg"),
'stock_journal': fields.many2one('stock.journal','Stock Journal', select=True),
}
def init(self, cr):
tools.drop_view_if_exists(cr, 'report_stock_move')
cr.execute("""
@ -142,12 +140,12 @@ class report_stock_move(osv.osv):
# FP Note: TODO: drop this table and use the stock.move table instead
class report_stock_inventory(osv.osv):
_name = "report.stock.inventory"
_description = "Stock Statistics"
_auto = False
_order = 'date desc'
def read_group(self, cr, uid, domain, fields, groupby, offset=0, limit=None, context=None, orderby=False):
res = super(report_stock_inventory, self).read_group(cr, uid, domain, fields, groupby, offset=offset, limit=limit, context=context, orderby=orderby)
product_obj = self.pool.get("product.product")
@ -188,205 +186,37 @@ class report_stock_inventory(osv.osv):
else:
res[line.id] = prodbrow[(line.company_id.id, line.product_id.id)].standard_price * line.product_qty
return res
_columns = {
'date': fields.datetime('Date', readonly=True),
'year': fields.char('Year', size=4, readonly=True),
'month':fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'),
('05','May'), ('06','June'), ('07','July'), ('08','August'), ('09','September'),
('10','October'), ('11','November'), ('12','December')], 'Month', readonly=True),
'partner_id':fields.many2one('res.partner', 'Partner', readonly=True),
'product_id':fields.many2one('product.product', 'Product', readonly=True),
'product_categ_id':fields.many2one('product.category', 'Product Category', readonly=True),
'location_id': fields.many2one('stock.location', 'Location', readonly=True),
'prodlot_id': fields.many2one('stock.production.lot', 'Lot', readonly=True),
'lot_id': fields.many2one('stock.production.lot', 'Lot', readonly=True),
'company_id': fields.many2one('res.company', 'Company', readonly=True),
'product_qty':fields.float('Quantity', digits_compute=dp.get_precision('Product Unit of Measure'), help="Qty Remaining", readonly=True),
'value' : fields.float('Total Value', digits_compute=dp.get_precision('Account'), required=True),
'state': fields.selection([('draft', 'Draft'), ('waiting', 'Waiting'), ('confirmed', 'Confirmed'), ('assigned', 'Available'), ('done', 'Done'), ('cancel', 'Cancelled')], 'Status', readonly=True, select=True,
help='When the stock move is created it is in the \'Draft\' state.\n After that it is set to \'Confirmed\' state.\n If stock is available state is set to \'Avaiable\'.\n When the picking it done the state is \'Done\'.\
\nThe state is \'Waiting\' if the move is waiting for another one.'),
'location_type': fields.selection([('supplier', 'Supplier Location'), ('view', 'View'), ('internal', 'Internal Location'), ('customer', 'Customer Location'), ('inventory', 'Inventory'), ('procurement', 'Procurement'), ('production', 'Production'), ('transit', 'Transit Location for Inter-Companies Transfers')], 'Location Type', required=True),
'scrap_location': fields.boolean('scrap'),
'inventory_value': fields.function(_calc_moves, string="Inventory Value", type='float', readonly=True),
'ref':fields.text('Reference', readonly=True),
'location_dest_type': fields.selection([('supplier', 'Supplier Location'), ('view', 'View'), ('internal', 'Internal Location'), ('customer', 'Customer Location'), ('inventory', 'Inventory'), ('procurement', 'Procurement'), ('production', 'Production'), ('transit', 'Transit Location for Inter-Companies Transfers')], 'Location Destination Type'),
'location_src_type': fields.selection([('supplier', 'Supplier Location'), ('view', 'View'), ('internal', 'Internal Location'), ('customer', 'Customer Location'), ('inventory', 'Inventory'), ('procurement', 'Procurement'), ('production', 'Production'), ('transit', 'Transit Location for Inter-Companies Transfers')], 'Location Source Type'),
'location_type': fields.selection([('supplier', 'Supplier Location'), ('view', 'View'), ('internal', 'Internal Location'), ('customer', 'Customer Location'), ('inventory', 'Inventory'), ('procurement', 'Procurement'), ('production', 'Production'), ('transit', 'Transit Location for Inter-Companies Transfers')], 'Location Source Type'),
}
def init(self, cr):
tools.drop_view_if_exists(cr, 'report_stock_inventory')
cr.execute("""
CREATE OR REPLACE view report_stock_inventory AS (
SELECT
sq.id as id, sq.in_date as date,
to_char(sq.in_date, 'YYYY') as year,
to_char(sq.in_date, 'MM') as month,
m.partner_id as partner_id, sq.location_id as location_id,
sq.product_id as product_id, pt.categ_id as product_categ_id, location.usage as location_type, location.scrap_location as scrap_location,
sq.id as id,
sq.in_date as date,
sq.location_id as location_id,
sq.product_id as product_id,
pt.categ_id as product_categ_id,
location.scrap_location as scrap_location,
sq.company_id,
m.state as state, sq.prodlot_id as prodlot_id,
sq.price_unit * sq.qty as value,
sq.lot_id as lot_id,
sq.cost * sq.qty as value,
sq.qty as product_qty,
p.name as ref,
location_dest.usage as location_dest_type,
location.usage as location_src_type
location.usage as location_type
FROM stock_quant sq
LEFT JOIN stock_quant_move_rel qm ON (qm.quant_id = sq.id)
LEFT JOIN stock_move m ON (qm.move_id = m.id)
LEFT JOIN stock_picking p ON (m.picking_id=p.id)
LEFT JOIN stock_location location ON (m.location_id = location.id)
LEFT JOIN stock_location location_dest ON (m.location_dest_id = location_dest.id)
LEFT JOIN stock_location location ON (sq.location_id = location.id)
LEFT JOIN product_template pt ON (sq.product_id=pt.id)
WHERE (location_dest.usage = 'internal' and location.usage <> 'internal') or (sq.qty < 0) or (sq.propagated_from_id IS NOT NULL)
GROUP BY
sq.id, sq.product_id, pt.categ_id, m.partner_id, m.location_id, m.location_dest_id,
sq.prodlot_id, sq.in_date, m.state, location.usage, location_dest.usage, location.scrap_location, sq.company_id, to_char(sq.in_date, 'YYYY'), to_char(sq.in_date, 'MM'), p.name
);
""")
#
# CREATE OR REPLACE view report_stock_inventory AS (
#
# SELECT
# m.id as id, m.date as date,
# to_char(m.date, 'YYYY') as year,
# to_char(m.date, 'MM') as month,
# m.partner_id as partner_id, m.location_dest_id as location_id,
# m.product_id as product_id, pt.categ_id as product_categ_id, l.usage as location_type, l.scrap_location as scrap_location,
# m.company_id,
# m.state as state, m.prodlot_id as prodlot_id,
# coalesce(sum(m.price_unit * m.qty_remaining)::decimal, 0.0) as value,
# coalesce(sum(m.qty_remaining * pu.factor / pu2.factor)::decimal, 0.0) as product_qty,
# p.name as ref,
# l.usage as location_dest_type,
# l_other.usage as location_src_type
# FROM
# stock_move m
# LEFT JOIN stock_picking p ON (m.picking_id=p.id)
# LEFT JOIN product_product pp ON (m.product_id=pp.id)
# LEFT JOIN product_template pt ON (pp.product_tmpl_id=pt.id)
# LEFT JOIN product_uom pu ON (pt.uom_id=pu.id)
# LEFT JOIN product_uom pu2 ON (m.product_uom=pu2.id)
# LEFT JOIN product_uom u ON (m.product_uom=u.id)
# LEFT JOIN stock_location l ON (m.location_dest_id=l.id)
# LEFT JOIN stock_location l_other ON (m.location_id=l_other.id)
# WHERE m.state != 'cancel'
# GROUP BY
# m.id, m.product_id, m.product_uom, pt.categ_id, m.partner_id, m.location_id, m.location_dest_id,
# m.prodlot_id, m.date, m.state, l.usage, l_other.usage, l.scrap_location, m.company_id, pt.uom_id, to_char(m.date, 'YYYY'), to_char(m.date, 'MM'), p.name
# );
class report_stock_valuation(osv.osv):
_name = "report.stock.valuation"
_description = "Stock Valuation Statistics"
_auto = False
_order = 'date desc'
_columns = {
'date': fields.datetime('Date', readonly=True),
'year': fields.char('Year', size=4, readonly=True),
'month':fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'),
('05','May'), ('06','June'), ('07','July'), ('08','August'), ('09','September'),
('10','October'), ('11','November'), ('12','December')], 'Month', readonly=True),
'partner_id':fields.many2one('res.partner', 'Partner', readonly=True),
'product_id':fields.many2one('product.product', 'Product', readonly=True),
'product_categ_id':fields.many2one('product.category', 'Product Category', readonly=True),
'location_id': fields.many2one('stock.location', 'Location', readonly=True),
'prodlot_id': fields.many2one('stock.production.lot', 'Lot', readonly=True),
'company_id': fields.many2one('res.company', 'Company', readonly=True),
'product_qty':fields.float('Quantity', digits_compute=dp.get_precision('Product Unit of Measure'), readonly=True),
'value' : fields.float('Value', digits_compute=dp.get_precision('Account'), required=True),
'state': fields.selection([('draft', 'Draft'), ('waiting', 'Waiting'), ('confirmed', 'Confirmed'), ('assigned', 'Available'), ('done', 'Done'), ('cancel', 'Cancelled')], 'Status', readonly=True, select=True,
help='When the stock move is created it is in the \'Draft\' state.\n After that it is set to \'Confirmed\' state.\n If stock is available state is set to \'Avaiable\'.\n When the picking it done the state is \'Done\'.\
\nThe state is \'Waiting\' if the move is waiting for another one.'),
'location_type': fields.selection([('supplier', 'Supplier Location'), ('view', 'View'), ('internal', 'Internal Location'), ('customer', 'Customer Location'), ('inventory', 'Inventory'), ('procurement', 'Procurement'), ('production', 'Production'), ('transit', 'Transit Location for Inter-Companies Transfers')], 'Location Type', required=True),
'scrap_location': fields.boolean('scrap'),
'name': fields.text('Reference', readonly=True),
'price_unit': fields.float('Unit price', digits_compute=dp.get_precision('Account')),
'qty_remaining': fields.float('Qty remaining'),
'location_dest_type': fields.selection([('supplier', 'Supplier Location'), ('view', 'View'), ('internal', 'Internal Location'), ('customer', 'Customer Location'), ('inventory', 'Inventory'), ('procurement', 'Procurement'), ('production', 'Production'), ('transit', 'Transit Location for Inter-Companies Transfers')], 'Location Destination Type'),
'location_src_type': fields.selection([('supplier', 'Supplier Location'), ('view', 'View'), ('internal', 'Internal Location'), ('customer', 'Customer Location'), ('inventory', 'Inventory'), ('procurement', 'Procurement'), ('production', 'Production'), ('transit', 'Transit Location for Inter-Companies Transfers')], 'Location Source Type'),
'match': fields.many2one('stock.move', 'Match', readonly=True),
'related_move_in': fields.related('match', 'picking_id', 'name', type='text', string="Original move", readonly=True),
}
def init(self, cr):
tools.drop_view_if_exists(cr, 'report_stock_valuation')
cr.execute("""
CREATE OR REPLACE view report_stock_valuation AS (
(SELECT
min(mm.id) as id, m.date as date,
to_char(m.date, 'YYYY') as year,
to_char(m.date, 'MM') as month,
m.partner_id as partner_id, m.location_id as location_id,
m.product_id as product_id, pt.categ_id as product_categ_id, l.usage as location_type, l.scrap_location as scrap_location,
m.company_id, m.qty_remaining as qty_remaining,
m.state as state, m.prodlot_id as prodlot_id,
p.name as name,
mm.move_in_id as match,
coalesce(mm.price_unit_out * pu2.factor / pu.factor, 0.0) as price_unit,
coalesce(sum(-mm.price_unit_out * mm.qty)::decimal, 0.0) as value,
coalesce(sum(-mm.qty * pu.factor / pu2.factor)::decimal, 0.0) as product_qty,
l_other.usage as location_dest_type,
l.usage as location_src_type
FROM
stock_move_matching mm, stock_move m
LEFT JOIN stock_picking p ON (m.picking_id=p.id)
LEFT JOIN product_product pp ON (m.product_id=pp.id)
LEFT JOIN product_template pt ON (pp.product_tmpl_id=pt.id)
LEFT JOIN product_uom pu ON (pt.uom_id=pu.id)
LEFT JOIN product_uom pu2 ON (m.product_uom=pu2.id)
LEFT JOIN product_uom u ON (m.product_uom=u.id)
LEFT JOIN stock_location l ON (m.location_id=l.id)
LEFT JOIN stock_location l_other ON (m.location_dest_id=l_other.id)
WHERE m.state != 'cancel' and mm.move_out_id=m.id
GROUP BY
p.name, mm.id, mm.move_out_id, m.id, m.product_id, m.product_uom, pt.categ_id, m.partner_id, m.location_id, m.location_dest_id,
m.prodlot_id, m.date, m.state, l.usage, l.scrap_location, m.company_id, pt.uom_id, to_char(m.date, 'YYYY'), to_char(m.date, 'MM'),
pu2.factor, pu.factor, m.qty_remaining, l_other.usage
) UNION ALL (
SELECT
-min(m.id) as id, m.date as date,
to_char(m.date, 'YYYY') as year,
to_char(m.date, 'MM') as month,
m.partner_id as partner_id, m.location_dest_id as location_id,
m.product_id as product_id, pt.categ_id as product_categ_id, l.usage as location_type, l.scrap_location as scrap_location,
m.company_id, m.qty_remaining as qty_remaining,
m.state as state, m.prodlot_id as prodlot_id,
p.name as name, 0 as match,
coalesce(m.price_unit * pu2.factor / pu.factor, 0.0) as price_unit,
coalesce(sum(m.price_unit * m.product_qty)::decimal, 0.0) as value,
coalesce(sum(m.product_qty * pu.factor / pu2.factor)::decimal, 0.0) as product_qty,
l.usage as location_dest_type,
l_other.usage as location_src_type
FROM
stock_move m
LEFT JOIN stock_picking p ON (m.picking_id=p.id)
LEFT JOIN product_product pp ON (m.product_id=pp.id)
LEFT JOIN product_template pt ON (pp.product_tmpl_id=pt.id)
LEFT JOIN product_uom pu ON (pt.uom_id=pu.id)
LEFT JOIN product_uom pu2 ON (m.product_uom=pu2.id)
LEFT JOIN product_uom u ON (m.product_uom=u.id)
LEFT JOIN stock_location l ON (m.location_dest_id=l.id)
LEFT JOIN stock_location l_other ON (m.location_id=l_other.id)
WHERE m.state != 'cancel'
GROUP BY
p.name, m.id, m.product_id, m.product_uom, pt.categ_id, m.partner_id, m.location_id, m.location_dest_id,
m.prodlot_id, m.date, m.state, l.usage, l.scrap_location, m.company_id, pt.uom_id, to_char(m.date, 'YYYY'), to_char(m.date, 'MM'),
pu2.factor, pu.factor, m.qty_remaining, l_other.usage
)
);
""")
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -106,19 +106,12 @@
<field name="model">report.stock.inventory</field>
<field name="arch" type="xml">
<tree string="Inventory Analysis" create="false">
<field name="date" invisible="1"/>
<field name="year" invisible="1" />
<field name="month" invisible="1"/>
<field name="company_id" invisible="1"/>
<field name="location_type" invisible="1"/>
<field name="location_id" invisible="1"/>
<field name="partner_id" invisible="1" context="{'contact_display':'partner'}"/>
<field name="product_categ_id" invisible="1"/>
<field name="product_id" invisible="1"/>
<field name="prodlot_id" invisible="1"/>
<field name="state" invisible="1"/>
<field name="ref"/>
<field name="date"/>
<field name="lot_id" invisible="1"/>
<field name="product_qty" sum="Total Quantity in Stock"/>
<field name="inventory_value" sum="Total Inventory Value"/>
</tree>
@ -141,37 +134,22 @@
<field name="model">report.stock.inventory</field>
<field name="arch" type="xml">
<search string="Inventory Analysis">
<filter string="Real" name="real" icon="terp-check" domain="[('state','=','done')]"
help="Analysis of current inventory (only moves that have already been processed)"/>
<filter string="Future" icon="terp-stock" domain="[('state','in',('assigned','done','waiting','confirmed'))]"
help = "Analysis including future moves (similar to virtual stock)"/>
<separator/>
<filter icon="terp-go-home" name="location_type_internal" string="Internal" domain="[('location_type','=','internal')]"/>
<filter name="inmovesremaining" string="In moves still in stock" domain="[('location_src_type','!=','internal'), ('location_dest_type','=', 'internal'), ('product_qty', '>', 0.0)]"
help="Analysis showing only the in moves which are still (partially) in stock"/>
<field name="product_id" default_focus="1"/>
<field name="company_id" groups="base.group_multi_company"/>
<field name="location_id" filter_domain="[('location_id', 'child_of', self)]"/>
<group expand="0" string="Extended Filters...">
<field name="partner_id" context="{'contact_display':'partner'}" filter_domain="[('partner_id', 'child_of', self)]"/>
<field name="product_categ_id" />
<field name="prodlot_id"/>
<field name="state"/>
<field name="lot_id"/>
<field name="location_type"/>
<field name="date"/>
<filter icon="terp-go-home" name="location_type_scrap" string="Scrap" domain="[('scrap_location','=','True')]"/>
</group>
<group expand="1" string="Group By..." >
<filter string="Partner" name="group_partner" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/>
<filter name="group_product_categ_id" string="Product Category" icon="terp-stock_symbol-selection" context="{'group_by':'product_categ_id'}"/>
<filter name="group_product" string="Product" icon="terp-accessories-archiver" context="{'group_by':'product_id'}"/>
<filter name="group_lot" string="Lot" icon="terp-accessories-archiver" context="{'group_by':'prodlot_id'}"/>
<filter name="group_lot" string="Lot" icon="terp-accessories-archiver" context="{'group_by':'lot_id'}"/>
<filter name="group_company" string="Company" groups="base.group_multi_company" icon="terp-go-home" context="{'group_by':'company_id'}"/>
<filter name="group_location" string="Location" icon="terp-go-home" context="{'group_by':'location_id'}"/>
<filter string="Status" icon="terp-stock_effects-object-colorize" context="{'group_by':'state'}"/>
<filter string="Date" icon="terp-go-today" context="{'group_by':'date'}"/>
<filter string="Month" icon="terp-go-month" context="{'group_by':'month'}"/>
<filter string="Year" icon="terp-go-year" context="{'group_by':'year'}"/>
</group>
</search>
</field>
@ -190,97 +168,5 @@
id="menu_action_stock_inventory_report"
parent="next_id_61" sequence="4"/>
<!-- Inventory: Stock Valuation report -->
<record id="view_stock_valuation_tree" model="ir.ui.view">
<field name="name">report.stock.valuation.tree</field>
<field name="model">report.stock.valuation</field>
<field name="arch" type="xml">
<tree string="Stock Valuation Analysis" create="false">
<field name="date" invisible="1"/>
<field name="year" invisible="1" />
<field name="month" invisible="1"/>
<field name="company_id" invisible="1"/>
<field name="location_type" invisible="1"/>
<field name="location_id" invisible="1"/>
<field name="partner_id" invisible="1" context="{'contact_display':'partner'}"/>
<field name="product_categ_id" invisible="1"/>
<field name="product_id" invisible="1"/>
<field name="prodlot_id" invisible="1"/>
<field name="state" invisible="1"/>
<field name="name"/>
<field name="related_move_in"/>
<field name="date"/>
<field name="price_unit"/>
<field name="product_qty" sum="Total Quantity"/>
<field name="value" sum="Total Value"/>
</tree>
</field>
</record>
<record id="view_stock_valuation_graph" model="ir.ui.view">
<field name="name">report.stock.valuation.graph</field>
<field name="model">report.stock.valuation</field>
<field name="arch" type="xml">
<graph string="Stock Valuation Analysis" type="bar">
<field name="product_id"/>
<field name="value"/>
</graph>
</field>
</record>
<record id="view_stock_valuation_search" model="ir.ui.view">
<field name="name">report.stock.valuation.search</field>
<field name="model">report.stock.valuation</field>
<field name="arch" type="xml">
<search string="Stock Valuation Analysis">
<filter string="Real" name="real" icon="terp-check" domain="[('state','=','done')]"
help="Analysis of current inventory (only moves that have already been processed)"/>
<filter string="Future" icon="terp-stock" domain="[('state','in',('assigned','done','waiting','confirmed'))]"
help = "Analysis including future moves (similar to virtual stock)"/>
<separator/>
<filter icon="terp-go-home" name="location_type_internal" string="Internal" domain="[('location_type','=','internal')]"/>
<field name="product_id" default_focus="1"/>
<field name="location_id" filter_domain="[('location_id', 'child_of', self)]"/>
<field name="company_id" groups="base.group_multi_company"/>
<group expand="0" string="Extended Filters...">
<field name="partner_id" context="{'contact_display':'partner'}" filter_domain="[('partner_id', 'child_of', self)]"/>
<field name="product_categ_id" />
<field name="prodlot_id"/>
<field name="state"/>
<field name="location_type"/>
<field name="date"/>
<filter icon="terp-go-home" name="location_type_scrap" string="Scrap" domain="[('scrap_location','=','True')]"/>
</group>
<group expand="1" string="Group By..." >
<filter string="Partner" name="group_partner" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/>
<filter name="group_product_categ_id" string="Product Category" icon="terp-stock_symbol-selection" context="{'group_by':'product_categ_id'}"/>
<filter name="group_product" string="Product" icon="terp-accessories-archiver" context="{'group_by':'product_id'}"/>
<filter name="group_lot" string="Lot" icon="terp-accessories-archiver" context="{'group_by':'prodlot_id'}"/>
<filter name="group_company" string="Company" groups="base.group_multi_company" icon="terp-go-home" context="{'group_by':'company_id'}"/>
<filter name="group_location" string="Location" icon="terp-go-home" context="{'group_by':'location_id'}"/>
<filter string="Status" icon="terp-stock_effects-object-colorize" context="{'group_by':'state'}"/>
<filter string="Date" icon="terp-go-today" context="{'group_by':'date'}"/>
<filter string="Month" icon="terp-go-month" context="{'group_by':'month'}"/>
<filter string="Year" icon="terp-go-year" context="{'group_by':'year'}"/>
<filter string="Price" context="{'group_by': 'price_unit'}"/>
<filter string="Ref" context="{'group_by': 'name'}"/>
</group>
</search>
</field>
</record>
<record id="action_stock_valuation_report" model="ir.actions.act_window">
<field name="name">Valuation History</field>
<field name="res_model">report.stock.valuation</field>
<field name="view_type">form</field>
<field name="view_mode">tree,graph</field>
<field name="search_view_id" eval="False"/>
<field name="context">{'contact_display': 'partner', 'search_default_real':1,
'search_default_location_type_internal':1,'group_by':[]}</field>
<field name="help">Stock Valuation Analysis allows you to easily check and analyse your company stock levels. The difference with the Inventory Analysis, is that
the stock is calculated based on the prices of the stock moves depending on the cost method of the product (FIFO/LIFO/Average/standard) and not just the standard price of the product.
Sort and group by selection criteria in order to better analyse and manage your company activities. </field>
</record>
<menuitem action="action_stock_valuation_report" id="menu_action_move_match" parent="menu_traceability" sequence="3" groups="stock.group_locations"/>
</data>
</openerp>
</openerp>

View File

@ -2,12 +2,6 @@
<openerp>
<data>
<act_window
domain="[('tracking_id', '=', active_id)]"
id="act_stock_tracking_lot_2_stock_report_tracklots"
name="Stock" res_model="stock.report.tracklots"
src_model="stock.tracking"/>
<!-- 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>
@ -59,16 +53,5 @@
<menuitem parent="next_id_61" action="action_stock_line_date" id="menu_report_stock_line_date" sequence="2"/>
<record id="view_location_graph" model="ir.ui.view">
<field name="name">stock.location.graph</field>
<field name="model">stock.location</field>
<field name="arch" type="xml">
<graph string="Stock Location">
<field name="complete_name"/>
<field name="stock_real_value" operator="+"/>
</graph>
</field>
</record>
</data>
</openerp>

View File

@ -8,9 +8,6 @@ access_stock_location_manager,stock.location.manager,model_stock_location,stock.
access_stock_location_user,stock.location.user,model_stock_location,base.group_user,1,0,0,0
access_stock_journal_user,stock.journal.user,model_stock_journal,base.group_user,1,0,0,0
access_stock_journal_manager,stock.journal.manager,model_stock_journal,stock.group_stock_manager,1,1,1,1
access_stock_tracking_user,stock.tracking user,model_stock_tracking,stock.group_stock_user,1,1,1,1
access_stock_tracking_manager,stock.tracking manager,model_stock_tracking,stock.group_stock_manager,1,0,0,0
access_stock_tracking_sales_user,stock.tracking sales.user,model_stock_tracking,base.group_sale_salesman,1,1,1,0
access_stock_picking_user,stock.picking user,model_stock_picking,stock.group_stock_user,1,1,1,1
access_stock_picking_in_user,stock.picking.in,model_stock_picking_in,stock.group_stock_user,1,1,1,1
access_stock_picking_out_user,stock.picking.out,model_stock_picking_out,stock.group_stock_user,1,1,1,1
@ -30,7 +27,6 @@ access_stock_location_sale_manager,stock.location sale manager,model_stock_locat
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_stock_report_tracklots,stock.report.tracklots,model_stock_report_tracklots,stock.group_stock_user,1,1,1,1
access_report_stock_move_user,report.stock.move user,model_report_stock_move,stock.group_stock_user,1,0,0,0
access_report_stock_move_manager,report.stock.move manager,model_report_stock_move,stock.group_stock_manager,1,1,1,1
access_report_stock_inventory_user,report.stock.inventory user,model_report_stock_inventory,stock.group_stock_user,1,1,1,1
@ -60,5 +56,3 @@ access_product_pricelist_version_stock_manager,product.pricelist.version stock_m
access_product_pricelist_item_stock_manager,product.pricelist.item stock_manager,product.model_product_pricelist_item,stock.group_stock_manager,1,1,1,1
access_account_account_stock_manager,account.account stock manager,account.model_account_account,stock.group_stock_manager,1,0,0,0
access_board_stock_user,board.board user,board.model_board_board,stock.group_stock_user,1,1,0,0
access_stock_move_matching_manager,stock.move.matching manager,model_stock_move_matching,stock.group_stock_manager,1,1,1,1
access_stock_move_matching_user,stock.move.matching user,model_stock_move_matching,stock.group_stock_user,1,1,1,0

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
8 access_stock_location_user stock.location.user model_stock_location base.group_user 1 0 0 0
9 access_stock_journal_user stock.journal.user model_stock_journal base.group_user 1 0 0 0
10 access_stock_journal_manager stock.journal.manager model_stock_journal stock.group_stock_manager 1 1 1 1
access_stock_tracking_user stock.tracking user model_stock_tracking stock.group_stock_user 1 1 1 1
access_stock_tracking_manager stock.tracking manager model_stock_tracking stock.group_stock_manager 1 0 0 0
access_stock_tracking_sales_user stock.tracking sales.user model_stock_tracking base.group_sale_salesman 1 1 1 0
11 access_stock_picking_user stock.picking user model_stock_picking stock.group_stock_user 1 1 1 1
12 access_stock_picking_in_user stock.picking.in model_stock_picking_in stock.group_stock_user 1 1 1 1
13 access_stock_picking_out_user stock.picking.out model_stock_picking_out stock.group_stock_user 1 1 1 1
27 access_stock_location_stock_manager stock.location stock manager model_stock_location stock.group_stock_manager 1 0 0 0
28 access_stock_lines_date_user report.stock.lines.date user model_report_stock_lines_date stock.group_stock_user 1 0 0 0
29 access_stock_lines_date_manager report.stock.lines.date manager model_report_stock_lines_date stock.group_stock_manager 1 1 1 1
access_stock_report_tracklots stock.report.tracklots model_stock_report_tracklots stock.group_stock_user 1 1 1 1
30 access_report_stock_move_user report.stock.move user model_report_stock_move stock.group_stock_user 1 0 0 0
31 access_report_stock_move_manager report.stock.move manager model_report_stock_move stock.group_stock_manager 1 1 1 1
32 access_report_stock_inventory_user report.stock.inventory user model_report_stock_inventory stock.group_stock_user 1 1 1 1
56 access_product_pricelist_item_stock_manager product.pricelist.item stock_manager product.model_product_pricelist_item stock.group_stock_manager 1 1 1 1
57 access_account_account_stock_manager account.account stock manager account.model_account_account stock.group_stock_manager 1 0 0 0
58 access_board_stock_user board.board user board.model_board_board stock.group_stock_user 1 1 0 0
access_stock_move_matching_manager stock.move.matching manager model_stock_move_matching stock.group_stock_manager 1 1 1 1
access_stock_move_matching_user stock.move.matching user model_stock_move_matching stock.group_stock_user 1 1 1 0

View File

@ -80,11 +80,5 @@
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
</record>
<record model="ir.rule" id="stock_move_matching_comp_rule">
<field name="name">Stock move matching</field>
<field name="model_id" ref="model_stock_move_matching"/>
<field name="global" eval="True"/>
<field name="domain_force">[('1','=','1')]</field>
</record>
</data>
</openerp>

File diff suppressed because it is too large Load Diff

View File

@ -44,10 +44,6 @@
<field name="product_id"/>
<field name="product_qty"/>
<field name="product_uom" groups="product.group_uom"/>
<field name="prod_lot_id" groups="stock.group_production_lot"/>
<button name="%(stock.action_view_stock_inventory_line_split)d"
string="Split inventory lines" groups="stock.group_inventory_valuation"
type="action" icon="gtk-justify-fill"/>
<field name="location_id" groups="stock.group_locations"/>
</tree>
</field>
@ -61,7 +57,6 @@
<field context="{'location':location_id, 'uom':product_uom, 'to_date':parent.date}" name="product_id" on_change="on_change_product_id(location_id,product_id,product_uom,parent.date)" domain="[('type','&lt;&gt;','service')]"/>
<field name="product_qty"/>
<field name="product_uom" groups="product.group_uom"/>
<field name="prod_lot_id" groups="stock.group_production_lot"/>
<field domain="[('usage','=','internal')]" name="location_id"/>
<button name="%(stock.action_view_stock_inventory_line_split)d"
string="Split Inventory Line" groups="stock.group_inventory_valuation"
@ -133,10 +128,6 @@
<field context="{'location':location_id, 'uom':product_uom, 'to_date':parent.date}" name="product_id" on_change="on_change_product_id(location_id,product_id,product_uom,parent.date)" domain="[('type','&lt;&gt;','service')]"/>
<field name="product_qty"/>
<field name="product_uom" groups="product.group_uom"/>
<field name="prod_lot_id" groups="stock.group_production_lot"/>
<button name="%(stock.action_view_stock_inventory_line_split)d"
string="Split inventory lines" groups="stock.group_inventory_valuation"
type="action" icon="gtk-justify-fill" states="draft,confirm"/>
<field name="state" invisible="True"/>
</tree>
<form string="Products" version="7.0">
@ -151,10 +142,6 @@
<field name="product_qty" class="oe_inline"/>
<field name="product_uom" class="oe_inline" groups="product.group_uom"/>
</div>
<field name="prod_lot_id" groups="stock.group_production_lot"/>
<button name="%(stock.action_view_stock_inventory_line_split)d"
string="Split inventory lines" groups="stock.group_inventory_valuation"
type="action" icon="gtk-justify-fill"/>
</group>
</group>
</form>
@ -166,19 +153,7 @@
<field name="product_id"/>
<field name="product_qty" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/>
<field name="product_uom" string="Unit of Measure" groups="product.group_uom"/>
<field name="prodlot_id" groups="stock.group_production_lot"/>
<button name="%(track_line)d" string="Split in serial numbers" type="action"
icon="gtk-justify-fill"
attrs="{'invisible': [('prodlot_id','&lt;&gt;',False)]}"
states="draft,done,cancel"
context="{'inventory_id':parent.id}"
groups="stock.group_production_lot"/>
<field groups="stock.group_tracking_lot" name="tracking_id"/>
<button name="%(split_into)d" string="Put in a new pack" type="action"
groups="stock.group_tracking_lot"
icon="terp-accessories-archiver+"
context="{'inventory_id':parent.id}"
states="draft,done,cancel"/>
<field name="quant_ids"/>
<field name="location_id" groups="stock.group_locations"/>
<field name="location_dest_id" groups="stock.group_locations"/>
<field name="date" string="Date"/>
@ -221,96 +196,17 @@
<field name="filter" eval="True"/>
</record>
<record id="view_tracking_form" model="ir.ui.view">
<field name="name">stock.tracking.form</field>
<field name="model">stock.tracking</field>
<field name="arch" type="xml">
<form string="Packs" version="7.0">
<group>
<group groups="product.group_stock_packaging" string="Pack Identification">
<field name="name"/>
<field name="serial"/>
<field name="date"/>
<field name="active"/>
</group>
<group groups="stock.group_tracking_lot" string="Traceability">
<button name="action_traceability" string="Upstream Traceability" type="object"
colspan="2"/>
<button name="action_traceability" string="Downstream Traceability" type="object"
context="{'type': 'move_history_ids'}" colspan="2"/>
</group>
</group>
<field name="move_ids"/>
</form>
</field>
</record>
<record id="view_tracking_tree" model="ir.ui.view">
<field name="name">stock.tracking.tree</field>
<field name="model">stock.tracking</field>
<field name="arch" type="xml">
<tree string="Packs">
<field name="name"/>
<field name="serial"/>
<field name="date"/>
</tree>
</field>
</record>
<record id="action_tracking_form" model="ir.actions.act_window">
<field name="name">Packs</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">stock.tracking</field>
<field name="view_type">form</field>
<field name="view_id" ref="view_tracking_tree"/>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to add a tracking number.
</p><p>
This is the list of all your packs. When you select a Pack, you
can get the upstream or downstream traceability of the products
contained in the pack.
</p>
</field>
</record>
<menuitem id="menu_traceability" name="Traceability" parent="menu_stock_root"
sequence="3"/>
<menuitem action="action_tracking_form" id="menu_action_tracking_form"
groups="product.group_stock_packaging"
sequence="6"
parent="menu_traceability"/>
<record id="lot_line_tree" model="ir.ui.view">
<field name="name">stock.tracking.tree</field>
<field name="model">stock.tracking</field>
<field name="field_parent">child_ids</field>
<field name="arch" type="xml">
<tree colors="grey:active == False" string="Packs">
<field name="name"/>
<field name="serial"/>
<field name="date"/>
<field name="active" invisible="1"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="search_stock_packs">
<field name="name">Pack Search</field>
<field name="model">stock.tracking</field>
<field name="arch" type="xml">
<search string="Pack Search">
<field name="name" string="Pack" filter_domain="['|',('name','ilike',self),('serial','ilike',self)]"/>
<field name="date"/>
<field name="active"/>
</search>
</field>
</record>
<record id="view_production_lot_form" model="ir.ui.view">
<field name="name">stock.production.lot.form</field>
<field name="model">stock.production.lot</field>
<field name="arch" type="xml">
<form string="Serial Number" version="7.0">
<div class="oe_button_box oe_right">
<button name="action_traceability" string="Upstream Traceability" type="object" context="{'type': 'move_history_ids2', 'field': 'prodlot_id'}"/>
<button name="action_traceability" string="Downstream Traceability" type="object" context="{'type': 'move_history_ids', 'field': 'prodlot_id'}"/>
<button name="action_traceability" string="Upstream Traceability" type="object"/>
<button name="action_traceability" string="Downstream Traceability" type="object"/>
</div>
<div class="oe_title">
<label for="name" class="oe_edit_only"/>
@ -330,7 +226,7 @@
<tree string="Stock Moves">
<field name="name"/>
<field name="product_id"/>
<field name="product_qty" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/>
<field name="qty" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/>
<field name="location_id" groups="stock.group_locations"/>
</tree>
</field>
@ -358,8 +254,6 @@
<field name="arch" type="xml">
<search string="Product Lots Filter">
<field name="name" string="Product Lots" filter_domain="['|','|',('name','ilike',self),('ref','ilike',self)]"/>
<field name="date"/>
<filter icon="terp-check" name="available" string="Available" domain="[('stock_available', '&gt;', 0)]" help="Available Product Lots"/>
<field name="product_id"/>
<group expand="0" string="Group By...">
<filter string="Product" icon="terp-accessories-archiver" domain="[]" context="{'group_by':'product_id'}"/>
@ -405,8 +299,6 @@
<field name="product_id"/>
<field name="product_qty"/>
<field name="product_uom" string="Unit of Measure" groups="product.group_uom"/>
<field name="prodlot_id" groups="stock.group_production_lot"/>
<field name="tracking_id" groups="stock.group_tracking_lot"/>
<field name="product_packaging" domain="[('product_id','=',product_id)]" groups="product.group_stock_packaging"/>
<field name="picking_id"/>
<field name="location_id" groups="stock.group_locations"/>
@ -427,8 +319,6 @@
<field name="product_id"/>
<field name="product_qty"/>
<field name="product_uom" string="Unit of Measure" groups="product.group_uom"/>
<field name="prodlot_id" groups="stock.group_production_lot"/>
<field name="tracking_id" groups="stock.group_tracking_lot"/>
<field name="product_packaging" domain="[('product_id','=',product_id)]" groups="product.group_stock_packaging"/>
<field name="picking_id"/>
<field name="location_id" groups="stock.group_locations"/>
@ -490,15 +380,6 @@
<field name="scrap_location"/>
<field name="active"/>
</group>
<group string="Chained Locations">
<field name="chained_location_type"/>
<field name="chained_location_id" attrs="{'required':[('chained_location_type','=','fixed')],'invisible':[('chained_location_type','in',['none','customer'])]}"/>
<field name="chained_auto_packing"/>
<field name="chained_delay"/>
<field name="chained_journal_id"/>
<field name="chained_picking_type"/>
<field name="chained_company_id" widget="selection"/>
</group>
<group string="Localization">
<field name="posx"/>
<field name="posy"/>
@ -537,8 +418,6 @@
<tree string="Stock Location" colors="blue:usage=='view';darkred:usage=='internal'">
<field name="complete_name"/>
<field name="usage"/>
<field name="stock_real" invisible="'product_id' not in context"/>
<field name="stock_virtual" invisible="'product_id' not in context"/>
</tree>
</field>
</record>
@ -1090,20 +969,6 @@
string="Scrap Products" type="action"
icon="terp-gtk-jump-to-ltr" context="{'scrap': True}"
states="draft,waiting,confirmed,assigned"/>
<field name="prodlot_id" groups="stock.group_production_lot"/>
<button name="%(track_line)d" string="Split in Serial Numbers" type="action"
icon="gtk-justify-fill" attrs="{'invisible': [('prodlot_id','&lt;&gt;',False)]}"
states="draft,waiting,confirmed,assigned,done"
groups="stock.group_tracking_lot"/>
<field name="tracking_id" groups="stock.group_tracking_lot"/>
<button name="setlast_tracking" string="Put in current pack" type="object"
groups="product.group_stock_packaging"
icon="terp-accessories-archiver" attrs="{'invisible': [('tracking_id','&lt;&gt;',False)]}"
states="draft,assigned,confirmed,done"/>
<button name="%(split_into)d" string="Put in a new pack" type="action"
groups="product.group_stock_packaging"
icon="terp-accessories-archiver+"
states="draft,assigned,confirmed,done"/>
<field name="location_id" groups="stock.group_locations"/>
<field name="location_dest_id" groups="stock.group_locations"/>
<field name="date" groups="base.group_no_one"/>
@ -1134,25 +999,8 @@
states="draft,waiting,confirmed,assigned"
groups="base.group_user"/>
<field name="scrapped" invisible="1"/>
<field name="prodlot_id" groups="stock.group_production_lot"/>
<button
name="%(stock.track_line)d"
string="Split in Serial Number"
groups="stock.group_production_lot"
type="action" icon="gtk-justify-fill"
states="draft,waiting,confirmed,assigned"/>
<field groups="stock.group_tracking_lot" name="tracking_id"/>
<button name="setlast_tracking" string="Put in current pack" type="object"
attrs="{'invisible': [('tracking_id','&lt;&gt;',False)]}"
icon="terp-accessories-archiver"
groups="stock.group_tracking_lot"
states="draft,assigned,confirmed"/>
<button name="%(split_into)d" string="Put in a new pack" type="action"
groups="product.group_stock_packaging"
icon="terp-accessories-archiver+"
states="draft,assigned,confirmed"/>
<field name="location_dest_id" groups="stock.group_locations"/>
<field name="state"/>
<field name="location_dest_id" groups="stock.group_locations"/>
<field name="state"/>
</tree>
</field>
</record>
@ -1210,27 +1058,6 @@
<field name="date_expected" on_change="onchange_date(date,date_expected)" attrs="{'invisible': [('state', '=', 'done')]}"/>
<field name="date" attrs="{'invisible': [('state', '!=', 'done')]}"/>
</group>
<group string="Traceability"
groups="stock.group_tracking_lot">
<label for="tracking_id" groups="stock.group_tracking_lot"/>
<div groups="stock.group_tracking_lot">
<field name="tracking_id" class="oe_inline"/>
<button name="%(split_into)d" string="New Pack" type="action"
groups="product.group_stock_packaging"
icon="terp-accessories-archiver+"
states="draft,assigned,confirmed"/>
</div>
<label for="prodlot_id" groups="stock.group_production_lot"/>
<div groups="stock.group_production_lot">
<field name="prodlot_id"
context="{'location_id':location_id, 'product_id':product_id}"
domain="[('product_id','=?',product_id)]" class="oe_inline"
on_change="onchange_lot_id(prodlot_id,product_qty, location_id, product_id, product_uom)"/>
<button name="%(track_line)d"
states="draft,waiting,confirmed,assigned"
string="Split" type="action" icon="gtk-justify-fill"/>
</div>
</group>
</group>
</sheet>
</form>
@ -1283,29 +1110,6 @@
<field name="location_dest_id" domain="[('usage','=','internal')]" groups="stock.group_locations"/>
</group>
<group groups="stock.group_tracking_lot" string="Traceability">
<label for="tracking_id"/>
<div>
<field name="tracking_id" groups="stock.group_tracking_lot" class="oe_inline"/>
<button name="%(split_into)d"
string="New Pack" type="action"
groups="product.group_stock_packaging"
icon="terp-accessories-archiver+"
states="draft,assigned,confirmed"/>
</div>
<label for="prodlot_id"/>
<div>
<field name="prodlot_id" groups="stock.group_production_lot"
context="{'location_id':location_id, 'product_id':product_id}"
domain="[('product_id','=?',product_id)]"
on_change="onchange_lot_id(prodlot_id,product_qty, location_id, product_id, product_uom)" class="oe_inline"/>
<button name="%(track_line)d"
groups="stock.group_tracking_lot"
states="draft,waiting,confirmed,assigned"
string="Split" type="action" icon="gtk-justify-fill"/>
</div>
</group>
</group>
</form>
</field>
@ -1328,12 +1132,9 @@
<field name="product_id"/>
<field name="name" string="Location" filter_domain="['|',('location_id','ilike',self),('location_dest_id','ilike',self)]"/>
<field name="partner_id" string="Partner" filter_domain="[('picking_id.partner_id','child_of',self)]"/>
<field name="prodlot_id"/>
<group expand="0" string="Group By...">
<filter string="Product" name="by_product" icon="terp-accessories-archiver" domain="[]" context="{'group_by':'product_id'}"/>
<filter string="Picking" name="groupby_picking_id" icon="terp-accessories-archiver" domain="[]" context="{'group_by':'picking_id'}"/>
<filter string="Serial Number" name="groupby_prodlot_id" icon="terp-accessories-archiver" domain="[]" context="{'group_by':'prodlot_id'}"/>
<filter string="Pack" name="groupby_tracking_id" icon="terp-accessories-archiver" domain="[]" context="{'group_by':'tracking_id'}"/>
<filter string="Source" name="groupby_location_id" icon="terp-gtk-jump-to-rtl" domain="[]" context="{'group_by':'location_id'}" groups="stock.group_locations"/>
<filter string="Destination" name="groupby_dest_location_id" icon="terp-gtk-jump-to-ltr" domain="[]" context="{'group_by':'location_dest_id'}" groups="stock.group_locations"/>
<filter icon="terp-stock_effects-object-colorize" string="Status" domain="[]" context="{'group_by':'state'}"/>
@ -1404,21 +1205,6 @@
string="Scrap Products" type="action"
icon="terp-gtk-jump-to-ltr" context="{'scrap': True}"
states="draft,waiting,confirmed,assigned"/>
<field name="prodlot_id" groups="stock.group_production_lot"/>
<button name="%(track_line)d" string="Split in Serial Numbers" type="action"
icon="gtk-justify-fill" attrs="{'invisible': [('prodlot_id','&lt;&gt;',False)]}"
states="draft,waiting,confirmed,assigned,done"
groups="stock.group_tracking_lot"/>
<field name="tracking_id" groups="stock.group_tracking_lot"/>
<button name="setlast_tracking" string="Put in current pack" type="object"
attrs="{'invisible': [('tracking_id','&lt;&gt;',False)]}"
groups="product.group_stock_packaging"
icon="terp-accessories-archiver"
states="draft,assigned,confirmed,done"/>
<button name="%(split_into)d" string="Put in a new pack" type="action"
groups="product.group_stock_packaging"
icon="terp-accessories-archiver+"
states="draft,assigned,confirmed,done"/>
<field name="state"/>
<button name="%(action_partial_move_server)d"
icon="terp-stock_effects-object-colorize" type="action"

View File

@ -22,7 +22,7 @@
location_id: location_refrigerator_small
new_quantity: 10
product_id: product_icecream
prodlot_id: lot_icecream_1
lot_id: lot_icecream_1
-
!python {model: stock.change.product.qty}: |
self.change_product_qty(cr, uid, [ref('change_qty')], context=context)
@ -65,7 +65,7 @@
assert len(inventory.move_ids) == len(inventory.inventory_line_id), "moves are not correspond."
for move_line in inventory.move_ids:
for line in inventory.inventory_line_id:
if move_line.product_id.id == line.product_id.id and move_line.prodlot_id.id == line.prod_lot_id.id:
if move_line.product_id.id == line.product_id.id and move_line.lot_id.id == line.prod_lot_id.id:
location_id = line.product_id.property_stock_inventory.id
assert move_line.product_qty == line.product_qty, "Qty is not correspond."
assert move_line.product_uom.id == line.product_uom.id, "UOM is not correspond."
@ -83,9 +83,9 @@
use_exist: True
line_exist_ids:
- quantity: 6
prodlot_id: lot_icecream_0
lot_id: lot_icecream_0
- quantity: 4
prodlot_id: lot_icecream_0
lot_id: lot_icecream_0
-
!python {model: stock.inventory.line.split }: |
self.split_lot(cr, uid, [ref('split_inventory_lot0')], context=context)

View File

@ -147,10 +147,10 @@
lot = self.pool.get('stock.move.split').browse(cr, uid, ref('split_lot_incomming'), context=context)
lot_ids = self.pool.get('stock.production.lot').search(cr, uid, [('name','in',[x.name for x in lot.line_ids])])
assert len(lot_ids) == 4, 'lots of incomming shipment are not correspond.'
move_ids = self.search(cr, uid, [('location_dest_id','=',ref('location_refrigerator')),('prodlot_id','in',lot_ids)])
move_ids = self.search(cr, uid, [('location_dest_id','=',ref('location_refrigerator')),('lot_id','in',lot_ids)])
assert len(move_ids) == 4, 'move lines are not correspond per prodcution lot after splited.'
for move in self.browse(cr, uid, move_ids, context=context):
assert move.prodlot_id.name in ['incoming_lot0', 'incoming_lot1', 'incoming_lot2', 'incoming_lot3'], "lot does not correspond."
assert move.lot_id.name in ['incoming_lot0', 'incoming_lot1', 'incoming_lot2', 'incoming_lot3'], "lot does not correspond."
assert move.product_qty == 10, "qty does not correspond per production lot."
context.update({'active_model':'stock.move', 'active_id':move_ids[0],'active_ids': move_ids})
-

View File

@ -30,7 +30,7 @@ class stock_change_product_qty(osv.osv_memory):
_columns = {
'product_id' : fields.many2one('product.product', 'Product'),
'new_quantity': fields.float('New Quantity on Hand', digits_compute=dp.get_precision('Product Unit of Measure'), required=True, help='This quantity is expressed in the Default Unit of Measure of the product.'),
'prodlot_id': fields.many2one('stock.production.lot', 'Serial Number', domain="[('product_id','=',product_id)]"),
'lot_id': fields.many2one('stock.production.lot', 'Serial Number', domain="[('product_id','=',product_id)]"),
'location_id': fields.many2one('stock.location', 'Location', required=True, domain="[('usage', '=', 'internal')]"),
}
@ -41,7 +41,7 @@ class stock_change_product_qty(osv.osv_memory):
if view_type == 'form' and (context.get('active_model') == 'product.product') and product_id:
prod_obj = self.pool.get('product.product').browse(cr, uid, product_id, context=context)
fvg['fields']['prodlot_id']['required'] = prod_obj.track_production
fvg['fields']['lot_id']['required'] = prod_obj.track_production
return fvg
@ -96,7 +96,7 @@ class stock_change_product_qty(osv.osv_memory):
'location_id' : data.location_id.id,
'product_id' : rec_id,
'product_uom' : res_original.uom_id.id,
'prod_lot_id' : data.prodlot_id.id
'prod_lot_id' : data.lot_id.id
}
inventry_line_obj.create(cr , uid, line_data, context=context)

View File

@ -10,7 +10,7 @@
<field name="new_quantity" />
<field name="product_id" invisible="1"/>
<field name="location_id" groups="stock.group_locations"/>
<field name="prodlot_id" context="{'search_default_product_id':product_id,'default_product_id':product_id}" groups="stock.group_tracking_lot"/>
<field name="lot_id" context="{'search_default_product_id':product_id,'default_product_id':product_id}" groups="stock.group_tracking_lot"/>
</group>
<footer>
<button name="change_product_qty" string="_Apply" type="object" class="oe_highlight"/>

View File

@ -102,7 +102,7 @@ class stock_fill_inventory(osv.osv_memory):
move_ids = move_obj.search(cr, uid, ['|',('location_dest_id','=',location),('location_id','=',location),('state','=','done')], context=context)
for move in move_obj.browse(cr, uid, move_ids, context=context):
lot_id = move.prodlot_id.id
lot_id = move.lot_id.id
prod_id = move.product_id.id
if move.location_dest_id.id != move.location_id.id:
if move.location_dest_id.id == location:

View File

@ -83,16 +83,16 @@ class stock_inventory_line_split(osv.osv_memory):
new_line.append(current_line)
if quantity_rest == 0:
current_line = inv_line.id
prodlot_id = False
lot_id = False
if data.use_exist:
prodlot_id = line.prodlot_id.id
if not prodlot_id:
prodlot_id = prodlot_obj.create(cr, uid, {
lot_id = line.lot_id.id
if not lot_id:
lot_id = prodlot_obj.create(cr, uid, {
'name': line.name,
'product_id': inv_line.product_id.id},
context=context)
line_obj.write(cr, uid, [current_line], {'prod_lot_id': prodlot_id})
prodlot = prodlot_obj.browse(cr, uid, prodlot_id)
line_obj.write(cr, uid, [current_line], {'prod_lot_id': lot_id})
prodlot = prodlot_obj.browse(cr, uid, lot_id)
update_val = {}
if quantity_rest > 0:

View File

@ -29,12 +29,12 @@
</field>
<field name="line_exist_ids" attrs="{'invisible':[('use_exist','!=',True)]}">
<tree string="Lots Number" editable="bottom">
<field name="prodlot_id" string="Lots" domain="[('product_id','=',parent.product_id)]"/>
<field name="lot_id" string="Lots" domain="[('product_id','=',parent.product_id)]"/>
<field name="quantity" />
</tree>
<form string="Lots Number" version="7.0">
<group>
<field name="prodlot_id" string="Lots" domain="[('product_id','=',parent.product_id)]"/>
<field name="lot_id" string="Lots" domain="[('product_id','=',parent.product_id)]"/>
<field name="quantity" />
</group>
</form>

View File

@ -233,16 +233,16 @@ class split_in_production_lot(osv.osv_memory):
if quantity_rest == 0:
current_move = move.id
prodlot_id = False
lot_id = False
if data.use_exist:
prodlot_id = line.prodlot_id.id
if not prodlot_id:
prodlot_id = prodlot_obj.create(cr, uid, {
lot_id = line.lot_id.id
if not lot_id:
lot_id = prodlot_obj.create(cr, uid, {
'name': line.name,
'product_id': move.product_id.id},
context=context)
move_obj.write(cr, uid, [current_move], {'prodlot_id': prodlot_id, 'state':move.state})
move_obj.write(cr, uid, [current_move], {'lot_id': lot_id, 'state':move.state})
update_val = {}
if quantity_rest > 0:
@ -262,15 +262,15 @@ class stock_move_split_lines_exist(osv.osv_memory):
'quantity': fields.float('Quantity', digits_compute=dp.get_precision('Product Unit of Measure')),
'wizard_id': fields.many2one('stock.move.split', 'Parent Wizard'),
'wizard_exist_id': fields.many2one('stock.move.split', 'Parent Wizard (for existing lines)'),
'prodlot_id': fields.many2one('stock.production.lot', 'Serial Number'),
'lot_id': fields.many2one('stock.production.lot', 'Serial Number'),
}
_defaults = {
'quantity': 1.0,
}
def onchange_lot_id(self, cr, uid, ids, prodlot_id=False, product_qty=False,
def onchange_lot_id(self, cr, uid, ids, lot_id=False, product_qty=False,
loc_id=False, product_id=False, uom_id=False,context=None):
return self.pool.get('stock.move').onchange_lot_id(cr, uid, [], prodlot_id, product_qty,
return self.pool.get('stock.move').onchange_lot_id(cr, uid, [], lot_id, product_qty,
loc_id, product_id, uom_id, context)
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -98,13 +98,13 @@
</field>
<field name="line_exist_ids" attrs="{'invisible':[('use_exist','!=',True)]}">
<tree string="Serial Numbers" editable="bottom">
<field name="prodlot_id" string="Serial Number" quick_create="false" domain="[('product_id','=',parent.product_id)]" on_change="onchange_lot_id(prodlot_id, quantity, parent.location_id, parent.product_id, parent.product_uom, context)" context="{'product_id': parent.product_id}"/>
<field name="quantity" on_change="onchange_lot_id(prodlot_id, quantity, parent.location_id, parent.product_id, parent.product_uom,context)" />
<field name="lot_id" string="Serial Number" quick_create="false" domain="[('product_id','=',parent.product_id)]" on_change="onchange_lot_id(lot_id, quantity, parent.location_id, parent.product_id, parent.product_uom, context)" context="{'product_id': parent.product_id}"/>
<field name="quantity" on_change="onchange_lot_id(lot_id, quantity, parent.location_id, parent.product_id, parent.product_uom,context)" />
</tree>
<form string="Serial Number" version="7.0">
<group>
<field name="prodlot_id" domain="[('product_id','=',parent.product_id)]" on_change="onchange_lot_id(prodlot_id, quantity, parent.location_id, parent.product_id, parent.product_uom, context)"/>
<field name="quantity" on_change="onchange_lot_id(prodlot_id, quantity, parent.location_id, parent.product_id, parent.product_uom, context)" />
<field name="lot_id" domain="[('product_id','=',parent.product_id)]" on_change="onchange_lot_id(lot_id, quantity, parent.location_id, parent.product_id, parent.product_uom, context)"/>
<field name="quantity" on_change="onchange_lot_id(lot_id, quantity, parent.location_id, parent.product_id, parent.product_uom, context)" />
</group>
</form>
</field>

View File

@ -75,7 +75,7 @@ class stock_partial_move(osv.osv_memory):
'product_id': move.product_id.id,
'product_qty': move.quantity,
'product_uom': move.product_uom.id,
'prodlot_id': move.prodlot_id.id,
'lot_id': move.lot_id.id,
}
moves_ids.append(move_id)
if (move.move_id.picking_id.type == 'in') and (move.product_id.cost_method != 'standard'):

View File

@ -41,7 +41,7 @@
<field name="product_uom" groups="product.group_uom"/>
<field name="location_id" />
<field name="location_dest_id" />
<field name="prodlot_id" domain="[('product_id', '=', product_id)]" groups="stock.group_production_lot"/>
<field name="lot_id" domain="[('product_id', '=', product_id)]" groups="stock.group_production_lot"/>
<field name="update_cost" invisible="1"/>
<field name="cost" attrs="{'invisible': [('update_cost','=', False)]}"/>
<field name="currency" attrs="{'invisible': [('update_cost','=', False)]}" groups="base.group_multi_currency"/>
@ -60,7 +60,7 @@
<field name="product_uom" />
<field name="location_id" />
<field name="location_dest_id" />
<field name="prodlot_id" domain="[('product_id', '=', product_id)]"/>
<field name="lot_id" domain="[('product_id', '=', product_id)]"/>
<field name="update_cost" invisible="1"/>
<field name="cost" attrs="{'invisible': [('update_cost','=', False)]}"/>
<field name="currency" attrs="{'invisible': [('update_cost','=', False)]}" groups="base.group_multi_currency"/>

View File

@ -45,7 +45,7 @@ class stock_partial_picking_line(osv.TransientModel):
'product_id' : fields.many2one('product.product', string="Product", required=True, ondelete='CASCADE'),
'quantity' : fields.float("Quantity", digits_compute=dp.get_precision('Product Unit of Measure'), required=True),
'product_uom': fields.many2one('product.uom', 'Unit of Measure', required=True, ondelete='CASCADE'),
'prodlot_id' : fields.many2one('stock.production.lot', 'Serial Number', ondelete='CASCADE'),
'lot_id' : fields.many2one('stock.production.lot', 'Serial Number', ondelete='CASCADE'),
'location_id': fields.many2one('stock.location', 'Location', required=True, ondelete='CASCADE', domain = [('usage','<>','view')]),
'location_dest_id': fields.many2one('stock.location', 'Dest. Location', required=True, ondelete='CASCADE',domain = [('usage','<>','view')]),
'move_id' : fields.many2one('stock.move', "Move", ondelete='CASCADE'),
@ -148,7 +148,7 @@ class stock_partial_picking(osv.osv_memory):
'product_id': move.product_id.id,
'quantity': move.product_qty - move.remaining_qty if move.state == 'assigned' else 0,
'product_uom': move.product_uom.id,
'prodlot_id': move.prodlot_id.id,
'lot_id': move.lot_id.id,
'move_id': move.id,
'location_id': move.location_id.id,
'location_dest_id': move.location_dest_id.id,
@ -199,7 +199,7 @@ class stock_partial_picking(osv.osv_memory):
'product_id': wizard_line.product_id.id,
'product_qty': wizard_line.quantity,
'product_uom': wizard_line.product_uom.id,
'prodlot_id': wizard_line.prodlot_id.id,
'lot_id': wizard_line.lot_id.id,
'location_id' : wizard_line.location_id.id,
'location_dest_id' : wizard_line.location_dest_id.id,
'picking_id': partial.picking_id.id,
@ -210,7 +210,7 @@ class stock_partial_picking(osv.osv_memory):
'product_id': wizard_line.product_id.id,
'product_qty': wizard_line.quantity,
'product_uom': wizard_line.product_uom.id,
'prodlot_id': wizard_line.prodlot_id.id,
'lot_id': wizard_line.lot_id.id,
}
if (picking_type == 'in') and (wizard_line.product_id.cost_method != 'standard'):
partial_data['move%s' % (wizard_line.move_id.id)].update(product_price=wizard_line.cost,)

View File

@ -23,7 +23,7 @@
<field name="quantity" />
<field name="product_uom" groups="product.group_uom"/>
<field name="tracking" invisible="1"/>
<field name="prodlot_id" domain="[('product_id', '=', product_id)]" invisible="context.get('hide_tracking',False)" attrs="{'required':[('tracking','=',True), ('quantity', '!=', 0)]}" groups="stock.group_production_lot" context="{'default_product_id':product_id}"/>
<field name="lot_id" domain="[('product_id', '=', product_id)]" invisible="context.get('hide_tracking',False)" attrs="{'required':[('tracking','=',True), ('quantity', '!=', 0)]}" groups="stock.group_production_lot" context="{'default_product_id':product_id}"/>
<!-- Removed as this feature is not logic: price must be updated upon reception of invoice -->
<field name="update_cost" invisible="1"/>
<field name="cost" invisible="1"/>
@ -48,7 +48,7 @@
<field name="quantity" />
<field name="product_uom" />
<field name="tracking" invisible="1"/>
<field name="prodlot_id" domain="[('product_id', '=', product_id)]" attrs="{'required':[('tracking','=',True)]}"/>
<field name="lot_id" domain="[('product_id', '=', product_id)]" attrs="{'required':[('tracking','=',True)]}"/>
<!-- Removed as this feature is not logic: price must be updated upon reception of invoice -->
<field name="update_cost" invisible="1"/>
<field name="cost" invisible="1"/>
@ -68,7 +68,7 @@
<field name="location_id" />
<field name="location_dest_id" />
<field name="tracking" invisible="1"/>
<field name="prodlot_id" domain="[('product_id', '=', product_id)]" attrs="{'required':[('tracking','=',True)]}"/>
<field name="lot_id" domain="[('product_id', '=', product_id)]" attrs="{'required':[('tracking','=',True)]}"/>
<field name="update_cost" invisible="1"/>
<field name="cost" attrs="{'invisible': [('update_cost','=', False)]}"/>
<field name="currency" attrs="{'invisible': [('update_cost','=', False)]}" groups="base.group_multi_currency"/>

View File

@ -34,7 +34,7 @@ class stock_return_picking_memory(osv.osv_memory):
'quantity' : fields.float("Quantity", digits_compute=dp.get_precision('Product Unit of Measure'), required=True),
'wizard_id' : fields.many2one('stock.return.picking', string="Wizard"),
'move_id' : fields.many2one('stock.move', "Move"),
'prodlot_id': fields.related('move_id', 'prodlot_id', type='many2one', relation='stock.production.lot', string='Serial Number', readonly=True),
'lot_id': fields.related('move_id', 'lot_id', type='many2one', relation='stock.production.lot', string='Serial Number', readonly=True),
}
@ -75,7 +75,7 @@ class stock_return_picking(osv.osv_memory):
for line in pick.move_lines:
qty = line.product_qty - return_history.get(line.id, 0)
if qty > 0:
result1.append({'product_id': line.product_id.id, 'quantity': qty,'move_id':line.id, 'prodlot_id': line.prodlot_id and line.prodlot_id.id or False})
result1.append({'product_id': line.product_id.id, 'quantity': qty,'move_id':line.id, 'lot_id': line.lot_id and line.lot_id.id or False})
if 'product_return_moves' in fields:
res.update({'product_return_moves': result1})
return res

View File

@ -32,7 +32,7 @@
<field name="arch" type="xml">
<tree editable="bottom" string="Product Moves">
<field name="product_id" />
<field name="prodlot_id" groups="stock.group_production_lot"/>
<field name="lot_id" groups="stock.group_production_lot"/>
<field name="quantity" />
</tree>
</field>
@ -45,7 +45,7 @@
<form string="Return Picking Memory" version="7.0">
<group col="4">
<field name="product_id" />
<field name="prodlot_id" groups="stock.group_production_lot"/>
<field name="lot_id" groups="stock.group_production_lot"/>
<field name="quantity" />
</group>
</form>