Skip to Content
Menu
This question has been flagged
1482 Zobrazenia

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
Zrušiť
Related Posts Replies Zobrazenia Aktivita
0
mar 25
1136
0
aug 24
1363
1
júl 24
2269
1
mar 22
5029
1
jún 21
3373