25 lines
765 B
Python
25 lines
765 B
Python
# -*- coding: utf-8 -*-
|
|
# Powered by Kanak Infosystems LLP.
|
|
# © 2020 Kanak Infosystems LLP. (<https://www.kanakinfosystems.com>)
|
|
|
|
from odoo import fields, models
|
|
|
|
|
|
class ProductProduct(models.Model):
|
|
_inherit = "product.product"
|
|
_order = 'pos_sequence, default_code, name, id'
|
|
|
|
|
|
class ProductTemplate(models.Model):
|
|
_inherit = "product.template"
|
|
_order = 'pos_sequence, name'
|
|
|
|
def _get_default_sequence(self):
|
|
self.env.cr.execute("SELECT MAX(pos_sequence) FROM product_template")
|
|
seq = self.env.cr.fetchone()
|
|
if seq[0] is not None:
|
|
return seq[0] + 1
|
|
|
|
pos_sequence = fields.Integer(
|
|
string='POS Sequence', default=_get_default_sequence, help='POS product display base on product sequence number')
|