[IMP]set pos company in statment create
authorSanjay Gohel (Open ERP) <sgo@tinyerp.com>
Thu, 18 Oct 2012 12:55:06 +0000 (18:25 +0530)
committerSanjay Gohel (Open ERP) <sgo@tinyerp.com>
Thu, 18 Oct 2012 12:55:06 +0000 (18:25 +0530)
bzr revid: sgo@tinyerp.com-20121018125506-lrdsyklk0oap2u5z

addons/account/account_bank_statement.py
addons/point_of_sale/point_of_sale.py

index 549363c..401fac4 100644 (file)
@@ -61,7 +61,7 @@ class account_bank_statement(osv.osv):
         return res
 
     def _get_period(self, cr, uid, context=None):
-        periods = self.pool.get('account.period').find(cr, uid)
+        periods = self.pool.get('account.period').find(cr, uid,context=context)
         if periods:
             return periods[0]
         return False
index 85eb1dd..e0b33d6 100644 (file)
@@ -296,6 +296,8 @@ class pos_session(osv.osv):
     ]
 
     def create(self, cr, uid, values, context=None):
+        if context is None:
+            context = {}
         config_id = values.get('config_id', False) or False
         if config_id:
             # journal_id is not required on the pos_config because it does not
@@ -304,6 +306,7 @@ class pos_session(osv.osv):
             # the .xml files as the CoA is not yet installed.
             jobj = self.pool.get('pos.config')
             pos_config = jobj.browse(cr, uid, config_id, context=context)
+            context.update({'company_id': pos_config.shop_id.company_id.id})
             if not pos_config.journal_id:
                 jid = jobj.default_get(cr, uid, ['journal_id'], context=context)['journal_id']
                 if jid:
@@ -330,6 +333,7 @@ class pos_session(osv.osv):
                 bank_values = {
                     'journal_id' : journal.id,
                     'user_id' : uid,
+                    'company_id' : pos_config.shop_id.company_id.id
                 }
                 statement_id = self.pool.get('account.bank.statement').create(cr, uid, bank_values, context=context)
                 bank_statement_ids.append(statement_id)