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

Hey folks, am new to Odoo and don't have much experience with coding. Am given this task by my boss so hope to get some help on this + clear instructions. Your help would be very helpful!

The problem I face:

  • Under the Sales module, creating a new Quotation and inserting Products for that Quotation, the Description of the Product will be auto-generated based on "[Internal Reference] Product Name".
  • This causes complications because when the data is ported over to Xero (using a Connector that we have), Xero's Invoices will show the Internal Reference twice. The way Xero operates is Item Code and Item Description, but since the Item Description has both the Code and Product Name, this duplication makes us appear unprofessional.

Is there a way for the Description to auto-generate just the "Product Name" without the Internal Reference instead? Am on Odoo-sh version 17. Have searched online for help but the answers were very hard to follow or outdated!

Appreciate it!

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

Thanks for this! How do I access the source code to insert this piece code? 

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

Hi,

Please use the following code,


class Sale (models.Model)

    _inherit = 'sale.order.line'



    @api.depends('product_id')

    def _compute_name(self):

        for rec in self:

            rec.name = rec.product_id.name if rec.product_id else False


Hope it helps,



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

Hello,
We have the same issue.
Any chance you could tell us a bit more about this with clean instructions?
What view are you adding this to?
sale.order.form?
sale.sale_order_portal_content?

Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 6 22
2426
2
thg 5 25
3738
0
thg 11 24
1063
1
thg 8 24
1782
1
thg 8 24
3258