Houssine BAKKALI
7 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
0 additions and
25 deletions
-
beesdoo_pos_remove_0_qty/models/pos_order_line.py
|
@ -1,25 +0,0 @@ |
|
|
# -*- 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 |
|
|
|