跳转至内容
  • 版块
  • 标签
  • 热门
  • 用户
  • 群组
皮肤
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • 默认(Flatly)
  • 不使用皮肤
折叠

Odoo 中文社区

Z

zhudyna

@zhudyna
关于
帖子
1
主题
1
群组
0
粉丝
0
关注
0

帖子

最新 最佳 有争议的

  • 求助:关于odoo搜索视图(日期搜索)
    Z zhudyna

    本人学习odoo不久,在做报表的时候遇到一个问题,graph视图中希望可以按照“时间条件”显示对应数据
    这是python文件

    class keywind_product_report(osv.osv):<br />&nbsp; &nbsp; _name = &quot;keywind.product.report&quot;<br />&nbsp; &nbsp; _auto = False<br />&nbsp; &nbsp; _description = &quot;keywind_product&quot;<br />#&nbsp; &nbsp;  _rec_name = &#039;date_deadline&#039;<br />#&nbsp; &nbsp;  _inherit = [&quot;crm.tracking.mixin&quot;]<br /><br />&nbsp; &nbsp; _columns = {<br />&nbsp; &nbsp; &nbsp; &nbsp; &#039;product&#039;: fields.many2one(&#039;keywind.kwproduct&#039;, &#039;物资名称&#039;, readonly=True),<br />&nbsp; &nbsp; &nbsp; &nbsp; &#039;xinghao&#039;: fields.char(u&#039;规格型号&#039;, readonly=True),<br />&nbsp; &nbsp; &nbsp; &nbsp; &#039;unit&#039;: fields.many2one(&#039;keywind.unit&#039;, u&#039;单位&#039;, readonly=True),<br />&nbsp; &nbsp; &nbsp; &nbsp; &#039;jiag&#039;: fields.float(&#039;单价&#039;, digits=(16, 4), readonly=True),<br />&nbsp; &nbsp; &nbsp; &nbsp; &#039;invoice&#039;: fields.char(&#039;发票号&#039;,readonly=True),<br />&nbsp; &nbsp; &nbsp; &nbsp; &#039;num_inwms&#039;: fields.float(&#039;入库数量&#039;, readonly=True, digits=(8, 2)),<br />&nbsp; &nbsp; &nbsp; &nbsp; &#039;num_outwms&#039;: fields.float(&#039;出库数量&#039;, readonly=True, digits=(8, 2)),<br />&nbsp; &nbsp; &nbsp; &nbsp; &#039;num_last&#039;: fields.float(&#039;剩余数量&#039;, readonly=True, digits=(8, 2)),<br />&nbsp; &nbsp; &nbsp; &nbsp; &#039;out_to&#039;: fields.char(u&#039;项目名&#039;, readonly=True),<br />&nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; &#039;in_date&#039;: fields.datetime(&#039;入库时间&#039;, readonly=True),<br />&nbsp; &nbsp; &nbsp; &nbsp; &#039;out_date&#039;: fields.datetime(&#039;出库时间&#039;, readonly=True),<br />&nbsp; &nbsp; &nbsp; &nbsp; &#039;in_date_month&#039;: fields.datetime(&#039;入库月份&#039;, readonly=True),<br />&nbsp; &nbsp; }<br /><br />&nbsp; &nbsp; def init(self, cr):<br />&nbsp; &nbsp; &nbsp; &nbsp; tools.sql.drop_view_if_exists(cr, &#039;keywind_product_report&#039;)<br />&nbsp; &nbsp; &nbsp; &nbsp; cr.execute(&quot;&quot;&quot;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; create or replace view keywind_product_report as (<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; select<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sq.id,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sq.product_id as product,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sq.guigxh as xinghao,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sq.product_jiag as jiag,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sq.qty as num_inwms,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sum(ow.shul) as num_outwms,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sq.qtylast as num_last,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ow.project as out_to,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sq.in_date as in_date,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; extract(month from sq.in_date) as in_date_month<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; from stock_quant sq<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; left join out_wms ow on (sq.id=ow.quant_id)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; group by sq.guigxh, ow.project,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sq.product_id, sq.product_jiag, sq.qty, sq.qtylast, sq.id, <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sq.in_date<br /><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; )<br />&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;)
    



    xml文件

    &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br />&lt;openerp&gt;<br />	&lt;data&gt;<br />		<br />		&lt;menuitem id=&quot;menu_keywind_report&quot; name=&quot;报表&quot; parent=&quot;menu_stock&quot; /&gt;<br />		<br /><br />		&lt;record id=&quot;action_report_crm_lead&quot; model=&quot;ir.actions.act_window&quot;&gt;<br />			&lt;field name=&quot;name&quot;&gt;报表&lt;/field&gt;<br />			&lt;field name=&quot;res_model&quot;&gt;keywind.product.report&lt;/field&gt;<br />			&lt;field name=&quot;view_type&quot;&gt;form&lt;/field&gt;<br />			&lt;field name=&quot;view_mode&quot;&gt;graph&lt;/field&gt;<br />			&lt;field name=&quot;context&quot;&gt;{}&lt;/field&gt;<br />			&lt;field name=&quot;domain&quot;&gt;&#91;]&lt;/field&gt;<br />		&lt;/record&gt;<br />		<br />		<br />		&lt;!-- Leads by user and section Graph View --&gt;<br />		&lt;record id=&quot;view_report_crm_lead_graph&quot; model=&quot;ir.ui.view&quot;&gt;<br />			&lt;field name=&quot;name&quot;&gt;keywind.product.report.graph&lt;/field&gt;<br />			&lt;field name=&quot;model&quot;&gt;keywind.product.report&lt;/field&gt;<br />			&lt;field name=&quot;arch&quot; type=&quot;xml&quot;&gt;<br />				&lt;graph string=&quot;Leads Analysis&quot; type=&quot;pivot&quot; stacked=&quot;True&quot;&gt;<br />				<br />					&lt;field name=&quot;product&quot; type=&quot;row&quot; /&gt;<br />					&lt;field name=&quot;xinghao&quot; type=&quot;row&quot; /&gt;<br />					&lt;field name=&quot;in_date&quot; type=&quot;col&quot;/&gt;<br />					&lt;field name=&quot;out_to&quot; type=&quot;col&quot; /&gt;<br />					&lt;field name=&quot;num_inwms&quot; type=&quot;measure&quot; /&gt;<br />					&lt;field name=&quot;num_outwms&quot; type=&quot;measure&quot; /&gt;<br />					&lt;field name=&quot;num_last&quot; type=&quot;measure&quot; /&gt;<br />					&lt;field name=&quot;jiag&quot; type=&quot;measure&quot; /&gt;<br />					 <br />				&lt;/graph&gt;<br />			&lt;/field&gt;<br />		&lt;/record&gt;<br />		<br />		&lt;!-- Leads by user and section Search View --&gt;<br />		&lt;record id=&quot;view_report_crm_lead_filter&quot; model=&quot;ir.ui.view&quot;&gt;<br />			&lt;field name=&quot;name&quot;&gt;keywind.product.report.select&lt;/field&gt;<br />			&lt;field name=&quot;model&quot;&gt;keywind.product.report&lt;/field&gt;<br />			&lt;field name=&quot;arch&quot; type=&quot;xml&quot;&gt;<br />				&lt;search string=&quot;Leads Analysis&quot;&gt;<br />					<br />				&nbsp; &nbsp; &lt;!--<br />				&nbsp; &nbsp; &lt;field name=&quot;in_date&quot; string=&#039;入库时间&#039; /&gt;<br />					&lt;field name=&quot;in_date_month&quot; filter_domain=&quot;[(&#039;in_date_month&#039;,&#039;ilike&#039;,self)]&quot;/&gt;<br />					&lt;filter name=&quot;in_date_month&quot; context=&quot;{&#039;group_by&#039;:&#039;in_date:month&#039;}&quot; /&gt;<br />					--&gt;<br />					<br />					&lt;field name=&quot;in_date_month&quot; filter_domain=&quot;[(&#039;in_date_month&#039;,&#039;ilike&#039;,self)]&quot;/&gt;<br />					<br />					<br />					&lt;group expand=&quot;1&quot; string=&quot;分组&quot;&gt;<br />						<br />					&lt;!-- <br />						&lt;filter string=&quot;入库时间&quot; context=&quot;{&#039;group_by&#039;:&#039;in_date:month&#039;}&quot; /&gt;<br />					 --&gt;<br />					&lt;/group&gt;<br />				&lt;/search&gt;<br />			&lt;/field&gt;<br />		&lt;/record&gt;<br />		<br />		&lt;menuitem id=&quot;menu_act_estimate_report&quot; action=&quot;action_report_crm_lead&quot; name=&quot;估入报表&quot; parent=&quot;menu_keywind_report&quot; /&gt;<br />		<br />		&lt;record id=&quot;action_report_crm_lead_graph&quot; model=&quot;ir.actions.act_window.view&quot;&gt;<br />			&lt;field name=&quot;sequence&quot; eval=&quot;2&quot; /&gt;<br />			&lt;field name=&quot;view_mode&quot;&gt;graph&lt;/field&gt;<br />			&lt;field name=&quot;view_id&quot; ref=&quot;view_report_crm_lead_graph&quot; /&gt;<br />			&lt;field name=&quot;act_window_id&quot; ref=&quot;action_report_crm_lead&quot; /&gt;<br />		&lt;/record&gt;<br />		<br />	&lt;/data&gt;<br />&lt;/openerp&gt;
    



    希望在搜索框中输入2015/9的时候,显示的是2015年9月的入库和出库信息,而现在当我输入2015/9的时候,默认搜索的是“2015/9/1 00:00:00”
    求大神指点

  • 登录

  • 没有帐号? 注册

  • 登录或注册以进行搜索。
  • 第一个帖子
    最后一个帖子
0
  • 版块
  • 标签
  • 热门
  • 用户
  • 群组