Amit Patel (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-imp-point-of-sale-apa into 
lp:openobject-addons.

Requested reviews:
  OpenERP Core Team (openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-imp-point-of-sale-apa/+merge/128669
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-imp-point-of-sale-apa/+merge/128669
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-imp-point-of-sale-apa.
=== modified file 'account/account_view.xml'
--- account/account_view.xml	2012-10-17 09:41:42 +0000
+++ account/account_view.xml	2012-10-23 06:54:22 +0000
@@ -509,8 +509,8 @@
                         <page string="Cash Registers">
                             <group>
                                 <group string="Accounts">
-                                    <field name="profit_account_id"/>
-                                    <field name="loss_account_id"/>
+                                    <field name="profit_account_id" domain="[('type','!=','view')]"/>
+                                    <field name="loss_account_id" domain="[('type','!=','view')]"/>
                                     <field name="internal_account_id"/>
                                 </group>
                                 <group string="Miscellaneous">

=== modified file 'account_bank_statement_extensions/account_bank_statement.py'
--- account_bank_statement_extensions/account_bank_statement.py	2012-08-06 15:44:10 +0000
+++ account_bank_statement_extensions/account_bank_statement.py	2012-10-23 06:54:22 +0000
@@ -105,7 +105,6 @@
 class account_bank_statement_line(osv.osv):
     _inherit = 'account.bank.statement.line'
     _columns = {
-        'date': fields.date('Entry Date', required=True, states={'confirm': [('readonly', True)]}),
         'val_date': fields.date('Valuta Date', states={'confirm': [('readonly', True)]}),
         'globalisation_id': fields.many2one('account.bank.statement.line.global', 'Globalisation ID',
             states={'confirm': [('readonly', True)]},

=== modified file 'account_bank_statement_extensions/account_bank_statement_view.xml'
--- account_bank_statement_extensions/account_bank_statement_view.xml	2012-10-12 13:06:39 +0000
+++ account_bank_statement_extensions/account_bank_statement_view.xml	2012-10-23 06:54:22 +0000
@@ -56,6 +56,9 @@
             <field name="globalisation_id"/>
             <field name="state" invisible="1"/>
           </xpath>
+          <xpath expr="//page[@name='statement_line_ids']/field[@name='line_ids']/tree/field[@name='date']" position="replace">
+            <field name="date" string="'Entry Date'" attrs="{'readonly':[('state','=','draft')]}" />
+          </xpath>
         </data>
       </field>
     </record>

=== modified file 'mail/mail_thread.py'
--- mail/mail_thread.py	2012-10-19 09:59:19 +0000
+++ mail/mail_thread.py	2012-10-23 06:54:22 +0000
@@ -156,25 +156,26 @@
         old = set(fol.partner_id.id for fol in fol_obj.browse(cr, SUPERUSER_ID, fol_ids))
         new = set(old)
 
-        for command in value:
-            if isinstance(command, (int, long)):
-                new.add(command)
-            elif command[0] == 0:
-                new.add(partner_obj.create(cr, uid, command[2], context=context))
-            elif command[0] == 1:
-                partner_obj.write(cr, uid, [command[1]], command[2], context=context)
-                new.add(command[1])
-            elif command[0] == 2:
-                partner_obj.unlink(cr, uid, [command[1]], context=context)
-                new.discard(command[1])
-            elif command[0] == 3:
-                new.discard(command[1])
-            elif command[0] == 4:
-                new.add(command[1])
-            elif command[0] == 5:
-                new.clear()
-            elif command[0] == 6:
-                new = set(command[2])
+        if value:
+            for command in value:
+                if isinstance(command, (int, long)):
+                    new.add(command)
+                elif command[0] == 0:
+                    new.add(partner_obj.create(cr, uid, command[2], context=context))
+                elif command[0] == 1:
+                    partner_obj.write(cr, uid, [command[1]], command[2], context=context)
+                    new.add(command[1])
+                elif command[0] == 2:
+                    partner_obj.unlink(cr, uid, [command[1]], context=context)
+                    new.discard(command[1])
+                elif command[0] == 3:
+                    new.discard(command[1])
+                elif command[0] == 4:
+                    new.add(command[1])
+                elif command[0] == 5:
+                    new.clear()
+                elif command[0] == 6:
+                    new = set(command[2])
 
         # remove partners that are no longer followers
         fol_ids = fol_obj.search(cr, SUPERUSER_ID,

=== modified file 'point_of_sale/point_of_sale.py'
--- point_of_sale/point_of_sale.py	2012-10-03 10:35:03 +0000
+++ point_of_sale/point_of_sale.py	2012-10-23 06:54:22 +0000
@@ -484,7 +484,8 @@
                 'name': order['name'],
                 'user_id': order['user_id'] or False,
                 'session_id': order['pos_session_id'],
-                'lines': order['lines']
+                'lines': order['lines'],
+                'pos_reference':order['name']
             }, context)
 
             for payments in order['statement_ids']:
@@ -592,7 +593,7 @@
         'picking_id': fields.many2one('stock.picking', 'Picking', readonly=True),
         'note': fields.text('Internal Notes'),
         'nb_print': fields.integer('Number of Print', readonly=True),
-
+        'pos_reference': fields.char('Receipt Ref', size=64, readonly=True),
         'sale_journal': fields.related('session_id', 'config_id', 'journal_id', relation='account.journal', type='many2one', string='Sale Journal', store=True, readonly=True),
     }
 

=== modified file 'point_of_sale/point_of_sale_view.xml'
--- point_of_sale/point_of_sale_view.xml	2012-10-01 09:52:54 +0000
+++ point_of_sale/point_of_sale_view.xml	2012-10-23 06:54:22 +0000
@@ -88,6 +88,7 @@
                                 <field name="user_id"/>
                                 <field name="pricelist_id" groups="product.group_sale_pricelist" domain="[('type','=','sale')]"/>
                                 <field name="picking_id" readonly="1"/>
+                                <field name="pos_reference"/>
                             </group>
                             <group string="Accounting Information">
                                 <field name="sale_journal" domain="[('type','=','sale')]"/>
@@ -131,6 +132,7 @@
             <field name="arch" type="xml">
                 <tree string="POS Orders" colors="blue:state == 'draft';gray:state in ('done','cancel');black:state not in('done','cancel')">
                     <field name="name"/>
+                    <field name="pos_reference"/>
                     <field name="partner_id"/>
                     <field name="date_order"/>
                     <field name="user_id"/>
@@ -149,6 +151,7 @@
                 <search string="Search Sales Order">
                     <field name="name" string="Sales Order"/>
                     <field name="date_order"/>
+                    <field name="pos_reference"/>
                     <filter icon="terp-document-new" string="New" domain="[('state','=','draft')]"/>
                     <filter icon="gtk-apply" string="Done" domain="[('state','in',('paid','invoiced','done'))]"/>
                     <filter icon="terp-check" string="Invoiced" domain="[('state','=','invoiced')]"/>
@@ -890,7 +893,7 @@
                             <field name="cash_control" invisible="1" />
                             <group>
                                 <field name="user_id"/>
-                                <field name="config_id" attrs="{'invisible' : [('config_id', '!=', False)]}"/>
+                                <field name="config_id"/>
                             </group>
                             <group>
                                 <field name="start_at" attrs="{'invisible' : [('state', '=', 'opening_control')]}"/>

=== modified file 'point_of_sale/report/pos_details.py'
--- point_of_sale/report/pos_details.py	2012-03-05 18:40:03 +0000
+++ point_of_sale/report/pos_details.py	2012-10-23 06:54:22 +0000
@@ -91,16 +91,17 @@
     def _get_sum_dis_2(self):
         return self.discount or 0.0
 
-    def _get_sum_discount(self, objects):
+    def _get_sum_discount(self, form):
         #code for the sum of discount value
-        return reduce(lambda acc, object:
-                                        acc + reduce(
-                                                lambda sum_dis, line:
-                                                        sum_dis + ((line.price_unit * line.qty) * (line.discount / 100)),
-                                                object.lines,
-                                                0.0),
-                                    objects,
-                                    0.0)
+        pos_obj = self.pool.get('pos.order')
+        user_obj = self.pool.get('res.users')
+        user_ids = form['user_ids'] or self._get_all_users()
+        company_id = user_obj.browse(self.cr, self.uid, self.uid).company_id.id
+        pos_ids = pos_obj.search(self.cr, self.uid, [('date_order','>=',form['date_start'] + ' 00:00:00'),('date_order','<=',form['date_end'] + ' 23:59:59'),('user_id','in',user_ids),('company_id','=',company_id)])
+        for pos in pos_obj.browse(self.cr, self.uid, pos_ids):
+            for pol in pos.lines:
+                self.total_discount += ((pol.price_unit * pol.qty) * (pol.discount / 100))
+        return self.total_discount or False
 
     def _get_payments(self, form):
         statement_line_obj = self.pool.get("account.bank.statement.line")
@@ -179,11 +180,12 @@
         self.qty = 0.0
         self.total_invoiced = 0.0
         self.discount = 0.0
+        self.total_discount = 0.0
         self.localcontext.update({
             'time': time,
             'strip_name': self._strip_name,
             'getpayments': self._get_payments,
-            'getsumdisc': self._get_sum_dis_2,
+            'getsumdisc': self._get_sum_discount,
             'gettotalofthaday': self._total_of_the_day,
             'gettaxamount': self._get_tax_amount,
             'pos_sales_details':self._pos_sales_details,

=== modified file 'point_of_sale/report/pos_details.rml'
--- point_of_sale/report/pos_details.rml	2012-10-02 16:40:01 +0000
+++ point_of_sale/report/pos_details.rml	2012-10-23 06:54:22 +0000
@@ -373,8 +373,8 @@
           <para style="terp_default_Bold_9">Total discount</para>
         </td>
         <td>
-          <para style="terp_default_Right_9_Bold">[[ formatLang(getsumdisc(), dp='Sale Price', currency_obj =  company.currency_id) ]]</para>
-        </td>
+          <para style="terp_default_Right_9_Bold">[[ formatLang(getsumdisc(data['form']), dp='Sale Price', currency_obj =  company.currency_id) ]]</para>
+>>      </td>
       </tr>
       <tr>
         <td>

=== modified file 'point_of_sale/report/pos_details.sxw'
Binary files point_of_sale/report/pos_details.sxw	2012-10-02 16:40:01 +0000 and point_of_sale/report/pos_details.sxw	2012-10-23 06:54:22 +0000 differ
=== modified file 'point_of_sale/report/pos_order_report.py'
--- point_of_sale/report/pos_order_report.py	2012-05-04 12:13:26 +0000
+++ point_of_sale/report/pos_order_report.py	2012-10-23 06:54:22 +0000
@@ -60,7 +60,7 @@
                     to_date(to_char(s.date_order, 'dd-MM-YYYY'),'dd-MM-YYYY') as date,
                     sum(l.qty * u.factor) as product_qty,
                     sum(l.qty * l.price_unit) as price_total,
-                    sum(l.qty * l.discount) as total_discount,
+                    sum((l.qty * l.price_unit) * (l.discount / 100)) as total_discount,
                     (sum(l.qty*l.price_unit)/sum(l.qty * u.factor))::decimal(16,2) as average_price,
                     sum(cast(to_char(date_trunc('day',s.date_order) - date_trunc('day',s.create_date),'DD') as int)) as delay_validation,
                     to_char(s.date_order, 'YYYY') as year,

=== modified file 'point_of_sale/report/pos_receipt.rml'
--- point_of_sale/report/pos_receipt.rml	2012-10-11 09:40:02 +0000
+++ point_of_sale/report/pos_receipt.rml	2012-10-23 06:54:22 +0000
@@ -103,6 +103,12 @@
         <td>
           <para style="P1">[[ repeatIn(o.lines,'line') ]]</para>
           <para style="terp_default_9b">[[ line.product_id.name ]]</para>
+          <para style="terp_default_Right_9">
+            <font face="Helvetica">With a [[ line and line.discount == 0.0 and removeParentNode('font') ]] ([[ '%.2f' % line.discount ]]) % discount.</font>
+          </para>
+          <para style="terp_default_9b">
+            <font color="white"> </font>
+          </para>
         </td>
         <td>
           <para style="terp_default_Right_9">[[o.state=='cancel' and o.statement_ids and '-' or '']][['%.f' % line.qty ]]</para>

=== modified file 'point_of_sale/report/pos_receipt.sxw'
Binary files point_of_sale/report/pos_receipt.sxw	2012-10-02 06:58:32 +0000 and point_of_sale/report/pos_receipt.sxw	2012-10-23 06:54:22 +0000 differ
=== modified file 'point_of_sale/static/src/css/pos.css'
--- point_of_sale/static/src/css/pos.css	2012-10-05 14:06:16 +0000
+++ point_of_sale/static/src/css/pos.css	2012-10-23 06:54:22 +0000
@@ -102,6 +102,11 @@
     border: 1px solid #cecbcb;
     border-radius: 4px;
 }
+.point-of-sale .pos-disc-font {
+    font-size: 12px;
+    font-style:italic;
+    color: #808080;
+}
 
 /*  ********* The black header bar ********* */
 

=== modified file 'point_of_sale/static/src/js/models.js'
--- point_of_sale/static/src/js/models.js	2012-09-13 14:03:10 +0000
+++ point_of_sale/static/src/js/models.js	2012-10-23 06:54:22 +0000
@@ -178,12 +178,15 @@
                         [['state','=','open'],['pos_session_id', '=', self.get('pos_session').id]]
                     );
                 }).pipe(function(bank_statements){
+                    var journals = new Array();
+                    _.each(bank_statements,function(statement) {
+                        journals.push(statement.journal_id[0])
+                    });
                     self.set('bank_statements', bank_statements);
-
-                    return self.fetch('account.journal', undefined, [['user_id','=', self.get('pos_session').user_id[0]]]);
+                    return self.fetch('account.journal', undefined, [['id','in', journals]]);
                 }).pipe(function(journals){
                     self.set('journals',journals);
-
+                    
                     // associate the bank statements with their journals. 
                     var bank_statements = self.get('bank_statements');
                     for(var i = 0, ilen = bank_statements.length; i < ilen; i++){
@@ -614,6 +617,11 @@
                 return sum + orderLine.get_price_with_tax();
             }), 0);
         },
