[FIX] account: [6.0] invoice - must check if product is to_sell, to_purchase

bzr revid: ara@tinyerp.com-20110309054913-ohllm2ppeyprk8n1
This commit is contained in:
ARA (OpenERP) 2011-03-09 11:19:13 +05:30
parent b45b35d224
commit 25ee7aff54
2 changed files with 3 additions and 3 deletions

View File

@ -172,7 +172,7 @@
<field name="reference" nolabel="1"/>
<field name="date_due"/>
<field name="check_total" required="2"/>
<field colspan="4" default_get="{'check_total': check_total, 'invoice_line': invoice_line, 'address_invoice_id': address_invoice_id, 'partner_id': partner_id, 'price_type': 'price_type' in dir() and price_type or False}" name="invoice_line" context="{'type':type}" nolabel="1">
<field colspan="4" default_get="{'check_total': check_total, 'invoice_line': invoice_line, 'address_invoice_id': address_invoice_id, 'partner_id': partner_id, 'price_type': 'price_type' in dir() and price_type or False}" name="invoice_line" context="{'type': type}" nolabel="1">
<tree string="Invoice lines">
<field name="product_id" on_change="product_id_change(product_id, uos_id, quantity, name, parent.type, parent.partner_id, parent.fiscal_position, price_unit, parent.address_invoice_id, parent.currency_id, {'company_id': parent.company_id})"/>
<field domain="[('company_id', '=', parent.company_id), ('journal_id', '=', parent.journal_id), ('type', '&lt;&gt;', 'view')]" name="account_id" on_change="onchange_account_id(parent.fiscal_position,account_id)"/>
@ -280,7 +280,7 @@
<field domain="[('company_id', '=', company_id),('type','=', 'receivable')]" name="account_id" groups="account.group_account_user"/>
<field name="name"/>
<field name="payment_term" widget="selection"/>
<field colspan="4" name="invoice_line" nolabel="1" widget="one2many_list" context="{'type':type}"/>
<field colspan="4" name="invoice_line" nolabel="1" widget="one2many_list" context="{'type': type}"/>
<group col="1" colspan="2">
<field name="tax_line" nolabel="1">
<tree editable="bottom" string="Taxes">

View File

@ -1297,7 +1297,7 @@ class account_invoice_line(osv.osv):
if context.get('type', False):
doc = etree.XML(res['arch'])
for node in doc.xpath("//field[@name='product_id']"):
if context['type'] in ('in_invoice','in_refund'):
if context['type'] in ('in_invoice', 'in_refund'):
node.set('domain', "[('purchase_ok', '=', True)]")
else:
node.set('domain', "[('sale_ok', '=', True)]")