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
- Boekhouding
- Voorraad
- PoS
- Project
- MRP
Deze vraag is gerapporteerd
2
Antwoorden
4717
Weergaven
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.
Geniet je van het gesprek? Blijf niet alleen lezen, doe ook mee!
Maak vandaag nog een account aan om te profiteren van exclusieve functies en deel uit te maken van onze geweldige community!
Aanmelden