[MERGE] forward port of branch 8.0 up to 780dd98
authorChristophe Simonis <chs@odoo.com>
Mon, 15 Sep 2014 13:09:32 +0000 (15:09 +0200)
committerChristophe Simonis <chs@odoo.com>
Mon, 15 Sep 2014 13:09:32 +0000 (15:09 +0200)
37 files changed:
1  2 
addons/account/account_invoice.py
addons/account/account_invoice_view.xml
addons/account_anglo_saxon/test/anglo_saxon.yml
addons/account_anglo_saxon/test/anglo_saxon_avg_fifo.yml
addons/hr_expense/hr_expense.py
addons/hr_recruitment/hr_recruitment.py
addons/mrp/mrp.py
addons/mrp/mrp_view.xml
addons/mrp/res_config_view.xml
addons/point_of_sale/point_of_sale.py
addons/point_of_sale/point_of_sale_view.xml
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/widgets.js
addons/point_of_sale/static/src/xml/pos.xml
addons/product/product_view.xml
addons/purchase/purchase.py
addons/purchase/purchase_view.xml
addons/stock/stock.py
addons/stock/stock_view.xml
addons/web/controllers/main.py
addons/web/static/src/css/base.css
addons/web/static/src/css/base.sass
addons/web/static/src/js/chrome.js
addons/web/static/src/js/view_form.js
addons/web/static/src/js/views.js
addons/web/static/src/xml/base.xml
addons/website/static/src/js/website.editor.js
addons/website_blog/views/website_blog_templates.xml
addons/website_forum/views/website_forum.xml
addons/website_sale/controllers/main.py
addons/website_sale/views/templates.xml
openerp/addons/base/ir/ir_attachment.py
openerp/addons/base/ir/ir_qweb.py
openerp/models.py
openerp/modules/module.py
openerp/tools/mail.py

Simple merge
Simple merge
@@@ -230,12 -219,14 +222,14 @@@ class hr_applicant(osv.Model)
          'response_id': fields.many2one('survey.user_input', "Response", ondelete='set null', oldname="response"),
          'reference': fields.char('Referred By'),
          'source_id': fields.many2one('hr.recruitment.source', 'Source'),
-         'day_open': fields.function(_compute_day, string='Days to Open', \
-                                 multi='day_open', type="float", store=True),
-         'day_close': fields.function(_compute_day, string='Days to Close', \
-                                 multi='day_close', type="float", store=True),
+         'day_open': fields.function(_compute_day, string='Days to Open',
+                                     multi='day_open', type="float",
+                                     store={'hr.applicant': (lambda self, cr, uid, ids, c={}: ids, ['date_open'], 10)}),
+         'day_close': fields.function(_compute_day, string='Days to Close',
+                                      multi='day_close', type="float",
+                                      store={'hr.applicant': (lambda self, cr, uid, ids, c={}: ids, ['date_closed'], 10)}),
          'color': fields.integer('Color Index'),
 -        'emp_id': fields.many2one('hr.employee', string='Employee', help='Employee linked to the applicant.'),
 +        'emp_id': fields.many2one('hr.employee', string='Employee', track_visibility='onchange', help='Employee linked to the applicant.'),
          'user_email': fields.related('user_id', 'email', type='char', string='User Email', readonly=True),
          'attachment_number': fields.function(_get_attachment_number, string='Number of Attachments', type="integer"),
      }
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -287,58 -314,10 +287,30 @@@ function openerp_pos_screens(instance, 
          },
      });
  
 +    module.FullscreenPopup = module.PopUpWidget.extend({
 +        template:'FullscreenPopupWidget',
 +        show: function(){
 +            var self = this;
 +            this._super();
 +            this.renderElement();
 +            this.$('.button.fullscreen').off('click').click(function(){
 +                window.document.body.webkitRequestFullscreen();
 +                self.pos_widget.screen_selector.close_popup();
 +            });
 +            this.$('.button.cancel').off('click').click(function(){
 +                self.pos_widget.screen_selector.close_popup();
 +            });
 +        },
 +        ismobile: function(){
 +            return typeof window.orientation !== 'undefined'; 
 +        }
 +    });
 +
 +
