[WIP] Add owner on quants and pack operations. Add owner option in warehouse settings. Change purchase_id on picking.
bzr revid: jco@openerp.com-20130830132507-oqrixcaxqjzuboyb
This commit is contained in:
@@ -13,12 +13,12 @@
|
||||
</record>
|
||||
|
||||
<record id="stock_picking_in_inherit_purchase" model="ir.ui.view">
|
||||
<field name="name">Incoming Picking Inherited</field>
|
||||
<field name="name">Picking Inherited</field>
|
||||
<field name="model">stock.picking</field>
|
||||
<field name="inherit_id" ref="stock.view_picking_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='date']" position="before">
|
||||
<field name="purchase_id" domain="[('invoice_method','=','picking')]" context="{'search_default_partner_id':partner_id,'default_partner_id':partner_id, 'default_invoice_method':'picking'}"/>
|
||||
<xpath expr="//field[@name='move_type']" position="before">
|
||||
<field name="purchase_id" domain="[('invoice_method','=','picking')]" groups="base.group_no_one" context="{'search_default_partner_id':partner_id,'default_partner_id':partner_id, 'default_invoice_method':'picking'}"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='company_id']" position="after">
|
||||
<field name="warehouse_id" groups="stock.group_locations"/>
|
||||
|
||||
@@ -62,6 +62,9 @@ This installs the module product_expiry."""),
|
||||
'group_stock_tracking_lot': fields.boolean("Track serial number on logistic units (pallets)",
|
||||
implied_group='stock.group_tracking_lot',
|
||||
help="""When you select a serial number on product moves, you can get the upstream or downstream traceability of that product."""),
|
||||
'group_stock_tracking_owner': fields.boolean("Manage owner on stock",
|
||||
implied_group='stock.group_tracking_owner',
|
||||
help="""This way you can receive products attributed to a certain owner. """),
|
||||
'module_stock_account': fields.boolean("Generate accounting entries per stock movement",
|
||||
implied_group='stock.group_inventory_valuation',
|
||||
help="""Allows to configure inventory valuations on products and product categories."""),
|
||||
|
||||
@@ -38,6 +38,10 @@
|
||||
<field name="group_stock_tracking_lot" class="oe_inline"/>
|
||||
<label for="group_stock_tracking_lot"/>
|
||||
</div>
|
||||
<div>
|
||||
<field name="group_stock_tracking_owner" class="oe_inline"/>
|
||||
<label for="group_stock_tracking_owner"/>
|
||||
</div>
|
||||
</div>
|
||||
</group>
|
||||
<separator string="Accounting"/>
|
||||
|
||||
@@ -29,6 +29,11 @@
|
||||
<field name="category_id" ref="base.module_category_hidden"/>
|
||||
</record>
|
||||
|
||||
<record id="group_tracking_owner" model="res.groups">
|
||||
<field name="name">Manage Different Stock Owners</field>
|
||||
<field name="category_id" ref="base.module_category_hidden"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
<data noupdate="1">
|
||||
<!-- multi -->
|
||||
|
||||
+21
-10
@@ -157,7 +157,7 @@ class stock_quant(osv.osv):
|
||||
'reservation_id': fields.many2one('stock.move', 'Reserved for Move', help="Is this quant reserved for a stock.move?"),
|
||||
'lot_id': fields.many2one('stock.production.lot', 'Lot'),
|
||||
'cost': fields.float('Unit Cost'),
|
||||
'partner_id': fields.related('lot_id', 'partner_id', type='many2one', relation="res.partner", string="Owner", store=True), # TODO implement store={}
|
||||
'owner_id': fields.many2one('res.partner', 'Owner', help="This is the owner of the quant"),
|
||||
|
||||
'create_date': fields.datetime('Creation Date'),
|
||||
'in_date': fields.datetime('Incoming Date'),
|
||||
@@ -653,9 +653,11 @@ class stock_picking(osv.osv):
|
||||
'product_qty': qty,
|
||||
'quant_id': quant.id,
|
||||
'product_id': quant.product_id.id,
|
||||
'lot_id': quant.lot_id.id,
|
||||
'lot_id': quant.lot_id and quant.lot_id.id or False,
|
||||
'product_uom_id': quant.product_id.uom_id.id,
|
||||
'owner_id': quant.owner_id and quant.owner_id.id or False,
|
||||
'cost': quant.cost,
|
||||
'package_id': quant.package_id and quant.package_id.id or False,
|
||||
}, context=context)
|
||||
if remaining_qty > 0:
|
||||
pack_operation_obj.create(cr, uid, {
|
||||
@@ -750,7 +752,8 @@ class stock_picking(osv.osv):
|
||||
'history_ids': [(4, move.id)],
|
||||
'in_date': datetime.now().strftime('%Y-%m-%d %H:%M:%S'),
|
||||
'company_id': move.company_id.id,
|
||||
'lot_id': ops.lot_id and ops.lot_id.id or False,
|
||||
'lot_id': ops.lot_id and ops.lot_id.id or False,
|
||||
'owner_id': ops.owner_id and ops.owner_id.id or False,
|
||||
'reservation_id': move.id, #Reserve at once
|
||||
'package_id': ops.result_package_id and ops.result_package_id.id or False,
|
||||
}
|
||||
@@ -929,7 +932,7 @@ class stock_production_lot(osv.osv):
|
||||
'product_id': fields.many2one('product.product', 'Product', required=True, domain=[('type', '<>', 'service')]),
|
||||
'quant_ids': fields.one2many('stock.quant', 'lot_id', 'Quants'),
|
||||
'create_date': fields.datetime('Creation Date'),
|
||||
'partner_id': fields.many2one('res.partner', 'Owner'),
|
||||
# 'partner_id': fields.many2one('res.partner', 'Owner'),
|
||||
}
|
||||
_defaults = {
|
||||
'name': lambda x, y, z, c: x.pool.get('ir.sequence').get(y, z, 'stock.lot.serial'),
|
||||
@@ -942,8 +945,8 @@ class stock_production_lot(osv.osv):
|
||||
res = []
|
||||
for lot in self.browse(cr, uid, ids, context=context):
|
||||
name = lot.name
|
||||
if lot.partner_id:
|
||||
name += ' (' + lot.partner_id.name + ')'
|
||||
# if lot.partner_id:
|
||||
# name += ' (' + lot.partner_id.name + ')'
|
||||
res.append((lot.id, name))
|
||||
return res
|
||||
|
||||
@@ -1654,7 +1657,7 @@ class stock_move(osv.osv):
|
||||
}, context=context)
|
||||
|
||||
if move.move_dest_id and move.propagate:
|
||||
self.split(self, cr, uid, move.move_dest_id, qty, context=context)
|
||||
self.split(cr, uid, move.move_dest_id, qty, context=context)
|
||||
return new_move
|
||||
|
||||
class stock_inventory(osv.osv):
|
||||
@@ -2079,6 +2082,7 @@ class stock_pack_operation(osv.osv):
|
||||
'lot_id': fields.many2one('stock.production.lot', 'Lot/Serial Number'),
|
||||
'result_package_id': fields.many2one('stock.quant.package', 'Container Package', help="If set, the operations are packed into this package", required=False, ondelete='cascade'),
|
||||
'date': fields.datetime('Date', required=True),
|
||||
'owner_id': fields.many2one('res.partner', 'Owner', help="Owner of the quants"),
|
||||
#'update_cost': fields.boolean('Need cost update'),
|
||||
'cost': fields.float("Cost", help="Unit Cost for this product line"),
|
||||
'currency': fields.many2one('res.currency', string="Currency", help="Currency in which Unit cost is expressed", ondelete='CASCADE'),
|
||||
@@ -2095,9 +2099,16 @@ class stock_pack_operation(osv.osv):
|
||||
res += "package_id <> " + str(ops.package_id.id)
|
||||
if ops.lot_id:
|
||||
if res:
|
||||
res += ", lot_id <> " + str(ops.lot_id.id)
|
||||
else:
|
||||
res += "lot_id <> " + str(ops.lot_id.id)
|
||||
res += ", "
|
||||
res += "lot_id <> " + str(ops.lot_id.id)
|
||||
if ops.owner_id:
|
||||
if res:
|
||||
res += ", "
|
||||
res += "owner_id <> " + str(ops.owner_id.id)
|
||||
else:
|
||||
if res:
|
||||
res += ", "
|
||||
res += "owner_id IS NOT NULL"
|
||||
return res
|
||||
|
||||
|
||||
|
||||
@@ -614,11 +614,12 @@
|
||||
<field name="pack_operation_ids" attrs="{'invisible': [('pack_operation_exist', '=', False)]}">
|
||||
<tree editable="top">
|
||||
<field name="product_id"/>
|
||||
<field name="product_uom_id"/>
|
||||
<field name="lot_id"/>
|
||||
<field name="package_id"/>
|
||||
<field name="product_uom_id" groups="product.group_uom"/>
|
||||
<field name="lot_id" groups="stock.group_production_lot"/>
|
||||
<field name="package_id" groups="stock.group_tracking_lot"/>
|
||||
<field name="owner_id" groups="stock.group_tracking_owner"/>
|
||||
<field name="product_qty"/>
|
||||
<field name="result_package_id"/>
|
||||
<field name="result_package_id" groups="stock.group_tracking_lot"/>
|
||||
</tree>
|
||||
</field>
|
||||
<field name="move_lines" context="{'address_in_id': partner_id, 'form_view_ref':'view_move_picking_form', 'tree_view_ref':'view_move_picking_tree', 'default_picking_type_id': picking_type_id}"/>
|
||||
@@ -1544,6 +1545,7 @@
|
||||
<field name="reservation_id"/>
|
||||
<field name="propagated_from_id"/>
|
||||
<field name="history_ids"/>
|
||||
<field name="owner_id"/>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
Reference in New Issue
Block a user