Browse Source

add module removing pos order line with qty at 0

pull/28/head
Houssine BAKKALI 7 years ago
committed by GitHub
parent
commit
a118271daf
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      beesdoo_pos_remove_0_qty/__init__.py
  2. 20
      beesdoo_pos_remove_0_qty/__openerp__.py
  3. 3
      beesdoo_pos_remove_0_qty/models/__init__.py
  4. 25
      beesdoo_pos_remove_0_qty/models/pos_order_line.py

2
beesdoo_pos_remove_0_qty/__init__.py

@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-
from . import models

20
beesdoo_pos_remove_0_qty/__openerp__.py

@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2016-Today: La Louve (<http://www.lalouve.net/>)
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
'name': 'Beesdoo - Remove pos order line with quantity set to 0',
'version': '9.0.1.0.0',
'category': 'Custom',
'summary': 'Remove pos order line with quantity set to 0',
'author': 'La Louve - Sylvain LE GAL',
'author': 'BEES coop - Houssine BAKKALI',
'website': 'http://www.bees-coop.be',
'depends': [
'point_of_sale',
],
'data': [],
'installable': True,
}

3
beesdoo_pos_remove_0_qty/models/__init__.py

@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-
from . import pos_order_line
#from . import pos_order

25
beesdoo_pos_remove_0_qty/models/pos_order_line.py

@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2016-Today: La Louve (<http://www.lalouve.net/>)
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
# Julien Weste (julien.weste@akretion.com.br)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import api, models
class PosOrderLine(models.Model):
_inherit = 'pos.order.line'
@api.multi
def write(self, vals):
if 'qty' in vals.keys() and vals['qty'] == 0:
self.unlink()
else:
super(PosOrderLine, self).write(vals)
@api.model
def create(self, vals):
pol = super(PosOrderLine, self).create(vals)
if pol.qty == 0:
pol.unlink()
return pol
Loading…
Cancel
Save