Skip to Content
Menu
This question has been flagged
2 Replies
1723 Views

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
Discard
Author Best Answer

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

Avatar
Discard
Best Answer

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
Discard

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?

Related Posts Replies Views Activity
1
Jun 22
2303
2
May 25
3330
0
Nov 24
959
1
Aug 24
1483
1
Aug 24
2828