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

Hi i'm using odoo v12 CE, python3.7 
I get this error when i'm adding a product in sale.order.line, this error is raised when executing the raise message combined with int and string
_('You plan to sell %s %s of %s but you only have %s %s available in %s warehouse.') % \
(self.product_uom_qty, self.product_uom.name, self.product_id.name, product.virtual_available, product.uom_id.name, self.order_id.warehouse_id.name)​

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

We had got the same issue. It came from translation string (the french one in our case) which didn't have the right number of arguments (4 instead of 6).
Just update your Odoo repo, update translation with the 'Overwrite Existing Terms' option checked.

Ảnh đại diện
Huỷ bỏ
Tác giả

Thank you David, absolutly nice, the issue is solved

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

Thank you Vishnu, 
I know that, my question is for the "TypeError: not all arguments converted during string formatting"

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hello,

This is actually a warning message for Not enough inventory! . You may adding a product with on hand stock low than ordering qty.

Check Stock of the product while adding in sale order.

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hello Firas,

This is because of wrong string formatting passed when you try to raise warning.
Please use this:
('You plan to sell %s %s of %s but you only have %s %s available in %s warehouse.') % \
(str(self.product_uom_qty), self.product_uom.name, self.product_id.name, str(product.virtual_available), product.uom_id.name, self.order_id.warehouse_id.name)​ 

This will format into string.

Hope it helps!

Thanks,
Mayank Gosai

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
8
thg 5 24
48536
1
thg 1 20
5064
2
thg 12 24
2422
2
thg 12 23
14758
0
thg 10 23
33