跳至內容
選單
此問題已被標幟
2 回覆
2486 瀏覽次數

Hi 


I would like to replace the value of the "Expected revenue" when a quotation exists.

If a quotation exists I would like to show the "untaxed amount" of the last created quotation in the "expected revenue" field.


Thanks for your help.


Jan

頭像
捨棄

Hello Jan,

Do you have a solution for this ?

Thank you

最佳答案

Hi Jan,

Try this example code 

class CRMleadInherit(models.Model):
_inherit='crm.lead'

amount = fields.Float(compute='_compute_expected_revenue', store=True)

@api.depends('order_ids')
def _compute_expected_revenue(self):
for rec in self:
if rec.order_ids:
last_quotation = rec.order_ids[0]
rec.amount = last_quotation.amount_untaxed
else:
rec.amount = 0.0

​Here in this field amount have the calculation that you needed


Regards

頭像
捨棄
最佳答案

Hi Julien

No not yet... 

We asked our Odoo partner to have a look at this, because they did some programming on top of this field. 

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
3
9月 25
3183
0
8月 25
745
1
8月 25
2943
2
7月 25
8572
2
7月 25
4978