[FIX]: fix a problme of the multi-company currensy selection based on company
bzr revid: mga@tinyerp.com-20100216070546-or12c6lr9skms63s
This commit is contained in:
@@ -198,7 +198,7 @@
|
||||
</group>
|
||||
</page>
|
||||
<page string="Other Info">
|
||||
<field name="company_id" on_change="onchange_company_id(company_id,partner_id,type,invoice_line)" widget="selection" groups="base.group_multi_company"/>
|
||||
<field name="company_id" on_change="onchange_company_id(company_id,partner_id,type,invoice_line,currency_id)" widget="selection" groups="base.group_multi_company"/>
|
||||
<field name="fiscal_position" groups="base.group_extended" widget="selection"/>
|
||||
<newline/>
|
||||
<field name="payment_term" widget="selection"/>
|
||||
@@ -289,7 +289,7 @@
|
||||
</group>
|
||||
</page>
|
||||
<page string="Other Info">
|
||||
<field name="company_id" on_change="onchange_company_id(company_id,partner_id,type,invoice_line)" widget="selection" groups="base.group_multi_company"/>
|
||||
<field name="company_id" on_change="onchange_company_id(company_id,partner_id,type,invoice_line,currency_id)" widget="selection" groups="base.group_multi_company"/>
|
||||
<field name="fiscal_position" groups="base.group_extended,base.group_user" widget="selection"/>
|
||||
<newline/>
|
||||
<field name="date_due" select="1"/>
|
||||
|
||||
@@ -419,7 +419,7 @@ class account_invoice(osv.osv):
|
||||
return result
|
||||
|
||||
def onchange_currency_id(self, cr, uid, ids, curr_id, company_id):
|
||||
if curr_id:
|
||||
if curr_id and company_id:
|
||||
currency = self.pool.get('res.currency').browse(cr, uid, curr_id)
|
||||
if currency.company_id.id != company_id:
|
||||
raise osv.except_osv(_('Configration Error !'),
|
||||
@@ -451,7 +451,7 @@ class account_invoice(osv.osv):
|
||||
def onchange_partner_bank(self, cursor, user, ids, partner_bank_id):
|
||||
return {'value': {}}
|
||||
|
||||
def onchange_company_id(self, cr, uid, ids, company_id, part_id, type, invoice_line):
|
||||
def onchange_company_id(self, cr, uid, ids, company_id, part_id, type, invoice_line, currency_id):
|
||||
val={}
|
||||
dom={}
|
||||
if company_id and part_id and type:
|
||||
@@ -504,6 +504,21 @@ class account_invoice(osv.osv):
|
||||
else:
|
||||
journal_ids=self.pool.get('account.journal').search(cr,uid,[])
|
||||
dom={'journal_id': [('id','in',journal_ids)]}
|
||||
|
||||
if currency_id and company_id:
|
||||
currency = self.pool.get('res.currency').browse(cr, uid, currency_id)
|
||||
if currency.company_id.id != company_id:
|
||||
val['currency_id'] = False
|
||||
else:
|
||||
val['currency_id'] = currency.id
|
||||
|
||||
if company_id:
|
||||
company = self.pool.get('res.company').browse(cr, uid, company_id)
|
||||
if company.currency_id.company_id.id != company_id:
|
||||
val['currency_id'] = False
|
||||
else:
|
||||
val['currency_id'] = company.currency_id.id
|
||||
|
||||
return {'value' : val, 'domain': dom }
|
||||
|
||||
# go from canceled state to draft state
|
||||
|
||||
Reference in New Issue
Block a user