[MERGE] from trunk
[odoo/odoo.git] / addons / point_of_sale / point_of_sale.py
index 78f5b0d..81f86fd 100644 (file)
@@ -45,6 +45,16 @@ class pos_config(osv.osv):
         ('deprecated', 'Deprecated')
     ]
 
+    def _get_currency(self, cr, uid, ids, fieldnames, args, context=None):
+        result = dict.fromkeys(ids, False)
+        for pos_config in self.browse(cr, uid, ids, context=context):
+            if pos_config.journal_id:
+                currency_id = pos_config.journal_id.currency.id or pos_config.journal_id.company_id.currency_id.id
+            else:
+                currency_id = self.pool['res.users'].browse(cr, uid, uid, context=context).company_id.currency_id.id
+            result[pos_config.id] = currency_id
+        return result
+
     _columns = {
         'name' : fields.char('Point of Sale Name', size=32, select=1,
              required=True, help="An internal identification of the point of sale"),
@@ -56,6 +66,7 @@ class pos_config(osv.osv):
         'journal_id' : fields.many2one('account.journal', 'Sale Journal',
              domain=[('type', '=', 'sale')],
              help="Accounting journal used to post sales entries."),
+        'currency_id' : fields.function(_get_currency, type="many2one", string="Currency", relation="res.currency"),
         'iface_self_checkout' : fields.boolean('Self Checkout Mode',
              help="Check this if this point of sale should open by default in a self checkout mode. If unchecked, OpenERP uses the normal cashier mode by default."),
         'iface_cashdrawer' : fields.boolean('Cashdrawer',help="Automatically open the cashdrawer"),
@@ -205,6 +216,7 @@ class pos_session(osv.osv):
                                     readonly=True,
                                     states={'opening_control' : [('readonly', False)]}
                                    ),
+        'currency_id' : fields.related('config_id', 'currency_id', type="many2one", relation='res.currency', string="Currnecy"),
         'start_at' : fields.datetime('Opening Date', readonly=True), 
         'stop_at' : fields.datetime('Closing Date', readonly=True),
 
@@ -235,27 +247,28 @@ class pos_session(osv.osv):
                 type='float',
                 digits_compute=dp.get_precision('Account'),
                 string="Ending Balance",
-                help="Computed using the cash control lines",
+                help="Total of closing cash control lines.",
                 readonly=True),
         'cash_register_balance_start' : fields.related('cash_register_id', 'balance_start',
                 type='float',
                 digits_compute=dp.get_precision('Account'),
                 string="Starting Balance",
-                help="Computed using the cash control at the opening.",
+                help="Total of opening cash control lines.",
                 readonly=True),
         'cash_register_total_entry_encoding' : fields.related('cash_register_id', 'total_entry_encoding',
                 string='Total Cash Transaction',
-                readonly=True),
+                readonly=True,
+                help="Total of all paid sale orders"),
         'cash_register_balance_end' : fields.related('cash_register_id', 'balance_end',
                 type='float',
                 digits_compute=dp.get_precision('Account'),
-                string="Computed Balance",
-                help="Computed with the initial cash control and the sum of all payments.",
+                string="Theoretical Closing Balance",
+                help="Sum of opening balance and transactions.",
                 readonly=True),
         'cash_register_difference' : fields.related('cash_register_id', 'difference',
                 type='float',
                 string='Difference',
-                help="Difference between the counted cash control at the closing and the computed balance.",
+                help="Difference between the theoretical closing balance and the real closing balance.",
                 readonly=True),
 
         'journal_ids' : fields.related('config_id', 'journal_ids',