[MERGE, IMP] merge with mma branch and improve the reoprt lable

bzr revid: psi@tinyerp.com-20120402110218-jgtrf0gqx704naey
This commit is contained in:
Purnendu Singh (OpenERP) 2012-04-02 16:32:18 +05:30
commit 507b997148
6 changed files with 43 additions and 33 deletions

View File

@ -427,9 +427,9 @@ class purchase_order(osv.osv):
'name': self.pool.get('ir.sequence').get(cr, uid, 'stock.picking.in'),
'origin': order.name + ((order.origin and (':' + order.origin)) or ''),
'date': order.date_order,
'type': 'in',
'partner_id': order.dest_address_id.id or order.partner_id.id,
'invoice_state': '2binvoiced' if order.invoice_method == 'picking' else 'none',
'type': 'in',
'purchase_id': order.id,
'company_id': order.company_id.id,
'move_lines' : [],

View File

@ -158,8 +158,8 @@
<blockTable colWidths="269.0,269.0" style="Table_Address_detail">
<tr>
<td>
<para style="terp_default_Bold_9">Supplier Address : [[ (picking.type == 'out' or removeParentNode('para')) and '' ]]</para>
<para style="terp_default_Bold_9">Customer Address : [[ (picking.type == 'in' or removeParentNode('para')) and '' ]]</para>
<para style="terp_default_Bold_9">Supplier Address : [[ (picking.type == 'in' or removeParentNode('para')) and '' ]]</para>
<para style="terp_default_Bold_9">Customer Address : [[ (picking.type == 'out' or removeParentNode('para')) and '' ]]</para>
<para style="terp_default_Bold_9">Warehouse Address : [[ (picking.type == 'internal' or removeParentNode('para')) and '' ]]</para>
<para style="terp_default_9">[[ (picking.partner_id and picking.partner_id.id and picking.partner_id.title.name) or '' ]] [[ picking.partner_id and picking.partner_id.id and picking.partner_id.name ]]</para>
<para style="terp_default_9">[[ picking.partner_id and display_address(picking.partner_id,'delivery') ]]</para>

View File

