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.

47 lines
2.2 KiB

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
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 action_invoice_create(self, grouped=False, final=False):
  13. res = super(SaleOrder, self).action_invoice_create(
  14. grouped, final)
  15. print("----- TEST ------", str(res))
  16. return res
  17. class SaleOrderLine(models.Model):
  18. _inherit = "sale.order.line"
  19. @api.multi
  20. def invoice_line_create(self, invoice_id, qty):
  21. invoice_lines = super(SaleOrderLine, self).invoice_line_create(
  22. invoice_id, qty)
  23. print("---- invoice_lines ----", str(invoice_lines))
  24. return invoice_lines
  25. # invoice_lines = self.env['account.invoice.line']
  26. # for line in self:
  27. # # Check if line has a pack_parent_line_id
  28. # print("---- self.pack_parent_line_id.exists() -----", str(self.pack_parent_line_id.exists()))
  29. # if self.pack_parent_line_id.exists():
  30. # # Get the ref of parent pack
  31. # sale_id_ref = self.env['sale.order.line'].search([('id', '=', self.pack_parent_line_id.id)])
  32. # print("--- sale_id_ref ---", str(sale_id_ref))
  33. # print("--- sale_id_ref.product_id.product_tmpl_id.pack_type ---", str(sale_id_ref.product_id.product_tmpl_id.pack_type))
  34. # print("--- sale_id_ref.product_id.product_tmpl_id.pack_component_price ---", str(sale_id_ref.product_id.product_tmpl_id.pack_component_price))
  35. # # Check if product is Pack detailed and option Totalized
  36. # if sale_id_ref.product_id.product_tmpl_id.pack_type == 'detailed' and sale_id_ref.product_id.product_tmpl_id.pack_component_price == 'totalized':
  37. # return invoice_lines
  38. # invoice_lines = super(SaleOrderLine, self).invoice_line_create(
  39. # invoice_id, qty)
  40. # return invoice_lines