Review: Needs Fixing code review Hay que cambiar la vista de búsqueda, pero es lo único.
Un saludo. Diff comments: > === modified file 'nayar_annexes_report/__init__.py' > --- nayar_annexes_report/__init__.py 2014-06-11 10:23:47 +0000 > +++ nayar_annexes_report/__init__.py 2014-06-30 15:01:03 +0000 > @@ -19,10 +19,4 @@ > # > > ############################################################################## > > -#---------------------------------------------------------- > -# Init Sales > -#---------------------------------------------------------- > - > -import report > - > -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: > +from . import report > > === modified file 'nayar_annexes_report/__openerp__.py' > --- nayar_annexes_report/__openerp__.py 2014-06-11 10:23:47 +0000 > +++ nayar_annexes_report/__openerp__.py 2014-06-30 15:01:03 +0000 > @@ -27,12 +27,10 @@ > 'author': 'Nayar Systems', > 'website': 'http://www.72horas.net', > 'depends': ['sale'], > - 'init_xml': [], > - 'update_xml': [ > + 'data': [ > 'report/annexe_report_view.xml', > 'security/ir.model.access.csv', > ], > 'installable': True, > 'active': False, > } > -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: > > === modified file 'nayar_annexes_report/report/__init__.py' > --- nayar_annexes_report/report/__init__.py 2014-06-11 10:23:47 +0000 > +++ nayar_annexes_report/report/__init__.py 2014-06-30 15:01:03 +0000 > @@ -19,6 +19,4 @@ > # > > ############################################################################## > > -import annexe_report > - > -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: > +from . import annexe_report > > === modified file 'nayar_annexes_report/report/annexe_report.py' > --- nayar_annexes_report/report/annexe_report.py 2014-06-11 10:23:47 > +0000 > +++ nayar_annexes_report/report/annexe_report.py 2014-06-30 15:01:03 > +0000 > @@ -19,42 +19,55 @@ > # > > ############################################################################## > > -import tools > -from osv import fields, osv > - > -class annexe_report(osv.osv): > +from openerp import tools > +from openerp.osv import fields, orm > + > + > +class AnnexeReport(orm.Model): > _name = "annexe.report" > _description = "Annexes Statistics" > _auto = False > _rec_name = 'annexe_date' > _columns = { > 'user_id': fields.many2one('res.users', 'Salesman', readonly=True), > - 'contract_id': > fields.many2one('contract.contract','Contract',select=True, required=True), > - 'customer_id': fields.many2one('res.partner','Customer',select=True, > required=True), > - 'contract_type':fields.char('Contract Type', size=15,readonly=True), > - 'elevator_id':fields.many2one('res.partner','Elevator',select=True, > required=True), > + 'contract_id': fields.many2one('contract.contract', 'Contract', > + select=True, required=True), > + 'customer_id': fields.many2one('res.partner', 'Customer', > select=True, > + required=True), > + 'contract_type': fields.char('Contract Type', size=15, > readonly=True), > + 'elevator_id': fields.many2one('res.partner', 'Elevator', > select=True, > + required=True), > 'annexe_date': fields.date('Annexe Date', readonly=True), > 'year': fields.char('Year', size=4, readonly=True), > - 'month': fields.selection([('01', 'January'), ('02', 'February'), > ('03', 'March'), ('04', 'April'), > - ('05', 'May'), ('06', 'June'), ('07', 'July'), ('08', 'August'), > ('09', 'September'), > - ('10', 'October'), ('11', 'November'), ('12', 'December')], > 'Month', readonly=True), > + 'month': fields.selection( > + [('01', 'January'), ('02', 'February'), ('03', 'March'), > + ('04', 'April'), ('05', 'May'), ('06', 'June'), ('07', 'July'), > + ('08', 'August'), ('09', 'September'), ('10', 'October'), > + ('11', 'November'), ('12', 'December')], 'Month', > readonly=True), > 'day': fields.char('Day', size=128, readonly=True), > 'icc': fields.char('ICC', size=64, readonly=True), > - 'imei':fields.char('IMEI', size=15, readonly=True), > - 'pack':fields.char('Pack', size=15, readonly=True), > - 'state':fields.boolean('State'), > - 'sum':fields.integer('# of Annexes', readonly=True), > - 'product_id':fields.many2one('product.product','SIM > Product',select=True), > - 'product_2_id':fields.many2one('product.product','Pack product', > select=True), > - 'annexe_fixed_price':fields.float('Annexe Fixed Price', > digits=(2,2)), > - 'annexe_differential_price':fields.float('Annexe Differential > Price', digits=(2,2)), > - 'fixed_commision':fields.float('Fixed commission', digits=(2,2)), > - 'num_cabins':fields.integer('Num. Cabins'), > - 'fixed_price':fields.float('Contract Fixed Price', digits=(2,2)), > - 'differential_price':fields.float('Contract Differential Price', > digits=(2,2)), > - 'active_contract':fields.boolean('Active'), > - } > + 'imei': fields.char('IMEI', size=15, readonly=True), > + 'pack': fields.char('Pack', size=15, readonly=True), > + 'state': fields.boolean('State'), > + 'sum': fields.integer('# of Annexes', readonly=True), > + 'product_id': fields.many2one('product.product', 'SIM Product', > + select=True), > + 'product_2_id': fields.many2one('product.product', 'Pack product', > + select=True), > + 'annexe_fixed_price': fields.float('Annexe Fixed Price', > + digits=(2, 2)), > + 'annexe_differential_price': fields.float('Annexe Differential > Price', > + digits=(2, 2)), > + 'fixed_commision': fields.float('Fixed commission', digits=(2, 2)), > + 'num_cabins': fields.integer('Num. Cabins'), > + 'fixed_price': fields.float('Contract Fixed Price', digits=(2, 2)), > + 'differential_price': fields.float('Contract Differential Price', > + digits=(2, 2)), > + 'active_contract': fields.boolean('Active'), > + } > + > _order = 'annexe_date desc' > + > def init(self, cr): > tools.drop_view_if_exists(cr, 'annexe_report') > cr.execute(""" > @@ -91,7 +104,8 @@ > left join res_partner p on (c.customer_id=p.id) > left join res_partner p2 on (c.elevator_id = > p2.id) > left join res_users u on (c.user_id = u.id) > - left join contract_type ct on > (c.contract_type_id = ct.id) > + left join contract_type ct on > + (c.contract_type_id = ct.id) > where a.active_annexe = 't' > group by > c.user_id, > @@ -116,6 +130,3 @@ > > ) > """) > -annexe_report() > - > -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: > > === modified file 'nayar_annexes_report/report/annexe_report_view.xml' > --- nayar_annexes_report/report/annexe_report_view.xml 2014-06-11 > 10:23:47 +0000 > +++ nayar_annexes_report/report/annexe_report_view.xml 2014-06-30 > 15:01:03 +0000 > @@ -1,193 +1,113 @@ > <?xml version="1.0" encoding="utf-8"?> > <openerp> > -<data> > - > - <record id="view_annexe_tree" model="ir.ui.view"> > - <field eval="1" name="priority"/> > - <field name="name">annexe.report.tree</field> > - <field name="model">annexe.report</field> > - <field name="type">tree</field> > - <field name="arch" type="xml"> > - <tree string="Annexes Analysis"> > - <field name="annexe_date"/> > - <field name="contract_id"/> > - <field name="user_id" invisible="1"/> > - <field name="year" invisible="1"/> > - <field name="day" invisible="1"/> > - <field name="month" invisible="1"/> > - <field name="sum" sum="# of Annexes"/> > - <field name="customer_id"/> > - <field name="product_id"/> > - <field name="product_2_id"/> > - <field name="elevator_id" invisible="1"/> > - <field name="contract_type" invisible="1"/> > - <field name="imei" invisible="1"/> > - <field name="icc" invisible="1"/> > - <field name="pack" invisible="1"/> > - <field name="state" invisible="1"/> > - </tree> > - </field> > - </record> > - > - > -<!-- > - <record id="view_order_product_graph" model="ir.ui.view"> > - <field name="name">sale.report.graph</field> > - <field name="model">sale.report</field> > - <field name="type">graph</field> > - <field name="arch" type="xml"> > - <graph string="Sales Analysis" type="bar"> > - <field name="product_id"/> > - <field name="price_total"/> > - <field name="state" group="True"/> > - </graph> > - </field> > - </record> > ---> > - > - <record id="view_annexe_search" model="ir.ui.view"> > - <field name="name">annexe.report.search</field> > - <field name="model">annexe.report</field> > - <field name="type">search</field> > - <field name="arch" type="xml"> > - <search string="Annexes Analysis"> > - <group> > - <filter icon="terp-go-year" string=" Year " > - domain="[('annexe_date','<=', > time.strftime('%%Y-%%m-%%d')),('annexe_date','>=',time.strftime('%%Y-01-01'))]" > - help="Annexes created in current year"/> > - <filter icon="terp-go-month" string=" Month " > - name="month" > - > domain="[('annexe_date','<=',(datetime.date.today()+relativedelta(day=31)).strftime('%%Y-%%m-%%d')),('annexe_date','>=',(datetime.date.today()-relativedelta(day=1)).strftime('%%Y-%%m-%%d'))]" > - help="Annexes created in current month"/> > - <filter icon="terp-go-month" > - string=" Month-1 " > - separator="1" > - domain="[('annexe_date','<=', > (datetime.date.today() - relativedelta(day=31, > months=1)).strftime('%%Y-%%m-%%d')),('annexe_date','>=',(datetime.date.today() > - relativedelta(day=1,months=1)).strftime('%%Y-%%m-%%d'))]" > - help="Annexes created in last month"/> > - <separator orientation="vertical"/> > - <!--<field name="partner_id"/>--> > - <!--<field name="product_id"/>--> > - <field name="user_id"> > - <filter icon="terp-personal" > - string="My Annexes" > - help="My Annexes" > - domain="[('user_id','=',uid)]"/> > - </field> > - </group> > - <newline/> > - <!--<group expand="0" string="Extended Filters..." > groups="base.group_extended"> > - <field name="categ_id" widget="selection"/> > - <newline/> > - <field name="date"/> > - <field name="date_confirm"/> > - </group> > - <newline/>--> > - <group expand="1" string="Group By..." colspan="10" col="12"> > - <filter string="Salesman" icon="terp-personal" > name="User" context="{'group_by':'user_id'}"/> > - <filter string="Customer" icon="terp-partner" > name="Customer" context="{'group_by':'customer_id'}"/> > - <filter string="Contract" icon="terp-partner" > name="Contract" context="{'group_by':'contract_id'}"/> > - <filter string="Elevator" icon="terp-partner" > name="Elevator" context="{'group_by':'elevator_id'}"/> > - <filter string="Operador" icon="terp-partner" > name="Operador" context="{'group_by':'product_id'}"/> > - <filter string="Enlace" icon="terp-partner" > name="Enlace" context="{'group_by':'product_2_id'}"/> > - <separator orientation="vertical"/> > - <filter string="Type of Contract" > icon="terp-stock_symbol-selection" name="Type of Contract" > context="{'group_by':'contract_type'}"/> > - <separator orientation="vertical"/> > - <filter string="Day" icon="terp-go-today" > context="{'group_by':'day'}" help="Ordered date of the sales order"/> > - <filter string="Month" name="order_month" > icon="terp-go-month" context="{'group_by':'month'}" help="Ordered month of > the sales order"/> > - <filter string="Year" icon="terp-go-year" > context="{'group_by':'year'}" help="Ordered Year of the sales order"/> > - </group> > - </search> > - </field> > - </record> > - > - > -<!-- > - <record id="view_order_product_search" model="ir.ui.view"> > - <field name="name">sale.report.search</field> > - <field name="model">sale.report</field> > - <field name="type">search</field> > - <field name="arch" type="xml"> > - <search string="Sales Analysis"> > - <group> > - <filter icon="terp-go-year" string=" Year " > - domain="[('date','<=', > time.strftime('%%Y-%%m-%%d')),('date','>=',time.strftime('%%Y-01-01'))]" > - help="Sales order created in current year"/> > - <filter icon="terp-go-month" string=" Month " > - name="month" > - > domain="[('date','<=',(datetime.date.today()+relativedelta(day=31)).strftime('%%Y-%%m-%%d')),('date','>=',(datetime.date.today()-relativedelta(day=1)).strftime('%%Y-%%m-%%d'))]" > - help="Sales order created in current month"/> > - <filter icon="terp-go-month" > - string=" Month-1 " > - separator="1" > - domain="[('date','<=', (datetime.date.today() - > relativedelta(day=31, > months=1)).strftime('%%Y-%%m-%%d')),('date','>=',(datetime.date.today() - > relativedelta(day=1,months=1)).strftime('%%Y-%%m-%%d'))]" > - help="Sales order created in last month"/> > - <separator orientation="vertical"/> > - <filter icon="terp-document-new" > - string="Quotations" > - domain="[('state','=','draft')]"/> > - <filter icon="terp-check" > - string="Sales" > - domain="[('state','not > in',('draft','done','cancel'))]"/> > - <separator orientation="vertical"/> > - <filter icon="terp-accessories-archiver" > - string="Picked" > - domain="[('shipped','=',True)]"/> > - <separator orientation="vertical"/> > - <field name="partner_id"/> > - <field name="product_id"/> > - <field name="user_id"> > - <filter icon="terp-personal" > - string="My Sales" > - help="My Sales" > - domain="[('user_id','=',uid)]"/> > - </field> > - </group> > - <newline/> > - <group expand="0" string="Extended Filters..." > groups="base.group_extended"> > - <field name="shop_id" widget="selection"/> > - <field name="categ_id" widget="selection"/> > - <field name="company_id" > groups="base.group_multi_company" widget="selection"/> > - <newline/> > - <field name="date"/> > - <field name="date_confirm"/> > - </group> > - <newline/> > - <group expand="1" string="Group By..." colspan="10" col="12"> > - <filter string="Salesman" icon="terp-personal" > name="User" context="{'group_by':'user_id'}"/> > - <filter string="Partner" icon="terp-partner" > name="Customer" context="{'group_by':'partner_id'}"/> > - <separator orientation="vertical"/> > - <filter string="Product" > icon="terp-accessories-archiver" > context="{'group_by':'product_id','set_visible':True}"/> > - <filter string="Reference UoM" icon="terp-mrp" > context="{'group_by':'product_uom'}"/> > - <filter string="Category of Product" > icon="terp-stock_symbol-selection" name="Category" > context="{'group_by':'categ_id'}"/> > - <separator orientation="vertical" > groups="analytic.group_analytic_accounting"/> > - <filter string="Analytic Account" > icon="terp-folder-green" context="{'group_by':'analytic_account_id'}" > groups="analytic.group_analytic_accounting"/> > - <separator orientation="vertical" > groups="analytic.group_analytic_accounting"/> > - <filter string="State" > icon="terp-stock_effects-object-colorize" context="{'group_by':'state'}"/> > - <separator orientation="vertical"/> > - <filter string="Shop" icon="terp-go-home" > context="{'group_by':'shop_id'}"/> > - <filter string="Company" icon="terp-go-home" > groups="base.group_multi_company" context="{'group_by':'company_id'}"/> > - <separator orientation="vertical"/> > - <filter string="Day" icon="terp-go-today" > context="{'group_by':'day'}" help="Ordered date of the sales order"/> > - <filter string="Month" name="order_month" > icon="terp-go-month" context="{'group_by':'month'}" help="Ordered month of > the sales order"/> > - <filter string="Year" icon="terp-go-year" > context="{'group_by':'year'}" help="Ordered Year of the sales order"/> > - </group> > - </search> > - </field> > - </record> > ---> > - <record id="action_annexes_report_all" model="ir.actions.act_window"> > - <field name="name">Anexos Analysis</field> > - <field name="res_model">annexe.report</field> > - <field name="view_type">form</field> > - <field name="view_mode">tree,graph</field> > - <field name="search_view_id" ref="view_annexe_search"/> > - <field name="view_id" ref="view_annexe_tree"/> > - <field > name="context">{'search_default_month':1,'search_default_User':0,'group_by_no_leaf':0,'group_by':[]}</field> > - <field name="help">This report performs analysis on your quotations > and sales orders. Analysis check your sales revenues and sort it by different > group criteria (salesman, partner, product, etc.) Use this report to perform > analysis on sales not having invoiced yet. If you want to analyse your > turnover, you should use the Invoice Analysis report in the Accounting > application.</field> > - </record> > - > - <menuitem id="base.next_id_64" name="Reporting" > parent="base.menu_base_partner" sequence="11"/> > - <menuitem action="action_annexes_report_all" > id="menu_report_product_all" parent="base.next_id_64" sequence="7" > groups="base.group_sale_manager"/> > - > -</data> > + <data> > + > + <record id="view_annexe_tree" model="ir.ui.view"> > + <field eval="1" name="priority" /> > + <field name="name">annexe.report.tree</field> > + <field name="model">annexe.report</field> > + <field name="type">tree</field> > + <field name="arch" type="xml"> > + <tree string="Annexes Analysis"> > + <field name="annexe_date" /> > + <field name="contract_id" /> > + <field name="user_id" invisible="1" /> > + <field name="year" invisible="1" /> > + <field name="day" invisible="1" /> > + <field name="month" invisible="1" /> > + <field name="sum" sum="# of Annexes" /> > + <field name="customer_id" /> > + <field name="product_id" /> > + <field name="product_2_id" /> > + <field name="elevator_id" invisible="1" /> > + <field name="contract_type" invisible="1" /> > + <field name="imei" invisible="1" /> > + <field name="icc" invisible="1" /> > + <field name="pack" invisible="1" /> > + <field name="state" invisible="1" /> > + </tree> > + </field> > + </record> > + > + <record id="view_annexe_search" model="ir.ui.view"> > + <field name="name">annexe.report.search</field> > + <field name="model">annexe.report</field> > + <field name="type">search</field> > + <field name="arch" type="xml"> > + <search string="Annexes Analysis"> > + <group> > + <filter icon="terp-go-year" string=" Year " > + domain="[('annexe_date','<=', > time.strftime('%%Y-%%m-%%d')),('annexe_date','>=',time.strftime('%%Y-01-01'))]" > + help="Annexes created in current year" /> > + <filter icon="terp-go-month" string=" Month " > + name="month" > + > domain="[('annexe_date','<=',(datetime.date.today()+relativedelta(day=31)).strftime('%%Y-%%m-%%d')),('annexe_date','>=',(datetime.date.today()-relativedelta(day=1)).strftime('%%Y-%%m-%%d'))]" > + help="Annexes created in current month" /> > + <filter icon="terp-go-month" string=" Month-1 " > + separator="1" > + domain="[('annexe_date','<=', > (datetime.date.today() - relativedelta(day=31, > months=1)).strftime('%%Y-%%m-%%d')),('annexe_date','>=',(datetime.date.today() > - relativedelta(day=1,months=1)).strftime('%%Y-%%m-%%d'))]" > + help="Annexes created in last month" /> > + <separator orientation="vertical" /> > + <field name="user_id"> > + <filter icon="terp-personal" string="My Annexes" > + help="My Annexes" > domain="[('user_id','=',uid)]" /> > + </field> > + </group> > + <newline /> > + <group expand="1" string="Group By..." Hay que adaptar la vista de búsqueda a la v7. Echa un vistazo cómo se ponen en v7 los filtros y los group_by > + colspan="10" col="12"> > + <filter string="Salesman" icon="terp-personal" > + name="User" context="{'group_by':'user_id'}" /> > + <filter string="Customer" icon="terp-partner" > + name="Customer" > context="{'group_by':'customer_id'}" /> > + <filter string="Contract" icon="terp-partner" > + name="Contract" > context="{'group_by':'contract_id'}" /> > + <filter string="Elevator" icon="terp-partner" > + name="Elevator" > context="{'group_by':'elevator_id'}" /> > + <filter string="Operador" icon="terp-partner" > + name="Operador" > context="{'group_by':'product_id'}" /> > + <filter string="Enlace" icon="terp-partner" > + name="Enlace" > context="{'group_by':'product_2_id'}" /> > + <separator orientation="vertical" /> > + <filter string="Type of Contract" > + icon="terp-stock_symbol-selection" name="Type of > Contract" > + context="{'group_by':'contract_type'}" /> > + <separator orientation="vertical" /> > + <filter string="Day" icon="terp-go-today" > + context="{'group_by':'day'}" help="Ordered date > of the sales order" /> > + <filter string="Month" name="order_month" > + icon="terp-go-month" > context="{'group_by':'month'}" > + help="Ordered month of the sales order" /> > + <filter string="Year" icon="terp-go-year" > + context="{'group_by':'year'}" help="Ordered Year > of the sales order" /> > + </group> > + </search> > + </field> > + </record> > + > + <record id="action_annexes_report_all" model="ir.actions.act_window"> > + <field name="name">Anexos Analysis</field> > + <field name="res_model">annexe.report</field> > + <field name="view_type">form</field> > + <field name="view_mode">tree,graph</field> > + <field name="search_view_id" ref="view_annexe_search" /> > + <field name="view_id" ref="view_annexe_tree" /> > + <field > name="context">{'search_default_month':1,'search_default_User':0,'group_by_no_leaf':0,'group_by':[]} > + </field> > + <field name="help">This report performs analysis on your > + quotations and sales orders. Analysis check your sales > + revenues and sort it by different group criteria > + (salesman, partner, product, etc.) Use this report to > + perform analysis on sales not having invoiced yet. If > + you want to analyse your turnover, you should use the > + Invoice Analysis report in the Accounting application. > + </field> > + </record> > + > + <menuitem id="base.next_id_64" name="Reporting" > + parent="base.menu_base_partner" sequence="11" /> > + <menuitem action="action_annexes_report_all" > id="menu_report_product_all" > + parent="base.next_id_64" sequence="7" > groups="base.group_sale_manager" /> > + > + </data> > </openerp> > -- https://code.launchpad.net/~oihanecruce/avanzosc/nayar_annexes_report/+merge/225029 Your team Avanzosc_security is subscribed to branch lp:~avanzosc-security-team/avanzosc/72horas. -- Mailing list: https://launchpad.net/~avanzosc Post to : [email protected] Unsubscribe : https://launchpad.net/~avanzosc More help : https://help.launchpad.net/ListHelp

