Skip to Content
Menu
This question has been flagged
2 Replies
3444 Views

Hello, 

I'm trying to show lot/serial number in invoice report in the same table that shows the items of the invoice, not in a desperate table:

so i did as in the comments, but this way makes all the serial numbers to be shown in each line.

how can i show only the serial number related to the item.

Thnx


Avatar
Discard
Author

<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>

Best Answer






" rel="ugc">line.product_id.name"/>



SN/LN:


Exp:


Avatar
Discard
Author

sorry, the code isn't shown correctly, can you try to pit it in a comment for your answer?
Thanks

Best Answer

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 

Avatar
Discard

XML File:-

<t t-foreach="lines" t-as="line">
<td>
<span t-field="line.lot_ids"/>
</td>
</t>

Author

i'll try this.
Thanks

Related Posts Replies Views Activity
0
Oct 21
5
4
Nov 24
5235
1
Mar 24
394
3
Sep 23
22646
0
Feb 24
1717