Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
3864 Lượt xem

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 !!

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Try,

replace xxx with self.partner_id.name

replace xxxx with self.partner_id.phone

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 9 23
2872
2
thg 8 25
17120
0
thg 8 17
5158
1
thg 5 17
3539
Paypal redirection Đã xử lý
2
thg 4 17
3743