Se rendre au contenu
Menu
Cette question a été signalée

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
Ignorer
Publications associées Réponses Vues Activité
0
mars 25
1136
0
août 24
1363
1
juil. 24
2271
1
mars 22
5030
1
juin 21
3373