@@ -314,7 +314,6 @@ class mrp_bom(osv.osv):
|
||||
d, m = divmod(factor, wc_use.workcenter_id.capacity_per_cycle)
|
||||
mult = (d + (m and 1.0 or 0.0))
|
||||
cycle = mult * wc_use.cycle_nbr
|
||||
print mult, wc_use.hour_nbr, wc.time_start, wc.time_stop, cycle
|
||||
result2.append({
|
||||
'name': bom.routing_id.name,
|
||||
'workcenter_id': wc.id,
|
||||
|
||||
@@ -328,14 +328,11 @@ class mrp_procurement(osv.osv):
|
||||
'product_qty': procurement.product_qty,
|
||||
'product_uom': procurement.product_uom.id,
|
||||
'date_planned': procurement.date_planned,
|
||||
'state': 'confirmed',
|
||||
'state': 'draft',
|
||||
'company_id': procurement.company_id.id,
|
||||
})
|
||||
move_obj.action_confirm(cr, uid, [id], context=context)
|
||||
self.write(cr, uid, [procurement.id], {'move_id': id, 'close_move': 1})
|
||||
else:
|
||||
# TODO: check this
|
||||
if procurement.procure_method == 'make_to_stock' and procurement.move_id.state in ('waiting','draft'):
|
||||
id = move_obj.write(cr, uid, [procurement.move_id.id], {'state':'confirmed'})
|
||||
self.write(cr, uid, ids, {'state': 'confirmed', 'message': ''})
|
||||
return True
|
||||
|
||||
|
||||
+15
-3
@@ -402,7 +402,6 @@ stock_tracking()
|
||||
#----------------------------------------------------------
|
||||
class stock_picking(osv.osv):
|
||||
_name = "stock.picking"
|
||||
_log_create = True
|
||||
_description = "Picking List"
|
||||
|
||||
def _set_maximum_date(self, cr, uid, ids, name, value, arg, context):
|
||||
@@ -460,7 +459,15 @@ class stock_picking(osv.osv):
|
||||
def create(self, cr, user, vals, context=None):
|
||||
if ('name' not in vals) or (vals.get('name')=='/'):
|
||||
vals['name'] = self.pool.get('ir.sequence').get(cr, user, 'stock.picking')
|
||||
|
||||
type_list = {
|
||||
'out':_('Packing List'),
|
||||
'in':_('Reception'),
|
||||
'internal': _('Internal picking'),
|
||||
'delivery': _('Delivery order')
|
||||
}
|
||||
if not vals.get('auto_picking', False):
|
||||
message = type_list.get(vals.get('type',_('Picking'))) + " '" + vals['name'] + "' "+ _("created.")
|
||||
self.log(cr, user, id, message)
|
||||
return super(stock_picking, self).create(cr, user, vals, context)
|
||||
|
||||
_columns = {
|
||||
@@ -533,7 +540,7 @@ class stock_picking(osv.osv):
|
||||
def action_confirm(self, cr, uid, ids, context={}):
|
||||
self.write(cr, uid, ids, {'state': 'confirmed'})
|
||||
todo = []
|
||||
for picking in self.browse(cr, uid, ids):
|
||||
for picking in self.browse(cr, uid, ids, context=context):
|
||||
for r in picking.move_lines:
|
||||
if r.state == 'draft':
|
||||
todo.append(r.id)
|
||||
@@ -1287,6 +1294,11 @@ class stock_move(osv.osv):
|
||||
def create(self, cr, user, vals, context=None):
|
||||
if vals.get('move_stock_return_history',False):
|
||||
vals['move_stock_return_history'] = []
|
||||
# Check that the stock.move is in draft state at creation to force
|
||||
# passing through button_confirm
|
||||
if vals.get('state','draft') not in ('draft','done','waiting'):
|
||||
logger = netsvc.Logger()
|
||||
logger.notifyChannel("code", netsvc.LOG_WARNING, "All new stock.move must be in state draft at the creation !")
|
||||
return super(stock_move, self).create(cr, user, vals, context)
|
||||
|
||||
def _auto_init(self, cursor, context):
|
||||
|
||||
+14
-14
@@ -69,7 +69,7 @@
|
||||
<field name="model">stock.inventory</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Lot Inventory" colors="grey:state in ('done', 'cancel')">
|
||||
<tree string="Lot Inventory" colors="grey:state in ('cancel')">
|
||||
<field name="name"/>
|
||||
<field name="date"/>
|
||||
<field name="state"/>
|
||||
@@ -307,7 +307,7 @@
|
||||
<field name="type">tree</field>
|
||||
<field name="field_parent">move_history_ids</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree colors="grey:state in ('cancel');black:state not in ('cancel')" string="Moves">
|
||||
<tree colors="grey:state in ('cancel')" string="Moves">
|
||||
<field name="product_id" select="1"/>
|
||||
<field name="product_qty" select="1"/>
|
||||
<field name="product_uom" select="1" string="UOM"/>
|
||||
@@ -329,7 +329,7 @@
|
||||
<field name="type">tree</field>
|
||||
<field name="field_parent">move_history_ids2</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree colors="grey:state in ('cancel');black:state not in ('cancel')" string="Moves">
|
||||
<tree colors="grey:state in ('cancel')" string="Moves">
|
||||
<field name="product_id" select="1"/>
|
||||
<field name="product_qty" select="1"/>
|
||||
<field name="product_uom" select="1" string="UOM"/>
|
||||
@@ -455,7 +455,7 @@
|
||||
<field name="type">tree</field>
|
||||
<field name="priority" eval="2"/>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Stock location" colors="blue:usage=='view';darkred:usage=='internal';black:usage not in ('view','internal')">
|
||||
<tree string="Stock location" colors="blue:usage=='view';darkred:usage=='internal'">
|
||||
<field name="complete_name"/>
|
||||
<field name="usage"/>
|
||||
<field name="stock_real" invisible="'product_id' not in context"/>
|
||||
@@ -580,7 +580,7 @@
|
||||
<field name="model">stock.picking</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree colors="blue:state in ('draft');grey:state in ('cancel', 'done');red:state not in ('cancel', 'done') and date < current_date" string="Picking list">
|
||||
<tree colors="blue:state in ('draft');grey:state in ('cancel');red:state not in ('cancel', 'done') and date < current_date" string="Picking list">
|
||||
<field name="name"/>
|
||||
<field name="backorder_id" groups="base.group_extended"/>
|
||||
<field name="origin"/>
|
||||
@@ -611,7 +611,7 @@
|
||||
<notebook colspan="4">
|
||||
<page string="General Information">
|
||||
<field colspan="4" name="move_lines" nolabel="1" widget="one2many_list" default_get="{'move_line':move_lines, 'address_out_id': address_id}">
|
||||
<tree colors="grey:state in ('done','cancel');black:state not in ('cancel','done')" string="Stock Moves">
|
||||
<tree colors="grey:state in ('cancel')" string="Stock Moves">
|
||||
<field name="name" string="Move Name"/>
|
||||
<field name="product_id"/>
|
||||
<field name="product_qty" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/>
|
||||
@@ -730,7 +730,7 @@
|
||||
<field name="model">stock.picking</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree colors="blue:state in ('draft');grey:state in ('cancel', 'done');red:state not in ('cancel', 'done') and date < current_date" string="Picking list">
|
||||
<tree colors="blue:state in ('draft');grey:state in ('cancel');red:state not in ('cancel', 'done') and date < current_date" string="Picking list">
|
||||
<field name="name"/>
|
||||
<field name="address_id" select="1"/>
|
||||
<field name="backorder_id" groups="base.group_extended"/>
|
||||
@@ -761,7 +761,7 @@
|
||||
<notebook colspan="4">
|
||||
<page string="General Information">
|
||||
<field colspan="4" name="move_lines" nolabel="1" widget="one2many_list" default_get="{'move_line':move_lines, 'address_out_id': address_id}">
|
||||
<tree colors="grey:state in ('done','cancel');black:state not in ('cancel','done')" string="Stock Moves">
|
||||
<tree colors="grey:state in ('cancel')" string="Stock Moves">
|
||||
<field name="name" string="Move Name"/>
|
||||
<field name="product_id"/>
|
||||
<field name="product_qty" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/>
|
||||
@@ -907,7 +907,7 @@
|
||||
<field name="model">stock.picking</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree colors="blue:state in ('draft');grey:state in ('cancel', 'done');red:state not in ('cancel', 'done') and date < current_date" string="Picking list">
|
||||
<tree colors="blue:state in ('draft');grey:state in ('cancel');red:state not in ('cancel', 'done') and date < current_date" string="Picking list">
|
||||
<field name="name"/>
|
||||
<field name="address_id"/>
|
||||
<field name="backorder_id" groups="base.group_extended"/>
|
||||
@@ -939,7 +939,7 @@
|
||||
<notebook colspan="4">
|
||||
<page string="General Information">
|
||||
<field colspan="4" name="move_lines" nolabel="1" widget="one2many_list" default_get="{'move_line':move_lines, 'address_out_id': address_id}">
|
||||
<tree colors="grey:state in ('done','cancel');black:state not in ('cancel','done')" string="Stock Moves">
|
||||
<tree colors="grey:state in ('cancel')" string="Stock Moves">
|
||||
<field name="name" string="Move Name"/>
|
||||
<field name="product_id"/>
|
||||
<field name="product_qty" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/>
|
||||
@@ -1082,7 +1082,7 @@
|
||||
<field name="model">stock.picking</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree colors="blue:state in ('draft');grey:state in ('cancel', 'done');red:state not in ('cancel', 'done') and date < current_date" string="Picking list">
|
||||
<tree colors="blue:state in ('draft');grey:state in ('done');red:state not in ('cancel', 'done') and date < current_date" string="Picking list">
|
||||
<field name="name"/>
|
||||
<field name="address_id"/>
|
||||
<field name="backorder_id" groups="base.group_extended"/>
|
||||
@@ -1116,7 +1116,7 @@
|
||||
<notebook colspan="4">
|
||||
<page string="General Information">
|
||||
<field colspan="4" name="move_lines" nolabel="1" widget="one2many_list" default_get="{'move_line':move_lines, 'address_in_id': address_id}">
|
||||
<tree colors="grey:state in ('done','cancel');black:state not in ('cancel','done')" string="Stock Moves">
|
||||
<tree colors="grey:state in ('cancel')" string="Stock Moves">
|
||||
<field name="product_id"/>
|
||||
<field name="product_qty"/>
|
||||
<field name="product_uom" string="Product Unit of Measure"/>
|
||||
@@ -1298,7 +1298,7 @@
|
||||
<field name="type">tree</field>
|
||||
<field eval="6" name="priority"/>
|
||||
<field name="arch" type="xml">
|
||||
<tree colors="grey:state in ('done', 'cancel');black:state not in ('done', 'cancel');red:date_planned > current_date" string="Moves">
|
||||
<tree colors="grey:state in ('cancel');red:date_planned > current_date" string="Moves">
|
||||
<field name="name" string="Move Name"/>
|
||||
<field name="product_id"/>
|
||||
<field name="product_qty" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/>
|
||||
@@ -1422,7 +1422,7 @@
|
||||
<field name="type">tree</field>
|
||||
<field eval="6" name="priority"/>
|
||||
<field name="arch" type="xml">
|
||||
<tree colors="grey:state in ('cancel','done');black:state not in ('cancel','done')" string="Moves">
|
||||
<tree colors="grey:state in ('cancel')" string="Moves">
|
||||
<field name="picking_id" string="Reference"/>
|
||||
<field name="origin" string="Latest Procurement"/>
|
||||
<field name="partner_id" string="Supplier"/>
|
||||
|
||||
Reference in New Issue
Block a user