-
+
diff --git a/addons/mrp/mrp_procurement.py b/addons/mrp/procurement.py
similarity index 90%
rename from addons/mrp/mrp_procurement.py
rename to addons/mrp/procurement.py
index 84392b329ea..d704afa46d6 100644
--- a/addons/mrp/mrp_procurement.py
+++ b/addons/mrp/procurement.py
@@ -27,17 +27,20 @@ import ir
import netsvc
import time
-class mrp_procurement(osv.osv):
- _inherit = 'mrp.procurement'
+class procurement_order(osv.osv):
+ _inherit = 'procurement.order'
_columns = {
'bom_id': fields.many2one('mrp.bom', 'BoM', ondelete='cascade', select=True),
}
def check_produce_product(self, cr, uid, procurement, context=[]):
+ """ Finds the bill of material for the product from procurement order.
+ @return: True or False
+ """
properties = [x.id for x in procurement.property_ids]
bom_id = self.pool.get('mrp.bom')._bom_find(cr, uid, procurement.product_id.id, procurement.product_uom.id, properties)
if not bom_id:
- cr.execute('update mrp_procurement set message=%s where id=%s', (_('No BoM defined for this product !'), procurement.id))
+ cr.execute('update procurement_order set message=%s where id=%s', (_('No BoM defined for this product !'), procurement.id))
return False
return True
@@ -45,7 +48,7 @@ class mrp_procurement(osv.osv):
""" This is action which call from workflow to assign production order to procurements
@return: True
"""
- procurement_obj = self.pool.get('mrp.procurement')
+ procurement_obj = self.pool.get('procurement.order')
res = procurement_obj.make_mo(cr, uid, ids, context=context)
res = res.values()
return len(res) and res[0] or 0 #TO CHECK: why workflow is generated error if return not integer value
@@ -59,7 +62,7 @@ class mrp_procurement(osv.osv):
production_obj = self.pool.get('mrp.production')
move_obj = self.pool.get('stock.move')
wf_service = netsvc.LocalService("workflow")
- procurement_obj = self.pool.get('mrp.procurement')
+ procurement_obj = self.pool.get('procurement.order')
for procurement in procurement_obj.browse(cr, uid, ids):
res_id = procurement.move_id.id
loc_id = procurement.location_id.id
@@ -88,6 +91,6 @@ class mrp_procurement(osv.osv):
{'location_id': procurement.location_id.id})
return res
-mrp_procurement()
+procurement_order()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/mrp/product.py b/addons/mrp/product.py
index 6a73063e591..ea717bd546c 100644
--- a/addons/mrp/product.py
+++ b/addons/mrp/product.py
@@ -26,30 +26,6 @@ from tools.translate import _
class product_product(osv.osv):
_inherit = "product.product"
- def get_product_accounts(self, cr, uid, product_id, context={}):
- """ To get the stock input account, stock output account and stock journal related to product.
- @param product_id: product id
- @return: dictionary which contains information regarding stock input account, stock output account and stock journal
- """
- product_obj = self.pool.get('product.product').browse(cr, uid, product_id, False)
-
- stock_input_acc = product_obj.property_stock_account_input and product_obj.property_stock_account_input.id or False
- if not stock_input_acc:
- stock_input_acc = product_obj.categ_id.property_stock_account_input_categ and product_obj.categ_id.property_stock_account_input_categ.id or False
-
- stock_output_acc = product_obj.property_stock_account_output and product_obj.property_stock_account_output.id or False
- if not stock_output_acc:
- stock_output_acc = product_obj.categ_id.property_stock_account_output_categ and product_obj.categ_id.property_stock_account_output_categ.id or False
-
- journal_id = product_obj.categ_id.property_stock_journal and product_obj.categ_id.property_stock_journal.id or False
-
- res = {}
- res.update({'stock_account_input': stock_input_acc})
- res.update({'stock_account_output': stock_output_acc})
- res.update({'stock_journal': journal_id})
-
- return res
-
def do_change_standard_price(self, cr, uid, ids, datas, context={}):
""" Changes the Standard Price of Product and parent products and creates an account move accordingly.
@param datas: dict. contain default datas like new_price, stock_output_account, stock_input_account, stock_journal
diff --git a/addons/mrp/report/order.rml b/addons/mrp/report/order.rml
index af55afce91b..200ca5bb76e 100644
--- a/addons/mrp/report/order.rml
+++ b/addons/mrp/report/order.rml
@@ -265,10 +265,10 @@
[[ formatLang(o.date_planned, date_time = True) ]]
|
- [[ o.sale_ref or ' ' ]]
+ [[ o.sale_ref or removeParentNode('para')]]
|
- [[ o.sale_name or '' ]]
+ [[ o.sale_name or removeParentNode('para') ]]
|
diff --git a/addons/mrp/security/ir.model.access.csv b/addons/mrp/security/ir.model.access.csv
index d5e00b9cbda..8f58f7179ad 100644
--- a/addons/mrp/security/ir.model.access.csv
+++ b/addons/mrp/security/ir.model.access.csv
@@ -7,7 +7,7 @@
"access_mrp_production","mrp.production","model_mrp_production","mrp.group_mrp_user",1,1,1,1
"access_mrp_production_workcenter_line","mrp.production.workcenter.line","model_mrp_production_workcenter_line","mrp.group_mrp_user",1,1,1,1
"access_mrp_production_product_line","mrp.production.product.line","model_mrp_production_product_line","mrp.group_mrp_user",1,1,1,1
-"access_mrp_procurement","mrp.procurement","model_mrp_procurement","mrp.group_mrp_user",1,1,1,1
+"access_procurement","procurement.order","model_procurement_order","mrp.group_mrp_user",1,1,1,1
"access_mrp_workcenter_manager","mrp.workcenter.manager","model_mrp_workcenter","mrp.group_mrp_user",1,1,1,1
"access_mrp_routing_manager","mrp.routing.manager","model_mrp_routing","mrp.group_mrp_manager",1,1,1,1
"access_mrp_routing_workcenter_manager","mrp.routing.workcenter.manager","model_mrp_routing_workcenter","mrp.group_mrp_manager",1,1,1,1
@@ -22,7 +22,7 @@
"access_purchase_order_mrp_worker","purchase.order mrp_worker","purchase.model_purchase_order","mrp.group_mrp_user",1,0,0,0
"access_purchase_order_line_mrp_worker","purchase.order.line mrp_worker","purchase.model_purchase_order_line","mrp.group_mrp_user",1,0,0,0
"access_hr_timesheet_group_mrp_worker","resource.calendar mrp_worker","resource.model_resource_calendar","mrp.group_mrp_user",1,0,0,0
-"access_mrp_procurement_stock_worker","mrp.procurement stock_worker","model_mrp_procurement","stock.group_stock_user",1,1,1,1
+"access_procurement_stock_worker","procurement.order stock_worker","model_procurement_order","stock.group_stock_user",1,1,1,1
"access_mrp_production_stock_worker","mrp.production stock_worker","model_mrp_production","stock.group_stock_user",1,0,0,0
"access_mrp_installer","mrp.installer","model_mrp_installer","mrp.group_mrp_user",1,0,0,0
"access_mrp_product_produce","mrp.product.produce","model_mrp_product_produce","mrp.group_mrp_user",1,0,0,0
diff --git a/addons/mrp/stock.py b/addons/mrp/stock.py
index 9bcc92e5c81..67efd0d2753 100644
--- a/addons/mrp/stock.py
+++ b/addons/mrp/stock.py
@@ -28,82 +28,12 @@ import netsvc
import time
-class stock_warehouse_orderpoint(osv.osv):
- """
- Defines Minimum stock rules.
- """
- _name = "stock.warehouse.orderpoint"
- _description = "Minimum Inventory Rule"
-
- _columns = {
- 'name': fields.char('Name', size=32, required=True),
- 'active': fields.boolean('Active', help="If the active field is set to true, it will allow you to hide the orderpoint without removing it."),
- 'logic': fields.selection([('max','Order to Max'),('price','Best price (not yet active!)')], 'Reordering Mode', required=True),
- 'warehouse_id': fields.many2one('stock.warehouse', 'Warehouse', required=True, ondelete="cascade"),
- 'location_id': fields.many2one('stock.location', 'Location', required=True, ondelete="cascade"),
- 'product_id': fields.many2one('product.product', 'Product', required=True, ondelete='cascade', domain=[('type','=','product')]),
- 'product_uom': fields.many2one('product.uom', 'Product UOM', required=True),
- 'product_min_qty': fields.float('Min Quantity', required=True,
- help="When the virtual stock goes belong the Min Quantity, Open ERP generates "\
- "a procurement to bring the virtual stock to the Max Quantity."),
- 'product_max_qty': fields.float('Max Quantity', required=True,
- help="When the virtual stock goes belong the Min Quantity, Open ERP generates "\
- "a procurement to bring the virtual stock to the Max Quantity."),
- 'qty_multiple': fields.integer('Qty Multiple', required=True,
- help="The procurement quantity will by rounded up to this multiple."),
- 'procurement_id': fields.many2one('mrp.procurement', 'Latest procurement', ondelete="set null"),
- 'company_id': fields.many2one('res.company','Company',required=True),
- }
- _defaults = {
- 'active': lambda *a: 1,
- 'logic': lambda *a: 'max',
- 'qty_multiple': lambda *a: 1,
- 'name': lambda x,y,z,c: x.pool.get('ir.sequence').get(y,z,'mrp.warehouse.orderpoint') or '',
- 'product_uom': lambda sel, cr, uid, context: context.get('product_uom', False),
- 'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'stock.warehouse.orderpoint', context=c)
- }
- _sql_constraints = [
- ('qty_multiple_check', 'CHECK( qty_multiple > 0 )', _('Qty Multiple must be greater than zero.')),
- ]
-
- def onchange_warehouse_id(self, cr, uid, ids, warehouse_id, context={}):
- """ Finds location id for changed warehouse.
- @param warehouse_id: Changed id of warehouse.
- @return: Dictionary of values.
- """
- if warehouse_id:
- w = self.pool.get('stock.warehouse').browse(cr, uid, warehouse_id, context)
- v = {'location_id': w.lot_stock_id.id}
- return {'value': v}
- return {}
-
- def onchange_product_id(self, cr, uid, ids, product_id, context={}):
- """ Finds UoM for changed product.
- @param product_id: Changed id of product.
- @return: Dictionary of values.
- """
- if product_id:
- prod = self.pool.get('product.product').browse(cr,uid,product_id)
- v = {'product_uom': prod.uom_id.id}
- return {'value': v}
- return {}
-
- def copy(self, cr, uid, id, default=None,context={}):
- if not default:
- default = {}
- default.update({
- 'name': self.pool.get('ir.sequence').get(cr, uid, 'mrp.warehouse.orderpoint') or '',
- })
- return super(stock_warehouse_orderpoint, self).copy(cr, uid, id, default, context)
-
-stock_warehouse_orderpoint()
-
class StockMove(osv.osv):
_inherit = 'stock.move'
_columns = {
'production_id': fields.many2one('mrp.production', 'Production', select=True),
- 'procurements': fields.one2many('mrp.procurement', 'move_id', 'Procurements'),
+ 'procurements': fields.one2many('procurement.order', 'move_id', 'Procurements'),
}
def copy(self, cr, uid, id, default=None, context=None):
@@ -118,7 +48,7 @@ class StockMove(osv.osv):
"""
bom_obj = self.pool.get('mrp.bom')
move_obj = self.pool.get('stock.move')
- procurement_obj = self.pool.get('mrp.procurement')
+ procurement_obj = self.pool.get('procurement.order')
product_obj = self.pool.get('product.product')
wf_service = netsvc.LocalService("workflow")
if move.product_id.supply_method == 'produce' and move.product_id.procure_method == 'make_to_order':
@@ -166,7 +96,7 @@ class StockMove(osv.osv):
'move_id': mid,
'company_id': line['company_id'],
})
- wf_service.trg_validate(uid, 'mrp.procurement', proc_id, 'button_confirm', cr)
+ wf_service.trg_validate(uid, 'procurement.order', proc_id, 'button_confirm', cr)
move_obj.write(cr, uid, [move.id], {
'location_id': move.location_dest_id.id,
'auto_validate': True,
@@ -175,7 +105,7 @@ class StockMove(osv.osv):
'state': 'waiting'
})
for m in procurement_obj.search(cr, uid, [('move_id','=',move.id)], context):
- wf_service.trg_validate(uid, 'mrp.procurement', m, 'button_wait_done', cr)
+ wf_service.trg_validate(uid, 'procurement.order', m, 'button_wait_done', cr)
return True
def action_consume(self, cr, uid, ids, product_qty, location_id=False, context=None):
@@ -231,7 +161,7 @@ class StockPicking(osv.osv):
for move in picking.move_lines:
if move.state == 'done' and move.procurements:
for procurement in move.procurements:
- wf_service.trg_validate(user, 'mrp.procurement',
+ wf_service.trg_validate(user, 'procurement.order',
procurement.id, 'button_check', cursor)
return res
diff --git a/addons/mrp/test/mrp_phantom_bom.yml b/addons/mrp/test/mrp_phantom_bom.yml
index 5475d54ffd4..4a3e2e3e1da 100644
--- a/addons/mrp/test/mrp_phantom_bom.yml
+++ b/addons/mrp/test/mrp_phantom_bom.yml
@@ -9,6 +9,8 @@
factor: 1.0
name: Litre
rounding: 0.01
+-
+ I create record for product Orange Juice.
-
!record {model: product.product, id: product_product_orangejuice0}:
categ_id: product.cat1
@@ -18,6 +20,8 @@
type: product
uom_id: product_uom_litre0
uom_po_id: product_uom_litre0
+-
+ I create record for product Orange.
-
!record {model: product.product, id: product_product_orange0}:
categ_id: product.cat1
@@ -31,6 +35,8 @@
type: product
uom_id: product.product_uom_kgm
uom_po_id: product.product_uom_kgm
+-
+ I create record for product Sugar.
-
!record {model: product.product, id: product_product_sugar0}:
categ_id: product.cat1
@@ -44,6 +50,8 @@
type: product
uom_id: product.product_uom_kgm
uom_po_id: product.product_uom_kgm
+-
+ I create record for product Water.
-
!record {model: product.product, id: product_product_water0}:
categ_id: product.cat1
@@ -54,7 +62,7 @@
uom_id: product_uom_litre0
uom_po_id: product_uom_litre0
-
- I define the BoM to produce an orange juice
+ I define the BoM to produce an orange juice.
-
!record {model: mrp.bom, id: mrp_bom_orangejuice0}:
company_id: base.main_company
@@ -64,6 +72,8 @@
product_qty: 1.0
product_uom: product_uom_litre0
type: phantom
+-
+ I create bom lines for BoM for Orange Juice.
-
!record {model: mrp.bom, id: mrp_bom_orangejuice0}:
bom_lines:
@@ -92,7 +102,7 @@
product_uom: product_uom_litre0
type: normal
-
- I define Minimum stock rules for my stockable products orange and sugar
+ I define Minimum stock rules for my stockable product "Orange".
-
!record {model: stock.warehouse.orderpoint, id: stock_warehouse_orderpoint_op0}:
company_id: base.main_company
@@ -105,6 +115,8 @@
product_uom: product.product_uom_kgm
qty_multiple: 1
warehouse_id: stock.warehouse0
+-
+ I define Minimum stock rules for my stockable product "Sugar".
-
!record {model: stock.warehouse.orderpoint, id: stock_warehouse_orderpoint_op1}:
company_id: base.main_company
@@ -168,23 +180,23 @@
-
I am checking Procurement orders. There are 3 orders generated for Oranges, Sugar and Water.
-
- !python {model: mrp.procurement}: |
+ !python {model: procurement.order}: |
from tools.translate import _
proc_ids = self.search(cr, uid, [('state','!=','cofirmed')])
assert proc_ids, _('No Procurements!')
-
The scheduler runs.
-
- !function {model: mrp.procurement, name: run_scheduler}:
- - model: mrp.procurement
- search: "[('origin','=',':MO/00002')]"
+ !function {model: procurement.order, name: run_scheduler}:
+ - model: procurement.order
+ search: "[('state','!=','cofirmed')]"
-
I am checking Internal picking. I see one picking for Orange juice and its
stock moves for Oranges, Sugar and Water made correctly.
-
!python {model: stock.picking}: |
from tools.translate import _
- pick_ids = self.search(cr, uid, [('origin','=',':MO/00002'),('type','=','internal')])
+ pick_ids = self.search(cr, uid, [('type','=','internal')])
assert pick_ids, _('No Internal Pickings!')
-
According to minimum stock rules. I have 2 purchase orders for
@@ -220,11 +232,15 @@
assert pick_ids, _('No Incoming Shipments found!')
-
I receive both the products. My incoming pickings are done.
+-
+ I create record for the incoming picking wizard.
-
!record {model: stock.partial.picking, id: stock_partial_picking0}:
date: '2010-04-30 16:53:36'
partner_id: base.res_partner_asus
address_id: base.res_partner_address_tang
+-
+ I make my pickings done.
-
!python {model: stock.partial.picking}: |
pick_obj = self.pool.get('stock.picking')
diff --git a/addons/mrp/test/mrp_procurement.yml b/addons/mrp/test/mrp_procurement.yml
index 37d0de5c5a9..1fe0f74fa6a 100644
--- a/addons/mrp/test/mrp_procurement.yml
+++ b/addons/mrp/test/mrp_procurement.yml
@@ -4,7 +4,7 @@
-
I am creating products.
-
- Creating a product.product record
+ I create record for product Shirt.
-
!record {model: product.product, id: product_product_shirt0}:
categ_id: product.cat1
@@ -27,7 +27,7 @@
weight: 0.0
weight_net: 0.0
-
- Creating a product.product record
+ I create record for product Cloth.
-
!record {model: product.product, id: product_product_cloth0}:
categ_id: product.cat1
@@ -53,7 +53,7 @@
weight: 0.0
weight_net: 0.0
-
- Creating a product.product record
+ I create record for product Buttons.
-
!record {model: product.product, id: product_product_buttons0}:
categ_id: product.cat1
@@ -81,7 +81,7 @@
-
I am creating bills of material for 'Shirt'.
-
- Creating a mrp.bom record
+ I create bills of material for Shirt.
-
!record {model: mrp.bom, id: mrp_bom_shirt0}:
bom_lines:
@@ -129,7 +129,7 @@
-
I create a procurement order for product Shirt.
-
- !record {model: mrp.procurement, id: mrp_procurement_shirt0}:
+ !record {model: procurement.order, id: procurement_order_shirt0}:
name: 'PROC: Shirt'
product_id: product_product_shirt0
product_qty: 5.00
@@ -138,11 +138,11 @@
-
I confirm the procurement order.
-
- !workflow {model: mrp.procurement, action: button_confirm, ref: mrp_procurement_shirt0}
+ !workflow {model: procurement.order, action: button_confirm, ref: procurement_order_shirt0}
-
I run the procurement.
-
- !workflow {model: mrp.procurement, action: button_check, ref: mrp_procurement_shirt0}
+ !workflow {model: procurement.order, action: button_check, ref: procurement_order_shirt0}
-
I see that there is a manufacturing order for Shirt.
-
@@ -153,15 +153,15 @@
-
I also check that there are two more procurement orders for sub products Cloth and Buttons.
-
- !python {model: mrp.procurement}: |
+ !python {model: procurement.order}: |
from tools.translate import _
proc_ids = self.search(cr, uid, [('product_id','in',[ref('product_product_cloth0'),ref('product_product_buttons0')])])
assert proc_ids, 'No Procurements.'
-
The scheduler runs.
-
- !function {model: mrp.procurement, name: run_scheduler}:
- - model: mrp.procurement
+ !function {model: procurement.order, name: run_scheduler}:
+ - model: procurement.order
search: "[]"
-
I check that there is one purchase order for Cloth.
@@ -216,11 +216,15 @@
from tools.translate import _
pick_ids = self.search(cr, uid, [('address_id.name','=','Wong'),('state','=','assigned')])
assert pick_ids, _('No Incoming Shipments found!')
+-
+ I create record for partial picking.
-
!record {model: stock.partial.picking, id: stock_partial_picking0}:
date: '2010-04-30 16:53:36'
partner_id: base.res_partner_maxtor
address_id: base.res_partner_address_wong
+-
+ I make my picking done.
-
!python {model: stock.partial.picking}: |
pick_obj = self.pool.get('stock.picking')
@@ -245,17 +249,21 @@
})
pick_obj.do_partial(cr, uid, picking_ids, partial_datas, context=context)
-
- I Check incoming shipments for buttons. And receive products.
+ I Check incoming shipments for buttons and receive products.
-
!python {model: stock.picking}: |
from tools.translate import _
pick_ids = self.search(cr, uid, [('address_id.name','=','Tang'),('state','=','assigned')])
assert pick_ids, _('No Incoming Shipments found!')
+-
+ I create record for partial picking.
-
!record {model: stock.partial.picking, id: stock_partial_picking0}:
date: '2010-04-30 16:53:36'
partner_id: base.res_partner_maxtor
address_id: base.res_partner_address_wong
+-
+ I make my picking done.
-
!python {model: stock.partial.picking}: |
pick_obj = self.pool.get('stock.picking')
@@ -282,8 +290,8 @@
-
Run scheduler again.
-
- !function {model: mrp.procurement, name: run_scheduler}:
- - model: mrp.procurement
+ !function {model: procurement.order, name: run_scheduler}:
+ - model: procurement.order
search: "[]"
-
Check state of manufacturing order for Shirt.
@@ -303,22 +311,30 @@
wf_service = netsvc.LocalService("workflow")
for p_id in prod_ids:
wf_service.trg_validate(uid, 'mrp.production', p_id, 'button_produce', cr)
+-
+ I create record for producing products with quantity 5.00.
-
!record {model: mrp.product.produce, id: mrp_product_produce0}:
product_qty: 5.00
mode: 'consume_produce'
+-
+ I produce 2 products with 5.00 quantities each.
-
!python {model: mrp.product.produce}: |
from tools.translate import _
prod_obj = self.pool.get('mrp.production')
prod_ids = prod_obj.search(cr, uid, [('product_id.name','=','Shirt')])
self.do_produce(cr, uid, [1], context={'active_ids': prod_ids})
+-
+ I create record for remaining products with quantity 35.00.
-
!record {model: stock.move.consume, id: stock_move_consume0}:
product_id: product_product_buttons0
product_qty: 35.00
product_uom: product.product_uom_unit
location_id: stock.stock_location_stock
+-
+ I produce remaining product Buttons with 35.00 quantity.
-
!python {model: stock.move.consume}: |
from tools.translate import _
diff --git a/addons/mrp/test/mrp_production_order.yml b/addons/mrp/test/mrp_production_order.yml
index 5de26180723..0ceebfab107 100644
--- a/addons/mrp/test/mrp_production_order.yml
+++ b/addons/mrp/test/mrp_production_order.yml
@@ -18,7 +18,7 @@
product_uom: product.product_uom_unit
product_uos_qty: 0.0
-
- Creating a mrp.production.workcenter.line record
+ I create a record for Workcenter line.
-
!record {model: mrp.production.workcenter.line, id: mrp_production_workcenter_line_assemblyline0}:
cycle: 5.0
@@ -28,7 +28,7 @@
sequence: 0.0
workcenter_id: mrp.mrp_workcenter_0
-
- Creating a mrp.production.product.line record
+ I create second record for Workcenter line.
-
!record {model: mrp.production.product.line, id: mrp_production_product_line_regularprocessorconfig0}:
name: Regular processor config
@@ -38,7 +38,7 @@
product_uos_qty: 0.0
production_id: mrp_production_mo0
-
- Creating a mrp.production.product.line record
+ I create third record for Workcenter line.
-
!record {model: mrp.production.product.line, id: mrp_production_product_line_hddseagategb0}:
name: HDD Seagate 7200.8 80GB
@@ -48,7 +48,7 @@
product_uos_qty: 0.0
production_id: mrp_production_mo0
-
- Creating a mrp.production.product.line record
+ I create fourth record for Workcenter line.
-
!record {model: mrp.production.product.line, id: mrp_production_product_line_atxmidsizetower0}:
name: ATX Mid-size Tower
@@ -58,7 +58,7 @@
product_uos_qty: 0.0
production_id: mrp_production_mo0
-
- Creating a mrp.production.product.line record
+ I create a record for production line.
-
!record {model: mrp.production.product.line, id: mrp_production_product_line_mouse0}:
name: Mouse
@@ -68,7 +68,7 @@
product_uos_qty: 0.0
production_id: mrp_production_mo0
-
- Creating a mrp.production.product.line record
+ I create second record for production line.
-
!record {model: mrp.production.product.line, id: mrp_production_product_line_keyboard0}:
name: Keyboard
@@ -84,15 +84,15 @@
-
I am checking Procurement orders.
-
- !python {model: mrp.procurement}: |
+ !python {model: procurement.order}: |
from tools.translate import _
proc_ids = self.search(cr, uid, [('state','!=','confirmed')])
assert proc_ids, _('No Procurements!')
-
The scheduler runs.
-
- !function {model: mrp.procurement, name: run_scheduler}:
- - model: mrp.procurement
+ !function {model: procurement.order, name: run_scheduler}:
+ - model: procurement.order
search: "[('state','=','confirmed')]"
-
I am checking Internal picking.
@@ -102,7 +102,7 @@
pick_ids = self.search(cr, uid, [('state','!=','done'),('type','=','internal')])
assert pick_ids, _('No Internal Pickings!')
-
- I see that there is a manufacturing order for the subproduct of PC1 with ready state.
+ I see that there is a manufacturing order for the sub product of PC1 with ready state.
-
!python {model: mrp.production}: |
from tools.translate import _
@@ -110,17 +110,21 @@
assert order_ids, _('No manufacturing order!')
-
I start producing that product first. So I marked it as started.
+-
+ I create record for producing products with quantity 5.00.
-
!record {model: mrp.product.produce, id: mrp_product_produce0}:
product_qty: 5.00
mode: 'consume_produce'
+-
+ I produce the product.
-
!python {model: mrp.product.produce}: |
prod_obj = self.pool.get('mrp.production')
prod_ids = prod_obj.search(cr, uid, [('state','=','confirmed')])
self.do_produce(cr, uid, [1], context={'active_ids': prod_ids})
-
- Now the manufacturing order for subproduct CPU_GEN is done. And manufacturing
+ Now the manufacturing order for subproduct CPU_GEN is done and manufacturing
order for PC1 is in ready state.
-
!python {model: mrp.production}: |
@@ -131,6 +135,8 @@
I start producing the product PC1.
-
!workflow {model: mrp.production, action: button_produce, ref: mrp_production_mo0}
+-
+ Finally my production order is done.
-
!python {model: mrp.product.produce}: |
from tools.translate import _
diff --git a/addons/mrp_jit/__openerp__.py b/addons/mrp_jit/__openerp__.py
index d9a862f5ddd..497a81352f3 100644
--- a/addons/mrp_jit/__openerp__.py
+++ b/addons/mrp_jit/__openerp__.py
@@ -40,7 +40,7 @@
""",
'author': 'Tiny',
- 'depends': ['mrp_procurement'],
+ 'depends': ['procurement'],
'update_xml': ['mrp_jit.xml'],
'demo_xml': [],
'installable': True,
diff --git a/addons/mrp_jit/mrp_jit.xml b/addons/mrp_jit/mrp_jit.xml
index bab0d62b495..99f74a19517 100644
--- a/addons/mrp_jit/mrp_jit.xml
+++ b/addons/mrp_jit/mrp_jit.xml
@@ -2,7 +2,7 @@
-
+
diff --git a/addons/mrp_operations/__openerp__.py b/addons/mrp_operations/__openerp__.py
index 9c0a2bb4f33..0ce116535c1 100644
--- a/addons/mrp_operations/__openerp__.py
+++ b/addons/mrp_operations/__openerp__.py
@@ -61,6 +61,7 @@
'process/mrp_operation_process.xml'
],
'demo_xml': ['mrp_operation_data.xml'],
+ 'test': ['test/mrp_operations.yml'],
'installable': True,
'active': False,
'certificate': '0056233813133',
diff --git a/addons/mrp_operations/mrp_operations.py b/addons/mrp_operations/mrp_operations.py
index e8a97a47d9d..d1e66c92889 100644
--- a/addons/mrp_operations/mrp_operations.py
+++ b/addons/mrp_operations/mrp_operations.py
@@ -47,6 +47,9 @@ stock_move()
class mrp_production_workcenter_line(osv.osv):
def _get_date_date(self, cr, uid, ids, field_name, arg, context):
+ """ Finds starting date.
+ @return: Dictionary of values.
+ """
res={}
for op in self.browse(cr, uid, ids, context=context):
if op.date_start:
@@ -54,7 +57,11 @@ class mrp_production_workcenter_line(osv.osv):
else:
res[op.id]=False
return res
+
def _get_date_end(self, cr, uid, ids, field_name, arg, context):
+ """ Finds ending date.
+ @return: Dictionary of values.
+ """
res = {}
for op in self.browse(cr, uid, ids, context=context):
res[op.id]= False
@@ -66,8 +73,10 @@ class mrp_production_workcenter_line(osv.osv):
else:
res[op.id] = op.date_planned
return res
+
_inherit = 'mrp.production.workcenter.line'
_order = "sequence, date_planned"
+
_columns = {
'state': fields.selection([('draft','Draft'),('startworking', 'In Progress'),('pause','Pause'),('cancel','Canceled'),('done','Finished')],'State', readonly=True,
help="* When a work order is created it is set in 'Draft' state.\n" \
@@ -90,16 +99,21 @@ class mrp_production_workcenter_line(osv.osv):
'qty':fields.related('production_id','product_qty',type='float',string='Qty',readonly=True),
'uom':fields.related('production_id','product_uom',type='many2one',relation='product.uom',string='UOM',readonly=True),
}
+
_defaults = {
'state': lambda *a: 'draft',
'delay': lambda *a: 0.0
}
- def modify_production_order_state(self,cr,uid,ids,action):
+ def modify_production_order_state(self, cr, uid, ids, action):
+ """ Modifies production order state if work order state is changed.
+ @param action: Action to perform.
+ @return: Nothing
+ """
wf_service = netsvc.LocalService("workflow")
- oper_obj=self.browse(cr,uid,ids)[0]
- prod_obj=oper_obj.production_id
- if action=='start':
+ oper_obj = self.browse(cr, uid, ids)[0]
+ prod_obj = oper_obj.production_id
+ if action == 'start':
if prod_obj.state =='confirmed':
self.pool.get('mrp.production').force_production(cr, uid, [prod_obj.id])
wf_service.trg_validate(uid, 'mrp.production', prod_obj.id, 'button_produce', cr)
@@ -110,12 +124,12 @@ class mrp_production_workcenter_line(osv.osv):
else:
raise osv.except_osv(_('Error!'),_('Production Order Cannot start in [%s] state') % (prod_obj.state,))
else:
- oper_ids=self.search(cr,uid,[('production_id','=',prod_obj.id)])
- obj=self.browse(cr,uid,oper_ids)
- flag=True
+ oper_ids = self.search(cr,uid,[('production_id','=',prod_obj.id)])
+ obj = self.browse(cr,uid,oper_ids)
+ flag = True
for line in obj:
- if line.state!='done':
- flag=False
+ if line.state != 'done':
+ flag = False
if flag:
wf_service.trg_validate(uid, 'mrp.production', oper_obj.production_id.id, 'button_produce_done', cr)
return
@@ -132,15 +146,24 @@ class mrp_production_workcenter_line(osv.osv):
return result
def action_draft(self, cr, uid, ids):
+ """ Sets state to draft.
+ @return: True
+ """
self.write(cr, uid, ids, {'state':'draft'})
return True
def action_start_working(self, cr, uid, ids):
- self.modify_production_order_state(cr,uid,ids,'start')
+ """ Sets state to start working and writes starting date.
+ @return: True
+ """
+ self.modify_production_order_state(cr, uid, ids, 'start')
self.write(cr, uid, ids, {'state':'startworking', 'date_start': time.strftime('%Y-%m-%d %H:%M:%S')})
return True
def action_done(self, cr, uid, ids):
+ """ Sets state to done, writes finish date and calculates delay.
+ @return: True
+ """
delay = 0.0
date_now = time.strftime('%Y-%m-%d %H:%M:%S')
obj_line = self.browse(cr, uid, ids[0])
@@ -155,14 +178,23 @@ class mrp_production_workcenter_line(osv.osv):
return True
def action_cancel(self, cr, uid, ids):
+ """ Sets state to cancel.
+ @return: True
+ """
self.write(cr, uid, ids, {'state':'cancel'})
return True
def action_pause(self, cr, uid, ids):
+ """ Sets state to pause.
+ @return: True
+ """
self.write(cr, uid, ids, {'state':'pause'})
return True
def action_resume(self, cr, uid, ids):
+ """ Sets state to startworking.
+ @return: True
+ """
self.write(cr, uid, ids, {'state':'startworking'})
return True
@@ -175,6 +207,9 @@ class mrp_production(osv.osv):
}
def _production_date_end(self, cr, uid, ids, prop, unknow_none, context={}):
+ """ Calculates planned end date of production order.
+ @return: Dictionary of values
+ """
result = {}
for prod in self.browse(cr, uid, ids, context=context):
result[prod.id] = prod.date_planned
@@ -183,10 +218,13 @@ class mrp_production(osv.osv):
return result
def action_production_end(self, cr, uid, ids):
- obj=self.browse(cr,uid,ids)[0]
+ """ Finishes work order if production order is done.
+ @return: Super method
+ """
+ obj = self.browse(cr, uid, ids)[0]
for workcenter_line in obj.workcenter_lines:
- tmp = self.pool.get('mrp.production.workcenter.line').action_done(cr,uid,[workcenter_line.id])
- return super(mrp_production,self).action_production_end(cr,uid,ids)
+ tmp = self.pool.get('mrp.production.workcenter.line').action_done(cr, uid, [workcenter_line.id])
+ return super(mrp_production,self).action_production_end(cr, uid, ids)
def action_in_production(self, cr, uid, ids):
""" Changes state to In Production and writes starting date.
@@ -199,12 +237,18 @@ class mrp_production(osv.osv):
return super(mrp_production,self).action_in_production(cr, uid, ids)
def action_cancel(self, cr, uid, ids):
- obj=self.browse(cr,uid,ids)[0]
+ """ Cancels work order if production order is canceled.
+ @return: Super method
+ """
+ obj = self.browse(cr, uid, ids)[0]
for workcenter_line in obj.workcenter_lines:
- tmp=self.pool.get('mrp.production.workcenter.line').action_cancel(cr,uid,[workcenter_line.id])
+ tmp = self.pool.get('mrp.production.workcenter.line').action_cancel(cr, uid, [workcenter_line.id])
return super(mrp_production,self).action_cancel(cr,uid,ids)
def _compute_planned_workcenter(self, cr, uid, ids, context={}, mini=False):
+ """ Computes planned and finished dates for work order.
+ @return: Calculated date
+ """
dt_end = DateTime.now()
for po in self.browse(cr, uid, ids, context=context):
dt_end = DateTime.strptime(po.date_start or po.date_planned, '%Y-%m-%d %H:%M:%S')
@@ -241,6 +285,9 @@ class mrp_production(osv.osv):
return dt_end
def _move_pass(self, cr, uid, ids, context={}):
+ """ Calculates start date for stock moves finding interval from resource calendar.
+ @return: True
+ """
for po in self.browse(cr, uid, ids, context):
if po.allow_reorder:
continue
@@ -251,7 +298,7 @@ class mrp_production(osv.osv):
if l.state in ('done','cancel','draft'):
continue
todo += l.move_dest_id_lines
- if l.production_id and (l.production_id.date_finnished>dt):
+ if l.production_id and (l.production_id.date_finnished > dt):
if l.production_id.state not in ('done','cancel'):
for wc in l.production_id.workcenter_lines:
i = self.pool.get('resource.calendar').interval_min_get(
@@ -261,11 +308,14 @@ class mrp_production(osv.osv):
dt, wc.hour or 0.0
)
dt = i[0][0]
- if l.production_id.date_start>dt.strftime('%Y-%m-%d %H:%M:%S'):
+ if l.production_id.date_start > dt.strftime('%Y-%m-%d %H:%M:%S'):
self.write(cr, uid, [l.production_id.id], {'date_start':dt.strftime('%Y-%m-%d %H:%M:%S')}, mini=True)
return True
def _move_futur(self, cr, uid, ids, context={}):
+ """ Calculates start date for stock moves.
+ @return: True
+ """
for po in self.browse(cr, uid, ids, context):
if po.allow_reorder:
continue
@@ -277,8 +327,8 @@ class mrp_production(osv.osv):
break
if l.production_id.state in ('done','cancel'):
break
- if l.production_id and (l.production_id.date_start
+ attrs="{'invisible':[('state','!=','paid'),('state','!=','invoiced')]}" context="{'return':'return'}" />
@@ -85,6 +85,7 @@
+
@@ -109,12 +110,9 @@
+
-
-
-
-
-
+
diff --git a/addons/point_of_sale/posrule_data.xml b/addons/point_of_sale/posrule_data.xml
index 80c06670243..905e78e6e7a 100644
--- a/addons/point_of_sale/posrule_data.xml
+++ b/addons/point_of_sale/posrule_data.xml
@@ -95,7 +95,7 @@
ref('stock.menu_action_picking_tree7'),
ref('stock.menu_action_picking_tree8'),
ref('stock.menu_action_picking_tree9'),
- ref('mrp_procurement.menu_mrp_procurement_action3'),
+ ref('procurement.menu_mrp_procurement_action3'),
ref('point_of_sale.menu_point_root')])]" name="menu_access"/>
@@ -132,7 +132,7 @@
-
+
@@ -206,7 +206,7 @@
-
+
@@ -474,12 +474,12 @@
-
+
-
+
@@ -497,7 +497,7 @@
name="Reporting"
parent="stock.menu_stock_root" groups="base.group_user"/>
-
+
diff --git a/addons/point_of_sale/posrule_data2.xml b/addons/point_of_sale/posrule_data2.xml
index 927584e92ce..7ac787db54c 100644
--- a/addons/point_of_sale/posrule_data2.xml
+++ b/addons/point_of_sale/posrule_data2.xml
@@ -177,7 +177,7 @@
ref('stock.menu_action_picking_tree7'),
ref('stock.menu_action_picking_tree8'),
ref('stock.menu_action_picking_tree9'),
- ref('mrp_procurement.menu_mrp_procurement_action3'),
+ ref('procurement.menu_mrp_procurement_action3'),
ref('point_of_sale.menu_point_root')])]" name="menu_access"/>
@@ -214,7 +214,7 @@