Browse Source
add module removing pos order line with qty at 0
pull/28/head
Houssine BAKKALI
7 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with
50 additions and
0 deletions
-
beesdoo_pos_remove_0_qty/__init__.py
-
beesdoo_pos_remove_0_qty/__openerp__.py
-
beesdoo_pos_remove_0_qty/models/__init__.py
-
beesdoo_pos_remove_0_qty/models/pos_order_line.py
|
@ -0,0 +1,2 @@ |
|
|
|
|
|
# -*- coding: utf-8 -*- |
|
|
|
|
|
from . import models |
|
@ -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, |
|
|
|
|
|
} |
|
@ -0,0 +1,3 @@ |
|
|
|
|
|
# -*- coding: utf-8 -*- |
|
|
|
|
|
from . import pos_order_line |
|
|
|
|
|
#from . import pos_order |
|
@ -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 |