Bharat Devnani (Open ERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-bug-777640-bde into 
lp:openobject-addons.

Requested reviews:
  OpenERP Core Team (openerp)
Related bugs:
  Bug #777640 in OpenERP Addons: "journal_id and period_id in account.move.line 
should be 'related' fields, and hidden in most cases"
  https://bugs.launchpad.net/openobject-addons/+bug/777640

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-777640-bde/+merge/69248

Hello Sir,

I have made journal_id and period_id function field of account.move.line.

Thanks & Regards,
Devnani Bharat R.


-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-777640-bde/+merge/69248
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-bug-777640-bde.
=== modified file 'account/account.py'
--- account/account.py	2011-07-18 08:34:24 +0000
+++ account/account.py	2011-07-26 10:49:10 +0000
@@ -1178,7 +1178,7 @@
             ['journal_id']),
         (_check_period_journal,
             'You cannot create entries on different periods/journals in the same move',
-            ['line_id']),
+            ['line_id']), 
     ]
 
     def post(self, cr, uid, ids, context=None):

=== modified file 'account/account_move_line.py'
--- account/account_move_line.py	2011-07-18 08:34:24 +0000
+++ account/account_move_line.py	2011-07-26 10:49:10 +0000
@@ -474,6 +474,30 @@
                 result.append(line.id)
         return result
 
+    def _get_period_id(self, cr, uid, ids, name, arg, context=None):
+        res = {}
+        for period_id in ids:
+            for value in self.browse(cr, uid, ids, context=context):
+                res[period_id] = value.move_id.period_id.id
+        return res
+
+    def _get_journal_id(self, cr, uid, ids, name, arg, context=None):
+        res = {}
+        for journal_id in ids:
+            for value in self.browse(cr, uid, ids, context=context):
+                res[journal_id] = value.move_id.journal_id.id
+        return res 
+
+    def value_period_id(self, cr, uid, id, name, value, arg, context=None):
+        if not value:
+            return True
+        return True
+
+    def value_journal_id(self, cr, uid, id, name, value, arg, context=None):
+        if not value:
+            return True
+        return True
+
     _columns = {
         'name': fields.char('Name', size=64, required=True),
         'quantity': fields.float('Quantity', digits=(16,2), help="The optional quantity expressed by this line, eg: number of product sold. The quantity is not a legal requirement but is very useful for some reports."),
@@ -492,8 +516,8 @@
         'amount_residual_currency': fields.function(_amount_residual, string='Residual Amount', multi="residual", help="The residual amount on a receivable or payable of a journal entry expressed in its currency (maybe different of the company currency)."),
         'amount_residual': fields.function(_amount_residual, string='Residual Amount', multi="residual", help="The residual amount on a receivable or payable of a journal entry expressed in the company currency."),
         'currency_id': fields.many2one('res.currency', 'Currency', help="The optional other currency if it is a multi-currency entry."),
-        'period_id': fields.many2one('account.period', 'Period', required=True, select=2),
-        'journal_id': fields.many2one('account.journal', 'Journal', required=True, select=1),
+        'period_id': fields.function(_get_period_id, fnct_inv=value_journal_id, string='Period', type='many2one', relation='account.period'),
+        'journal_id': fields.function(_get_journal_id, fnct_inv=value_journal_id, string='Journal', type='many2one', relation='account.journal'),
         'blocked': fields.boolean('Litigation', help="You can check this box to mark this journal item as a litigation with the associated partner"),
         'partner_id': fields.many2one('res.partner', 'Partner', select=1, ondelete='restrict'),
         'date_maturity': fields.date('Due date', select=True ,help="This field is used for payable and receivable journal entries. You can put the limit date for the payment of this line."),

_______________________________________________
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