Ajay Chauhan(OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-addons_issue10_warehouse-cha into 
lp:openobject-addons.

Requested reviews:
  Purnendu Singh (OpenERP) (psi-tinyerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-addons_issue10_warehouse-cha/+merge/125181

Hello,

  I have made changes for following issues.
    > Gives wrong warning message for no stock in serial number
    > Remove icon from split in serial number wizard & add cancel button
    > Improve help for 'stock_available' field
    > Gives traceback on 'return products' button for some scenario
    > Not proper view for UOM form

Thanks,
Ajay Chauhan
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-addons_issue10_warehouse-cha/+merge/125181
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-addons_issue10_warehouse-cha.
=== modified file 'product/product_view.xml'
--- product/product_view.xml	2012-09-17 14:47:40 +0000
+++ product/product_view.xml	2012-09-21 06:38:19 +0000
@@ -467,9 +467,9 @@
                             <field name="uom_type" on_change="onchange_type(uom_type)"/>
                             <field name="rounding"/>
                             <field name="factor" attrs="{'invisible':[('uom_type','!=','smaller')]}"/>
-                            <label string="  e.g: 1 * (reference unit) = ratio * (this unit)" attrs="{'invisible':[('uom_type','!=','smaller')]}"/>
                             <field name="factor_inv" attrs="{'invisible':[('uom_type','!=','bigger')]}"/>
-                            <label string="  e.g: 1 * (this unit) = ratio * (reference unit)" attrs="{'invisible':[('uom_type','!=','bigger')]}"/>
+                            <label string="e.g: 1 * (reference unit) = ratio * (this unit)" attrs="{'invisible':[('uom_type','!=','smaller')]}"/>
+                            <label string="e.g: 1 * (this unit) = ratio * (reference unit)" attrs="{'invisible':[('uom_type','!=','bigger')]}"/>
                         </group>
                     </group>
                 </form>

=== modified file 'stock/stock.py'
--- stock/stock.py	2012-09-20 05:05:24 +0000
+++ stock/stock.py	2012-09-21 06:38:19 +0000
@@ -761,6 +761,15 @@
             self.pool.get('stock.move').force_assign(cr, uid, move_ids)
             wf_service.trg_write(uid, 'stock.picking', pick.id, cr)
         return True
+    
+    def button_cancel(self, cr, uid, ids, *args):
+        """ Changes state of picking to cancel.
+        @return: True
+        """
+        wf_service = netsvc.LocalService("workflow")
+        for pick in self.browse(cr, uid, ids):
+            wf_service.trg_validate(uid, 'stock.picking', pick.id, 'button_cancel', cr)
+        return True
 
     def draft_force_assign(self, cr, uid, ids, *args):
         """ Confirms picking directly from draft state.
@@ -1141,7 +1150,7 @@
             for move in pick.move_lines:
                 if move.state not in ('cancel','done'):
                     return False
-                if move.state=='done':
+                if move.state=='done' and not move.scrapped:
                     ok = True
         return ok
 
@@ -1160,7 +1169,7 @@
             if not pick.move_lines:
                 return True
             for move in pick.move_lines:
-                if move.state == 'done':
+                if move.state == 'done' and not move.scrapped:
                     raise osv.except_osv(_('Error!'), _('You cannot cancel picking because stock move is in done state!'))
         return True
     def unlink(self, cr, uid, ids, context=None):
@@ -1492,7 +1501,7 @@
         'product_id': fields.many2one('product.product', 'Product', required=True, domain=[('type', '<>', 'service')]),
         'date': fields.datetime('Creation Date', required=True),
         'stock_available': fields.function(_get_stock, fnct_search=_stock_search, type="float", string="Available", select=True,
-            help="Current quantity of products with this Production Lot Number available in company warehouses",
+            help="Current quantity of products with this Serial Number available in company warehouses",
             digits_compute=dp.get_precision('Product Unit of Measure')),
         'revisions': fields.one2many('stock.production.lot.revision', 'lot_id', 'Revisions'),
         'company_id': fields.many2one('res.company', 'Company', select=True),
@@ -1827,8 +1836,8 @@
         warning = {}
         if (location.usage == 'internal') and (product_qty > (amount_actual or 0.0)):
             warning = {
-                'title': _('Insufficient Stock in Lot !'),
-                'message': _('You are moving %.2f %s products but only %.2f %s available in this lot.') % (product_qty, uom.name, amount_actual, uom.name)
+                'title': _('Insufficient Stock in Serial Number !'),
+                'message': _('You are moving %.2f %s products but only %.2f %s available in this serial number.') % (product_qty, uom.name, amount_actual, uom.name)
             }
         return {'warning': warning}
 

=== modified file 'stock/stock_view.xml'
--- stock/stock_view.xml	2012-09-20 07:25:22 +0000
+++ stock/stock_view.xml	2012-09-21 06:38:19 +0000
@@ -754,7 +754,7 @@
                         <button name="action_process" states="assigned" string="Confirm &amp; Transfer" groups="stock.group_stock_user" type="object" class="oe_highlight"/>
                         <button name="%(action_stock_invoice_onshipping)d" string="Create Invoice/Refund"  attrs="{'invisible': ['|','|',('state','&lt;&gt;','done'),('invoice_state','=','invoiced'),('invoice_state','=','none')]}"  type="action" class="oe_highlight"/>
                         <button name="%(act_stock_return_picking)d" string="Reverse Transfer" states="done" type="action"/>
-                        <button name="button_cancel" states="assigned,confirmed,draft" string="_Cancel"/>
+                        <button name="button_cancel" type="object" states="assigned,confirmed,draft" string="_Cancel"/>
                     </span>
                     <field name="state" widget="statusbar" statusbar_visible="draft,assigned,done" statusbar_colors='{"shipping_except":"red","invoice_except":"red","waiting_date":"blue"}'/>
                 </header>

=== modified file 'stock/wizard/stock_move_view.xml'
--- stock/wizard/stock_move_view.xml	2012-09-18 17:10:20 +0000
+++ stock/wizard/stock_move_view.xml	2012-09-21 06:38:19 +0000
@@ -109,7 +109,9 @@
                         </form>
                     </field>
                     <footer>
-                        <button name="split_lot" string="Ok" type="object" icon="gtk-ok" class="oe_highlight"  />
+                        <button name="split_lot" string="Split" type="object" class="oe_highlight"/>
+                        or
+                        <button string="Cancel" class="oe_link" special="cancel"/>
                     </footer>
                 </form>
                 </field>

=== modified file 'stock/wizard/stock_return_picking.py'
--- stock/wizard/stock_return_picking.py	2012-08-07 11:34:14 +0000
+++ stock/wizard/stock_return_picking.py	2012-09-21 06:38:19 +0000
@@ -72,9 +72,10 @@
                     res.update({'invoice_state': 'none'})
             return_history = self.get_return_history(cr, uid, record_id, context)       
             for line in pick.move_lines:
-                qty = line.product_qty - return_history[line.id]
-                if qty > 0:
-                    result1.append({'product_id': line.product_id.id, 'quantity': qty,'move_id':line.id})
+                if (return_history.get(line.id) is not None) and (line.product_qty * line.product_uom.factor > return_history[line.id]):
+                    qty = line.product_qty - return_history[line.id]
+                    if qty > 0:
+                        result1.append({'product_id': line.product_id.id, 'quantity': qty,'move_id':line.id})
             if 'product_return_moves' in fields:
                 res.update({'product_return_moves': result1})
         return res
@@ -100,8 +101,8 @@
             valid_lines = 0
             return_history = self.get_return_history(cr, uid, record_id, context)
             for m  in pick.move_lines:
-                if m.product_qty * m.product_uom.factor > return_history[m.id]:
-                        valid_lines += 1
+                if (return_history.get(m.id) is not None) and (m.product_qty * m.product_uom.factor > return_history[m.id]):
+                    valid_lines += 1
             if not valid_lines:
                 raise osv.except_osv(_('Warning!'), _("No products to return (only lines in Done state and not fully returned yet can be returned)!"))
         return res

_______________________________________________
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

Reply via email to