You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
970 B

5 years ago
  1. # © 2019 Le Filament (<http://www.le-filament.com>)
  2. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  3. from odoo import models, fields, api
  4. class SaleOrder(models.Model):
  5. _inherit = "sale.order"
  6. @api.one
  7. def _compute_website_order_line(self):
  8. self.website_order_line = self.order_line.filtered(
  9. lambda t: not t.pack_parent_line_id.exists(),
  10. )
  11. @api.multi
  12. def _cart_update(self, product_id=None, line_id=None, add_qty=0, set_qty=0, **kwargs):
  13. self.ensure_one()
  14. if line_id is not False:
  15. order_line = self.env['sale.order.line'].browse(line_id)
  16. # order_line = self._cart_find_product_line(product_id, line_id, **kwargs)[:1]
  17. if order_line.pack_parent_line_id:
  18. return {'line_id': order_line.id, 'quantity': 0}
  19. return super(SaleOrder, self)._cart_update(product_id, line_id, add_qty, set_qty, **kwargs)