[FORWARD] Forward-port of addons saas-1 until revision 8775 (revid tde@openerp.com...
authorThibault Delavallée <tde@openerp.com>
Fri, 13 Sep 2013 09:56:12 +0000 (11:56 +0200)
committerThibault Delavallée <tde@openerp.com>
Fri, 13 Sep 2013 09:56:12 +0000 (11:56 +0200)
[FIX] account: trunk version of the fix added in version 9440 of 7.0 branch

bzr revid: tde@openerp.com-20130913095612-i2f0kd3mhxdavdp6

1  2 
addons/account/account.py
addons/point_of_sale/static/src/css/pos.css
addons/point_of_sale/static/src/js/db.js
addons/point_of_sale/static/src/js/models.js
addons/point_of_sale/static/src/js/screens.js
addons/point_of_sale/static/src/js/widget_keyboard.js
addons/point_of_sale/static/src/js/widgets.js
addons/point_of_sale/static/src/xml/pos.xml

@@@ -3086,10 -3095,12 +3086,12 @@@ class wizard_multi_charts_accounts(osv.
          ids = self.pool.get('account.chart.template').search(cr, uid, [('visible', '=', True)], context=context)
          if ids:
              if 'chart_template_id' in fields:
 -                #in order to set default chart which was last created set max of ids.
 +                #in order to get set default chart which was last created set max of ids.
                  chart_id = max(ids)
                  if context.get("default_charts"):
-                     chart_id = self.pool.get('ir.model.data').search_read(cr, uid, [('model','=','account.chart.template'),('module','=',context.get("default_charts"))], ['res_id'], context=context)[0]['res_id']
 -                    data_ids = data_obj.search(cr, uid, [('model', '=', 'account.chart.template'), ('module', '=', context.get("default_charts"))], limit=1, context=context)
 -                    if data_ids:
 -                        chart_id = data_obj.browse(cr, uid, data_ids[0], context=context).res_id
++                    model_data = self.pool.get('ir.model.data').search_read(cr, uid, [('model','=','account.chart.template'),('module','=',context.get("default_charts"))], ['res_id'], context=context)
++                    if model_data:
++                        chart_id = model_data[0]['res_id']
                  res.update({'only_one_chart_template': len(ids) == 1, 'chart_template_id': chart_id})
              if 'sale_tax' in fields:
                  sale_tax_ids = tax_templ_obj.search(cr, uid, [("chart_template_id"
@@@ -182,10 -175,10 +182,10 @@@ function openerp_pos_models(instance, m
  
                      return self.fetch(
                          'product.product', 
-                         ['name', 'list_price','price','pos_categ_id', 'taxes_id', 'ean13', 
+                         ['name', 'list_price','price','pos_categ_id', 'taxes_id', 'ean13', 'default_code',
                           'to_weight', 'uom_id', 'uos_id', 'uos_coeff', 'mes_type', 'description_sale', 'description'],
                          [['sale_ok','=',true],['available_in_pos','=',true]],
 -                        {pricelist: self.get('shop').pricelist_id[0]} // context for price
 +                        {pricelist: self.get('pos_config').pricelist_id[0]} // context for price
                      );
                  }).then(function(products){
                      self.db.add_products(products);
@@@ -44,10 -43,15 +43,10 @@@ function openerp_pos_keyboard(instance
  
          // Write a character to the input zone
          writeCharacter: function(character){
-             var $input = $(this.input_selector);
 -            var $input = this.$target;
 -            if(character === '\n'){
 -                $input.trigger($.Event('keydown',{which:13}));
 -                $input.trigger($.Event('keyup',{which:13}));
 -            }else{
 -                $input[0].value += character;
 -                $input.keydown();
 -                $input.keyup();
 -            }
++            var $input = this.$target
 +            $input[0].value += character;
 +            $input.keydown();
 +            $input.keyup();
          },
          
          // Sends a 'return' character to the input zone. TODO
@@@ -541,9 -538,13 +541,12 @@@ function openerp_pos_widgets(instance, 
                  var category = self.pos.db.get_category_by_id(id);
                  self.set_category(category);
                  self.renderElement();
 +                self.search_and_categories(category);
              });
 -
 -            this.search_and_categories();
 -
+             if(this.pos.iface_vkeyboard && this.pos_widget.onscreen_keyboard){
+                 this.pos_widget.onscreen_keyboard.connect(this.$('.searchbox input'));
+             }
 +            this.search_and_categories();
          },
          
          set_product_type: function(type){       // 'all' | 'weightable'