[FIX] stock: filled picking_type_id field on stock.move when created manually from a picking + fixed errors in dates with push rules

bzr revid: qdp-launchpad@openerp.com-20131211144420-y1pdr47kofvsdnwa
This commit is contained in:
Quentin (OpenERP) 2013-12-11 15:44:20 +01:00
parent 3b7e8fcbf6
commit a101d351b5
2 changed files with 5 additions and 4 deletions

View File

@ -1439,7 +1439,6 @@ class stock_move(osv.osv):
if rules:
rule = push_obj.browse(cr, uid, rules[0], context=context)
push_obj._apply(cr, uid, rule, move, context=context)
return True
# Create the stock.move.putaway records
@ -2925,11 +2924,12 @@ class stock_location_path(osv.osv):
}
def _apply(self, cr, uid, rule, move, context=None):
move_obj = self.pool.get('stock.move')
newdate = (datetime.strptime(move.date, DEFAULT_SERVER_DATETIME_FORMAT) + relativedelta.relativedelta(days=rule.delay or 0)).strftime(DEFAULT_SERVER_DATE_FORMAT)
newdate = (datetime.strptime(move.date_expected, DEFAULT_SERVER_DATETIME_FORMAT) + relativedelta.relativedelta(days=rule.delay or 0)).strftime(DEFAULT_SERVER_DATE_FORMAT)
if rule.auto == 'transparent':
old_dest_location = move.location_dest_id.id
move_obj.write(cr, uid, [move.id], {
'date': newdate,
'date_expected': newdate,
'location_dest_id': rule.location_dest_id.id
})
move.refresh()
@ -2942,7 +2942,7 @@ class stock_location_path(osv.osv):
move_id = move_obj.copy(cr, uid, move.id, {
'location_id': move.location_dest_id.id,
'location_dest_id': rule.location_dest_id.id,
'date': datetime.now().strftime('%Y-%m-%d'),
'date': newdate,
'company_id': rule.company_id and rule.company_id.id or False,
'date_expected': newdate,
'picking_id': False,

View File

@ -1128,6 +1128,7 @@
<group>
<field name="product_id" on_change="onchange_product_id(product_id,location_id,location_dest_id, parent.partner_id)"/>
<field name="procure_method"/>
<field name="picking_type_id" invisible="1"/>
<label for="product_uom_qty"/>
<div>
<field name="product_uom_qty" on_change="onchange_quantity(product_id, product_uom_qty, product_uom, product_uos)" class="oe_inline"/>
@ -1153,7 +1154,7 @@
</group>
<group string="Locations" groups="stock.group_locations">
<field name="location_id" domain="[('usage','&lt;&gt;','view')]"/>
<field name="location_dest_id" domain="[('usage','=','internal')]" groups="stock.group_locations"/>
<field name="location_dest_id" domain="[('usage','=','internal')]"/>
</group>
</group>
</form>