This question has been flagged
1 Reply
1370 Views

How can I alert a user if they sell product below cost in POS?

I came across this article but its for Sales Order and I want it inside POS. 

https://www.odoo.com/es_ES/forum/ayuda-1/how-to-alert-if-user-sell-product-bellow-cost-172728


Can anyone help me on this?


Avatar
Discard

This is very useful. I came from microsoft dynamics POS where by every edited price will get an icon lightning. But red color / bold will be useful

Best Answer

Hi Hassan, 

Please find code in comment. 

Hope it will be helpful to you.

Thanks & Regards,
Email: odoo@aktivsoftware.com
Skype: kalpeshmaheshwari

Avatar
Discard

Please find code here :-

1. Create XML file to Override the Orderline template to add an attribute
<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">

<t t-name="Orderline" t-inherit="point_of_sale.Orderline" t-inherit-mode="extension" owl="1">
<xpath expr="//li[hasclass('orderline')]" position="attributes">
<attribute name="t-attf-style">{{props.line.get_display_price() - props.line.get_total_cost() lt 0 ? 'color:red;': ''}}</attribute>
</xpath>
</t>

</templates>

2. Add point_of_sale in depends and Register your XML in __manifest__.py file
'depends': ['point_of_sale'],
'assets': {
'point_of_sale.assets': [
'module_name/path/to/your/file.xml',
],
},