[IMP] account_analytic_default : add group by and filter in search view

bzr revid: vth@tinyerp.com-20101012115315-adg21e4peyc3yhba
This commit is contained in:
vth 2010-10-12 17:23:15 +05:30
parent 5b88f70aef
commit ed0ccd6c3b
3 changed files with 26 additions and 9 deletions

View File

@ -14,6 +14,8 @@
<field name="quantity"/>
<field name="quantity_max"/>
<field name="date"/>
<field name="user_id" invisible="1"/>
<field name="parent_id" invisible="1"/>
</tree>
</field>
</record>

View File

@ -29,14 +29,14 @@ class account_analytic_default(osv.osv):
_rec_name = "analytic_id"
_order = "sequence"
_columns = {
'sequence': fields.integer('Sequence', help="Gives the sequence order when displaying a list of analytic distribution."),
'analytic_id': fields.many2one('account.analytic.account', 'Analytic Account'),
'product_id': fields.many2one('product.product', 'Product', ondelete='cascade'),
'partner_id': fields.many2one('res.partner', 'Partner', ondelete='cascade'),
'user_id': fields.many2one('res.users', 'User', ondelete='cascade'),
'company_id': fields.many2one('res.company', 'Company', ondelete='cascade'),
'date_start': fields.date('Start Date'),
'date_stop': fields.date('End Date'),
'sequence': fields.integer('Sequence', help="Gives the sequence order when displaying a list of analytic distribution"),
'analytic_id': fields.many2one('account.analytic.account', 'Analytic Account' , help="Analytical Account"),
'product_id': fields.many2one('product.product', 'Product', ondelete='cascade', help="select a product which will use analytical account specified in analytic default (eg. create new cutomer invoice or Sale order if we select this product, it will automatically take this as an analytical account)"),
'partner_id': fields.many2one('res.partner', 'Partner', ondelete='cascade', help="select a partner which will use analytical account specified in analytic default (eg. create new cutomer invoice or Sale order if we select this partner, it will automatically take this as an analytical account)"),
'user_id': fields.many2one('res.users', 'User', ondelete='cascade', help="select a user which will use analytical account specified in analytic default"),
'company_id': fields.many2one('res.company', 'Company', ondelete='cascade', help="select a company which will use analytical account specified in analytic default (eg. create new cutomer invoice or Sale order if we select this company, it will automatically take this as an analytical account)"),
'date_start': fields.date('Start Date', help="Default start date for this Analytical Account"),
'date_stop': fields.date('End Date', help="Default end date for this Analytical Account"),
}
def account_get(self, cr, uid, product_id=None, partner_id=None, user_id=None, date=None, context=None):

View File

@ -6,7 +6,7 @@
<field name="model">account.analytic.default</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Analytic Defaults">
<tree string="Analytic Defaults" colors="grey:date_stop and (date_stop &lt; datetime.date.today().strftime('%%Y-%%m-%%d'))" >
<field name="sequence"/>
<field name="analytic_id" required="0" domain="[('parent_id','!=',False)]" groups="analytic.group_analytic_accounting"/>
<field name="product_id"/>
@ -44,11 +44,25 @@
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Accounts">
<group col="10" colspan="4">
<filter icon="terp-go-month" string="Current" name = "current" help="Current" domain = "['|', ('date_stop', '&gt;', datetime.date.today().strftime('%%Y-%%m-%%d')), ('date_stop', '=', False)]" />
<separator orientation="vertical"/>
<field name="analytic_id" groups="analytic.group_analytic_accounting"/>
<field name="product_id"/>
<field name="partner_id"/>
<field name="user_id"/>
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
</group>
<newline/>
<group expand="0" string="Group By...">
<filter string="User" icon="terp-personal" context="{'group_by':'user_id'}" help="User"/>
<filter string="Partner" icon="terp-partner" context="{'group_by':'partner_id'}" help="Partner"/>
<separator orientation="vertical"/>
<filter string="Product" icon="terp-accessories-archiver" context="{'group_by':'product_id'}" help="Product" />
<filter string="Analytic Account" icon="terp-folder-green" context="{'group_by':'analytic_id'}" help="Analytic Account" groups="analytic.group_analytic_accounting"/>
<separator orientation="vertical"/>
<filter string="Company" icon="terp-go-home" context="{'group_by':'company_id'}" help="Comapny" groups="base.group_multi_company" />
</group>
</search>
</field>
</record>
@ -59,6 +73,7 @@
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="search_view_id" ref="view_account_analytic_default_form_search"/>
<field name="context">{"search_default_current":1}</field>
</record>
<act_window