[MERGE] merge with mma branch to updated state tooltips

bzr revid: psi@tinyerp.com-20120323134555-a8l4blv7q1e9sh1h
This commit is contained in:
Purnendu Singh (OpenERP)
2012-03-23 19:15:55 +05:30
3 changed files with 71 additions and 31 deletions
+3 -3
View File
@@ -68,8 +68,8 @@
<group col="8" colspan="4">
<filter icon="terp-check" name="available" string="Available"
domain="[('state','=','assigned')]" help="Incoming Shipments Available"/>
<filter icon="terp-dialog-close" name="done" string="Done"
domain="[('state','=','done')]" help="Incoming Shipments already processed"/>
<filter icon="terp-dialog-close" name="done" string="Received"
domain="[('state','=','done')]" help="Incoming Shipments already Received"/>
<separator orientation="vertical"/>
<filter icon="terp-accessories-archiver-minus" string="Back Orders"
domain="[('backorder_id', '!=', False)]" help="Is a Back Order" groups="base.group_extended"/>
@@ -93,7 +93,7 @@
<separator orientation="vertical"/>
<filter string="Order Date" icon="terp-go-month"
domain="[]" context="{'group_by':'date'}"/>
<filter string="Expected Date" icon="terp-go-month"
<filter string="Scheduled Date" icon="terp-go-month"
domain="[]" context="{'group_by':'min_date'}"/>
<separator orientation="vertical"/>
<filter string="Journal" icon="terp-folder-orange"
+47 -7
View File
@@ -19,6 +19,7 @@
#
##############################################################################
from lxml import etree
from datetime import datetime
from dateutil.relativedelta import relativedelta
import time
@@ -633,10 +634,10 @@ class stock_picking(osv.osv):
'location_dest_id': fields.many2one('stock.location', 'Dest. Location', states={'done':[('readonly', True)], 'cancel':[('readonly',True)]}, help="Location where the system will stock the finished products.", select=True),
'move_type': fields.selection([('direct', 'Partial'), ('one', 'All at once')], 'Delivery Method', required=True, states={'done':[('readonly', True)], 'cancel':[('readonly',True)]}, help="It specifies goods to be deliver partially or all at once"),
'state': fields.selection(PICK_STATE, 'State', readonly=True, select=True,
help="* Draft: not confirmed yet and will not be scheduled until confirmed\n"\
"* Confirmed: still waiting for the availability of products\n"\
"* Available: products reserved, simply waiting for confirmation.\n"\
"* Waiting: waiting for another move to proceed before it becomes automatically available (e.g. in Make-To-Order flows)\n"\
help="* Draft: not confirmed yet and will not be scheduled until confirmed\n"\
"* Waiting Another Operation: waiting for another move to proceed before it becomes automatically available (e.g. in Make-To-Order flows)\n"\
"* Waiting Availability: still waiting for the availability of products\n"\
"* Ready to Process: products reserved, simply waiting for confirmation.\n"\
"* Done: has been processed, can't be modified or cancelled anymore\n"\
"* 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",
@@ -704,24 +705,38 @@ class stock_picking(osv.osv):
# To update the states label according to shipping type
if field == 'state':
_state = []
_tooltip_state_assigned = ''
_tooltip_state_done = ''
for key, value in PICK_STATE:
if type == 'in':
if key == 'assigned':
value = _('Ready to Receive')
_tooltip_state_assigned = _('Ready to Receive')
elif key == 'done':
value = _('Received')
_tooltip_state_done = _('Received')
elif type == 'internal':
if key == 'assigned':
value = _('Ready to Transfer')
_tooltip_state_assigned = _('Ready to Transfer')
elif key == 'done':
value = _('Transferred')
_tooltip_state_done = _('Transferred')
elif type == 'out':
if key == 'assigned':
value = _('Ready to Deliver')
_tooltip_state_assigned = _('Ready to Deliver')
elif key == 'done':
value = _('Delivered')
_tooltip_state_done = _('Delivered')
_state.append((key,value))
res['fields']['state']['selection'] = _state
res['fields']['state']['help'] = _("* Draft: not confirmed yet and will not be scheduled until confirmed\n"\
"* Waiting Another Operation: waiting for another move to proceed before it becomes automatically available (e.g. in Make-To-Order flows)\n"\
"* Waiting Availability: still waiting for the availability of products\n"\
"* %s: products reserved, simply waiting for confirmation.\n"\
"* %s: has been processed, can't be modified or cancelled anymore\n"\
"* Cancelled: has been cancelled, can't be confirmed anymore") %(_tooltip_state_assigned, _tooltip_state_done)
# To update the fields tooltips according to shipping type
if field == 'address_id':
_tooltip = ''
@@ -1671,8 +1686,11 @@ class stock_move(osv.osv):
'picking_id': fields.many2one('stock.picking', 'Reference', select=True,states={'done': [('readonly', True)]}),
'note': fields.text('Notes'),
'state': fields.selection(MOVE_STATE, 'State', readonly=True, select=True,
help='When the stock move is created it is in the \'Draft\' state.\n After that, it is set to \'Not Available\' state if the scheduler did not find the products.\n When products are reserved it is set to \'Available\'.\n When the picking is done the state is \'Done\'.\
\nThe state is \'Waiting\' if the move is waiting for another one.'),
help="* Draft: When the stock move is created it is in the \'Draft\' state.\n"\
"* Waiting Another Move: it is set to \'Waiting Another Move\' state if the scheduler did not find the products.\n"\
"* Waiting Availability: The state is \'Waiting Availability\' if the move is waiting for another one.\n"\
"* Available: When products are reserved it is set to \'Available\'.\n"\
"* Done: When the shipment is done the state is \'Done\'."),
'price_unit': fields.float('Unit Price', digits_compute= dp.get_precision('Account'), help="Technical field used to record the product cost set by the user during a picking confirmation (when average price costing method is used)"),
'price_currency_id': fields.many2one('res.currency', 'Currency for average price', help="Technical field used to record the currency chosen by the user during a picking confirmation (when average price costing method is used)"),
'company_id': fields.many2one('res.company', 'Company', required=True, select=True),
@@ -1702,31 +1720,53 @@ class stock_move(osv.osv):
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_picking_type', False)
type = context.get('default_type', False)
res = super(stock_move, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu)
if type:
doc = etree.XML(res['arch'])
if type == 'out':
#To Update button label in case of shipping type is out
if view_type == 'tree':
for node in doc.xpath("//button[@string='Receive']"):
node.set('string', _('Deliver'))
for node in doc.xpath("//group/button[@string='Process Now']"):
node.set('string', _('Deliver'))
for field in res['fields']:
# To update the states label according to the containing shipping type
if field == 'state':
_state = []
_tooltip_state_assigned = ''
_tooltip_state_done = ''
for key, value in MOVE_STATE:
if type == 'in':
if key == 'assigned':
value = _('Ready to Receive')
_tooltip_state_assigned = _('Ready to Receive')
elif key == 'done':
value = _('Received')
_tooltip_state_done = _('Received')
elif type == 'internal':
if key == 'assigned':
value = _('Ready to Transfer')
_tooltip_state_assigned = _('Ready to Transfer')
elif key == 'done':
value = _('Transferred')
_tooltip_state_done = _('Transferred')
elif type == 'out':
if key == 'assigned':
value = _('Ready to Deliver')
_tooltip_state_assigned = _('Ready to Deliver')
elif key == 'done':
value = _('Delivered')
_tooltip_state_done = _('Delivered')
_state.append((key,value))
res['fields']['state']['selection'] = _state
res['fields']['state']['help'] = _("* Draft: When the stock move is created it is in the \'Draft\' state.\n"\
"* Waiting Another Move: it is set to \'Waiting Another Move\' state if the scheduler did not find the products.\n"\
"* Waiting Availability: The state is \'Waiting Availability\' if the move is waiting for another one.\n"\
"* %s: When products are reserved it is set to %s.\n"\
"* %s: When the shipment is done the state is %s.") % (_tooltip_state_assigned, _tooltip_state_assigned, _tooltip_state_done, _tooltip_state_done)
res['arch'] = etree.tostring(doc)
return res
def _default_location_destination(self, cr, uid, context=None):
+21 -21
View File
@@ -750,7 +750,7 @@
string="Scrap" type="action" groups="base.group_extended"
icon="gtk-convert" context="{'scrap': True}"
states="draft,waiting,confirmed,assigned" colspan="1"/>
<field name="product_uom" string="Unit Of Measure" colspan="4"/>
<field name="product_uom" string="Unit of Measure" colspan="4"/>
<field name="product_uos_qty" groups="product.group_uos" on_change="onchange_uos_quantity(product_id, product_uos_qty, product_uos, product_uom)" colspan="4"/>
<field groups="product.group_uos" name="product_uos" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)" colspan="4"/>
<field groups="base.group_extended" name="product_packaging" domain="[('product_id','=',product_id)]" colspan="4"/>
@@ -830,13 +830,13 @@
<field name="arch" type="xml">
<search string="Search Stock Picking">
<group>
<filter icon="terp-check" name="available" string="Available" domain="[('state','=','assigned')]" help="Available Pickings"/>
<filter icon="terp-camera_test" string="Confirmed" domain="[('state','=','confirmed')]" help="Confirmed Pickings"/>
<filter icon="terp-dialog-close" name="done" string="Done" domain="[('state','=','done')]" help="Pickings already processed"/>
<filter icon="terp-check" name="available" string="Available" domain="[('state','=','assigned')]" help="Incoming Shipments Available"/>
<filter icon="terp-camera_test" string="Confirmed" domain="[('state','=','confirmed')]" help="Incoming Shipments Confirmed"/>
<filter icon="terp-dialog-close" name="done" string="Received" domain="[('state','=','done')]" help="Incoming Shipments already Received"/>
<separator orientation="vertical"/>
<filter icon="terp-accessories-archiver-minus" string="Back Orders" domain="[('backorder_id', '!=', False)]" help="Is a Back Order" groups="base.group_extended"/>
<separator orientation="vertical"/>
<filter icon="terp-dolar" name="to_invoice" string="To Invoice" domain="[('invoice_state','=','2binvoiced')]" help="Internal Pickings to invoice"/>
<filter icon="terp-dolar" name="to_invoice" string="To Invoice" domain="[('invoice_state','=','2binvoiced')]" help="Internal Shipments to invoice"/>
<separator orientation="vertical"/>
<field name="name"/>
<field name="address_id"/>
@@ -943,7 +943,7 @@
string="Scrap" type="action"
icon="gtk-convert" context="{'scrap': True}"
states="draft,waiting,confirmed,assigned" colspan="1" groups="base.group_extended"/>
<field name="product_uom" string="Unit Of Measure" colspan="4" />
<field name="product_uom" string="Unit of Measure" colspan="4" />
<field name="product_uos_qty" groups="product.group_uos" on_change="onchange_uos_quantity(product_id, product_uos_qty, product_uos, product_uom)" colspan="4" />
<field groups="product.group_uos" name="product_uos" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)" colspan="4" />
<field groups="base.group_extended" name="product_packaging" domain="[('product_id','=',product_id)]" colspan="4" />
@@ -1045,7 +1045,7 @@
<filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
<separator orientation="vertical" />
<filter string="Order Date" icon="terp-go-month" domain="[]" context="{'group_by':'date'}"/>
<filter string="Expected Date" icon="terp-go-month" domain="[]" context="{'group_by':'min_date'}"/>
<filter string="Scheduled Date" icon="terp-go-month" domain="[]" context="{'group_by':'min_date'}"/>
<separator orientation="vertical" />
<filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'stock_journal_id'}" groups="base.group_extended"/>
</group>
@@ -1165,7 +1165,7 @@
string="Scrap" type="action" groups="base.group_extended"
icon="gtk-convert" context="{'scrap': True}"
states="draft,waiting,confirmed,assigned" colspan="1"/>
<field name="product_uom" string="Unit Of Measure" colspan="4"/>
<field name="product_uom" string="Unit of Measure" colspan="4"/>
<field name="product_uos_qty" groups="product.group_uos" on_change="onchange_uos_quantity(product_id, product_uos_qty, product_uos, product_uom)" colspan="4"/>
<field groups="product.group_uos" name="product_uos" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)" colspan="4"/>
<field groups="base.group_extended" name="product_packaging" domain="[('product_id','=',product_id)]" colspan="4"/>
@@ -1262,7 +1262,7 @@
<filter icon="terp-stock_effects-object-colorize" name="state" string="State" domain="[]" context="{'group_by':'state'}"/>
<separator orientation="vertical" />
<filter string="Order Date" icon="terp-go-month" domain="[]" context="{'group_by':'date'}"/>
<filter string="Expected Date" icon="terp-go-month" domain="[]" context="{'group_by':'min_date'}"/>
<filter string="Scheduled Date" icon="terp-go-month" domain="[]" context="{'group_by':'min_date'}"/>
<separator orientation="vertical" />
<filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'stock_journal_id'}" groups="base.group_extended"/>
</group>
@@ -1321,7 +1321,7 @@
<filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
<separator orientation="vertical"/>
<filter string="Order Date" icon="terp-go-month" domain="[]" context="{'group_by':'date'}"/>
<filter string="Expected Date" icon="terp-go-month" domain="[]" context="{'group_by':'min_date'}"/>
<filter string="Scheduled Date" icon="terp-go-month" domain="[]" context="{'group_by':'min_date'}"/>
<separator orientation="vertical"/>
<filter string="Origin" icon="terp-gtk-jump-to-rtl" domain="[]" context="{'group_by':'origin'}"/>
<separator orientation="vertical" />
@@ -1400,7 +1400,7 @@
<field name="date"/>
<field name="date_expected"/>
<field name="state"/>
<button name="action_done" states="confirmed,assigned" string="Deliver" type="object" icon="gtk-go-forward"/>
<button name="action_done" states="confirmed,assigned" string="Process" type="object" icon="gtk-go-forward"/>
</tree>
</field>
</record>
@@ -1417,7 +1417,7 @@
<group colspan="4" col="7">
<field name="product_id" on_change="onchange_product_id(product_id,location_id,location_dest_id, False)"/>
<field name="product_qty" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/>
<field name="product_uom" string="Unit Of Measure"/>
<field name="product_uom" string="Unit of Measure"/>
<button name="%(stock.move_scrap)d" groups="base.group_extended"
string="Scrap" type="action"
icon="gtk-convert" context="{'scrap': True}"
@@ -1436,7 +1436,7 @@
</group>
<group colspan="2" col="2">
<separator string="Picking" colspan="2" />
<separator string="Shipment" colspan="2" />
<field name="picking_id" context="{'default_picking_id':picking_id}"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
</group>
@@ -1470,7 +1470,7 @@
<group col="4" colspan="2">
<button name="action_confirm" states="draft" string="Confirm" type="object" icon="gtk-apply"/>
<button name="force_assign" states="confirmed" string="Set Available" type="object" icon="gtk-yes"/>
<button name="action_done" states="draft,assigned,confirmed" string="Deliver" type="object" icon="gtk-jump-to"/>
<button name="action_done" states="draft,assigned,confirmed" string="Process Now" type="object" icon="gtk-jump-to"/>
<button name="action_cancel" states="assigned,confirmed" string="_Cancel" type="object" icon="gtk-cancel"/>
</group>
</form>
@@ -1501,7 +1501,7 @@
<newline/>
<group expand="0" string="Group By..." groups="base.group_extended">
<filter string="Product" name="by_product" icon="terp-accessories-archiver" domain="[]" context="{'group_by':'product_id'}"/>
<filter string="Picking" name="groupby_picking_id" icon="terp-accessories-archiver" domain="[]" context="{'group_by':'picking_id'}"/>
<filter string="Shipment" name="groupby_picking_id" icon="terp-accessories-archiver" domain="[]" context="{'group_by':'picking_id'}"/>
<filter string="Lot" name="groupby_prodlot_id" icon="terp-accessories-archiver" domain="[]" context="{'group_by':'prodlot_id'}"/>
<filter string="Pack" name="groupby_tracking_id" icon="terp-accessories-archiver" domain="[]" context="{'group_by':'tracking_id'}"/>
<separator orientation="vertical"/>
@@ -1605,7 +1605,7 @@
<group colspan="4" col="7">
<field name="product_id" on_change="onchange_product_id(product_id,location_id,location_dest_id, False)"/>
<field name="product_qty" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/>
<field name="product_uom" string="Unit Of Measure"/>
<field name="product_uom" string="Unit of Measure"/>
<button name="%(stock.move_scrap)d" groups="base.group_extended"
string="Scrap" type="action"
icon="gtk-convert" context="{'scrap': True}"
@@ -1624,7 +1624,7 @@
</group>
<group colspan="2" col="2">
<separator string="Picking" colspan="2" />
<separator string="Shipment" colspan="2" />
<field name="picking_id" context="{'default_picking_id':picking_id}"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
</group>
@@ -1674,7 +1674,7 @@
<search string="Stock Moves">
<group>
<filter icon="terp-gtk-go-back-rtl" name="receive" string="Waiting " domain="[('state','in',('confirmed','assigned'))]" help="Stock to be receive"/>
<filter icon="terp-check" name="available" string="Available" domain="[('state','in',('assigned',))]" help="Stock available to be delivered"/>
<filter icon="terp-check" name="available" string="Available" domain="[('state','in',('assigned',))]" help="Stock available to be receive"/>
<filter icon="terp-dialog-close" name="done" string="Received" domain="[('state', '=', 'done')]"/>
<separator orientation="vertical"/>
<filter icon="terp-go-today" string="Today" domain="[('date','&lt;=',time.strftime('%%Y-%%m-%%d 23:59:59')),('date','&gt;=',time.strftime('%%Y-%%m-%%d 00:00:00'))]" help="Orders planned for today"/>
@@ -1739,7 +1739,7 @@
<field name="view_mode">tree,form</field>
<field name="domain">['|','&amp;',('picking_id','=',False),('location_id.usage', 'in', ['customer','supplier']),'&amp;',('picking_id','!=',False),('picking_id.type','=','in')]</field>
<field name="view_id" ref="view_move_tree_reception_picking"/>
<field name="context" eval="'{\'default_picking_type\':\'in\', \'search_default_receive\':1, \'search_default_available\':1, \'product_receive\' : True, \'default_location_id\':%d, \'default_location_dest_id\':%d}' % (ref('stock_location_suppliers'),ref('stock_location_stock') )"/>
<field name="context" eval="'{\'default_type\':\'in\', \'search_default_receive\':1, \'search_default_available\':1, \'product_receive\' : True, \'default_location_id\':%d, \'default_location_dest_id\':%d}' % (ref('stock_location_suppliers'),ref('stock_location_stock') )"/>
<field name="search_view_id" ref="view_move_search_reception_incoming_picking"/>
<field name="help">Here you can receive individual products, no matter what purchase order or picking order they come from. You will find the list of all products you are waiting for. Once you receive an order, you can filter based on the name of the supplier or the purchase order reference. Then you can confirm all products received using the buttons on the right of each line.</field>
</record>
@@ -1812,7 +1812,7 @@
context="{'default_type': 'internal'}"
domain="[('move_lines','=',active_id)]"
id="act_relate_picking"
name="Related Picking"
name="Related Shipment"
res_model="stock.picking"
src_model="stock.move"/>
@@ -1875,7 +1875,7 @@
<field name="view_mode">tree,form</field>
<field name="domain">['|','&amp;',('picking_id','=',False),('location_dest_id.usage', 'in', ['customer','supplier']),'&amp;',('picking_id','!=',False),('picking_id.type','=','out')]</field>
<field name="view_id" ref="view_move_tree_reception_picking"/>
<field name="context" eval="'{\'default_picking_type\':\'out\', \'search_default_receive\':1,\'search_default_available\':1, \'default_location_id\':%d, \'default_location_dest_id\':%d}' % (ref('stock_location_stock'),ref('stock_location_customers'))"/>
<field name="context" eval="'{\'default_type\':\'out\', \'search_default_receive\':1,\'search_default_available\':1, \'default_location_id\':%d, \'default_location_dest_id\':%d}' % (ref('stock_location_stock'),ref('stock_location_customers'))"/>
<field name="search_view_id" ref="view_move_search_reception_outcoming_picking"/>
<field name="help">You will find in this list all products you have to deliver to your customers. You can process the deliveries directly from this list using the buttons on the right of each line. You can filter the products to deliver by customer, products or sale order (using the Origin field).</field>
</record>