[MERGE] from upstream
bzr revid: fva@openerp.com-20130925131047-il61spet92tn7233
This commit is contained in:
@@ -77,8 +77,8 @@ Dashboard / Reports for MRP will include:
|
||||
#TODO: This yml tests are needed to be completely reviewed again because the product wood panel is removed in product demo as it does not suit for new demo context of computer and consultant company
|
||||
# so the ymls are too complex to change at this stage
|
||||
'test': [
|
||||
# 'test/order_demo.yml',
|
||||
# 'test/order_process.yml',
|
||||
'test/order_demo.yml',
|
||||
'test/order_process.yml',
|
||||
# 'test/cancel_order.yml',
|
||||
],
|
||||
'installable': True,
|
||||
|
||||
+18
-23
@@ -502,9 +502,9 @@ class mrp_production(osv.osv):
|
||||
'picking_id': fields.many2one('stock.picking', 'Picking List', readonly=True, ondelete="restrict",
|
||||
help="This is the Internal Picking List that brings the finished product to the production plan"),
|
||||
'move_prod_id': fields.many2one('stock.move', 'Product Move', readonly=True),
|
||||
'move_lines': fields.many2many('stock.move', 'mrp_production_move_ids', 'production_id', 'move_id', 'Products to Consume',
|
||||
'move_lines': fields.one2many('stock.move', 'raw_material_production_id', 'Products to Consume',
|
||||
domain=[('state','not in', ('done', 'cancel'))], readonly=True, states={'draft':[('readonly',False)]}),
|
||||
'move_lines2': fields.many2many('stock.move', 'mrp_production_move_ids', 'production_id', 'move_id', 'Consumed Products',
|
||||
'move_lines2': fields.one2many('stock.move', 'raw_material_production_id', 'Consumed Products',
|
||||
domain=[('state','in', ('done', 'cancel'))], readonly=True, states={'draft':[('readonly',False)]}),
|
||||
'move_created_ids': fields.one2many('stock.move', 'production_id', 'Products to Produce',
|
||||
domain=[('state','not in', ('done', 'cancel'))], readonly=True, states={'draft':[('readonly',False)]}),
|
||||
@@ -824,14 +824,6 @@ class mrp_production(osv.osv):
|
||||
if rest_qty > 0 :
|
||||
stock_mov_obj.action_consume(cr, uid, [produce_product.id], (subproduct_factor * production_qty), context=context)
|
||||
|
||||
for raw_product in production.move_lines2:
|
||||
new_parent_ids = []
|
||||
parent_move_ids = [x.id for x in raw_product.move_history_ids]
|
||||
for final_product in production.move_created_ids2:
|
||||
if final_product.id not in parent_move_ids:
|
||||
new_parent_ids.append(final_product.id)
|
||||
for new_parent_id in new_parent_ids:
|
||||
stock_mov_obj.write(cr, uid, [raw_product.id], {'move_history_ids': [(4,new_parent_id)]})
|
||||
self.message_post(cr, uid, production_id, body=_("%s produced") % self._description, context=context)
|
||||
self.signal_button_produce_done(cr, uid, [production_id])
|
||||
return True
|
||||
@@ -886,15 +878,17 @@ class mrp_production(osv.osv):
|
||||
"""
|
||||
return self.write(cr, uid, ids, {'state': 'in_production', 'date_start': time.strftime('%Y-%m-%d %H:%M:%S')})
|
||||
|
||||
def test_if_product(self, cr, uid, ids):
|
||||
"""
|
||||
@return: True or False
|
||||
"""
|
||||
res = True
|
||||
def consume_lines_get(self, cr, uid, ids, *args):
|
||||
res = []
|
||||
for order in self.browse(cr, uid, ids, context={}):
|
||||
res += [x.id for x in order.move_lines]
|
||||
return res
|
||||
|
||||
def test_ready(self, cr, uid, ids):
|
||||
res = False
|
||||
for production in self.browse(cr, uid, ids):
|
||||
if not production.product_lines:
|
||||
if not self.action_compute(cr, uid, [production.id]):
|
||||
res = False
|
||||
if production.ready_production:
|
||||
res = True
|
||||
return res
|
||||
|
||||
def _make_production_produce_line(self, cr, uid, production, context=None):
|
||||
@@ -933,9 +927,8 @@ class mrp_production(osv.osv):
|
||||
'name': production.name,
|
||||
'date': production.date_planned,
|
||||
'product_id': production_line.product_id.id,
|
||||
'product_qty': production_line.product_qty,
|
||||
'product_uom_qty': production.product_qty,
|
||||
'product_uom': production_line.product_uom.id,
|
||||
'product_uom_qty': production_line.product_qty,
|
||||
'product_uom': production_line.product_uom.id,
|
||||
'product_uos_qty': production_line.product_uos and production_line.product_uos_qty or False,
|
||||
'product_uos': production_line.product_uos and production_line.product_uos.id or False,
|
||||
'location_id': source_location_id,
|
||||
@@ -972,8 +965,10 @@ class mrp_production(osv.osv):
|
||||
@param *args: Arguments
|
||||
@return: True
|
||||
"""
|
||||
pick_obj = self.pool.get('stock.picking')
|
||||
pick_obj.force_assign(cr, uid, [prod.picking_id.id for prod in self.browse(cr, uid, ids)])
|
||||
|
||||
move_obj = self.pool.get('stock.move')
|
||||
for order in self.browse(cr, uid, ids):
|
||||
move_obj.force_assign(cr, uid, [x.id for x in order.move_lines])
|
||||
return True
|
||||
|
||||
|
||||
|
||||
@@ -619,7 +619,7 @@
|
||||
<form string="Manufacturing Orders" version="7.0">
|
||||
<header>
|
||||
<button name="button_confirm" states="draft" string="Confirm Production" class="oe_highlight"/>
|
||||
<button name="%(act_mrp_product_produce)d" states="confirmed,ready,in_production" string="Produce" type="action" class="oe_highlight"/>
|
||||
<button name="%(act_mrp_product_produce)d" states="ready,in_production" string="Produce" type="action" class="oe_highlight"/>
|
||||
<button name="force_production" states="confirmed" string="Force Reservation" type="object"/>
|
||||
<button name="force_production" states="picking_except" string="Force Reservation" type="object"/>
|
||||
<button name="button_produce" states="ready" string="Mark as Started"/>
|
||||
|
||||
+12
-63
@@ -14,11 +14,10 @@
|
||||
<field name="flow_start">True</field>
|
||||
<field name="name">draft</field>
|
||||
</record>
|
||||
<record id="prod_act_picking" model="workflow.activity">
|
||||
<record id="prod_act_confirmed" model="workflow.activity">
|
||||
<field name="wkf_id" ref="wkf_prod"/>
|
||||
<field name="name">picking</field>
|
||||
<field name="kind">subflow</field>
|
||||
<field name="subflow_id" search="[('osv','=','stock.picking')]"/>
|
||||
<field name="name">confirmed</field>
|
||||
<field name="kind">function</field>
|
||||
<field name="action">action_confirm()</field>
|
||||
</record>
|
||||
<record id="prod_act_ready" model="workflow.activity">
|
||||
@@ -27,12 +26,6 @@
|
||||
<field name="kind">function</field>
|
||||
<field name="action">action_ready()</field>
|
||||
</record>
|
||||
<record id="prod_act_picking_exception" model="workflow.activity">
|
||||
<field name="wkf_id" ref="wkf_prod"/>
|
||||
<field name="name">picking_exception</field>
|
||||
<field name="kind">function</field>
|
||||
<field name="action">action_picking_except()</field>
|
||||
</record>
|
||||
<record id="prod_act_in_production" model="workflow.activity">
|
||||
<field name="wkf_id" ref="wkf_prod"/>
|
||||
<field name="name">in_production</field>
|
||||
@@ -54,23 +47,17 @@
|
||||
<field name="action">action_cancel()</field>
|
||||
</record>
|
||||
|
||||
<record id="prod_trans_draft_ready" model="workflow.transition">
|
||||
<field name="act_from" ref="prod_act_draft"/>
|
||||
<field name="act_to" ref="prod_act_ready"/>
|
||||
<field name="signal">button_confirm</field>
|
||||
<field name="condition">not test_if_product()</field>
|
||||
</record>
|
||||
<record id="prod_trans_draft_picking" model="workflow.transition">
|
||||
<field name="act_from" ref="prod_act_draft"/>
|
||||
<field name="act_to" ref="prod_act_picking"/>
|
||||
<field name="act_to" ref="prod_act_confirmed"/>
|
||||
<field name="signal">button_confirm</field>
|
||||
<field name="condition">test_if_product()</field>
|
||||
</record>
|
||||
<record id="prod_trans_picking_ready" model="workflow.transition">
|
||||
<field name="act_from" ref="prod_act_picking"/>
|
||||
<field name="act_from" ref="prod_act_confirmed"/>
|
||||
<field name="act_to" ref="prod_act_ready"/>
|
||||
<field name="signal"></field>
|
||||
<field name="condition">ready_production</field>
|
||||
<field name="trigger_model">stock.move</field>
|
||||
<field name="trigger_expr_id">consume_lines_get()</field>
|
||||
<field name="condition">test_ready()</field>
|
||||
</record>
|
||||
<record id="prod_trans_ready_in_production" model="workflow.transition">
|
||||
<field name="act_from" ref="prod_act_ready"/>
|
||||
@@ -83,21 +70,6 @@
|
||||
<field name="signal">button_produce_done</field>
|
||||
<field name="condition">test_production_done()</field>
|
||||
</record>
|
||||
<record id="prod_trans_picking_picking_exception" model="workflow.transition">
|
||||
<field name="act_from" ref="prod_act_picking"/>
|
||||
<field name="act_to" ref="prod_act_picking_exception"/>
|
||||
<field name="signal">subflow.cancel</field>
|
||||
</record>
|
||||
<record id="prod_trans_picking_exception_cancel" model="workflow.transition">
|
||||
<field name="act_from" ref="prod_act_picking_exception"/>
|
||||
<field name="act_to" ref="prod_act_cancel"/>
|
||||
<field name="signal">button_cancel</field>
|
||||
</record>
|
||||
<record id="prod_trans_picking_exception_picking" model="workflow.transition">
|
||||
<field name="act_from" ref="prod_act_picking_exception"/>
|
||||
<field name="act_to" ref="prod_act_picking"/>
|
||||
<field name="signal">button_recreate</field>
|
||||
</record>
|
||||
<record id="prod_trans_ready_cancel" model="workflow.transition">
|
||||
<field name="act_from" ref="prod_act_ready"/>
|
||||
<field name="act_to" ref="prod_act_cancel"/>
|
||||
@@ -113,34 +85,11 @@
|
||||
<field name="act_to" ref="prod_act_cancel"/>
|
||||
<field name="signal">button_cancel</field>
|
||||
</record>
|
||||
|
||||
<!-- Procurement -->
|
||||
<!-- TODO csn : check if fix is needed since no more workflow in procurement -->
|
||||
<!-- <record id="act_produce" model="workflow.activity">
|
||||
<field name="wkf_id" ref="procurement.wkf_procurement"/>
|
||||
<field name="name">produce</field>
|
||||
<field name="kind">subflow</field>
|
||||
<field name="subflow_id" search="[('osv','=','mrp.production')]"/>
|
||||
<field name="action">action_produce_assign_product()</field>
|
||||
<record id="prod_trans_confirmed_cancel" model="workflow.transition">
|
||||
<field name="act_from" ref="prod_act_confirmed"/>
|
||||
<field name="act_to" ref="prod_act_cancel"/>
|
||||
<field name="signal">button_cancel</field>
|
||||
</record>
|
||||
|
||||
<record id="trans_confirm_mto_need_production" model="workflow.transition">
|
||||
<field name="act_from" ref="procurement.act_confirm_mto"/>
|
||||
<field name="act_to" ref="act_produce"/>
|
||||
<field name="condition">check_produce() and is_product() and check_bom_exists()</field>
|
||||
</record>
|
||||
|
||||
<record id="trans_produce_finished_prod" model="workflow.transition">
|
||||
<field name="act_from" ref="act_produce"/>
|
||||
<field name="act_to" ref="procurement.act_make_done"/>
|
||||
<field name="signal">subflow.done</field>
|
||||
</record>
|
||||
|
||||
<record id="trans_produce_cancel" model="workflow.transition">
|
||||
<field name="act_from" ref="act_produce"/>
|
||||
<field name="act_to" ref="procurement.act_cancel"/>
|
||||
<field name="signal">subflow.cancel</field>
|
||||
</record> -->
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
+21
-12
@@ -27,7 +27,8 @@ class StockMove(osv.osv):
|
||||
_inherit = 'stock.move'
|
||||
|
||||
_columns = {
|
||||
'production_id': fields.many2one('mrp.production', 'Production', select=True),
|
||||
'production_id': fields.many2one('mrp.production', 'Production Order for Produced Products', select=True),
|
||||
'raw_material_production_id': fields.many2one('mrp.production', 'Production Order for Raw Materials', select=True),
|
||||
}
|
||||
|
||||
|
||||
@@ -83,33 +84,33 @@ class StockMove(osv.osv):
|
||||
'move_id': mid,
|
||||
})
|
||||
procurement_obj.signal_button_confirm(cr, uid, [proc_id])
|
||||
|
||||
|
||||
move_obj.write(cr, uid, [move.id], {
|
||||
'location_dest_id': move.location_id.id, # dummy move for the kit
|
||||
'location_dest_id': move.location_id.id, # dummy move for the kit
|
||||
'picking_id': False,
|
||||
'state': 'confirmed'
|
||||
})
|
||||
procurement_ids = procurement_obj.search(cr, uid, [('move_id','=',move.id)], context)
|
||||
procurement_ids = procurement_obj.search(cr, uid, [('move_id', '=', move.id)], context)
|
||||
procurement_obj.signal_button_confirm(cr, uid, procurement_ids)
|
||||
procurement_obj.signal_button_wait_done(cr, uid, procurement_ids)
|
||||
return processed_ids
|
||||
|
||||
|
||||
def action_consume(self, cr, uid, ids, product_qty, location_id=False, context=None):
|
||||
""" Consumed product with specific quatity from specific source location.
|
||||
@param product_qty: Consumed product quantity
|
||||
@param location_id: Source location
|
||||
@return: Consumed lines
|
||||
"""
|
||||
"""
|
||||
res = []
|
||||
production_obj = self.pool.get('mrp.production')
|
||||
for move in self.browse(cr, uid, ids):
|
||||
move.action_confirm(context)
|
||||
for move in self.browse(cr, uid, ids, context=context):
|
||||
self.action_confirm(cr, uid, [move.id], context=context)
|
||||
new_moves = super(StockMove, self).action_consume(cr, uid, [move.id], product_qty, location_id, context=context)
|
||||
production_ids = production_obj.search(cr, uid, [('move_lines', 'in', [move.id])])
|
||||
for prod in production_obj.browse(cr, uid, production_ids, context=context):
|
||||
if prod.state == 'confirmed':
|
||||
production_obj.force_production(cr, uid, [prod.id])
|
||||
production_obj.signal_button_produce(cr, uid, production_ids)
|
||||
production_obj.signal_button_produce(cr, uid, production_ids)
|
||||
for new_move in new_moves:
|
||||
if new_move == move.id:
|
||||
#This move is already there in move lines of production order
|
||||
@@ -117,13 +118,13 @@ class StockMove(osv.osv):
|
||||
production_obj.write(cr, uid, production_ids, {'move_lines': [(4, new_move)]})
|
||||
res.append(new_move)
|
||||
return res
|
||||
|
||||
|
||||
def action_scrap(self, cr, uid, ids, product_qty, location_id, context=None):
|
||||
""" Move the scrap/damaged product into scrap location
|
||||
@param product_qty: Scraped product quantity
|
||||
@param location_id: Scrap location
|
||||
@return: Scraped lines
|
||||
"""
|
||||
"""
|
||||
res = []
|
||||
production_obj = self.pool.get('mrp.production')
|
||||
for move in self.browse(cr, uid, ids, context=context):
|
||||
@@ -137,7 +138,15 @@ class StockMove(osv.osv):
|
||||
res.append(new_move)
|
||||
return res
|
||||
|
||||
|
||||
def write(self, cr, uid, ids, vals, context=None):
|
||||
if isinstance(ids, (int, long)):
|
||||
ids = [ids]
|
||||
res = super(StockMove, self).write(cr, uid, ids, vals, context=context)
|
||||
from openerp import workflow
|
||||
for move in self.browse(cr, uid, ids, context=context):
|
||||
if move.raw_material_production_id and move.raw_material_production_id.state == 'confirmed':
|
||||
workflow.trg_trigger(uid, 'stock.move', move.id, cr)
|
||||
return res
|
||||
|
||||
class StockPicking(osv.osv):
|
||||
_inherit = 'stock.picking'
|
||||
|
||||
@@ -33,76 +33,51 @@
|
||||
move = order.move_created_ids[0]
|
||||
source_location_id = order.product_id.property_stock_production.id
|
||||
assert move.date == order.date_planned, "Planned date is not correspond."
|
||||
assert move.product_id.id == order.product_id.id, "Product is not correspond."
|
||||
assert move.product_uom.id == order.product_uom.id, "UOM is not correspond."
|
||||
assert move.product_qty == order.product_qty, "Qty is not correspond."
|
||||
assert move.product_uos_qty == order.product_uos and order.product_uos_qty or order.product_qty, "UOS qty is not correspond."
|
||||
assert move.product_id.id == order.product_id.id, "Product does not correspond."
|
||||
assert move.product_uom.id == order.product_uom.id, "UOM does not correspond."
|
||||
assert move.product_qty == order.product_qty, "Qty does not correspond."
|
||||
assert move.product_uos_qty == order.product_uos and order.product_uos_qty or order.product_qty, "UOS qty does not correspond."
|
||||
if order.product_uos:
|
||||
assert move.product_uos.id == order.product_uos.id, "UOS is not correspond."
|
||||
assert move.location_id.id == source_location_id, "Source Location is not correspond."
|
||||
assert move.location_dest_id.id == order.location_dest_id.id, "Destination Location is not correspond."
|
||||
assert move.product_uos.id == order.product_uos.id, "UOS does not correspond."
|
||||
assert move.location_id.id == source_location_id, "Source Location does not correspond."
|
||||
assert move.location_dest_id.id == order.location_dest_id.id, "Destination Location does not correspond."
|
||||
routing_loc = None
|
||||
if order.bom_id.routing_id and order.bom_id.routing_id.location_id:
|
||||
routing_loc = order.bom_id.routing_id.location_id.id
|
||||
date_planned = order.date_planned
|
||||
for move_line in order.move_lines:
|
||||
for order_line in order.product_lines:
|
||||
if move_line.product_id.type not in ('product', 'consu'):
|
||||
continue
|
||||
if move_line.product_id.id == order_line.product_id.id:
|
||||
assert move_line.date == date_planned, "Planned date is not correspond in 'To consume line'."
|
||||
assert move_line.product_qty == order_line.product_qty, "Qty is not correspond in 'To consume line'."
|
||||
assert move_line.product_uom.id == order_line.product_uom.id, "UOM is not correspond in 'To consume line'."
|
||||
assert move_line.product_uos_qty == order_line.product_uos and order_line.product_uos_qty or order_line.product_qty, "UOS qty is not correspond in 'To consume line'."
|
||||
if order_line.product_uos:
|
||||
assert move_line.product_uos.id == order_line.product_uos.id, "UOS is not correspond in 'To consume line'."
|
||||
assert move_line.location_id.id == routing_loc or order.location_src_id.id, "Source location is not correspond in 'To consume line'."
|
||||
assert move_line.location_dest_id.id == source_location_id, "Destination Location is not correspond in 'To consume line'."
|
||||
if move_line.product_id.type not in ('product', 'consu'):
|
||||
continue
|
||||
if move_line.product_id.id == order_line.product_id.id:
|
||||
assert move_line.date == date_planned, "Planned date does not correspond in 'To consume line'."
|
||||
assert move_line.product_qty == order_line.product_qty, "Qty does not correspond in 'To consume line'."
|
||||
assert move_line.product_uom.id == order_line.product_uom.id, "UOM does not correspond in 'To consume line'."
|
||||
assert move_line.product_uos_qty == order_line.product_uos and order_line.product_uos_qty or order_line.product_qty, "UOS qty is not correspond in 'To consume line'."
|
||||
if order_line.product_uos:
|
||||
assert move_line.product_uos.id == order_line.product_uos.id, "UOS is not correspond in 'To consume line'."
|
||||
assert move_line.location_id.id == routing_loc or order.location_src_id.id, "Source location is not correspond in 'To consume line'."
|
||||
assert move_line.location_dest_id.id == source_location_id, "Destination Location is not correspond in 'To consume line'."
|
||||
-
|
||||
I check details of an Internal Shipment after confirmed production order to bring components in Raw Materials Location.
|
||||
-
|
||||
!python {model: mrp.production}: |
|
||||
procurement = self.pool.get('procurement.order')
|
||||
order = self.browse(cr, uid, ref("mrp_production_test1"))
|
||||
assert order.picking_id, 'Internal Shipment should be created!'
|
||||
|
||||
routing_loc = None
|
||||
pick_type = 'internal'
|
||||
partner_id = False
|
||||
if order.bom_id.routing_id and order.bom_id.routing_id.location_id:
|
||||
routing_loc = order.bom_id.routing_id.location_id
|
||||
if routing_loc.usage != 'internal':
|
||||
pick_type = 'out'
|
||||
partner_id = routing_loc.partner_id and routing_loc.partner_id.id or False
|
||||
routing_loc = routing_loc.id
|
||||
assert order.picking_id.type == pick_type, "Shipment should be Internal."
|
||||
assert order.picking_id.partner_id.id == partner_id, "Shipment Address is not correspond with Adderss of Routing Location."
|
||||
date_planned = order.date_planned
|
||||
for move_line in order.picking_id.move_lines:
|
||||
for order_line in order.product_lines:
|
||||
if move_line.product_id.type not in ('product', 'consu'):
|
||||
continue
|
||||
if move_line.product_id.id == order_line.product_id.id:
|
||||
assert move_line.date == date_planned, "Planned date is not correspond."
|
||||
assert move_line.product_qty == order_line.product_qty, "Qty is not correspond."
|
||||
assert move_line.product_uom.id == order_line.product_uom.id, "UOM is not correspond."
|
||||
assert move_line.product_uos_qty == order_line.product_uos and order_line.product_uos_qty or order_line.product_qty, "UOS qty is not correspond."
|
||||
if order_line.product_uos:
|
||||
assert move_line.product_uos.id == order_line.product_uos.id, "UOS is not correspond."
|
||||
assert move_line.location_id.id == order.location_src_id.id, "Source location is not correspond."
|
||||
assert move_line.location_dest_id.id == routing_loc or order.location_src_id.id, "Destination Location is not correspond."
|
||||
procurement_ids = procurement.search(cr, uid, [('move_id','=',move_line.id)])
|
||||
assert procurement_ids, "Procurement should be created for shipment line of raw materials."
|
||||
shipment_procurement = procurement.browse(cr, uid, procurement_ids[0], context=context)
|
||||
assert shipment_procurement.date_planned == date_planned, "Planned date is not correspond in procurement."
|
||||
assert shipment_procurement.product_id.id == order_line.product_id.id, "Product is not correspond in procurement."
|
||||
assert shipment_procurement.product_qty == order_line.product_qty, "Qty is not correspond in procurement."
|
||||
assert shipment_procurement.product_uom.id == order_line.product_uom.id, "UOM is not correspond in procurement."
|
||||
assert shipment_procurement.product_uos_qty == order_line.product_uos and order_line.product_uos_qty or order_line.product_qty, "UOS qty is not correspond in procurement."
|
||||
if order_line.product_uos:
|
||||
assert shipment_procurement.product_uos.id == order_line.product_uos.id, "UOS is not correspond in procurement."
|
||||
assert shipment_procurement.location_id.id == order.location_src_id.id, "Location is not correspond in procurement."
|
||||
assert shipment_procurement.procure_method == order_line.product_id.procure_method, "Procure method is not correspond in procurement."
|
||||
I check procurements have been generated for every consume line
|
||||
-
|
||||
!python {model: procurement.order}: |
|
||||
order = self.pool.get("mrp.production").browse(cr, uid, ref("mrp_production_test1"))
|
||||
move_line_ids = [x.id for x in order.move_lines]
|
||||
procurements = self.search(cr, uid, [('move_dest_id', 'in', move_line_ids)])
|
||||
for proc in self.browse(cr, uid, procurements):
|
||||
for order_line in order.product_lines:
|
||||
date_planned = order.date_planned
|
||||
if proc.product_id.type not in ('product', 'consu'):
|
||||
continue
|
||||
if proc.product_id.id == order_line.product_id.id:
|
||||
assert proc.date_planned == date_planned, "Planned date does not correspond"
|
||||
assert proc.product_qty == order_line.product_qty, "Qty does not correspond"
|
||||
assert proc.location_id.id == order.location_src_id.id, "Input location and procurement location do not correspond"
|
||||
assert proc.product_uom.id == order_line.product_uom.id, "UOM does not correspond in procurement."
|
||||
assert proc.product_uos_qty == order_line.product_uos and order_line.product_uos_qty or order_line.product_qty, "UOS qty does not correspond in procurement."
|
||||
if order_line.product_uos:
|
||||
assert proc.product_uos.id == order_line.product_uos.id, "UOS is not correspond in procurement."
|
||||
-
|
||||
I change production qty with 3 PC Assemble SC349.
|
||||
-
|
||||
@@ -128,17 +103,16 @@
|
||||
!python {model: procurement.order}: |
|
||||
self.run_scheduler(cr, uid)
|
||||
-
|
||||
The production order is Waiting Goods, I forcefully done internal shipment.
|
||||
The production order is Waiting Goods, will force production which should set consume lines as available
|
||||
-
|
||||
!python {model: mrp.production}: |
|
||||
self.force_production(cr, uid, [ref("mrp_production_test1")])
|
||||
-
|
||||
I check that production order in ready state after forcefully done internal shipment.
|
||||
I check that production order in ready state after forcing production.
|
||||
-
|
||||
!python {model: mrp.production}: |
|
||||
order = self.browse(cr, uid, ref("mrp_production_test1"))
|
||||
assert order.state == 'ready', 'Production order should be in Ready State.'
|
||||
assert order.picking_id.state == 'done', 'Internal shipment should be done.'
|
||||
-
|
||||
Now I start production.
|
||||
-
|
||||
@@ -157,9 +131,10 @@
|
||||
scrap_location_id = scrap_location_ids[0]
|
||||
order = self.browse(cr, uid, ref("mrp_production_test1"))
|
||||
for move in order.move_lines:
|
||||
move.action_consume(move.product_qty)
|
||||
if move.product_id.id == ref("product.product_product_6"):
|
||||
move.action_scrap(5.0, scrap_location_id)
|
||||
move.action_consume(move.product_qty)
|
||||
|
||||
-
|
||||
I produce product.
|
||||
-
|
||||
@@ -208,8 +183,8 @@
|
||||
raise AssertionError('unknown cost line: %s' % line)
|
||||
assert line.general_account_id.id == wc.costs_general_account_id.id, "General Account is not correspond."
|
||||
assert line.journal_id.id == wc.costs_journal_id.id, "Account Journal is not correspond."
|
||||
assert line.product_id.id == wc.product_id.id, "Product is not correspond."
|
||||
assert line.product_uom_id.id == wc.product_id.uom_id.id, "UOM is not correspond."
|
||||
assert line.product_id.id == wc.product_id.id, "Product does not correspond."
|
||||
assert line.product_uom_id.id == wc.product_id.uom_id.id, "UOM does not correspond."
|
||||
-
|
||||
I print a "BOM Structure".
|
||||
-
|
||||
@@ -239,5 +214,4 @@
|
||||
ctx.update({'model': 'mrp.workcenter','active_ids': [ref('mrp_workcenter_0'),ref('mrp_workcenter_1')]})
|
||||
data_dict = {'time_unit': 'day', 'measure_unit': 'hours'}
|
||||
from openerp.tools import test_reports
|
||||
test_reports.try_report_action(cr, uid, 'action_mrp_workcenter_load_wizard',wiz_data=data_dict, context=ctx, our_module='mrp')
|
||||
|
||||
test_reports.try_report_action(cr, uid, 'action_mrp_workcenter_load_wizard',wiz_data=data_dict, context=ctx, our_module='mrp')
|
||||
@@ -90,12 +90,9 @@ class change_production_qty(osv.osv_memory):
|
||||
factor = prod.product_qty * prod.product_uom.factor / bom_point.product_uom.factor
|
||||
product_details, workcenter_details = \
|
||||
bom_obj._bom_explode(cr, uid, bom_point, factor / bom_point.product_qty, [])
|
||||
product_move = dict((mv.product_id.id, mv.id) for mv in prod.picking_id.move_lines)
|
||||
for r in product_details:
|
||||
if r['product_id'] == move.product_id.id:
|
||||
move_obj.write(cr, uid, [move.id], {'product_uom_qty': r['product_qty']})
|
||||
if r['product_id'] in product_move:
|
||||
move_obj.write(cr, uid, [product_move[r['product_id']]], {'product_uom_qty': r['product_qty']})
|
||||
if prod.move_prod_id:
|
||||
move_obj.write(cr, uid, [prod.move_prod_id.id], {'product_uom_qty' : wiz_qty.product_qty})
|
||||
self._update_product_to_produce(cr, uid, prod, wiz_qty.product_qty, context=context)
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<field name="name">sent</field>
|
||||
<field name="kind">function</field>
|
||||
<field name="action">write({'state':'sent'})</field>
|
||||
</record>
|
||||
</record>
|
||||
|
||||
<record id="act_router" model="workflow.activity">
|
||||
<field name="wkf_id" ref="wkf_sale"/>
|
||||
|
||||
@@ -1001,7 +1001,7 @@ class stock_picking(osv.osv):
|
||||
# Methods for the barcode UI
|
||||
|
||||
def get_picking_for_packing_ui(self, cr, uid, context=None):
|
||||
res = self.search(cr, uid, [('state', '=', 'assigned')], limit=1, context=context)
|
||||
res = self.search(cr, uid, [('state', 'in', ('confirmed', 'assigned'))], limit=1, context=context)
|
||||
return res and res[0] or False # TODO: what to do if nothing is left to do?
|
||||
|
||||
def action_done_from_packing_ui(self, cr, uid, picking_id, only_split_lines=False, context=None):
|
||||
@@ -1768,7 +1768,7 @@ class stock_move(osv.osv):
|
||||
uos_qty = quantity / move_qty * move.product_uos_qty
|
||||
if quantity_rest > 0:
|
||||
default_val = {
|
||||
'product_qty': quantity,
|
||||
'product_uom_qty': quantity,
|
||||
'product_uos_qty': uos_qty,
|
||||
'state': move.state,
|
||||
'location_id': location_id or move.location_id.id,
|
||||
@@ -1776,7 +1776,7 @@ class stock_move(osv.osv):
|
||||
current_move = self.copy(cr, uid, move.id, default_val)
|
||||
res += [current_move]
|
||||
update_val = {}
|
||||
update_val['product_qty'] = quantity_rest
|
||||
update_val['product_uom_qty'] = quantity_rest
|
||||
update_val['product_uos_qty'] = uos_qty_rest
|
||||
self.write(cr, uid, [move.id], update_val)
|
||||
|
||||
@@ -1785,7 +1785,7 @@ class stock_move(osv.osv):
|
||||
uos_qty_rest = uos_qty
|
||||
res += [move.id]
|
||||
update_val = {
|
||||
'product_qty' : quantity_rest,
|
||||
'product_uom_qty' : quantity_rest,
|
||||
'product_uos_qty' : uos_qty_rest,
|
||||
'location_id': location_id or move.location_id.id,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user