Prestashop wrong invoice order - prestashop

I have a problem, a customer places an order and the invoice doesn't match what he bought and paid for.
he buys 3 articles the invoice displays 12....
where should I look for to solve this BIG problem? I am on Prestashop 1.6.9
I didn't delete orders manually throught database, this is my first order...
Thanks !

Are these products combinations and if so do they contain one attribute or more than one? Do you have any modules that are overriding the OrderInvoice class? Check in override--classes--order.
I would probably start in classes--order--OrderInvoice.php. The Invoices are created using this class and I believe they use the method getProducts to loop through the products from the order.

Related

Prestashop partial order invoincing

I would like to know if it is possible to invoice only a part of a client order. I don't want to change the original order of the client. I need to invoice only that articles that I have in my stock. My environment is with no stock.
You can override PDF class, but order total will be different than invoice total and you should add an invoiced total column in AdminOrders vieworder for your info.
I do not see the point about allow orders with no stock products, then not include these in bill but not delete products in order ....
Prestashop statistics will be affected too.
I am not on your shoes, but I advise you to analyze the situation and take the simplest solution.

Prestashop 1.7 Order Class: How to update the products list, recompute the shipping cost, and the VAT?

I have to update an existing order. This update includes adding/removing/updating products (updating products would consist in changing the quantities for example), recomputing the shipping cost, and the VAT.
In the Order and Product classes, I didn't find any method to do it. How could I fulfill my goal?
Edit:
To recompute the shipping cost, I've found: Order::refreshShippingCost()
Check this function ajaxProcessEditProductOnOrder in controllers/admin/AdminOrderController.
You should create a new function based on this, or you can use the existing one.

How to make a payment for each product in an invoice in Odoo

I have an invoice with 2 products (product A and B), I need to do a payment only for the product A, is there any way to do that ?, and after see the product A with the correct moves in the accounting.
I know how to do the change in code but will be better if Odoo has this functionality
Thanks a lot
That can be done if you shipped all products separately and keep
invoice policy based on shipment. Then you can create separate invoice
for each products.
While you click on Create Invoice button in sales order then it will create invoice for eligible shipments with it's all delivered products.
So your purpose will be resolved by just change the configuration other there is no more option in odoo you have to write code to achieve it.

Generate random resource ID's with prefix?

I have a simple Rails 3 invoicing application with the following models:
Brand
Client
Invoice
A brand has many invoices, clients have many invoices and invoices belong to clients and brands. Basically the brand is the company creating the invoice, client is the recipient of the invoice and the invoice the the actual invoice.
I am trying to work out the best way of having a simple random reference number for each invoice that's prefixed by something unique per brand.
I'm thinking of adding a invoice_prefix to the brand table. Then the brands would each have a three digit prefix, such as DAN-.
What would be the best way of adding the brands prefix followed by a 5 digit random number to a column in the invoice table?
I'm open to suggestions of better ways of doing this!
The end result I would like is for each invoice to have a unique reference similar to DAN-98372.
I think the best way would be to add the prefix column to the brand table and then create an before_create action for invoices that inserts a random number after the brand prefix. I'm just not sure on the best way to do this.
before_create :generate_reference
private
def generate_reference
self.invoice_number = self.brand.prefix
end
The above code correctly pulls in the brand prefix, but I'm unsure how to add a random 5 digit number afterwards.
I think something like <%= rand(1000..9999) %> would work, but I'm not sure how to add that to the brand prefix in the before_create.
I'm not very familiar with after_create methods so any advice would be appreciated!
you can use
https://github.com/patdeegan/integer-obfuscator
or https://github.com/namick/obfuscate_id
that way you can hide how many invoices you really have and it will be unique
From the provided info, its a case of polymorphic association. refer http://guides.rubyonrails.org/association_basics.html.
In the code provided, u should call 'generate_reference' 'before_create' rather than 'after_create' since u want the assigned values to be saved. specifying 'after_create' will go infinite loop.
Generate random data resources
https://github.com/wemersonblend/fakejs

Oracle PL/SQL - Generate Invoice

I have a basic database for a shop with product, sales and customer tables. I need to generate an invoice for each customer every 3 months to show the customers total expenditure.
What I'm not sure about is the way to go about this. Should I have an invoice table?
Any help or tips greatly appreciated.
How about creating a view based on a select statement using those tables. Then just refer to the view. You can also create a stored procedure or function that accepts an input like customer ID. I'd go with the view route personally.
Yes
What invoices you've generated is valuable information that you don't want to lose. How else do you know who's paid which invoice?
You want to be able to say exactly what invoices you've sent out, the value of those invoices and exactly what items they correspond to.
Personally not only would I have an invoice table but an invoice items table as well.