Divyesh Makwana(OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-bug-810548-mdi into 
lp:openobject-addons.

Requested reviews:
  Divyesh Makwana(OpenERP) (mdi-openerp)
  qdp (OpenERP) (qdp)
Related bugs:
  Bug #810548 in OpenERP Addons: "multi-company invoice validation error"
  https://bugs.launchpad.net/openobject-addons/+bug/810548

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-810548-mdi/+merge/81941

Hello Sir,

Here i put a constraint for period related to the company.
Because, if period is not found for the company, it will take the default 
company's period.

Divyesh Makwana(MDI)
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-810548-mdi/+merge/81941
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-bug-810548-mdi.
=== modified file 'account/account_invoice.py'
--- account/account_invoice.py	2011-11-10 22:58:02 +0000
+++ account/account_invoice.py	2011-11-11 06:15:30 +0000
@@ -795,6 +795,7 @@
         """Creates invoice related analytics and financial move lines"""
         ait_obj = self.pool.get('account.invoice.tax')
         cur_obj = self.pool.get('res.currency')
+        period_obj = self.pool.get('account.period')
         context = {}
         for inv in self.browse(cr, uid, ids):
             if not inv.journal_id.sequence_id:
@@ -924,9 +925,8 @@
             }
             period_id = inv.period_id and inv.period_id.id or False
             if not period_id:
-                period_ids = self.pool.get('account.period').search(cr, uid, [('date_start','<=',inv.date_invoice or time.strftime('%Y-%m-%d')),('date_stop','>=',inv.date_invoice or time.strftime('%Y-%m-%d')), ('company_id', '=', inv.company_id.id)])
-                if period_ids:
-                    period_id = period_ids[0]
+                period_ids = period_obj.find(cr, uid, inv.date_invoice)
+                period_id = period_ids[0]
             if period_id:
                 move['period_id'] = period_id
                 for i in line:

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : openerp-dev-gtk@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to