Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
2 Odpowiedzi
1879 Widoki

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!

Awatar
Odrzuć
Autor Najlepsza odpowiedź

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

Awatar
Odrzuć
Najlepsza odpowiedź

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,



Awatar
Odrzuć

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?

Powiązane posty Odpowiedzi Widoki Czynność
1
cze 22
2424
2
maj 25
3737
0
lis 24
1062
1
sie 24
1780
1
sie 24
3255