Zum Inhalt springen
Menü
Sie müssen registriert sein, um mit der Community zu interagieren.
Diese Frage wurde gekennzeichnet
1490 Ansichten

Hi, 

I did a module that sends invoice details to a fiscal device using an api.  I have had issues with getting the invoice data and appending it to the schema.  A gentleman proposed using the ORM Api ( never used it before ).

Are their examples of how the Odoo 10  ORM Api works and more so for the account.invoice module?


Also, kindly check my code and tell me where I am going wrong.

items = []
for line in rec.invoice_line_ids:
invoice_line = {'ID':line.id,'DESC':line.name,'TAXCODE':tax.name,'QTY':line.quantity,'AMT':line.price_unit,'line_total':line.price_subtotal}
items.append(invoice_line)
items = json.dumps(items)

items, predict = [], {}
cashier = self.user_id.name
tsin = self.number
buyername = self.partner_id.name
pinofbuyer = self.partner_id.vat
buyeradd = self.partner_id.city
buyerphone = self.partner_id.phone
for item in self.invoice_line_ids:
items.append({
"name": item.product_id.name,
"quantity"
: item.quantity,
"unitPrice"
: item.price_unit
})




payload_tuples = json.dumps({
"invoiceType": 0,
"transactionType"
: 0,
"cashier"
: cashier,
"TraderSystemInvoiceNumber"
: tsin,
"buyer"
: {
"buyerName": buyername,
"pinOfBuyer"
: pinofbuyer,
"buyerAddress"
: buyeradd,
"buyerPhone"
: buyerphone
},
"items"
: items,
"payment"
: [
{
"amount": 1,
"paymentType"
: "Cash"
}
],
"lines"
: [
{
"lineType": "Text",
"alignment"
: "bold center",
"format"
: "Bold",
"value"
: "Thank you!!"
}
]
})


Avatar
Verwerfen
Verknüpfte Beiträge Antworten Ansichten Aktivität
0
März 25
1136
0
Aug. 24
1363
1
Juli 24
2272
1
März 22
5030
1
Juni 21
3373