[FIX] point_of_sale: Put check constraint for quantity <= 0 in sale order line.

[IMP] point_of_sale: Changed menu sequences.

bzr revid: uco@tinyerp.com-20100622101239-fcan55bfuunr4c5i
This commit is contained in:
uco 2010-06-22 15:42:39 +05:30
parent 5138f83593
commit 93ea7917bf
2 changed files with 15 additions and 4 deletions

View File

@ -1174,7 +1174,18 @@ class pos_order_line(osv.osv):
'notice': lambda *a: 'No Discount',
'company_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id,
}
def _check_qty(self, cr, uid, ids):
lines = self.browse(cr, uid, ids)
for line in lines:
if line.qty <= 0:
return False
return True
_constraints = [
(_check_qty, 'Order quantity cannot be negative or zero !', ['qty']),
]
def create(self, cr, user, vals, context={}):
if vals.get('product_id'):
return super(pos_order_line, self).create(cr, user, vals, context)

View File

@ -174,7 +174,7 @@
<menuitem name="Point of Sale" id="menu_point_of_sale" parent="menu_point_root" sequence="1" />
<menuitem name="Sales Order" parent="menu_point_of_sale" id="menu_point_ofsale" action="action_pos_pos_form" sequence="1"/>
<menuitem name="Products" id="menu_point_of_sale_product" parent="menu_point_root" sequence="29" />
<menuitem name="Products" id="menu_point_of_sale_product" parent="menu_point_root" sequence="15" />
<menuitem action="product.product_normal_action" id="menu_pos_products" parent="menu_point_of_sale_product" sequence="2" name="Products"/>
@ -743,7 +743,7 @@
</record>
<menuitem name="Configuration" parent="menu_point_root"
id="menu_point_config_product" sequence="6"/>
id="menu_point_config_product" sequence="25"/>
<record model="ir.actions.act_window" id="action_product_input">
<field name="name">Products</field>
@ -860,7 +860,7 @@
</record>
<!-- Miscelleanous Operations/Reporting -->
<menuitem name="Reporting" parent="menu_point_root" id="menu_point_rep" sequence="30"/>
<menuitem name="Reporting" parent="menu_point_root" id="menu_point_rep" sequence="20"/>
<menuitem name="Registers" parent="menu_point_rep" id="menu_point_report_register" sequence="0" />
<menuitem name="Sales" parent="menu_point_rep" id="menu_point_report_sale" sequence="1" />