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.

23 lines
862 B

  1. # Copyright (C) 2017 - Today: GRAP (http://www.grap.coop)
  2. # @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
  3. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  4. from odoo import api, models
  5. class SaleOrderLine(models.Model):
  6. _inherit = "sale.order.line"
  7. @api.model
  8. def _prepare_from_pos(self, sale_order, order_line_data):
  9. ProductProduct = self.env["product.product"]
  10. product = ProductProduct.browse(order_line_data["product_id"])
  11. return {
  12. "order_id": sale_order.id,
  13. "product_id": order_line_data["product_id"],
  14. "name": product.name,
  15. "product_uom_qty": order_line_data["qty"],
  16. "discount": order_line_data["discount"],
  17. "price_unit": order_line_data["price_unit"],
  18. "tax_id": order_line_data["tax_ids"],
  19. }