[MERGE]
authorOlivier Laurent <olt@tinyerp.com>
Tue, 7 Jul 2009 07:14:13 +0000 (09:14 +0200)
committerOlivier Laurent <olt@tinyerp.com>
Tue, 7 Jul 2009 07:14:13 +0000 (09:14 +0200)
bzr revid: olt@tinyerp.com-20090707071413-6hp0dcgsh1tqbdnc

addons/account/invoice.py
addons/product/product.py
addons/sale/sale.py
addons/stock/stock.py

index 6ec083a..2bbd2e9 100644 (file)
@@ -223,7 +223,7 @@ class account_invoice(osv.osv):
             help="If you use payment terms, the due date will be computed automatically at the generation "\
                 "of accounting entries. If you keep the payment term and the due date empty, it means direct payment. "\
                 "The payment term may compute several due dates, for example 50% now, 50% in one month."),
-        'period_id': fields.many2one('account.period', 'Force Period', domain=[('state','<>','done')], help="Keep empty to use the period of the validation(invoice) date."),
+        'period_id': fields.many2one('account.period', 'Force Period', domain=[('state','<>','done')], help="Keep empty to use the period of the validation(invoice) date.", readonly=True, states={'draft':[('readonly',False)]}),
 
         'account_id': fields.many2one('account.account', 'Account', required=True, readonly=True, states={'draft':[('readonly',False)]}, help="The partner account used for this invoice."),
         'invoice_line': fields.one2many('account.invoice.line', 'invoice_id', 'Invoice Lines', readonly=True, states={'draft':[('readonly',False)]}),
index b7ae4ea..1937912 100644 (file)
@@ -496,12 +496,15 @@ class product_product(osv.osv):
             args=[]
         if not context:
             context={}
-        ids = self.search(cr, user, [('default_code','=',name)]+ args, limit=limit, context=context)
-        if not len(ids):
-            ids = self.search(cr, user, [('ean13','=',name)]+ args, limit=limit, context=context)
-        if not len(ids):
-            ids = self.search(cr, user, [('default_code',operator,name)]+ args, limit=limit, context=context)
-            ids += self.search(cr, user, [('name',operator,name)]+ args, limit=limit, context=context)
+        if name:
+            ids = self.search(cr, user, [('default_code','=',name)]+ args, limit=limit, context=context)
+            if not len(ids):
+                ids = self.search(cr, user, [('ean13','=',name)]+ args, limit=limit, context=context)
+            if not len(ids):
+                ids = self.search(cr, user, [('default_code',operator,name)]+ args, limit=limit, context=context)
+                ids += self.search(cr, user, [('name',operator,name)]+ args, limit=limit, context=context)
+        else:
+            ids = self.search(cr, user, args, limit=limit, context=context)
         result = self.name_get(cr, user, ids, context)
         return result
 
index 58240d2..e36d1f1 100644 (file)
@@ -359,7 +359,7 @@ class sale_order(osv.osv):
         else:
             pay_term = False
         for preinv in order.invoice_ids:
-            if preinv.state in ('open','paid','proforma'):
+            if preinv.state not in ('cancel',):
                 for preline in preinv.invoice_line:
                     inv_line_id = self.pool.get('account.invoice.line').copy(cr, uid, preline.id, {'invoice_id':False, 'price_unit':-preline.price_unit})
                     lines.append(inv_line_id)
@@ -893,10 +893,10 @@ class sale_order_line(osv.osv):
                 ean = pack.ean
                 qty_pack = pack.qty
                 type_ul = pack.ul
-                warn_msg = "You selected a quantity of %d Units.\nBut it's not compatible with the selected packaging.\nHere is a proposition of quantities according to the packaging: " % (qty)
-                warn_msg = warn_msg + "\n\nEAN: " + str(ean) + " Quantity: " + str(qty_pack) + " Type of ul: " + str(type_ul.name)
+                warn_msg = _("You selected a quantity of %d Units.\nBut it's not compatible with the selected packaging.\nHere is a proposition of quantities according to the packaging: ") % (qty)
+                warn_msg = warn_msg + "\n\n"+_("EAN: ") + str(ean) + _(" Quantity: ") + str(qty_pack) + _(" Type of ul: ") + str(type_ul.name)
                 warning={
-                    'title':'Packing Information !',
+                    'title':_('Packing Information !'),
                     'message': warn_msg
                     }
             result['product_uom_qty'] = qty
index 199cb38..2cdb9a2 100644 (file)
@@ -428,7 +428,7 @@ class stock_picking(osv.osv):
             ('confirmed','Confirmed'),
             ('assigned','Available'),
             ('done','Done'),
-            ('cancel','Cancel'),
+            ('cancel','Canceled'),
             ], 'Status', readonly=True, select=True),
         'min_date': fields.function(get_min_max_date, fnct_inv=_set_minimum_date, multi="min_max_date",
                  method=True,store=True, type='datetime', string='Planned Date', select=1),