bzr revid: fp@tinyerp.com-20081027203142-cdqgk11kigopue52
This commit is contained in:
Fabien Pinckaers 2008-10-27 21:31:42 +01:00
parent d54616572e
commit 33269606bd
2 changed files with 38 additions and 15 deletions

View File

@ -133,7 +133,8 @@ class mrp_routing_workcenter(osv.osv):
'workcenter_id': fields.many2one('mrp.workcenter', 'Workcenter', required=True), 'workcenter_id': fields.many2one('mrp.workcenter', 'Workcenter', required=True),
'name': fields.char('Name', size=64, required=True), 'name': fields.char('Name', size=64, required=True),
'sequence': fields.integer('Sequence'), 'sequence': fields.integer('Sequence'),
'cycle_nbr': fields.float('Number of Cycle', required=True), 'cycle_nbr': fields.float('Number of Cycle', required=True,
help="A cycle is defined in the workcenter definition."),
'hour_nbr': fields.float('Number of Hours', required=True), 'hour_nbr': fields.float('Number of Hours', required=True),
'routing_id': fields.many2one('mrp.routing', 'Parent Routing', select=True), 'routing_id': fields.many2one('mrp.routing', 'Parent Routing', select=True),
'note': fields.text('Description') 'note': fields.text('Description')
@ -184,7 +185,6 @@ class mrp_bom(osv.osv):
"between the sale order to the picking without going through the production order." \ "between the sale order to the picking without going through the production order." \
"The normal BoM will generate one production order per BoM level."), "The normal BoM will generate one production order per BoM level."),
'method': fields.function(_compute_type, string='Method', method=True, type='selection', selection=[('',''),('stock','On Stock'),('order','On Order'),('set','Set / Pack')]), 'method': fields.function(_compute_type, string='Method', method=True, type='selection', selection=[('',''),('stock','On Stock'),('order','On Order'),('set','Set / Pack')]),
'date_start': fields.date('Valid From', help="Validity of this BoM or component. Keep empty if it's always valid."), 'date_start': fields.date('Valid From', help="Validity of this BoM or component. Keep empty if it's always valid."),
'date_stop': fields.date('Valid Until', help="Validity of this BoM or component. Keep empty if it's always valid."), 'date_stop': fields.date('Valid Until', help="Validity of this BoM or component. Keep empty if it's always valid."),
'sequence': fields.integer('Sequence'), 'sequence': fields.integer('Sequence'),
@ -194,8 +194,8 @@ class mrp_bom(osv.osv):
'product_uos': fields.many2one('product.uom', 'Product UOS'), 'product_uos': fields.many2one('product.uom', 'Product UOS'),
'product_qty': fields.float('Product Qty', required=True), 'product_qty': fields.float('Product Qty', required=True),
'product_uom': fields.many2one('product.uom', 'Product UOM', required=True), 'product_uom': fields.many2one('product.uom', 'Product UOM', required=True),
'product_rounding': fields.float('Product Rounding'), 'product_rounding': fields.float('Product Rounding', help="Rounding applied on the product quantity. For integer only values, put 1.0"),
'product_efficiency': fields.float('Product Efficiency', required=True), 'product_efficiency': fields.float('Product Efficiency', required=True, help="Efficiency on the production. A factor of 0.9 means a loss of 10% in the production."),
'bom_lines': fields.one2many('mrp.bom', 'bom_id', 'BoM Lines'), 'bom_lines': fields.one2many('mrp.bom', 'bom_id', 'BoM Lines'),
'bom_id': fields.many2one('mrp.bom', 'Parent BoM', ondelete='cascade', select=True), 'bom_id': fields.many2one('mrp.bom', 'Parent BoM', ondelete='cascade', select=True),
'routing_id': fields.many2one('mrp.routing', 'Routing', help="The list of operations (list of workcenters) to produce the finnished product. The routing is mainly used to compute workcenter costs during operations and to plan futur loads on workcenters based on production plannification."), 'routing_id': fields.many2one('mrp.routing', 'Routing', help="The list of operations (list of workcenters) to produce the finnished product. The routing is mainly used to compute workcenter costs during operations and to plan futur loads on workcenters based on production plannification."),
@ -214,7 +214,8 @@ class mrp_bom(osv.osv):
} }
_order = "sequence" _order = "sequence"
_sql_constraints = [ _sql_constraints = [
('bom_qty_zero', 'CHECK (product_qty>0)', 'All product quantities must be greater than 0 !'), ('bom_qty_zero', 'CHECK (product_qty>0)', 'All product quantities must be greater than 0.\n' \
'You should install the mrp_subproduct module if you want to manage extra products on BoMs !'),
] ]
def _check_recursion(self, cr, uid, ids): def _check_recursion(self, cr, uid, ids):
@ -385,8 +386,10 @@ class mrp_production(osv.osv):
'product_uos_qty': fields.float('Product Qty'), 'product_uos_qty': fields.float('Product Qty'),
'product_uos': fields.many2one('product.uom', 'Product UOM'), 'product_uos': fields.many2one('product.uom', 'Product UOM'),
'location_src_id': fields.many2one('stock.location', 'Raw Products Location', required=True), 'location_src_id': fields.many2one('stock.location', 'Raw Products Location', required=True,
'location_dest_id': fields.many2one('stock.location', 'Finnished Products Location', required=True), help="Location where the system will look for products used in raw materials."),
'location_dest_id': fields.many2one('stock.location', 'Finnished Products Location', required=True,
help="Location where the system will stock the finnished products."),
'date_planned': fields.datetime('Scheduled date', required=True, select=1), 'date_planned': fields.datetime('Scheduled date', required=True, select=1),
'date_start': fields.datetime('Start Date'), 'date_start': fields.datetime('Start Date'),
@ -394,7 +397,8 @@ class mrp_production(osv.osv):
'bom_id': fields.many2one('mrp.bom', 'Bill of Material', domain=[('bom_id','=',False)]), 'bom_id': fields.many2one('mrp.bom', 'Bill of Material', domain=[('bom_id','=',False)]),
'picking_id': fields.many2one('stock.picking', 'Packing list', readonly=True), 'picking_id': fields.many2one('stock.picking', 'Packing list', readonly=True,
help="This is the internal picking list take bring the raw materials to the production plan."),
'move_prod_id': fields.many2one('stock.move', 'Move product', readonly=True), 'move_prod_id': fields.many2one('stock.move', 'Move product', readonly=True),
'move_lines': fields.many2many('stock.move', 'mrp_production_move_ids', 'production_id', 'move_id', 'Products Consummed'), 'move_lines': fields.many2many('stock.move', 'mrp_production_move_ids', 'production_id', 'move_id', 'Products Consummed'),
@ -739,7 +743,9 @@ class mrp_procurement(osv.osv):
_description = "Procurement" _description = "Procurement"
_columns = { _columns = {
'name': fields.char('Name', size=64, required=True), 'name': fields.char('Name', size=64, required=True),
'origin': fields.char('Origin', size=64), 'origin': fields.char('Origin', size=64,
help="Reference of the document that created this procurement.\n"
"This is automatically completed by Open ERP."),
'priority': fields.selection([('0','Not urgent'),('1','Normal'),('2','Urgent'),('3','Very Urgent')], 'Priority', required=True), 'priority': fields.selection([('0','Not urgent'),('1','Normal'),('2','Urgent'),('3','Very Urgent')], 'Priority', required=True),
'date_planned': fields.datetime('Scheduled date', required=True), 'date_planned': fields.datetime('Scheduled date', required=True),
'date_close': fields.datetime('Date Closed'), 'date_close': fields.datetime('Date Closed'),
@ -754,7 +760,9 @@ class mrp_procurement(osv.osv):
'close_move': fields.boolean('Close Move at end', required=True), 'close_move': fields.boolean('Close Move at end', required=True),
'location_id': fields.many2one('stock.location', 'Location', required=True), 'location_id': fields.many2one('stock.location', 'Location', required=True),
'procure_method': fields.selection([('make_to_stock','from stock'),('make_to_order','on order')], 'Procurement Method', states={'draft':[('readonly',False)], 'confirmed':[('readonly',False)]}, readonly=True, required=True), 'procure_method': fields.selection([('make_to_stock','from stock'),('make_to_order','on order')], 'Procurement Method', states={'draft':[('readonly',False)], 'confirmed':[('readonly',False)]},
readonly=True, required=True, help="If you encode manually a procurement, you probably want to use" \
" a make to order method."),
'purchase_id': fields.many2one('purchase.order', 'Purchase Order'), 'purchase_id': fields.many2one('purchase.order', 'Purchase Order'),
'purchase_line_id': fields.many2one('purchase.order.line', 'Purchase Order Line'), 'purchase_line_id': fields.many2one('purchase.order.line', 'Purchase Order Line'),
@ -771,6 +779,16 @@ class mrp_procurement(osv.osv):
'close_move': lambda *a: 0, 'close_move': lambda *a: 0,
'procure_method': lambda *a: 'make_to_order', 'procure_method': lambda *a: 'make_to_order',
} }
def onchange_product_id(self, cr, uid, ids, product_id, context={}):
if product_id:
w=self.pool.get('product.product').browse(cr,uid,product_id, context)
v = {
'product_uom':w.uom_id.id,
'product_uos':w.uos_id and w.uos_id.id or w.uom_id.id
}
return {'value': v}
return {}
def check_product(self, cr, uid, ids): def check_product(self, cr, uid, ids):
for procurement in self.browse(cr, uid, ids): for procurement in self.browse(cr, uid, ids):
if procurement.product_id.type in ('product', 'consu'): if procurement.product_id.type in ('product', 'consu'):
@ -1081,9 +1099,14 @@ class stock_warehouse_orderpoint(osv.osv):
'location_id': fields.many2one('stock.location', 'Location', required=True), 'location_id': fields.many2one('stock.location', 'Location', required=True),
'product_id': fields.many2one('product.product', 'Product', required=True, domain=[('type','=','product')]), 'product_id': fields.many2one('product.product', 'Product', required=True, domain=[('type','=','product')]),
'product_uom': fields.many2one('product.uom', 'Product UOM', required=True ), 'product_uom': fields.many2one('product.uom', 'Product UOM', required=True ),
'product_min_qty': fields.float('Min Quantity', required=True), 'product_min_qty': fields.float('Min Quantity', required=True,
'product_max_qty': fields.float('Max Quantity', required=True), help="When the virtual stock goes belong the Min Quantity, Open ERP generates "\
'qty_multiple': fields.integer('Qty Multiple', required=True), "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', 'Purchase Order') 'procurement_id': fields.many2one('mrp.procurement', 'Purchase Order')
} }
_defaults = { _defaults = {

View File

@ -642,12 +642,12 @@
<separator colspan="2" string="Planification"/> <separator colspan="2" string="Planification"/>
<field name="date_planned" select="1"/> <field name="date_planned" select="1"/>
<field name="procure_method" select="2"/> <field name="procure_method" select="2"/>
<field name="priority"/> <field name="priority" groups="base.group_extended"/>
</group> </group>
<notebook colspan="4"> <notebook colspan="4">
<page string="Procurement Details"> <page string="Procurement Details">
<separator colspan="4" string="Product &amp; Location"/> <separator colspan="4" string="Product &amp; Location"/>
<field name="product_id" select="1"/> <field name="product_id" select="1" on_change="onchange_product_id(product_id)"/>
<field name="location_id" select="2"/> <field name="location_id" select="2"/>
<field name="product_qty"/> <field name="product_qty"/>
<field name="product_uom"/> <field name="product_uom"/>