Divyesh Makwana(OpenERP) has proposed merging
lp:~openerp-dev/openobject-addons/trunk-stock_picking_usability-mdi into
lp:openobject-addons.
Requested reviews:
OpenERP Core Team (openerp)
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-stock_picking_usability-mdi/+merge/98166
Hello Sir,
I have improved state name, button name and report name according to Incoming
Shipments, Internal Moves and Delivery Orders.
Thanks,
Divyesh
--
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-stock_picking_usability-mdi/+merge/98166
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/trunk-stock_picking_usability-mdi.
=== modified file 'stock/__openerp__.py'
--- stock/__openerp__.py 2012-02-13 15:27:55 +0000
+++ stock/__openerp__.py 2012-03-19 08:52:26 +0000
@@ -72,8 +72,8 @@
'wizard/stock_return_picking_view.xml',
"stock_workflow.xml",
"stock_incoterms.xml",
+ "stock_report.xml",
"stock_view.xml",
- "stock_report.xml",
"stock_sequence.xml",
"product_data.xml",
"product_view.xml",
=== modified file 'stock/stock.py'
--- stock/stock.py 2012-02-28 14:08:16 +0000
+++ stock/stock.py 2012-03-19 08:52:26 +0000
@@ -613,17 +613,17 @@
return new_id
_columns = {
- 'name': fields.char('Reference', size=64, select=True),
- 'origin': fields.char('Origin', size=64, help="Reference of the document that produced this picking.", select=True),
- 'backorder_id': fields.many2one('stock.picking', 'Back Order of', help="If this picking was split this field links to the picking that contains the other part that has been processed already.", select=True),
- 'type': fields.selection([('out', 'Sending Goods'), ('in', 'Getting Goods'), ('internal', 'Internal')], 'Shipping Type', required=True, select=True, help="Shipping type specify, goods coming in or going out."),
- 'note': fields.text('Notes'),
- 'stock_journal_id': fields.many2one('stock.journal','Stock Journal', select=True),
- 'location_id': fields.many2one('stock.location', 'Location', help="Keep empty if you produce at the location where the finished products are needed." \
+ 'name': fields.char('Reference', size=64, select=True, states={'done': [('readonly', True)]}),
+ 'origin': fields.char('Origin', size=64, states={'done': [('readonly', True)]}, help="Reference of the document that produced this picking.", select=True),
+ 'backorder_id': fields.many2one('stock.picking', 'Back Order of', states={'done': [('readonly', True)]}, help="If this picking was split this field links to the picking that contains the other part that has been processed already.", select=True),
+ 'type': fields.selection([('out', 'Sending Goods'), ('in', 'Getting Goods'), ('internal', 'Internal')], 'Shipping Type', required=True, select=True, states={'done': [('readonly', True)]}, help="Shipping type specify, goods coming in or going out."),
+ 'note': fields.text('Notes', states={'done': [('readonly', True)]}),
+ 'stock_journal_id': fields.many2one('stock.journal','Stock Journal', select=True, states={'done': [('readonly', True)]}),
+ 'location_id': fields.many2one('stock.location', 'Location', states={'done': [('readonly', True)]}, help="Keep empty if you produce at the location where the finished products are needed." \
"Set a location if you produce at a fixed location. This can be a partner location " \
"if you subcontract the manufacturing operations.", select=True),
- 'location_dest_id': fields.many2one('stock.location', 'Dest. Location',help="Location where the system will stock the finished products.", select=True),
- 'move_type': fields.selection([('direct', 'Partial Delivery'), ('one', 'All at once')], 'Delivery Method', required=True, help="It specifies goods to be delivered all at once or by direct delivery"),
+ 'location_dest_id': fields.many2one('stock.location', 'Dest. Location', states={'done': [('readonly', True)]}, help="Location where the system will stock the finished products.", select=True),
+ 'move_type': fields.selection([('direct', 'Partial Delivery'), ('one', 'All at once')], 'Delivery Method', required=True, states={'done': [('readonly', True)]}, help="It specifies goods to be delivered all at once or by direct delivery"),
'state': fields.selection([
('draft', 'New'),
('auto', 'Waiting Another Operation'),
@@ -640,20 +640,20 @@
"* Cancelled: has been cancelled, can't be confirmed anymore"),
'min_date': fields.function(get_min_max_date, fnct_inv=_set_minimum_date, multi="min_max_date",
store=True, type='datetime', string='Expected Date', select=1, help="Expected date for the picking to be processed"),
- 'date': fields.datetime('Order Date', help="Date of Order", select=True),
- 'date_done': fields.datetime('Date Done', help="Date of Completion"),
+ 'date': fields.datetime('Order Date', help="Date of Order", select=True, states={'done': [('readonly', True)]}),
+ 'date_done': fields.datetime('Date Done', help="Date of Completion", states={'done': [('readonly', True)]}),
'max_date': fields.function(get_min_max_date, fnct_inv=_set_maximum_date, multi="min_max_date",
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'),
- 'address_id': fields.many2one('res.partner.address', 'Address', help="Address of partner"),
+ 'auto_picking': fields.boolean('Auto-Picking', states={'done': [('readonly', True)]}),
+ 'address_id': fields.many2one('res.partner.address', 'Address', states={'done': [('readonly', True)]}, help="Address of partner"),
'partner_id': fields.related('address_id','partner_id',type='many2one',relation='res.partner',string='Partner',store=True),
'invoice_state': fields.selection([
("invoiced", "Invoiced"),
("2binvoiced", "To Be Invoiced"),
("none", "Not Applicable")], "Invoice Control",
select=True, required=True, readonly=True, states={'draft': [('readonly', False)]}),
- 'company_id': fields.many2one('res.company', 'Company', required=True, select=True),
+ 'company_id': fields.many2one('res.company', 'Company', required=True, select=True, states={'done': [('readonly', True)]}),
}
_defaults = {
'name': lambda self, cr, uid, context: '/',
@@ -668,6 +668,47 @@
('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 = {}
+ type = context.get('default_type', False)
+ res = super(stock_picking, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu)
+ if type:
+ if res.get('toolbar', False):
+ for i in xrange(0, len(res['toolbar']['print'])):
+ if res['toolbar']['print'][i]['report_name'] == 'stock.picking.list':
+ if type == 'in':
+ res['toolbar']['print'][i]['string'] = 'Incoming Shipment/Receipt'
+ elif type == 'internal':
+ res['toolbar']['print'][i]['string'] = 'Internal Shipment'
+ elif type == 'out':
+ res['toolbar']['print'][i]['string'] = 'Delivery Order'
+
+ for field in res['fields']:
+ if field == 'state':
+ if type == 'in':
+ res['fields']['state']['selection'] = [('draft', 'New'),
+ ('auto', 'Waiting Another Operation'),
+ ('confirmed', 'Waiting Availability'),
+ ('assigned', 'Ready to Receive'),
+ ('done', 'Received'),
+ ('cancel', 'Cancelled')]
+ elif type == 'internal':
+ res['fields']['state']['selection'] = [('draft', 'New'),
+ ('auto', 'Waiting Another Operation'),
+ ('confirmed', 'Waiting Availability'),
+ ('assigned', 'Ready to Move'),
+ ('done', 'Moved'),
+ ('cancel', 'Cancelled')]
+ elif type == 'out':
+ res['fields']['state']['selection'] = [('draft', 'New'),
+ ('auto', 'Waiting Another Operation'),
+ ('confirmed', 'Waiting Availability'),
+ ('assigned', 'Ready to Deliver'),
+ ('done', 'Delivered'),
+ ('cancel', 'Cancelled')]
+ return res
+
def action_process(self, cr, uid, ids, context=None):
if context is None: context = {}
context = dict(context, active_ids=ids, active_model=self._name)
@@ -738,7 +779,10 @@
""" Changes state of picking to available if all moves are confirmed.
@return: True
"""
+ wf_service = netsvc.LocalService("workflow")
for pick in self.browse(cr, uid, ids):
+ if pick.state == 'draft':
+ wf_service.trg_validate(uid, 'stock.picking', pick.id,'button_confirm', cr)
move_ids = [x.id for x in pick.move_lines if x.state == 'confirmed']
if not move_ids:
raise osv.except_osv(_('Warning !'),_('Not enough stock, unable to reserve the products.'))
=== modified file 'stock/stock_view.xml'
--- stock/stock_view.xml 2012-02-13 15:27:55 +0000
+++ stock/stock_view.xml 2012-03-19 08:52:26 +0000
@@ -681,7 +681,7 @@
<field name="invoice_state"/>
<field name="stock_journal_id" groups="base.group_extended" widget="selection"/>
<field name="state"/>
- <button name="action_process" states="assigned" groups="stock.group_stock_user" string="Process" type="object" icon="gtk-go-forward"/>
+ <button name="action_process" states="assigned" groups="stock.group_stock_user" string="Move" type="object" icon="gtk-go-forward"/>
</tree>
</field>
</record>
@@ -798,13 +798,12 @@
</field>
<group col="10" colspan="4">
<field name="state" readonly="1" widget="statusbar" statusbar_visible="draft,confirmed,assigned,done" statusbar_colors='{"auto":"blue", "confirmed":"blue"}'/>
- <button name="button_cancel" states="assigned,confirmed,draft" string="_Cancel" icon="gtk-cancel"/>
- <button name="draft_force_assign" states="draft" string="Process Later" type="object" icon="gtk-apply"/>
- <button name="draft_validate" states="draft" string="Process Now" type="object" icon="gtk-media-play"/>
- <button name="action_assign" states="confirmed" string="Check Availability" type="object" icon="gtk-find"/>
+ <button name="draft_validate" states="draft" string="Move Now" type="object" icon="gtk-media-play"/>
+ <button name="action_assign" states="draft" string="Check Availability" type="object" icon="gtk-find"/>
<button name="force_assign" states="confirmed" string="Force Availability" type="object" icon="gtk-jump-to"/>
- <button name="action_process" states="assigned" string="Process" groups="stock.group_stock_user" type="object" icon="gtk-go-forward"/>
+ <button name="action_process" states="assigned" string="Move" groups="stock.group_stock_user" type="object" icon="gtk-go-forward"/>
<button name="%(action_stock_invoice_onshipping)d" string="Create Invoice" attrs="{'invisible': ['|','|',('state','<>','done'),('invoice_state','=','invoiced'),('invoice_state','=','none')]}" type="action" icon="terp-gtk-go-back-rtl" />
+ <button name="button_cancel" states="assigned,confirmed,draft" string="_Cancel" icon="gtk-cancel"/>
</group>
</page>
<page string="Additional info" groups="base.group_extended,base.group_multi_company">
@@ -875,7 +874,7 @@
<field name="invoice_state"/>
<field name="stock_journal_id" groups="base.group_extended" widget="selection"/>
<field name="state"/>
- <button name="action_process" states="assigned" string="Process" type="object" icon="gtk-go-forward"/>
+ <button name="action_process" states="assigned" string="Deliver" type="object" icon="gtk-go-forward"/>
</tree>
</field>
</record>
@@ -989,14 +988,14 @@
</field>
<group col="12" colspan="4">
<field name="state" readonly="1" widget="statusbar" statusbar_visible="draft,confirmed,assigned,done" statusbar_colors='{"auto":"blue", "confirmed":"blue"}'/>
- <button name="button_cancel" states="assigned,confirmed,draft" string="_Cancel" icon="gtk-cancel"/>
- <button name="draft_force_assign" states="draft" string="Process Later" type="object" icon="gtk-ok"/>
- <button name="draft_validate" states="draft" string="Process Now" type="object" icon="gtk-yes"/>
- <button name="action_assign" states="confirmed" string="Check Availability" type="object" groups="base.group_extended" icon="gtk-find"/>
+ <button name="draft_validate" states="draft" string="Deliver Now" type="object" icon="gtk-media-play"/>
+ <button name="action_assign" states="draft" string="Check Availability" type="object" groups="base.group_extended" icon="gtk-find"/>
<button name="force_assign" states="confirmed" string="Force Availability" type="object" icon="gtk-jump-to"/>
- <button name="action_process" states="assigned" string="Process" type="object" icon="gtk-go-forward"/>
+ <button name="action_process" states="assigned" string="Deliver" type="object" icon="gtk-go-forward"/>
+ <button name="%(report_picking_list)d" string="Print Delivery Order" states="done" type="action" icon="gtk-print"/>
<button name="%(act_stock_return_picking)d" string="Return Products" states="done" type="action" icon="gtk-execute"/>
<button name="%(action_stock_invoice_onshipping)d" string="Create Invoice" attrs="{'invisible': ['|','|',('state','<>','done'),('invoice_state','=','invoiced'),('invoice_state','=','none')]}" type="action" icon="terp-gtk-go-back-rtl"/>
+ <button name="button_cancel" states="assigned,confirmed,draft" string="_Cancel" icon="gtk-cancel"/>
</group>
</page>
<page string="Additional info" groups="base.group_extended,base.group_multi_company">
@@ -1095,7 +1094,7 @@
<field name="invoice_state" groups="base.group_extended"/>
<field name="stock_journal_id" groups="base.group_extended" widget="selection"/>
<field name="state"/>
- <button name="action_process" states="assigned" string="Process" type="object" icon="gtk-go-forward"/>
+ <button name="action_process" states="assigned" string="Receive" type="object" icon="gtk-go-forward"/>
<button name="button_cancel" states="assigned,confirmed,draft" string="Cancel" icon="gtk-cancel" confirm="This operation will cancel the shipment. Do you want to continue?" />
</tree>
</field>
@@ -1208,15 +1207,15 @@
</form>
</field>
<group col="10" colspan="4">
- <field name="state" readonly="1" widget="statusbar" statusbar_visible="draft,assigned,done" statusbar_colors='{"auto":"blue", "confirmed":"blue"}'/>
- <button name="button_cancel" states="assigned,confirmed,draft" string="_Cancel" icon="gtk-cancel"/>
- <button name="draft_force_assign" states="draft" string="Process Later" type="object" icon="gtk-ok"/>
- <button name="draft_validate" states="draft" string="Process Now" type="object" icon="gtk-media-play"/>
- <button name="action_assign" states="confirmed" string="Check Availability" type="object" icon="gtk-find"/>
+ <field name="state" readonly="1" widget="statusbar" statusbar_visible="draft,confirmed,assigned,done" statusbar_colors='{"auto":"blue", "confirmed":"blue"}'/>
+ <button name="draft_validate" states="draft" string="Receive Now" type="object" icon="gtk-media-play"/>
+ <button name="action_assign" states="draft, confirmed" string="Check Availability" type="object" icon="gtk-find"/>
<button name="force_assign" states="confirmed" string="Force Availability" type="object" groups="base.group_extended" icon="gtk-jump-to"/>
- <button name="action_process" states="assigned" string="Process" type="object" icon="gtk-go-forward"/>
+ <button name="action_process" states="assigned" string="Receive" type="object" icon="gtk-go-forward"/>
+ <button name="%(report_picking_list)d" string="Print Reception" type="action" icon="gtk-print" states="done"/>
<button name="%(act_stock_return_picking)d" string="Return Products" states="done" type="action" icon="gtk-execute"/>
<button name="%(action_stock_invoice_onshipping)d" string="Create Invoice" attrs="{'invisible': ['|','|',('state','<>','done'),('invoice_state','=','invoiced'),('invoice_state','=','none')]}" type="action" icon="terp-gtk-go-back-rtl" />
+ <button name="button_cancel" states="assigned,confirmed,draft" string="_Cancel" icon="gtk-cancel"/>
</group>
</page>
<page string="Additional Info" groups="base.group_extended,base.group_multi_company">
@@ -1274,7 +1273,7 @@
<field name="view_type">form</field>
<field name="view_mode">tree,form,calendar</field>
<field name="domain">[('type','=','in')]</field>
- <field name="context">{'contact_display': 'partner_address',"search_default_available":1}</field>
+ <field name="context">{'default_type': 'in', 'contact_display': 'partner_address',"search_default_available":1}</field>
<field name="search_view_id" ref="view_picking_in_search"/>
<field name="help">The Incoming Shipments is the list of all orders you will receive from your suppliers. An incoming shipment contains a list of products to be received according to the original purchase order. You can validate the shipment totally or partially.</field>
</record>
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp