problem whit the new orm method AttributeError: 'sale.order.line' object has no attribute 'get' odoo
i want to add lines to the order_line from other sale order but it giveme an error AttributeError: 'sale.order.line' object has no attribute 'get' odoo
my code below
from odoo import fields, models, api
class InvoiceOrder(models.Model):
_inherit = "sale.order"
container_id=fields.Many2one(comodel_name="container.shipment",string="Container")
@api.onchange("container_id")
def _onchange_lines_conatiner(self):
if self.container_id != None:
container=self.env["container.shipment"].search(
[
("name", "=", self.container_id.name),
], limit=1
)
order_line_def= self.order_line
dict_order={}
vals=[]
for bulk in container.bulk_ids:
for order in bulk.line_ids:
order_id=order.order_id
order_line1=order_id.order_line
order_line_def= order_line1 + order_line_def
for record in order_line_def:
dict_order.update({
'product_id': record.product_id.id,
'name': record.name,
'product_uom_qty':record.product_uom_qty,
'product_uom': record.product_uom,
'price_unit': record.price_unit,
'order_id': self.id,
})
vals.append(dict_order)
for line1 in vals:
order1 = self.env['sale.order.line'].new(line1)
return order1
source https://stackoverflow.com/questions/71054672/problem-whit-the-new-orm-method-attributeerror-sale-order-line-object-has-no
Comments
Post a Comment