From e0866884406a2dfed65fe23a0d0d404d9ce334ee Mon Sep 17 00:00:00 2001 From: "Rifakat Haradwala (Open ERP)" Date: Thu, 24 Feb 2011 17:15:37 +0530 Subject: [PATCH 1/4] [Fix]: account_payment: missing company information in payment.order and payment.line lp bug: https://launchpad.net/bugs/724059 fixed bzr revid: rha@tinyerp.com-20110224114537-gygz2yf3jjpgk6z3 --- addons/account_payment/account_payment.py | 6 +++++- addons/account_payment/account_payment_view.xml | 5 ++++- .../security/account_payment_security.xml | 14 ++++++++++++++ 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/addons/account_payment/account_payment.py b/addons/account_payment/account_payment.py index 138be103f2e..c82d0f1bf9a 100644 --- a/addons/account_payment/account_payment.py +++ b/addons/account_payment/account_payment.py @@ -94,6 +94,7 @@ class payment_order(osv.osv): ], "Preferred date", change_default=True, required=True, states={'done': [('readonly', True)]}, help="Choose an option for the Payment Order:'Fixed' stands for a date specified by you.'Directly' stands for the direct execution.'Due date' stands for the scheduled date of execution."), 'date_created': fields.date('Creation date', readonly=True), 'date_done': fields.date('Execution date', readonly=True), + 'company_id': fields.many2one('res.company', 'Company', required=True), } _defaults = { @@ -102,6 +103,7 @@ class payment_order(osv.osv): 'date_prefered': 'due', 'date_created': lambda *a: time.strftime('%Y-%m-%d'), 'reference': lambda self,cr,uid,context: self.pool.get('ir.sequence').get(cr, uid, 'payment.order'), + 'company_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id } def set_to_draft(self, cr, uid, ids, *args): @@ -343,7 +345,8 @@ class payment_line(osv.osv): 'date': fields.date('Payment Date', help="If no payment date is specified, the bank will treat this payment line directly"), 'create_date': fields.datetime('Created', readonly=True), 'state': fields.selection([('normal','Free'), ('structured','Structured')], 'Communication Type', required=True), - 'bank_statement_line_id': fields.many2one('account.bank.statement.line', 'Bank statement line') + 'bank_statement_line_id': fields.many2one('account.bank.statement.line', 'Bank statement line'), + 'company_id': fields.many2one('res.company', 'Company', required=True), } _defaults = { 'name': lambda obj, cursor, user, context: obj.pool.get('ir.sequence' @@ -352,6 +355,7 @@ class payment_line(osv.osv): 'currency': _get_currency, 'company_currency': _get_currency, 'date': _get_date, + 'company_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id } _sql_constraints = [ ('name_uniq', 'UNIQUE(name)', 'The payment line name must be unique!'), diff --git a/addons/account_payment/account_payment_view.xml b/addons/account_payment/account_payment_view.xml index b829748cb93..56ff30e5ded 100644 --- a/addons/account_payment/account_payment_view.xml +++ b/addons/account_payment/account_payment_view.xml @@ -107,6 +107,7 @@