@ -655,7 +655,7 @@ class stock_picking(osv.osv):
store=True, type='datetime', string='Max. Expected Date', select=2),
'move_lines': fields.one2many('stock.move', 'picking_id', 'Internal Moves', states={'done': [('readonly', True)], 'cancel': [('readonly', True)]}),
'auto_picking': fields.boolean('Auto-Picking', states={'done':[('readonly', True)], 'cancel':[('readonly',True)]}),
'partner_id': fields.many2one('res.partner', 'Partner'),
'partner_id': fields.many2one('res.partner', 'Partner', states={'done':[('readonly', True)], 'cancel':[('readonly',True)]}),
'invoice_state': fields.selection([
("invoiced", "Invoiced"),
("2binvoiced", "To Be Invoiced"),
@ -675,7 +675,7 @@ class stock_picking(osv.osv):
_sql_constraints = [
('name_uniq', 'unique(name, company_id)', 'Reference must be unique per Company!'),
]
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
if context is None:
context = {}
@ -722,7 +722,7 @@ class stock_picking(osv.osv):
res['fields']['state']['selection'] = [(x[0], _state[x[0]]) for x in PICK_STATE]
res['fields']['state']['help'] = self._tooltip_picking_state(_state)
# To update the fields tooltips according to shipping type
if field == 'address_id':
if field == 'partner_id':
_tooltip = ''
if type == 'in':
_tooltip = _('supplier')
@ -730,7 +730,7 @@ class stock_picking(osv.osv):
_tooltip = _('warehouse')
elif type == 'out':
_tooltip = _('customer')
res['fields']['address_id']['help'] = _("Address of %s") %(_tooltip)
res['fields']['partner_id']['help'] = _("Address of %s") %(_tooltip)
return res
def action_process(self, cr, uid, ids, context=None):
@ -889,10 +889,13 @@ class stock_picking(osv.osv):
#TOFIX: assignment of move lines should be call before testing assigment otherwise picking never gone in assign state
ok = True
for pick in self.browse(cr, uid, ids):
if pick.type == 'in':
return True
mt = pick.move_type
for move in pick.move_lines:
if pick.type == 'in':
if move.state == 'waiting':
return False
if move.product_id.type == 'consu' or move.location_id.usage == 'supplier':
return True
if (move.state in ('confirmed', 'draft')) and (mt == 'one'):
return False
if (mt == 'direct') and (move.state == 'assigned') and (move.product_qty):

View File

@ -694,7 +694,7 @@
<group colspan="4" col="4">
<field name="name" readonly="1"/>
<field name="origin"/>
<field name="partner_id" on_change="onchange_partner_in(partner_id)" colspan="4"/>
<field name="partner_id" string="Warehouse" on_change="onchange_partner_in(partner_id)" colspan="4"/>
<field name="invoice_state" string="Invoice Control" groups="base.group_extended"/>
</group>
<group colspan="2" col="2">
@ -886,7 +886,7 @@
<group colspan="4" col="4">
<field name="name" readonly="1"/>
<field name="origin" readonly="1"/>
<field name="partner_id" on_change="onchange_partner_in(partner_id)" colspan="4"/>
<field name="partner_id" string="Customer" on_change="onchange_partner_in(partner_id)" colspan="4"/>
<field name="invoice_state"/>
</group>
@ -1106,7 +1106,7 @@
<group colspan="4" col="4">
<field name="name" readonly="1"/>
<field name="origin"/>
<field name="partner_id" on_change="onchange_partner_in(partner_id)" colspan="4"/>
<field name="partner_id" string="Supplier" on_change="onchange_partner_in(partner_id)" colspan="4"/>
<field name="invoice_state" string="Invoice Control"/>
</group>

View File

@ -51,11 +51,12 @@
<field name="act_to" ref="act_confirmed"/>
<field name="signal">button_confirm</field>
</record>
<record id="trans_confirmed_assigned_back" model="workflow.transition">
<field name="act_from" ref="act_assigned"/>
<field name="act_to" ref="act_confirmed"/>
<field name="condition">not test_assigned()</field>
</record>
</record>
<record id="trans_confirmed_assigned" model="workflow.transition">
<field name="act_from" ref="act_confirmed"/>
<field name="act_to" ref="act_assigned"/>

View File

@ -45,7 +45,7 @@ class stock_return_picking(osv.osv_memory):
_columns = {
'product_return_moves' : fields.one2many('stock.return.picking.memory', 'wizard_id', 'Moves'),
'invoice_state': fields.selection([('2binvoiced', 'To be refunded/invoiced'), ('none', 'No invoicing')], 'Invoicing',required=True),
}
}
def default_get(self, cr, uid, fields, context=None):
"""
@ -143,6 +143,8 @@ class stock_return_picking(osv.osv_memory):
pick_obj = self.pool.get('stock.picking')
uom_obj = self.pool.get('product.uom')
data_obj = self.pool.get('stock.return.picking.memory')
act_obj = self.pool.get('ir.actions.act_window')
model_obj = self.pool.get('ir.model.data')
wf_service = netsvc.LocalService("workflow")
pick = pick_obj.browse(cr, uid, record_id, context=context)
data = self.read(cr, uid, ids[0], context=context)
@ -152,15 +154,20 @@ class stock_return_picking(osv.osv_memory):
returned_lines = 0
# Create new picking for returned products
if pick.type=='out':
if pick.type =='out':
new_type = 'in'
elif pick.type=='in':
elif pick.type =='in':
new_type = 'out'
else:
new_type = 'internal'
new_picking = pick_obj.copy(cr, uid, pick.id, {'name':'%s-return' % pick.name,
'move_lines':[], 'state':'draft', 'type':new_type,
'date':date_cur, 'invoice_state':data['invoice_state'],})
new_picking = pick_obj.copy(cr, uid, pick.id, {
'name':'%s-return' % pick.name,
'move_lines': [],
'state':'draft',
'type': new_type,
'date':date_cur,
'invoice_state': data['invoice_state'],
})
val_id = data['product_return_moves']
for v in val_id:
@ -178,18 +185,20 @@ class stock_return_picking(osv.osv_memory):
if new_qty:
returned_lines += 1
new_move=move_obj.copy(cr, uid, move.id, {
'product_qty': new_qty,
'product_uos_qty': uom_obj._compute_qty(cr, uid, move.product_uom.id,
new_qty, move.product_uos.id),
'picking_id':new_picking, 'state':'draft',
'location_id':new_location, 'location_dest_id':move.location_id.id,
'date':date_cur,})
move_obj.write(cr, uid, [move.id], {'move_history_ids2':[(4,new_move)]})
'product_qty': new_qty,
'product_uos_qty': uom_obj._compute_qty(cr, uid, move.product_uom.id, new_qty, move.product_uos.id),
'picking_id':new_picking,
'state': 'draft',
'location_id': new_location,
'location_dest_id': move.location_id.id,
'date': date_cur,
})
move_obj.write(cr, uid, [move.id], {'move_history_ids2':[(4,new_move)]}, context=context)
if not returned_lines:
raise osv.except_osv(_('Warning !'), _("Please specify at least one non-zero quantity!"))
if set_invoice_state_to_none:
pick_obj.write(cr, uid, [pick.id], {'invoice_state':'none'})
pick_obj.write(cr, uid, [pick.id], {'invoice_state':'none'}, context=context)
wf_service.trg_validate(uid, 'stock.picking', new_picking, 'button_confirm', cr)
pick_obj.force_assign(cr, uid, [new_picking], context)
# Update view id in context, lp:702939
@ -197,11 +206,9 @@ class stock_return_picking(osv.osv_memory):
'out': 'action_picking_tree',
'in': 'action_picking_tree4',
'internal': 'action_picking_tree6',
}
data_obj = self.pool.get('ir.model.data')
act_obj = self.pool.get('ir.actions.act_window')
result = data_obj.get_object_reference(cr, uid, 'stock', action_list.get(new_type, 'action_picking_tree6'))
id = result and result[1] or False
}
res = model_obj.get_object_reference(cr, uid, 'stock', action_list.get(new_type, 'action_picking_tree6'))
id = res and res[1] or False
result = act_obj.read(cr, uid, [id], context=context)[0]
result['domain'] = "[('id', 'in', ["+str(new_picking)+"])]"
return result
@ -209,4 +216,3 @@ class stock_return_picking(osv.osv_memory):
stock_return_picking()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: