[FIX] account_voucher: account_id always visible on sales & purchase receipts

account_id is mandatory, and is set thanks to an onchange of partner_id. But partner_id is not required, therefore, if you do not set a customer/supplier, there is no
     account_id set by default.

On the purchase, the account_id was always invisible. Therefore, it was impossible to set the account_id if you did not set any supplier
On the sale, the account_id was invisible if you set the pay_now to pay later. Therefore, it was impossible to set an account_id if you did not set any customer and set pay later.

Anyway, now, account_id is always displayed, so the user can change the value of account_id if the default value provided is not was he wants, whatever the value of the other fields

bzr revid: dle@openerp.com-20140212142737-ox2l9twg3x6ywvqg
This commit is contained in:
Denis Ledoux 2014-02-12 15:27:37 +01:00
commit 4ca9ae11a5
1 changed files with 8 additions and 11 deletions

View File

@ -73,8 +73,14 @@
<group>
<group>
<field name="type" invisible="True"/>
<field name="partner_id" domain="[('customer','=',True)]" on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date, context)" string="Customer" context="{'search_default_customer':1, 'show_address': 1}" options='{"always_reload": True}'/>
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
<field name="partner_id" domain="[('customer','=',True)]" on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date, context)" string="Customer" context="{'search_default_customer':1, 'show_address': 1}" options='{"always_reload": True}'/>
<field name="account_id"
domain="[('type','in', ['liquidity', 'receivable'])]"/>
<field name="pay_now" on_change="onchange_payment(pay_now, journal_id, partner_id)" required="1"/>
<field name="date_due" attrs="{'invisible':[('pay_now','=','pay_now')]}"/>
<field name="reference"
attrs="{'invisible':[('pay_now','!=','pay_now')]}"/>
</group>
<group>
<field name="journal_id" domain="[('type','in',['sale','sale_refund'])]" widget="selection" on_change="onchange_journal(journal_id, line_cr_ids, tax_id, partner_id, date, amount, type, company_id, context)" groups="account.group_account_user"/>
@ -112,15 +118,6 @@
</div>
<field name="amount" class="oe_subtotal_footer_separator" nolabel="1"/>
</group>
<group>
<field name="pay_now" on_change="onchange_payment(pay_now, journal_id, partner_id)" required="1"/>
<field name="date_due" attrs="{'invisible':[('pay_now','=','pay_now')]}"/>
<field name="account_id"
attrs="{'invisible':[('pay_now','!=','pay_now')]}"
domain="[('type','=','liquidity')]"/>
<field name="reference"
attrs="{'invisible':[('pay_now','!=','pay_now')]}"/>
</group>
</group>
</page>
<page string="Journal Items" attrs="{'invisible': [('state','!=','posted')]}">
@ -224,11 +221,11 @@
<h1><label for="number" string="Purchase Receipt"/> <field name="number" class="oe_inline" readonly="1"/></h1>
<field name="pay_now" invisible="1"/>
<field name="account_id" domain="[('type','=','other')]" invisible="True"/>
<field name="type" invisible="True"/>
<group>
<group>
<field name="partner_id" domain="[('supplier','=',True)]" string="Supplier" on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date, context)" context="{'default_customer': 0, 'search_default_supplier': 1, 'default_supplier': 1}" />
<field name="account_id" domain="[('type', 'in', ['liquidity', 'payable'])]"/>
<field name="name" colspan="2"/>
<field name="reference"/>
<field name="company_id" widget="selection" groups="base.group_multi_company"/>