Hello Nour Abboud,
I think the below code will help to the shown lot/serial number in report line-wise related to the item.
PY File:-
class AccountMoveLine(models.Model):
_inherit = 'account.move.line'
lot_account_move = fields.Char(related='sale_line_ids.lot_sale_order_line')
lot_ids = fields.Many2many('stock.production.lot', related='sale_line_ids.lot_ids', string="Serial Numbers")
class SaleOrderLine(models.Model):
_inherit = 'sale.order.line'
lot_sale_order_line = fields.Char(compute='_compute_lot_sale', string='Lot')
lot_ids = fields.Many2many('stock.production.lot', string="Serial Numbers", compute='_compute_lot_sale', store=True)
@api.depends('qty_delivered')
def _compute_lot_sale(self):
for line in self:
move_ids = self.env['stock.move'].search([
('sale_line_id', '=', line.id)
])
if move_ids:
line.lot_ids = move_ids.lot_ids
line.lot_sale_order_line = ''
else:
line.lot_sale_order_line = ''
XML File:-
| Thanks & Regards,
Email: odoo@aktivsoftware.com
Skype: kalpeshmaheshwari
<td style="border: 0.5px solid gray;" name="td_name">
<span t-esc="line.product_id.name"/>
<br/>
<span style="direction: rtl;" t-esc="line.product_id.ar_name"/>
<t t-if="lot_values">
<br/>
<t t-foreach="lot_values" t-as="snln_line">
SN/LN:
<t t-esc="snln_line['lot_name']"/>
<br/>
Exp:
<t t-esc="snln_line['lot_expiry_date']"/>
</t>
</t>
</td>