-     module.ChooseReceiptPopupWidget = module.PopUpWidget.extend({
-         template:'ChooseReceiptPopupWidget',
-         show: function(){
-             this._super();
-             this.renderElement();
-             var self = this;
-             var currentOrder = self.pos.get('selectedOrder');
-             
-             this.$('.button.receipt').off('click').click(function(){
-                 currentOrder.set_receipt_type('receipt');
-                 self.pos_widget.screen_selector.set_current_screen('products');
-             });
-             this.$('.button.invoice').off('click').click(function(){
-                 currentOrder.set_receipt_type('invoice');
-                 self.pos_widget.screen_selector.set_current_screen('products');
-             });
-         },
-         get_client_name: function(){
-             var client = this.pos.get('selectedOrder').get_client();
-             if( client ){
-                 return client.name;
-             }else{
-                 return '';
-             }
-         },
-     });
      module.ErrorPopupWidget = module.PopUpWidget.extend({
          template:'ErrorPopupWidget',
-         show: function(text){
+         show: function(options){
+             options = options || {};
              var self = this;
              this._super();
  
                  return;
              }
  
+             // The exact amount must be paid if there is no cash payment method defined.
 -            if (Math.abs(currentOrder.getTotalTaxIncluded() - currentOrder.getPaidTotal()) > 0.00001) {
++            if (Math.abs(order.getTotalTaxIncluded() - order.getPaidTotal()) > 0.00001) {
+                 var cash = false;
+                 for (var i = 0; i < this.pos.cashregisters.length; i++) {
+                     cash = cash || (this.pos.cashregisters[i].journal.type === 'cash');
+                 }
+                 if (!cash) {
+                     this.pos_widget.screen_selector.show_popup('error',{
+                         message: _t('Cannot return change without a cash payment method'),
+                         comment: _t('There is no cash payment method available in this point of sale to handle the change.\n\n Please pay the exact amount or add a cash payment method in the point of sale configuration'),
+                     });
+                     return;
+                 }
+             }
 -            if(    this.pos.config.iface_cashdrawer 
 -                && this.pos.get('selectedOrder').get('paymentLines').find( function(pl){ 
 -                           return pl.cashregister.journal.type === 'cash'; 
 -                   })){
 +            if (order.isPaidWithCash() && this.pos.config.iface_cashdrawer) { 
++            
                      this.pos.proxy.open_cashbox();
              }
  
 -            if(options.invoice){
 -                // deactivate the validation button while we try to send the order
 -                this.pos_widget.action_bar.set_button_disabled('validation',true);
 -                this.pos_widget.action_bar.set_button_disabled('invoice',true);
 -
 -                var invoiced = this.pos.push_and_invoice_order(currentOrder);
 +            if (order.is_to_invoice()) {
 +                var invoiced = this.pos.push_and_invoice_order(order);
 +                this.invoicing = true;
  
                  invoiced.fail(function(error){
 -                    if(error === 'error-no-client'){
 -                        self.pos_widget.screen_selector.show_popup('error',{
 -                            message: _t('An anonymous order cannot be invoiced'),
 -                            comment: _t('Please select a client for this order. This can be done by clicking the order tab'),
 +                    self.invoicing = false;
 +                    if (error === 'error-no-client') {
 +                        self.pos_widget.screen_selector.show_popup('confirm',{
 +                            message: _t('Please select the Customer'),
 +                            comment: _t('You need to select the customer before you can invoice an order.'),
 +                            confirm: function(){
 +                                self.pos_widget.screen_selector.set_current_screen('clientlist');
 +                            },
                          });
 -                    }else{
 +                    } else {
-                         self.pos_widget.screen_selector.show_popup('error-invoice-transfer');
+                         self.pos_widget.screen_selector.show_popup('error',{
+                             message: _t('The order could not be sent'),
+                             comment: _t('Check your internet connection and try again.'),
+                         });
                      }
 -                    self.pos_widget.action_bar.set_button_disabled('validation',false);
 -                    self.pos_widget.action_bar.set_button_disabled('invoice',false);
                  });
  
                  invoiced.done(function(){
@@@ -907,16 -1017,6 +907,10 @@@ function openerp_pos_widgets(instance, 
  
                  instance.webclient.set_content_full_screen(true);
  
-                 if (!self.pos.session) {
-                     self.screen_selector.show_popup('error', 'Sorry, we could not create a user session');
-                 }else if(!self.pos.config){
-                     self.screen_selector.show_popup('error', 'Sorry, we could not find any PoS Configuration for this session');
 +                }else if(self.pos.config.iface_fullscreen && document.body.webkitRequestFullscreen && (
 +                    window.screen.availWidth  > window.innerWidth ||
 +                    window.screen.availHeight > window.innerHeight    )){
 +                    self.screen_selector.show_popup('fullscreen');
-                 }
-             
                  self.$('.loader').animate({opacity:0},1500,'swing',function(){self.$('.loader').addClass('oe_hidden');});
  
                  self.pos.push_order();
                  popup_set:{
                      'error': this.error_popup,
                      'error-barcode': this.error_barcode_popup,
-                     'error-session': this.error_session_popup,
-                     'choose-receipt': this.choose_receipt_popup,
-                     'error-invoice-transfer': this.error_invoice_transfer_popup,
                      'error-traceback': this.error_traceback_popup,
                      'confirm': this.confirm_popup,
 +                    'fullscreen': this.fullscreen_popup,
                      'unsent-orders': this.unsent_orders_popup,
                  },
                  default_screen: 'products',
          </receipt>
      </t>
  
-     <t t-name="ChooseReceiptPopupWidget">
-         <div class="modal-dialog">
-             <div class="popup popup-receipt">
-                 <p class="message">Welcome <t t-esc="widget.get_client_name()" /><br /> Choose your type of receipt:</p>
-                 <div class = "button big-left receipt">
-                     Ticket
-                 </div>
-                 <div class = "button big-right invoice">
-                     Invoice
-                 </div>
-             </div>
-         </div>
-     </t>
 +    <t t-name="FullscreenPopupWidget">
 +        <div class="modal-dialog">
 +            <div class="popup popup-fullscreen">
 +                <p class="message">Fullscreen Setup</p>
 +
 +                <t t-if='widget.ismobile()'>
 +                    <p class="comment">
 +                        The best way to make the point of sale fullscreen on mobile
 +                        devices is to add the point of sale to your home screen. On 
 +                        iPhone and iPad this is done by tapping <img src='/point_of_sale/static/src/img/ios-share-icon.png' />
 +                        and then <i>Add to Homescreen</i>
 +                    </p>
 +                    <p class='comment'>
 +                        This also works on Android with the Chrome Beta Browser, using the <i>Add to Homescreen</i> option 
 +                        in the browser's menu.
 +                    </p>
 +                    <p class='comment'> 
 +                        If you want to work in fullscreen just this time tap the <i>Go Fullscreen</i> button.
 +                    </p>
 +                </t>
 +
 +                <t t-if='!widget.ismobile()'>
 +                    <p class="comment">
 +                        The best way to make the point of sale fullscreen on desktop
 +                        and laptops is to launch your browser in kiosk mode. Please
 +                        refer to your browser's documentation for the specific 
 +                        instructions.
 +                    </p>
 +                    <p class="comment">
 +                        If you want to work in fullscreen just this time, click the <i> Go Fullscreen</i> button.
 +                    </p>
 +                </t>
 +
 +                <div class="footer">
 +                    <div class="button fullscreen">
 +                        Go Fullscreen
 +                    </div>
 +                    <div class="button cancel">
 +                        Cancel
 +                    </div>
 +                </div>
 +            </div>
 +        </div>
 +    </t>
 +
-     <t t-name="ErrorSessionPopupWidget">
-         <div class="modal-dialog">
-             <div class="popup popup-nosession">
-                 <p class="message">Sorry, we could not create a session for this user.</p>
-             </div>
-         </div>
-     </t>
 +    <t t-name="ErrorInvoiceTransferPopupWidget">
 +        <div class="modal-dialog">
 +            <div class="popup popup-invoice">
 +                <p class="message">The Order could not be sent to the server for invoicing. Invoices cannot be generated
 +                    in offline mode. Please check your internet connection and try again.</p>
 +                <div class="footer">
 +                    <div class="button">
 +                        Ok
 +                    </div>
 +                </div>
 +            </div>
 +        </div>
 +    </t>
 +
      <t t-name="ErrorPopupWidget">
          <div class="modal-dialog">
              <div class="popup popup-error">
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -2,28 -2,6 +2,28 @@@
  <openerp>
      <data>
  
 +<!-- Editor custom -->
- <template id="assets_editor" inherit_id="website.assets_editor" name="Forum Editor Assets">
++<template id="assets_editor" inherit_id="website.assets_editor" name="Forum Editor Assets" groups="base.group_user">
 +    <xpath expr="." position="inside">
 +        <link rel='stylesheet' href="/website_forum/static/src/css/website_forum.css"/>
 +        <script type="text/javascript" src="/website_forum/static/src/js/website.tour.forum.js"/>
 +        <script type="text/javascript" src="/website_forum/static/src/js/website_forum.editor.js"/>
 +    </xpath>
 +</template>
 +
 +<template id="assets_forum" name="Forum Assets">
 +    <link rel='stylesheet' href="/web/static/lib/jquery.textext/jquery.textext.css"/>
 +    <link rel='stylesheet' href='/website_forum/static/src/css/website_forum.css'/>
 +
 +    <script type="text/javascript" src="/website_forum/static/src/js/website_forum.js"/>
 +    <script type="text/javascript" src="/web/static/lib/jquery.textext/jquery.textext.js"/>
 +    <script type="text/javascript" src="/web/static/lib/ckeditor/ckeditor.js"/>
 +    <script type="text/javascript">
 +        CKEDITOR.config.toolbar = [['Bold','Italic','Underline','Strike'],['NumberedList','BulletedList', 'Blockquote']
 +        ,['Outdent','Indent','Link','Unlink','Image'],] ;
 +    </script>
 +</template>
 +
  <!-- Layout add nav and footer -->
  <template id="header_footer_custom" inherit_id="website.footer_default"
      name="Footer Questions Link">
  <template id="header" name="Forum Index">
      <t t-call="website.layout">
          <t t-set="head">
 -            <script type="text/javascript" src="/web/static/lib/ckeditor/ckeditor.js"/>
 -            <script type="text/javascript">
 -                CKEDITOR.config.toolbar = [['Bold','Italic','Underline','Strike'],['NumberedList','BulletedList', 'Blockquote']
 -                ,['Outdent','Indent','Link','Unlink','Image'],] ;
 -            </script>
 +            <t t-call-assets="website_forum.assets_forum"/>
-             <t t-raw="0"/>
          </t>
          <div class="container mt16 website_forum">
              <div class="navbar navbar-default">
Simple merge
Simple merge
Simple merge
Simple merge