跳至内容
菜单
此问题已终结
2 回复
1865 查看

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!

形象
丢弃
编写者 最佳答案

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

形象
丢弃
最佳答案

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,



形象
丢弃

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?

相关帖文 回复 查看 活动
1
6月 22
2410
2
5月 25
3729
0
11月 24
1058
1
8月 24
1776
1
8月 24
3239