Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
4 Trả lời
6309 Lượt xem

Thanks,

Rob

Ảnh đại diện
Huỷ bỏ

Further to this, it would be fantastic if the system could use a specific sequence based of something about the product. IE: the products Internal Category. Upon saving the product, the system should check if Internal Reference is empty, if it is empty it should check which internal category the product belongs to, and then apply one of the chosen sequences.

So maybe you would have:

FOOD-XXXXX

CONS-XXXXX

ELEC-XXXXX

CLTH-XXXXX

for food, consumables, electronics, and clothes.

Just an idea.

Tác giả

Completely agree, although I'm trying to get away from "Intelligent" part numbers. But for starters I just want a sequence that is incremented whenever a new product is created. Any help out there?

Tác giả

OK, I've created a sequence manually, then added this to the python file that inherits product.template:

def create(self, vals):

vals['ref']=self.pool.get('ir.sequence').get('product.product')

return super(object, seld).create(vals)

I'm getting an error. Any ideas?

Tác giả Câu trả lời hay nhất

I manually created the sequence (product.product) in Odoo from the developer menu, database structure, sequences. Then added the following code in the py file:

sms_part_number = fields.Char('Part Number', help="Enter SMS Part Number")

@api.model   

def create(self, vals):
        vals['sms_part_number'] = self.env['ir.sequence'].next_by_code('product.product') or '/'       

        return super(sms, self).create(vals)

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 11 24
20052
1
thg 9 23
2927
3
thg 5 23
5499
7
thg 4 23
48845
1
thg 12 22
7739