Update draft invoice from API, Unbalanced exception - odoo

Our customers have a subscription on our services.
The subscription generates an draft invoice and one of the product on the draft I want to change the quantity off. This product quantity is different every month and our external software know this number.
What I’ve do through the API/XMLRPC.
We find the draft in the 'account.move' model then search the 'account.move.line' for our product. Then here we change the amount and we write the 'account.move.line' back.
Here we get an exception 'Cannot create unbalanced journal entry. <...>.'.
I can’t believe we have the recalculate all the financial values. Isn’t this something the API should do?

Related

Can we increase shipping rates in shopify using shopify script?

I found similar question in the forum, and from this answer I come to know about Career service. Which looks promising initially, but after reading the doc from here, I found that there is an issue for my use case.
This is my use case:
There will be multiple items in the cart with different delivery dates set(I store delivery dates in the line_item property)
now when user go to checkout the shipping rate has to be calculated based on the delivery dates(which are stored in the line item property for each line item)
shipping price should be calculated like ...... if there is only one delivery day, we need to offer x price, if there are two different delivery dates we need to offer 2x price and so on....
so the issue is, Carrier Service uses Server side cashing and it will only ask for price if any of these(variant IDs, default shipping box weight and dimensions, variant quantities, carrier service ID, origin address, destination address, item weights and signatures) field change. It doesn't include line item properties(where I have stored delivery dates).
I have also checked the shopify scripts from here, but after some mockups I come to know that we can only provide discount to the existing shipping rates and can not add new shipping method, or increase shipping price for existing shipping method.
Please help me to find a solution for this problem.

How do I retrieve the currency details of a journal transaction from the REST API in Acumatica?

I’m having a hard time making sense of multi-currency transactions. I’m using the REST API to retrieve journal transaction details. I’m hitting the /entity/Default/18.200.001/JournalTransaction endpoint with $expand=Details and some date filters. The base currency of this Acumatica instance is USD, but some journal transactions are entered in EUR. The problem is that for these EUR transactions, I have no way of knowing these debit/credit amounts were entered in the non-default currency. I see the EUR amount, but the CurrencyID of the transactions indicates “USD”. About the only thing I notice is that the transaction is in the “US” branch, but the details are in the “EU” branch. Is there a way, via the REST API, to query journal transactions/details, and discern what currency the debit/credit amount is represented in?
Journal header contains CurrencyID field which should tell you what currency it belongs to.

How do I access all the information for a Square transaction?

I am a student (so I am pretty new to all of this stuff) trying to create a database for a coffee shop that uses Square for their register and website. I want the database to update with all the information from a transaction every time one is completed.
I have a webhook that gets me the IDs every time a transaction completes, I can send the transaction ID to the Square API with an http request and get back information about the payment, but I still cannot figure out how to get the rest of the transaction information. We want to query the database about what kinds of items are being sold when and with what modifiers, but so far the only way I can get that is through downloading a csv file with the item line information from the Square Dashboard.
If there is a way to get the line item information in some kind of way that can be automatically added to the database, I would really appreciate the help. I have been looking for a solution and cannot find it on my own.
For in-person payments the only way to see itemizations is to use V1 ListPayments (or RetrievePayment).
In order to see itemizations for online payments, you must utilize Square's Orders API. The workflow would be:
Create an order (CreateOrder) with line_items (can be ad-hoc, or use Catalog ids). Save the order_id for the next step.
When calling Charge, pass in the order_id from the previous step.
Once you are successfully attaching the order_id's, when you retrieve a transaction you will be able to call the BatchRetrieveOrders endpoint with the order_id to see the itemizations.
References:
V1 Payments
Orders Overview
Orders Reference

SQL Point of sale how does a return work

Im new to POS systems. I have to create a very simple one for a few stores. Here is my SQL Server DB Schema:
The question that I have is how to handle returns.
In the real world how does a return works? Is a return a new sale but with a negative balance? If so then I would need to add to my sale table a "transactiontype" field (sale, return, etc.) and also a "referencesaleuid" field so the new sale (that will be a return) can reference the original sale ticket.
How to handle returns is a business decision.
For one example, we have worked with retailers of larger ticket items that needed to match returned products back to the original line item. So if a customer walked out of the store with two widgets and later returned one widget then we needed to be able to link the returned SKU back to the original transaction and SKU.
As another example, we have worked with retailers of smaller ticket items where returns were treated negative transactions.
I would suggest consulting closely with the business managers to find out what they would like to do in order to manage the business best.

Adding PDF as page to PDF

I'm working on an online bookstore. Obviously when something is bought we send out an invoice. I have a default template that is used to put all the information in (customer data) and of course the information about the bought items.
Now comes a part that might seem confusing. We are going to give discounts as well.
Example: A product is €100 and you get 10% discount. Now you pay just €90 but that missing €10 has to be paid at some point, by the one giving the discounts.
So once a month we send an additional invoice to the companies that gave discounts, with all the discounts they gave, so they know what to pay us.
On the first page of that invoice will be an overview for all orders with the total amount of discount on that order together with taxes and the order number. On the second page there will be a detailed overview of all orders.
I will show what is bought on the order so they can see where the discount came from and the prices are correct.
Now we finally get to the problem. The first page will hold (once again) all the details of the customer, in this case the company. It has the address, name, customer number, invoice number etc. The second page doesn't need this information, so I want to make a new template for that, giving me two template PDFs.
Is it possible to grab the second PDF and insert it into the PDF as a single page? This is all to be done in vb.net.