Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.0] [ADD] stock_picking_invoicing_unified #128

Merged
merged 10 commits into from Mar 10, 2016

Conversation

pedrobaeza
Copy link
Member

Stock Picking Invoicing Unified

Odoo allows to select several pickings and click on "Create Draft Invoices"
option for creating the corresponding invoice(s) depending if you have
selected several partners and if you have marked the "Group by partner"
check.

But it only takes into account the first picking for selecting the type of the
invoice you are going to create (customer/supplier invoice/refund), mixing all
the lines on it. And not only that: if you have returned pickings, the returned
quantities are summed to the rest, instead of decreasing the amount to invoice,
which is the common practise when you have some returns.

This module overpasses this limitation, allowing to invoice them all together
without having to worry about that, and also having the extra feature of
reducing the amount in the invoice when you have delivered or received goods
and some of them (or previous ones) have been returned, instead of needing
to create 2 invoices and to conciliate them for the final/real amount.

Usage

  • Select several pickings from any of the menus that allows it (
    Warehouse > All Operations and click on any of the lines,
    Purchases > Invoice Control > On Incoming Shipments, etc).
  • Click on More > Create Draft Invoices.
  • In the resulting dialog, the proper invoices types that are going to be
    created are computed, and you have to select the journals for that types.
  • Click on Create button, and the invoices will be correctly created.
  • The lines of pickings that are not of the greater picking type are created
    with negative price unit.

Known issues / Roadmap

  • Add tests

@legalsylvain legalsylvain added this to the 8.0 milestone Feb 19, 2016
@clonedagain
Copy link

@lbellier maybe you will want to have a look at this module

@oihane
Copy link
Contributor

oihane commented Feb 29, 2016

LGTM 👍

pedrobaeza and others added 2 commits March 3, 2016 09:48
…not the price !

Give default value to journals (to behave like the stock_account module on this point)
Replace [:1] by [0], to make it easier to read
Add summary key in __openerp__.py
Re-phrase some parts of README.rst
@alexis-via
Copy link
Contributor

This is a really great module, I wanted to develop it one day, and you did it before me :)

I made a PR to enhance it:
pedrobaeza#1

The main change in my PR is that, for a return, the quantity should be < 0, not the price ! For example, you sell 2 units and the customer returns 1. With your implementation, in the invoice stats, you will see that you sold 3 units ! And if you want to do statistics on the average sell price for a particular product, it breaks it too.

My PR also adds default value to journals, to keep the same behavior on that point.

journal_id = fields.Many2one(required=False)
sale_journal = fields.Many2one(
comodel_name='account.journal', string='Sale Journal',
domain="[('type', '=', 'sale')]")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For curiosity: is there a good reason to use domain as a string, instead of sequence: domain=[('type', '=', 'sale')] ? I usually declare domains as a sequence in my Python code, not as a string... but I don't know if it is equivalent or not.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course it can be a list of tuples! Maybe a copy/paste from an XML view leads to this.

@pedrobaeza
Copy link
Member Author

@alexis-via, I haven't put negative quantities because I remember a constraint that prevents it. Did you check it?

@alexis-via
Copy link
Contributor

@pedrobaeza I didn't hit such a constraint during my tests. AFAIK, it is possible to have a negative quantity on invoice line.

…ed-alexis

stock_picking_invoicing_unified: for a return, qty should be < 0, not the price (plus some other details)
@alexis-via
Copy link
Contributor

👍 let's merge it !

@alexis-via
Copy link
Contributor

@pedrobaeza In the "models" subdir, the file stock_picking.py should be renamed stock_move.py

@pedrobaeza
Copy link
Member Author

@alexis-via, changes done.

@andhit-r
Copy link
Member

andhit-r commented Mar 7, 2016

Test steps:

  1. Create invoice from 1 delivery order and 1 incoming shipment (same partner)
  2. Open customer invoice created from step 1
  3. customer invoice data opened through supplier invoice form (see screenshot)

selection_001

It will not break any flow nor produce wrong accounting entry, but IMHO it will make untrained users confuse. Better put explanation on known issue. Other then that 👍

@pedrobaeza
Copy link
Member Author

The form view issue can't be solved easily. The only solution is to avoid the opening in form view. I'll merge this one and noted that problem as an issue. The standard also has that problem.

pedrobaeza added a commit that referenced this pull request Mar 10, 2016
…nified

[8.0] [ADD] stock_picking_invoicing_unified
@pedrobaeza pedrobaeza merged commit 8d9250b into OCA:8.0 Mar 10, 2016
@pedrobaeza pedrobaeza deleted the 8.0-stock_picking_invoicing_unified branch March 10, 2016 17:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants