I have a list of Items from my Invoice. I decided to create a column for serial number. How to i get it to display numbers 1, 2, 3 etc for the products as i keep entering them?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Akuntansi
- Inventaris
- PoS
- Project
- MRP
Pertanyaan ini telah diberikan tanda
2
Replies
4708
Tampilan
Hi,
can you try the below code for odoo 12
in . py
class OrdinalNumber(models.Model):
_inherit = 'account.invoice.line'
number_sequence = fields.Integer(
compute='_compute_get_number',
store=True,
)
@api.depends('sequence', 'invoice_id')
def _compute_get_number(self):
for invoice in self.mapped('invoice_id'):
number_sequence = 1
for line in invoice.invoice_line_ids:
line.number_sequence = number_sequence
number_sequence += 1
in .xml
<record model="ir.ui.view" id="view_invoice_number_sequence_form">
<field name="name">account.invoice.inherit</field>
<field name="model">account.invoice</field>
<field name="inherit_id" ref="account.invoice_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='sequence']" position="after">
<field name="number_sequence" string="No"/>
</xpath>
</field>
</record>
Hi Samuel,
You can add sequence function to line in order to achieve this. Check out this App for serial in order lines.
Menikmati diskusi? Jangan hanya membaca, ikuti!
Buat akun sekarang untuk menikmati fitur eksklufi dan agar terlibat dengan komunitas kami!
Daftar