Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
2 Replies
1886 Tampilan

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!

Avatar
Buang
Penulis Jawaban Terbai

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

Avatar
Buang
Jawaban Terbai

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,



Avatar
Buang

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?

Post Terkait Replies Tampilan Aktivitas
1
Jun 22
2430
2
Mei 25
3739
0
Nov 24
1066
1
Agu 24
1784
1
Agu 24
3263