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

How to get customer in account.invoice ?

I have created a button in customer invoice with the following code

.py code

class labelprint(models.Model):

 _inherit = 'account.invoice'

def labeltest(self):

  delivery_partner_id = self.partner_id.()

  url = 'https://requestb.in/1bz11jv1'

  headers = {'Content-Type': 'application/json'}

  data = {

    "Customername" : xxx,

    "Customerphone": xxxx,

  }

  data_json = json.dumps(data)

  r = requests.post(url=url, data=data_json, headers=headers)

what are the function i have to write in xxx in order to get details ?? 

do i have to inherited res.partner ?? 

Please help !!

頭像
捨棄
最佳答案

Try,

replace xxx with self.partner_id.name

replace xxxx with self.partner_id.phone

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
0
9月 23
2862
2
8月 25
17095
0
8月 17
5123
1
5月 17
3526
2
4月 17
3734