[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
This commit is contained in:
Rifakat Haradwala (Open ERP) 2011-02-24 17:15:37 +05:30
parent 14a1f2b574
commit e086688440
3 changed files with 23 additions and 2 deletions

View File

@ -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!'),

View File

@ -107,6 +107,7 @@
<field name="date_prefered"/>
<field name="date_scheduled" select="1" attrs="{'readonly':[('date_prefered','!=','fixed')]}" />
<button colspan="2" name="%(action_create_payment_order)d" string="Select Invoices to Pay" type="action" attrs="{'invisible':[('state','=','done')]}" icon="gtk-find"/>
<field name="company_id" widget='selection' groups="base.group_multi_company"/>
</group>
<field name="line_ids" colspan="4" widget="one2many_list" nolabel="1" default_get="{'order_id': active_id or False}" >
<form string="Payment Line">
@ -128,7 +129,8 @@
<field colspan="4" name="communication"/>
<field colspan="4" name="communication2"/>
<field name="name"/>
<field name="state"/>
<field name="state"/>
<field name="company_id" widget='selection' groups="base.group_multi_company"/>
</page>
<page string="Information">
@ -179,6 +181,7 @@
<field name="reference"/>
<field name="mode"/>
<field name="user_id"/>
<field name="company_id" groups="base.group_multi_company"/>
<field name="date_created"/>
<field name="date_done"/>
<field name="total"/>

View File

@ -13,5 +13,19 @@
<field name="domain_force">['|','|',('company_id','=',False),('company_id','child_of',[user.company_id.id]),('company_id.child_ids','child_of',[user.company_id.id])]</field>
</record>
<record id="payment_order_comp_rule" model="ir.rule">
<field name="name">Payment order multi company rule</field>
<field model="ir.model" name="model_id" ref="model_payment_order"/>
<field eval="True" name="global"/>
<field name="domain_force">['|','|',('company_id','=',False),('company_id','child_of',[user.company_id.id]),('company_id.child_ids','child_of',[user.company_id.id])]</field>
</record>
<record id="payment_line_comp_rule" model="ir.rule">
<field name="name">Payment line multi company rule</field>
<field model="ir.model" name="model_id" ref="model_payment_line"/>
<field eval="True" name="global"/>
<field name="domain_force">['|','|',('company_id','=',False),('company_id','child_of',[user.company_id.id]),('company_id.child_ids','child_of',[user.company_id.id])]</field>
</record>
</data>
</openerp>