
Odoo中文社区可以通过以下两个域名访问:shine-it.net , odoo.net.cn
由于系统升迁的原因,本论坛部分较早期的内容存在格式和链接损坏失效的问题,并非本论坛系统本身的缺陷,望谅解
本社区没有维护任何QQ群讨论组,任何与本社区同名的QQ群讨论组的言论与本社区无关!
开发人员可以登录gitter讨论组: http://gitter.im/odoo-china/Talk, 需要github账号
如果您登录系统碰到问题,请在微信公众号留言:
订单tree 视图显示是否退货
-
正常流程下,销售订单或采购订单,发完货,订单显示完成。如果退了货,从订单看不出任何痕迹。需求出来,如果有退货,提示有退货。
经 总监 提醒,在订单 里加上 function 字段,如 amount_stock_return
_columns = {
'amount_stock_return': fields.function(_amount_stock_return, type='float', string=u'退货金额', multi="amount_stock_return", help="出库单,退货对应销售订单金额")
,'amount_payment_return':fields.function(_amount_payment_return, type='float', string=u'退款金额', multi="amount_payment_return", help="红字发票,付款(即退款)")
}
自定义 _amount_stock_return 和_amount_payment_return 函数,函数中读取想要的数据,
然后在 xml 里
<record model="ir.ui.view" id="sale_order_xyls_tree">
<field name="name">sale.view_order.tree</field>
<field name="type">tree</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_tree" />
<field name="arch" type="xml">
<!--
<xpath expr="//tree[@string='Sales Orders']" position="attributes">
<attribute colors="grey:state=='cancel';green:amount_stock_return>0;blue:state in ('waiting_date','manual');red:state in ('invoice_except','shipping_except')"/>
</xpath>
-->
<field name="partner_id" position="before">
<field name="shop_id" string="门店"/>
</field>
<field name="amount_total" position="after">
<field name="amount_stock_return" sum="退货合计"/>
</field>
</field>
</record>
本想,如果退货金额大于0 时 变绿色,在xml 没有成功,不知道怎么定位到 修改colors 的地方,暂时 注释
--------------------------------修改--------------------------------------
按照楼下大师指点,改为 正常,感谢大师
<xpath expr="//tree[@string='Sales Orders']" position="attributes">
<attribute name="colors">
grey:state=='cancel';green:amount_stock_return>0;blue:state in ('waiting_date','manual');red:state in ('invoice_except','shipping_except')
</attribute>
</xpath> -
不错
你研究下 XPATH -
[font=verdana][size=13px] [/size][/font]
<xpath expr="//tree[@string='Sales Orders']" position="attributes"> <attribute colors="grey:state=='cancel';green:amount_stock_return>0;blue:state in ('waiting_date','manual');red:state in ('invoice_except','shipping_except')"/> </xpath>
改成<xpath expr="//tree[@string='Sales Orders']" position="attributes"><br /><attribute name="colors"><br /> grey:state=='cancel';green:amount_stock_return>0;blue:state in ('waiting_date','manual');red:state in ('invoice_except','shipping_except')<br /> </attribute> <br /></xpath>
-
嗯... 对于属性值是串的话, 就是
<attribute name="属性名称">属性串值</attribute> -
_amount_stock_return 和_amount_payment_return 函数 的内容怎么没有放出来啊?
-
感谢大师指点 ,按照大师写法,成功了
-
1、订单的发货单
2、发货单的退货单
3、重新发货的发货单
如何区分换货和退货?颜色提示的意义是什么? -
楼上的问题我好像只能回答一个 ,颜色:只是和其他不一样 起到提示作用。
-
求 _amount_stock_return 和_amount_payment_return 函数 的具体写法,非常感谢!
-
mark,这个需求很典型