[IMP] Usability Issue: Distribution Models Form view and Analytic Account Form view

bzr revid: ara@tinyerp.com-20101222110557-5msgqcxvlng7cju3
This commit is contained in:
ARA (OpenERP) 2010-12-22 16:35:57 +05:30
parent 01f31bb93d
commit a3ac0b2691
4 changed files with 39 additions and 5 deletions

View File

@ -171,7 +171,7 @@ class account_analytic_plan_instance(osv.osv):
"""% (tools.to_xml(plan_id.name), wiz_id[0])
for line in plan_id.plan_ids:
res['arch']+="""
<field name="account%d_ids" string="%s" colspan="4">
<field name="account%d_ids" string="%s" nolabel="1" colspan="4">
<tree string="%s" editable="bottom">
<field name="rate"/>
<field name="analytic_account_id" domain="[('parent_id','child_of',[%d])]" groups="base.group_extended"/>

View File

@ -35,8 +35,8 @@
<field name="inherit_id" ref="hr_timesheet_invoice.account_analytic_account_form_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='to_invoice']" position="after">
<field name="journal_rate_ids" colspan="4"/>
</xpath>
<field name="journal_rate_ids" nolabel="1" colspan="4"/>
</xpath>
</field>
</record>

View File

@ -76,7 +76,33 @@ class account_analytic_account(osv.osv):
}
_defaults = {
'pricelist_id': lambda self, cr, uid, ctx: ctx.get('pricelist_id', False),
'state': 'draft'
}
def set_close(self, cr, uid, ids, context=None):
self.write(cr, uid, ids, {'state':'close'}, context=context)
return True
def set_cancel(self, cr, uid, ids, context=None):
self.write(cr, uid, ids, {'state':'cancelled'}, context=context)
return True
def set_open(self, cr, uid, ids, context=None):
self.write(cr, uid, ids, {'state':'open'}, context=context)
return True
def set_pending(self, cr, uid, ids, context=None):
self.write(cr, uid, ids, {'state':'pending'}, context=context)
return True
def set_template(self, cr, uid, ids, context=None):
self.write(cr, uid, ids, {'state':'template'}, context=context)
return True
def reset_account(self, cr, uid, ids, context=None):
self.write(cr, uid, ids, {'state':'open'}, context=context)
return True
account_analytic_account()

View File

@ -14,8 +14,16 @@
<field name="to_invoice" widget="selection" />
<field name="amount_max"/>
<field name="amount_invoiced"/>
<separator colspan="4" string="State"/>
<field name="state"/>
<separator colspan="4"/>
<group col="9" colspan="8">
<field name="state" readonly="1"/>
<button name="set_cancel" string="Cancel" type="object" states="open,pending" icon="gtk-cancel"/>
<button name="set_template" string="Set as Template" type="object" states="open" icon="gtk-convert"/>
<button name="set_open" string="Reactivate Account" type="object" states="pending,cancelled,close" icon="gtk-ok"/>
<button name="set_pending" string="Pending" type="object" states="open" icon="gtk-media-pause"/>
<button name="set_close" string="Close" type="object" states="open,pending" icon="terp-dialog-close"/>
<button name="reset_account" string="Reset as Account" type="object" states="template" icon="gtk-convert"/>
</group>
</group>
</field>
</field>