Skip to Content
Menú
This question has been flagged
1478 Vistes

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
Descartar
Related Posts Respostes Vistes Activitat
0
de març 25
1128
0
d’ag. 24
1355
1
de jul. 24
2244
1
de març 22
4999
1
de juny 21
3358