+        getDiscountTotal: function() {
+            return (this.get('orderLines')).reduce((function(sum, orderLine) {
+                return sum + (orderLine.get_list_price() * (orderLine.get_discount()/100) * orderLine.get_quantity());
+            }), 0);
+        },
         getTotalTaxExcluded: function() {
             return (this.get('orderLines')).reduce((function(sum, orderLine) {
                 return sum + orderLine.get_price_without_tax();

=== modified file 'point_of_sale/static/src/js/screens.js'
--- point_of_sale/static/src/js/screens.js	2012-09-18 13:37:32 +0000
+++ point_of_sale/static/src/js/screens.js	2012-10-23 06:54:22 +0000
@@ -966,6 +966,9 @@
             this.$('#payment-paid-total').html(paidTotal.toFixed(2));
             this.$('#payment-remaining').html(remaining.toFixed(2));
             this.$('#payment-change').html(change.toFixed(2));
+            if((currentOrder.selected_orderline == undefined))
+                remaining = 1
+                
             if(this.pos_widget.action_bar){
                 this.pos_widget.action_bar.set_button_disabled('validation', remaining > 0);
             }

=== modified file 'point_of_sale/static/src/xml/pos.xml'
--- point_of_sale/static/src/xml/pos.xml	2012-09-28 15:20:41 +0000
+++ point_of_sale/static/src/xml/pos.xml	2012-10-23 06:54:22 +0000
@@ -541,8 +541,9 @@
 
     <t t-name="PosTicket">
         <div class="pos-sale-ticket">
+            
             <div class="pos-right-align"><t t-esc="new Date().toString(Date.CultureInfo.formatPatterns.shortDate + ' ' +
-                Date.CultureInfo.formatPatterns.longTime)"/></div>
+                Date.CultureInfo.formatPatterns.longTime)"/><li><t t-esc="widget.currentOrder.attributes.name"/></li></div>
             <br />
             <t t-esc="widget.company.name"/><br />
             Phone: <t t-esc="widget.company.phone || ''"/><br />
@@ -553,6 +554,11 @@
                 <tr t-foreach="widget.currentOrderLines.toArray()" t-as="order">
                     <td>
                         <t t-esc="order.get_product().get('name')"/>
+                         <t t-if="order.get_discount() > 0">
+                            <li class="pos-disc-font">
+                                With a <t t-esc="order.get_discount()"/>% discount
+                            </li>
+                        </t>
                     </td>
                     <td class="pos-right-align">
                         <t t-esc="order.get_quantity().toFixed(0)"/>
@@ -567,6 +573,9 @@
                 <tr><td>Tax:</td><td class="pos-right-align">
                     <t t-esc="widget.format_currency(widget.currentOrder.getTax().toFixed(2))"/>
                     </td></tr>
+                <tr><td>Discount:</td><td class="pos-right-align">
+                    <t t-esc="widget.format_currency(widget.currentOrder.getDiscountTotal().toFixed(2))"/>
+                    </td></tr>
                 <tr class="emph"><td>Total:</td><td class="pos-right-align">
                     <t t-esc="widget.format_currency(widget.currentOrder.getTotal().toFixed(2))"/>
                     </td></tr>

_______________________________________________
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