You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
621 B

  1. # Copyright 2020 Coop IT Easy SCRL fs
  2. # Robin Keunen <robin@coopiteasy.be>
  3. # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
  4. from odoo import api, fields, models
  5. class AccountInvoice(models.Model):
  6. _inherit = "account.invoice"
  7. external_id = fields.Integer(
  8. string="External ID", index=True, required=False
  9. )
  10. @api.multi
  11. def get_external_id(self):
  12. self.ensure_one()
  13. if not self.external_id:
  14. self.external_id = self.env["ir.sequence"].next_by_code(
  15. "account.invoice.external.id"
  16. )
  17. return self.external_id