diff --git a/addons/crm/crm_phonecall.py b/addons/crm/crm_phonecall.py index 1d6a855c208..bcdcc2e9bf6 100644 --- a/addons/crm/crm_phonecall.py +++ b/addons/crm/crm_phonecall.py @@ -52,7 +52,7 @@ class crm_phonecall(osv.osv, crm_case): ('draft', 'Draft'), ('open', 'Todo'), ('cancel', 'Cancelled'), - ('done', 'Closed'), + ('done', 'Done'), ('pending', 'Pending'), ], 'State', size=16, readonly=True, help='The state is set to \'Draft\', when a case is created.\ @@ -89,7 +89,7 @@ class crm_phonecall(osv.osv, crm_case): _defaults = { 'date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'), 'priority': lambda *a: crm.AVAILABLE_PRIORITIES[2][0], - 'state': lambda *a: 'draft', + 'state': lambda *a: 'open', 'user_id': lambda self,cr,uid,ctx: uid, 'active': lambda *a: 1, } diff --git a/addons/crm/crm_phonecall_menu.xml b/addons/crm/crm_phonecall_menu.xml index e269cadfaf1..6c5472afa99 100644 --- a/addons/crm/crm_phonecall_menu.xml +++ b/addons/crm/crm_phonecall_menu.xml @@ -67,7 +67,7 @@ tree,calendar - {'set_editable':True,'default_state':'open'} + {'set_editable':True,'default_state':'open','search_default_current':1,'search_default_today':1} @@ -103,7 +103,7 @@ tree,calendar - {'default_state':'open'} + {'default_state':'open','search_default_current':1} diff --git a/addons/crm/crm_phonecall_view.xml b/addons/crm/crm_phonecall_view.xml index ef068e122a3..bb143964d70 100644 --- a/addons/crm/crm_phonecall_view.xml +++ b/addons/crm/crm_phonecall_view.xml @@ -245,17 +245,22 @@ search + + + diff --git a/addons/product/product.py b/addons/product/product.py index 8c35990cf9e..7787a8e646e 100644 --- a/addons/product/product.py +++ b/addons/product/product.py @@ -48,35 +48,25 @@ class product_uom(osv.osv): _name = 'product.uom' _description = 'Product Unit of Measure' - def _factor(self, cursor, user, ids, name, arg, context): + def _factor_inv(self, cursor, user, ids, name, arg, context): res = {} for uom in self.browse(cursor, user, ids, context=context): if uom.factor: - if uom.factor_inv_data: - res[uom.id] = uom.factor_inv_data - else: - res[uom.id] = round(1 / uom.factor, 6) + res[uom.id] = round(1 / uom.factor, 6) else: res[uom.id] = 0.0 return res - def _factor_inv(self, cursor, user, id, name, value, arg, context): - ctx = context.copy() - if 'read_delta' in ctx: - del ctx['read_delta'] + def _factor_inv_write(self, cursor, user, id, name, value, arg, context): if value: - data = 0.0 - if round(1 / round(1/value, 6), 6) != value: - data = value self.write(cursor, user, id, { 'factor': round(1/value, 6), - 'factor_inv_data': data, - }, context=ctx) + }, context=context) else: self.write(cursor, user, id, { 'factor': 0.0, - 'factor_inv_data': 0.0, - }, context=ctx) + }, context=context) + return True _columns = { 'name': fields.char('Name', size=64, required=True, translate=True), @@ -85,17 +75,17 @@ class product_uom(osv.osv): 'factor': fields.float('Ratio', digits=(12, 6), required=True, help='The coefficient for the formula:\n' \ '1 (base unit) = coeff (this unit). Ratio = 1 / Factor.'), - 'factor_inv': fields.function(_factor, digits=(12, 6), + 'factor_inv': fields.function(_factor_inv, digits=(12, 6), + fnct_inv=_factor_inv_write, method=True, string='Factor', help='The coefficient for the formula:\n' \ 'coeff (base unit) = 1 (this unit). Factor = 1 / Rate.'), - 'factor_inv_data': fields.float('Factor', digits=(12, 6)), 'rounding': fields.float('Rounding Precision', digits=(16, 3), required=True, help="The computed quantity will be a multiple of this value. Use 1.0 for products that can not be split."), 'active': fields.boolean('Active', help="If the active field is set to true, it will allow you to hide the unit of measure without removing it."), - 'uom_factor': fields.selection([('bigger','Bigger than the Default'), - ('smaller','Smaller than the Default'), - ('','')],'UoM Factor'), + 'uom_factor': fields.selection([('bigger','Bigger than the default'), + ('smaller','Smaller than the default'), + ('default','The Default unit of measure')],'Type of Unit', required=1), } _defaults = { @@ -103,12 +93,11 @@ class product_uom(osv.osv): 'factor_inv': lambda *a: 1.0, 'active': lambda *a: 1, 'rounding': lambda *a: 0.01, - 'uom_factor': lambda *a: 'smaller', + 'uom_factor': lambda *a: 'default', } _sql_constraints = [ ('factor_gt_zero', 'CHECK (factor!=0)', 'Value of the factor can never be 0 !'), - ('factor_inv_data_gt_zero', 'CHECK (factor_inv_data!=0)', 'Value of the factor_inv_data can never be 0 !'), ] def _compute_qty(self, cr, uid, from_uom_id, qty, to_uom_id=False): @@ -124,15 +113,9 @@ class product_uom(osv.osv): def _compute_qty_obj(self, cr, uid, from_unit, qty, to_unit, context={}): if from_unit.category_id.id <> to_unit.category_id.id: return qty - if from_unit.factor_inv_data: - amount = qty * from_unit.factor_inv_data - else: - amount = qty / from_unit.factor + amount = qty / from_unit.factor if to_unit: - if to_unit.factor_inv_data: - amount = rounding(amount / to_unit.factor_inv_data, to_unit.rounding) - else: - amount = rounding(amount * to_unit.factor, to_unit.rounding) + amount = rounding(amount * to_unit.factor, to_unit.rounding) return amount def _compute_price(self, cr, uid, from_uom_id, price, to_uom_id=False): @@ -145,26 +128,15 @@ class product_uom(osv.osv): from_unit, to_unit = uoms[-1], uoms[0] if from_unit.category_id.id <> to_unit.category_id.id: return price - if from_unit.factor_inv_data: - amount = price / from_unit.factor_inv_data - else: - amount = price * from_unit.factor + amount = price * from_unit.factor if to_uom_id: - if to_unit.factor_inv_data: - amount = amount * to_unit.factor_inv_data - else: - amount = amount / to_unit.factor + amount = amount / to_unit.factor return amount - def onchange_factor_inv(self, cursor, user, ids, value): - if value == 0.0: - return {'value': {'factor': 0}} - return {'value': {'factor': round(1/value, 6)}} - def onchange_factor(self, cursor, user, ids, value): - if value == 0.0: - return {'value': {'factor_inv': 0}} - return {'value': {'factor_inv': round(1/value, 6)}} + if value == 'default': + return {'value': {'factor': 1, 'factor_inv': 1}} + return {} product_uom() diff --git a/addons/product/product_data.xml b/addons/product/product_data.xml index 4763c191817..ff4da8254ec 100644 --- a/addons/product/product_data.xml +++ b/addons/product/product_data.xml @@ -30,7 +30,7 @@ KGM - 1000.0 + 1 Hour @@ -45,7 +45,7 @@ TON - 1.0 + 0.001 diff --git a/addons/product/product_view.xml b/addons/product/product_view.xml index e302ed912c0..a9f408db9f2 100644 --- a/addons/product/product_view.xml +++ b/addons/product/product_view.xml @@ -298,7 +298,6 @@ - @@ -310,14 +309,18 @@ form
- - - - - - - - + + + + + + + + + + + +
diff --git a/addons/sale/sale.py b/addons/sale/sale.py index b7229fcef46..7d32e3c721a 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -97,6 +97,7 @@ class sale_order(osv.osv): res[order.id]['amount_total'] = res[order.id]['amount_untaxed'] + res[order.id]['amount_tax'] return res + # This is False def _picked_rate(self, cr, uid, ids, name, arg, context=None): if context is None: context = {} @@ -1021,6 +1022,7 @@ class sale_order_line(osv.osv): } result['product_uom_qty'] = qty + uom2 = False if uom: uom2 = product_uom_obj.browse(cr, uid, uom) if product_obj.uom_id.category_id.id != uom2.category_id.id: @@ -1076,6 +1078,19 @@ class sale_order_line(osv.osv): result['product_uos_qty'] = qty result['th_weight'] = q * product_obj.weight # Round the quantity up + if not uom2: + uom2 = product_obj.uom_id + if (product_obj.type=='product') and (product_obj.virtual_available * product_obj.uom_id.factor < qty * uom2.factor) \ + and (product_obj.procure_method=='make_to_stock'): + warning = { + 'title': _('Not enough stock !'), + 'message': _('You plan to sell %.2f %s but you only have %.2f %s available !\nThe real stock is %.2f %s. (without reservations)') % + (qty, uom2 and uom2.name or product_obj.uom_id.name, + max(0,product_obj.virtual_available), product_obj.uom_id.name, + max(0,product_obj.qty_available), product_obj.uom_id.name) + } + + # get unit price if not pricelist: diff --git a/addons/sale/sale_view.xml b/addons/sale/sale_view.xml index 7a46b213b43..4bb3d603ce7 100644 --- a/addons/sale/sale_view.xml +++ b/addons/sale/sale_view.xml @@ -134,7 +134,7 @@ diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 9dca7325314..acc4378398e 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -408,7 +408,7 @@ stock_location() class stock_tracking(osv.osv): _name = "stock.tracking" - _description = "Stock Tracking Lots" + _description = "Packs" def checksum(sscc): salt = '31' * 8 + '3' @@ -424,7 +424,7 @@ class stock_tracking(osv.osv): _columns = { 'name': fields.char('Tracking ID', size=64, required=True), - 'active': fields.boolean('Active', help="If the active field is set to true, it will allow you to hide the tracking lots without removing it."), + 'active': fields.boolean('Active', help="If the active field is set to true, it will allow you to hide the pack without removing it."), 'serial': fields.char('Reference', size=64), 'move_ids': fields.one2many('stock.move', 'tracking_id', 'Moves Tracked'), 'date': fields.datetime('Created Date', required=True), @@ -1308,7 +1308,7 @@ class stock_move(osv.osv): return (res and res[0]) or False _name = "stock.move" _description = "Stock Move" - _order = 'date_planned desc' + _order = 'date_expected desc, id' _log_create = False def name_get(self, cr, uid, ids, context={}): @@ -1362,7 +1362,7 @@ class stock_move(osv.osv): 'address_id': fields.many2one('res.partner.address', 'Dest. Address', help="Address where goods are to be delivered"), 'prodlot_id': fields.many2one('stock.production.lot', 'Production Lot', help="Production lot is used to put a serial number on the production"), - 'tracking_id': fields.many2one('stock.tracking', 'Tracking Lot', select=True, help="Tracking lot is the code that will be put on the logistical unit/pallet"), + 'tracking_id': fields.many2one('stock.tracking', 'Pack', select=True, help="This is the code that will be put on the logistical unit: pallet, box, pack."), # 'lot_id': fields.many2one('stock.lot', 'Consumer lot', select=True, readonly=True), 'auto_validate': fields.boolean('Auto Validate'), diff --git a/addons/stock/stock_sequence.xml b/addons/stock/stock_sequence.xml index 9c5083d13b4..06d898c6637 100644 --- a/addons/stock/stock_sequence.xml +++ b/addons/stock/stock_sequence.xml @@ -61,11 +61,11 @@ Sequences from tracking numbers --> - Stock Production Lots + Production Lots stock.lot.serial - Stock Production Lots + Production Lots stock.lot.serial 7 @@ -74,12 +74,12 @@ - Stock Tracking Lots + Packs stock.lot.tracking - Stock Tracking Lots + Packs stock.lot.tracking 7 diff --git a/addons/stock/stock_view.xml b/addons/stock/stock_view.xml index 0129fbe8b8d..699a11a7a4b 100644 --- a/addons/stock/stock_view.xml +++ b/addons/stock/stock_view.xml @@ -154,7 +154,7 @@ stock.tracking form -
+ @@ -167,7 +167,7 @@ stock.tracking tree - + @@ -176,7 +176,7 @@ - Tracking Lots + Packs ir.actions.act_window stock.tracking form @@ -193,7 +193,7 @@ tree child_ids - + @@ -637,15 +637,14 @@ type="action" icon="terp-stock_effects-object-colorize" states="draft,waiting,confirmed,assigned" /> -