Merge pull request #1663 from odoo-dev/8.0-wmsstaging5-jco
8.0 wmsstaging5 jco various fixes from support and github issues
This commit is contained in:
@@ -15,16 +15,12 @@
|
||||
</group>
|
||||
<group name="properties">
|
||||
<group>
|
||||
<field name="property_account_income" domain="[('type','=','other')]" groups="account.group_account_user"
|
||||
attrs="{'readonly': [('is_product_variant', '=', True)]}"/>
|
||||
<field name="taxes_id" colspan="2" widget="many2many_tags"
|
||||
attrs="{'readonly':[('sale_ok','=',0)]}"/>
|
||||
<field name="property_account_income" domain="[('type','=','other')]" groups="account.group_account_user"/>
|
||||
<field name="taxes_id" colspan="2" widget="many2many_tags"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="property_account_expense" domain="[('type','=','other')]" groups="account.group_account_user"
|
||||
attrs="{'readonly': [('is_product_variant', '=', True)]}"/>
|
||||
<field name="supplier_taxes_id" colspan="2" widget="many2many_tags"
|
||||
attrs="{'readonly': [('is_product_variant', '=', True)]}"/>
|
||||
<field name="property_account_expense" domain="[('type','=','other')]" groups="account.group_account_user"/>
|
||||
<field name="supplier_taxes_id" colspan="2" widget="many2many_tags"/>
|
||||
</group>
|
||||
</group>
|
||||
</page>
|
||||
|
||||
@@ -720,7 +720,7 @@
|
||||
<field name="move_lines" nolabel="1" options="{'reload_on_button': true}">
|
||||
<tree colors="blue:state == 'draft';black:state in ('ready','assigned','in_production');gray:state in ('cancel','done');red:state in ('confirmed','waiting')" string="Products to Consume">
|
||||
<field name="product_id"/>
|
||||
<field name="product_qty" string="Quantity"/>
|
||||
<field name="product_uom_qty" string="Quantity"/>
|
||||
<field name="product_uom" string="Unit of Measure" groups="product.group_uom"/>
|
||||
<field name="state" invisible="1"/>
|
||||
<button name="%(mrp.move_consume)d"
|
||||
@@ -740,7 +740,7 @@
|
||||
<tree colors="red:scrapped==True;blue:state == 'draft';black:state in ('confirmed','ready','in_production');gray:state == 'cancel' " string="Consumed Products" editable="bottom">
|
||||
<field name="product_id" readonly="1"/>
|
||||
<field name="restrict_lot_id" context="{'product_id': product_id}" groups="stock.group_production_lot"/>
|
||||
<field name="product_qty" readonly="1"/>
|
||||
<field name="product_uom_qty" readonly="1"/>
|
||||
<field name="product_uom" readonly="1" string="Unit of Measure" groups="product.group_uom"/>
|
||||
<field name="state" invisible="1"/>
|
||||
<field name="scrapped" invisible="1"/>
|
||||
@@ -755,7 +755,7 @@
|
||||
<field name="move_created_ids" nolabel="1" options="{'reload_on_button': true}">
|
||||
<tree string="Products to Finish">
|
||||
<field name="product_id"/>
|
||||
<field name="product_qty"/>
|
||||
<field name="product_uom_qty"/>
|
||||
<field name="product_uom" string="Unit of Measure" groups="product.group_uom"/>
|
||||
<field name="state" invisible="1"/>
|
||||
<!--TODO: should have a partial picking here-->
|
||||
@@ -766,7 +766,7 @@
|
||||
<field name="move_created_ids2" nolabel="1" options="{'reload_on_button': true}">
|
||||
<tree colors="red:scrapped==True;blue:state == 'draft';black:state in('confirmed','ready','in_production');gray:state in('cancel','done') " string="Finished Products">
|
||||
<field name="product_id" readonly="1"/>
|
||||
<field name="product_qty" readonly="1"/>
|
||||
<field name="product_uom_qty" readonly="1"/>
|
||||
<field name="restrict_lot_id" groups="stock.group_production_lot"/>
|
||||
<field name="product_uom" readonly="1" string="Unit of Measure" groups="product.group_uom"/>
|
||||
<field name="location_dest_id" readonly="1" string="Destination Loc." widget="selection" groups="stock.group_locations"/>
|
||||
|
||||
@@ -51,6 +51,7 @@
|
||||
<field name="act_from" ref="prod_act_draft"/>
|
||||
<field name="act_to" ref="prod_act_confirmed"/>
|
||||
<field name="signal">button_confirm</field>
|
||||
<field name="condition">True</field>
|
||||
</record>
|
||||
<record id="prod_trans_picking_ready" model="workflow.transition">
|
||||
<field name="act_from" ref="prod_act_confirmed"/>
|
||||
|
||||
@@ -56,8 +56,11 @@ class product_template(osv.osv):
|
||||
def action_view_mos(self, cr, uid, ids, context=None):
|
||||
products = self._get_products(cr, uid, ids, context=context)
|
||||
result = self._get_act_window_dict(cr, uid, 'mrp.act_product_mrp_production', context=context)
|
||||
result['domain'] = "[('product_id','in',[" + ','.join(map(str, products)) + "])]"
|
||||
result['context'] = "{}"
|
||||
if len(ids) == 1 and len(products) == 1:
|
||||
result['context'] = "{'default_product_id': " + str(products[0]) + ", 'search_default_product_id': " + str(products[0]) + "}"
|
||||
else:
|
||||
result['domain'] = "[('product_id','in',[" + ','.join(map(str, products)) + "])]"
|
||||
result['context'] = "{}"
|
||||
return result
|
||||
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
'default_subject': name,
|
||||
'default_name': name,
|
||||
}"
|
||||
attrs="{'invisible': [('is_product_variant', '=', False)]}"
|
||||
/>
|
||||
</field>
|
||||
</field>
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
<field name="mobile" position="after">
|
||||
<field name="purchase_order_count"/>
|
||||
</field>
|
||||
|
||||
<xpath expr="//div[@class='oe_kanban_partner_links']" position="inside">
|
||||
<a name="%(purchase.act_res_partner_2_purchase_order)d" type="action" t-if="record.purchase_order_count.value>0">
|
||||
<t t-esc="record.purchase_order_count.value"/> Purchases
|
||||
@@ -80,7 +81,8 @@
|
||||
<field string="Purchases" name="purchase_order_count" widget="statinfo"/>
|
||||
</button>
|
||||
<button class="oe_inline oe_stat_button" name="%(purchase.act_res_partner_2_supplier_invoices)d" type="action"
|
||||
attrs="{'invisible': [('supplier', '=', False)]}" icon="fa-pencil-square-o" help="Supplier Invoices">
|
||||
attrs="{'invisible': [('supplier', '=', False)]}" icon="fa-pencil-square-o" help="Supplier Invoices"
|
||||
groups="account.group_account_user,account.group_account_manager">
|
||||
<field string="Supplier Inv." name="supplier_invoice_count" widget="statinfo"/>
|
||||
</button>
|
||||
</xpath>
|
||||
|
||||
+10
-4
@@ -421,16 +421,22 @@ class product_template(osv.osv):
|
||||
def action_view_orderpoints(self, cr, uid, ids, context=None):
|
||||
products = self._get_products(cr, uid, ids, context=context)
|
||||
result = self._get_act_window_dict(cr, uid, 'stock.product_open_orderpoint', context=context)
|
||||
result['domain'] = "[('product_id','in',[" + ','.join(map(str, products)) + "])]"
|
||||
result['context'] = "{}"
|
||||
if len(ids) == 1 and len(products) == 1:
|
||||
result['context'] = "{'default_product_id': " + str(products[0]) + ", 'search_default_product_id': " + str(products[0]) + "}"
|
||||
else:
|
||||
result['domain'] = "[('product_id','in',[" + ','.join(map(str, products)) + "])]"
|
||||
result['context'] = "{}"
|
||||
return result
|
||||
|
||||
|
||||
def action_view_stock_moves(self, cr, uid, ids, context=None):
|
||||
products = self._get_products(cr, uid, ids, context=context)
|
||||
result = self._get_act_window_dict(cr, uid, 'stock.act_product_stock_move_open', context=context)
|
||||
result['domain'] = "[('product_id','in',[" + ','.join(map(str, products)) + "])]"
|
||||
result['context'] = "{}"
|
||||
if len(ids) == 1 and len(products) == 1:
|
||||
result['context'] = "{'default_product_id': " + str(products[0]) + ", 'search_default_product_id': " + str(products[0]) + "}"
|
||||
else:
|
||||
result['domain'] = "[('product_id','in',[" + ','.join(map(str, products)) + "])]"
|
||||
result['context'] = "{}"
|
||||
return result
|
||||
|
||||
|
||||
|
||||
@@ -162,8 +162,8 @@
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu" role="menu">
|
||||
<t t-if="!row.cols.lot && row.cols.product_id">
|
||||
<li><a class="js_create_lot" href="#">Create Lot</a></li>
|
||||
<t t-if="row.cols.product_id">
|
||||
<li><a class="js_create_lot" href="#">Create / Change Lot</a></li>
|
||||
</t>
|
||||
<t t-if="!row.cols.head_container && !row.cols.container">
|
||||
<li><a class="js_change_src" href="#">Change source location</a></li>
|
||||
|
||||
+39
-37
@@ -1209,7 +1209,7 @@ class stock_picking(osv.osv):
|
||||
|
||||
#check if the quant is matching the operation details
|
||||
if ops.package_id:
|
||||
flag = quant.package_id and bool(package_obj.search(cr, uid, [('id', 'child_of', [ops.package_id.id]), ('id', '=', quant.package_id.id)], context=context)) or False
|
||||
flag = quant.package_id and bool(package_obj.search(cr, uid, [('id', 'child_of', [ops.package_id.id])], context=context)) or False
|
||||
else:
|
||||
flag = not quant.package_id.id
|
||||
flag = flag and ((ops.lot_id and ops.lot_id.id == quant.lot_id.id) or not ops.lot_id)
|
||||
@@ -1384,8 +1384,8 @@ class stock_picking(osv.osv):
|
||||
stock_operation_obj.write(cr, uid, operation.id, {'product_qty': operation.product_qty - operation.qty_done,'qty_done': 0, 'lot_id': False}, context=context)
|
||||
op = stock_operation_obj.browse(cr, uid, new_operation, context=context)
|
||||
pack_operation_ids.append(op.id)
|
||||
for record in op.linked_move_operation_ids:
|
||||
stock_move_obj.check_tracking(cr, uid, record.move_id, op.package_id.id or op.lot_id.id, context=context)
|
||||
if op.product_id and op.location_id and op.location_dest_id:
|
||||
stock_move_obj.check_tracking_product(cr, uid, op.product_id, op.lot_id.id, op.location_id, op.location_dest_id, context=context)
|
||||
package_id = package_obj.create(cr, uid, {}, context=context)
|
||||
stock_operation_obj.write(cr, uid, pack_operation_ids, {'result_package_id': package_id}, context=context)
|
||||
return True
|
||||
@@ -1804,8 +1804,8 @@ class stock_move(osv.osv):
|
||||
if wh_route_ids:
|
||||
rules = push_obj.search(cr, uid, domain + [('route_id', 'in', wh_route_ids)], order='route_sequence, sequence', context=context)
|
||||
if not rules:
|
||||
#if no specialized push rule has been found yet, we try to find a general one
|
||||
rules = push_obj.search(cr, uid, domain, order='route_sequence, sequence', context=context)
|
||||
#if no specialized push rule has been found yet, we try to find a general one (without route)
|
||||
rules = push_obj.search(cr, uid, domain + [('route_id', '=', False)], order='sequence', context=context)
|
||||
if rules:
|
||||
rule = push_obj.browse(cr, uid, rules[0], context=context)
|
||||
push_obj._apply(cr, uid, rule, move, context=context)
|
||||
@@ -2052,18 +2052,23 @@ class stock_move(osv.osv):
|
||||
"""
|
||||
return self.write(cr, uid, ids, {'state': 'assigned'}, context=context)
|
||||
|
||||
def check_tracking_product(self, cr, uid, product, lot_id, location, location_dest, context=None):
|
||||
check = False
|
||||
if product.track_all and not location_dest.usage == 'inventory':
|
||||
check = True
|
||||
elif product.track_incoming and location.usage in ('supplier', 'transit', 'inventory') and location_dest.usage == 'internal':
|
||||
check = True
|
||||
elif product.track_outgoing and location_dest.usage in ('customer', 'transit') and location.usage == 'internal':
|
||||
check = True
|
||||
if check and not lot_id:
|
||||
raise osv.except_osv(_('Warning!'), _('You must assign a serial number for the product %s') % (product.name))
|
||||
|
||||
|
||||
def check_tracking(self, cr, uid, move, lot_id, context=None):
|
||||
""" Checks if serial number is assigned to stock move or not and raise an error if it had to.
|
||||
"""
|
||||
check = False
|
||||
if move.product_id.track_all and not move.location_dest_id.usage == 'inventory':
|
||||
check = True
|
||||
elif move.product_id.track_incoming and move.location_id.usage in ('supplier', 'transit', 'inventory') and move.location_dest_id.usage == 'internal':
|
||||
check = True
|
||||
elif move.product_id.track_outgoing and move.location_dest_id.usage in ('customer', 'transit') and move.location_id.usage == 'internal':
|
||||
check = True
|
||||
if check and not lot_id:
|
||||
raise osv.except_osv(_('Warning!'), _('You must assign a serial number for the product %s') % (move.product_id.name))
|
||||
self.check_tracking_product(cr, uid, move.product_id, lot_id, move.location_id, move.location_dest_id, context=context)
|
||||
|
||||
|
||||
def action_assign(self, cr, uid, ids, context=None):
|
||||
""" Checks the product type and accordingly writes the state.
|
||||
@@ -2227,7 +2232,7 @@ class stock_move(osv.osv):
|
||||
main_domain = [('qty', '>', 0)]
|
||||
for record in ops.linked_move_operation_ids:
|
||||
move = record.move_id
|
||||
self.check_tracking(cr, uid, move, ops.package_id.id or ops.lot_id.id, context=context)
|
||||
self.check_tracking(cr, uid, move, not ops.product_id and ops.package_id.id or ops.lot_id.id, context=context)
|
||||
prefered_domain = [('reservation_id', '=', move.id)]
|
||||
fallback_domain = [('reservation_id', '=', False)]
|
||||
fallback_domain2 = ['&', ('reservation_id', '!=', move.id), ('reservation_id', '!=', False)]
|
||||
@@ -2744,7 +2749,7 @@ class stock_warehouse(osv.osv):
|
||||
'company_id': fields.many2one('res.company', 'Company', required=True, readonly=True, select=True),
|
||||
'partner_id': fields.many2one('res.partner', 'Address'),
|
||||
'view_location_id': fields.many2one('stock.location', 'View Location', required=True, domain=[('usage', '=', 'view')]),
|
||||
'lot_stock_id': fields.many2one('stock.location', 'Location Stock', required=True, domain=[('usage', '=', 'internal')]),
|
||||
'lot_stock_id': fields.many2one('stock.location', 'Location Stock', domain=[('usage', '=', 'internal')], required=True),
|
||||
'code': fields.char('Short Name', size=5, required=True, help="Short name used to identify your warehouse"),
|
||||
'route_ids': fields.many2many('stock.location.route', 'stock_route_warehouse', 'warehouse_id', 'route_id', 'Routes', domain="[('warehouse_selectable', '=', True)]", help='Defaults routes through the warehouse'),
|
||||
'reception_steps': fields.selection([
|
||||
@@ -2820,7 +2825,7 @@ class stock_warehouse(osv.osv):
|
||||
if wh.delivery_steps == 'ship_only':
|
||||
output_loc = wh.lot_stock_id
|
||||
# Create extra MTO rule (only for 'ship only' because in the other cases MTO rules already exists)
|
||||
mto_pull_vals = self._get_mto_pull_rule(cr, uid, wh, [(output_loc, transit_location, wh.out_type_id.id)], context=context)
|
||||
mto_pull_vals = self._get_mto_pull_rule(cr, uid, wh, [(output_loc, transit_location, wh.out_type_id.id)], context=context)[0]
|
||||
pull_obj.create(cr, uid, mto_pull_vals, context=context)
|
||||
inter_wh_route_vals = self._get_inter_wh_route(cr, uid, warehouse, wh, context=context)
|
||||
inter_wh_route_id = route_obj.create(cr, uid, vals=inter_wh_route_vals, context=context)
|
||||
@@ -2832,17 +2837,8 @@ class stock_warehouse(osv.osv):
|
||||
if default_resupply_wh and default_resupply_wh.id == wh.id:
|
||||
self.write(cr, uid, [warehouse.id], {'route_ids': [(4, inter_wh_route_id)]}, context=context)
|
||||
|
||||
def _default_stock_id(self, cr, uid, context=None):
|
||||
#lot_input_stock = self.pool.get('ir.model.data').get_object(cr, uid, 'stock', 'stock_location_stock')
|
||||
try:
|
||||
warehouse = self.pool.get('ir.model.data').get_object(cr, uid, 'stock', 'warehouse0')
|
||||
return warehouse.lot_stock_id.id
|
||||
except:
|
||||
return False
|
||||
|
||||
_defaults = {
|
||||
'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'stock.inventory', context=c),
|
||||
'lot_stock_id': _default_stock_id,
|
||||
'reception_steps': 'one_step',
|
||||
'delivery_steps': 'ship_only',
|
||||
}
|
||||
@@ -2961,8 +2957,10 @@ class stock_warehouse(osv.osv):
|
||||
|
||||
def _get_mto_pull_rule(self, cr, uid, warehouse, values, context=None):
|
||||
mto_route_id = self._get_mto_route(cr, uid, context=context)
|
||||
from_loc, dest_loc, pick_type_id = values[0]
|
||||
return {
|
||||
res = []
|
||||
for value in values:
|
||||
from_loc, dest_loc, pick_type_id = value
|
||||
res += [{
|
||||
'name': self._format_rulename(cr, uid, warehouse, from_loc, dest_loc, context=context) + _(' MTO'),
|
||||
'location_src_id': from_loc.id,
|
||||
'location_id': dest_loc.id,
|
||||
@@ -2972,7 +2970,8 @@ class stock_warehouse(osv.osv):
|
||||
'procure_method': 'make_to_order',
|
||||
'active': True,
|
||||
'warehouse_id': warehouse.id,
|
||||
}
|
||||
}]
|
||||
return res
|
||||
|
||||
def _get_crossdock_route(self, cr, uid, warehouse, route_name, context=None):
|
||||
return {
|
||||
@@ -3014,7 +3013,7 @@ class stock_warehouse(osv.osv):
|
||||
for pull_rule in pull_rules_list:
|
||||
pull_obj.create(cr, uid, vals=pull_rule, context=context)
|
||||
#create MTO pull rule and link it to the generic MTO route
|
||||
mto_pull_vals = self._get_mto_pull_rule(cr, uid, warehouse, values, context=context)
|
||||
mto_pull_vals = self._get_mto_pull_rule(cr, uid, warehouse, values, context=context)[0]
|
||||
mto_pull_id = pull_obj.create(cr, uid, mto_pull_vals, context=context)
|
||||
|
||||
#create a route for cross dock operations, that can be set on products and product categories
|
||||
@@ -3088,7 +3087,7 @@ class stock_warehouse(osv.osv):
|
||||
|
||||
#change MTO rule
|
||||
dummy, values = routes_dict[new_delivery_step]
|
||||
mto_pull_vals = self._get_mto_pull_rule(cr, uid, warehouse, values, context=context)
|
||||
mto_pull_vals = self._get_mto_pull_rule(cr, uid, warehouse, values, context=context)[0]
|
||||
pull_obj.write(cr, uid, warehouse.mto_pull_id.id, mto_pull_vals, context=context)
|
||||
return True
|
||||
|
||||
@@ -3290,7 +3289,7 @@ class stock_warehouse(osv.osv):
|
||||
route_obj = self.pool.get("stock.location.route")
|
||||
pull_obj = self.pool.get("procurement.rule")
|
||||
routes = route_obj.search(cr, uid, [('supplier_wh_id','=', warehouse.id)], context=context)
|
||||
pulls= pull_obj.search(cr, uid, ['&', ('route_id', 'in', routes), ('location_id.usage', '=', 'transit')], context=context)
|
||||
pulls = pull_obj.search(cr, uid, ['&', ('route_id', 'in', routes), ('location_id.usage', '=', 'transit')], context=context)
|
||||
if pulls:
|
||||
pull_obj.write(cr, uid, pulls, {'location_src_id': new_location, 'procure_method': change_to_multiple and "make_to_order" or "make_to_stock"}, context=context)
|
||||
# Create or clean MTO rules
|
||||
@@ -3302,7 +3301,8 @@ class stock_warehouse(osv.osv):
|
||||
transfer_locs = list(set([x.location_id for x in pull_recs]))
|
||||
vals = [(warehouse.lot_stock_id , x, warehouse.out_type_id.id) for x in transfer_locs]
|
||||
mto_pull_vals = self._get_mto_pull_rule(cr, uid, warehouse, vals, context=context)
|
||||
pull_obj.create(cr, uid, mto_pull_vals, context=context)
|
||||
for mto_pull_val in mto_pull_vals:
|
||||
pull_obj.create(cr, uid, mto_pull_val, context=context)
|
||||
else:
|
||||
# We need to delete all the MTO pull rules, otherwise they risk to be used in the system
|
||||
pulls = pull_obj.search(cr, uid, ['&', ('route_id', '=', mto_route_id), ('location_id.usage', '=', 'transit'), ('location_src_id', '=', warehouse.lot_stock_id.id)], context=context)
|
||||
@@ -3793,7 +3793,10 @@ class stock_pack_operation(osv.osv):
|
||||
operation in two to process the one with the qty moved
|
||||
'''
|
||||
processed_ids = []
|
||||
move_obj = self.pool.get("stock.move")
|
||||
for pack_op in self.browse(cr, uid, ids, context=None):
|
||||
if pack_op.product_id and pack_op.location_id and pack_op.location_dest_id:
|
||||
move_obj.check_tracking_product(cr, uid, pack_op.product_id, pack_op.lot_id.id, pack_op.location_id, pack_op.location_dest_id, context=context)
|
||||
op = pack_op.id
|
||||
if pack_op.qty_done < pack_op.product_qty:
|
||||
# we split the operation in two
|
||||
@@ -3815,10 +3818,9 @@ class stock_pack_operation(osv.osv):
|
||||
new_lot_id = lots[0]
|
||||
val.update({'name': name})
|
||||
|
||||
if not obj.lot_id:
|
||||
if not new_lot_id:
|
||||
new_lot_id = self.pool.get('stock.production.lot').create(cr, uid, val, context=context)
|
||||
self.write(cr, uid, id, {'lot_id': new_lot_id}, context=context)
|
||||
if not new_lot_id:
|
||||
new_lot_id = self.pool.get('stock.production.lot').create(cr, uid, val, context=context)
|
||||
self.write(cr, uid, id, {'lot_id': new_lot_id}, context=context)
|
||||
|
||||
def _search_and_increment(self, cr, uid, picking_id, domain, filter_visible=False, visible_op_ids=False, increment=True, context=None):
|
||||
'''Search for an operation with given 'domain' in a picking, if it exists increment the qty (+1) otherwise create it
|
||||
|
||||
@@ -524,7 +524,6 @@
|
||||
<group>
|
||||
<group>
|
||||
<field name="code"/>
|
||||
<field name="lot_stock_id" groups="stock.group_locations" string="Inventory Location" invisible="1"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
|
||||
|
||||
@@ -25,12 +25,6 @@
|
||||
<field name="model">product.template</field>
|
||||
<field name="inherit_id" ref="product.product_template_form_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//group[@name='weight']" position="after">
|
||||
<group string="Accounting Entries">
|
||||
<field name="property_stock_account_input" domain="[('type','<>','view'),('type','<>','consolidation')]"/>
|
||||
<field name="property_stock_account_output" domain="[('type','<>','view'),('type','<>','consolidation')]"/>
|
||||
</group>
|
||||
</xpath>
|
||||
<field name="standard_price" position="replace">
|
||||
<field name="cost_method" groups="stock_account.group_inventory_valuation"/>
|
||||
<label string="Cost Price" for="standard_price" align="1.0" groups="base.group_user"/>
|
||||
|
||||
@@ -191,7 +191,10 @@ class stock_quant(osv.osv):
|
||||
if context.get('force_valuation_amount'):
|
||||
valuation_amount = context.get('force_valuation_amount')
|
||||
else:
|
||||
valuation_amount = move.product_id.cost_method == 'real' and cost or move.product_id.standard_price
|
||||
if move.product_id.cost_method == 'average':
|
||||
valuation_amount = move.location_id.usage != 'internal' and move.location_dest_id.usage == 'internal' and cost or move.product_id.standard_price
|
||||
else:
|
||||
valuation_amount = move.product_id.cost_method == 'real' and cost or move.product_id.standard_price
|
||||
#the standard_price of the product may be in another decimal precision, or not compatible with the coinage of
|
||||
#the company currency... so we need to use round() before creating the accounting entries.
|
||||
valuation_amount = currency_obj.round(cr, uid, move.company_id.currency_id, valuation_amount * qty)
|
||||
|
||||
@@ -84,7 +84,7 @@ class stock_history(osv.osv):
|
||||
'company_id': fields.many2one('res.company', 'Company'),
|
||||
'product_id': fields.many2one('product.product', 'Product', required=True),
|
||||
'product_categ_id': fields.many2one('product.category', 'Product Category', required=True),
|
||||
'quantity': fields.integer('Product Quantity'),
|
||||
'quantity': fields.float('Product Quantity'),
|
||||
'date': fields.datetime('Operation Date'),
|
||||
'price_unit_on_quant': fields.float('Value'),
|
||||
'inventory_value': fields.function(_get_inventory_value, string="Inventory Value", type='float', readonly=True),
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
<field name="name">Stock Value At Date</field>
|
||||
<field name="model">stock.history</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Stock Value At Date" create="0">
|
||||
<tree string="Stock Value At Date" create="0" delete="0">
|
||||
<field name="location_id" invisible="1"/>
|
||||
<field name="product_id" invisible="1"/>
|
||||
<field name="move_id"/>
|
||||
|
||||
Reference in New Issue
Block a user