Commit Graph
279 Commits
Author SHA1 Message Date
Christophe Simonis fcb48b7241 [FIX] purchase,stock_dropshipping: keep current company currency
Changing it is not needed and generated missmatch against existing
entries (created by l10n_generic_coa demo data, thus depending on module
install order).
2018-03-08 18:16:55 +01:00
Christophe Simonis bfe88c50e2 [MERGE] forward port branch saas-15 up to 0ae300e9e6 2018-03-08 13:22:28 +01:00
Nicolas Martinelli 1048fc6ed5 [FIX] purchase, stock_dropshipping: fix tests
Astonishingly, some people really need a green runbot to work.
2018-03-08 09:22:59 +01:00
amoyaux 03559629ee [IMP] stock: make immediate transfer and backorder multi
The purpose of this commit is to allow future modules that need
immediate transfer and back order function on multiples picking
to do it.

This commit does not modify the behavior of single picking processing
2017-09-26 09:31:26 +02:00
Simon Lejeune b27b86955f [FIX] stock_account
This commit fixes:
- an expected singleton in vacuum, as `_get_in_domain` should be called
  on the move we are looping on, not the whole recordset
- some entries were posted for non valuated stock moves
- the depends for the stock value where not correct and the value was
  not recomputed when it should
- there was a mismatch between `get_price_unit` and `_get_price_unit`,
  we rename all these method into the private one
- the valuation fields were copied on copied move. this proved to be
  problmatic when creating extra move
- in the `_fifo_vacuum` method, when looking for candidates, filter on
  available ones

We also refactore the way the valuation is implemented. Indeed, before
this commit, the valuation of a product was the sum of all the sum
fields of the valuated stock moves associated to the given product. This
proved to be the wrong approach when dealing with done stock move
edition and negative stock. Let's say you sold 20 items you do not have,
we'll post an entry with the estimated price and later, when we correct
this entry after receiving new products, updating the value was
complicated. We moved out from this approach by never editing the value
(it is the value at which the stock move was initially valuated) but
updating the remaining value: a negative stock move has a negative
remaining value, every time we compensate it we increase the value. Once
the remaining quantity is null, we wipe the remaining value. We adapted
the code according to this new principle, especially the code posting
the correction entry (that should compensate the negative remaiing
value).

A mechanism was not correctly implemented: increasing the quantity of a
done out move should re-run the fifo lookup. We extract the `_run_fifo`
method into a model method and add to it an optional quantity argument.
This allows to run the method from the write on a done stock move.

We also raise a blocking error if the valuation is 0, it means that the
user has not correctly set its master data.

We add a bunch of tests for all these usecases and complete some older
ones to check the total of account entries.
2017-09-25 15:34:55 +02:00
Fabien Pinckaers 0e4f3bb959 [IMP] stock: remove procurement orders to fufill immediately
This removes the procurement.order model. To fufill their needs SO, PO, MO and
stock moves now call the _run method of the relevant procurement.group.

This mecanism is now only used for stockable product, tasks now uses their own
independent mecanism.

The _run method will check all the applicable rules and create directly the
needed model to fufill the need.

The modules stock, purchase, mrp, extends the _run method to implement their
specific strategy relevant for the rule type they define.

If an exception happens the message will be logged as a mail messsage on the
source model, for example, if a sales order cannot be fufilled the salesperson
will now see directly the reason.

OLD commit messages:
[WIP] procurement: removing procurement.order in stock, sale, purchase, sale_stock. WIP
fixup! [WIP] procurement: removing procurement.order in stock, sale, purchase, sale_stock. WIP
[IMP] Basic tests
[FIX] test not necessary anymore
[FIX] remove unnecessary print statement
[FIX] unnecessary test + why passing warehouse worked before?
[IMP] purchase: one move by purchase order line
[FIX] purchase: correct inventory tests and pass move_dest_ids among procurements
[FIX] because of bad cherry-pick merge
[IMP] make mrp pass by adding move_dest_ids there too
[IMP] tests of sale_mrp, no need for cancelpropagation then
[IMP] better to consistently use recordsets also for one2many
[FIX] purchase_requisition
[FIX] Exceptions should trigger errors, which should be caught in the tests
[FIX] sale_mrp: remove usage of procurement.order and use sale order name instead of sol
[FIX] stock_dropshipping: add sale_line_id on purchase_line_id
[FIX] Remove pdb
[IMP] add stock_dropshipping files
[IMP] stock: search carrier through sale line instead of procurement group
[IMP] add procrule test and preision needed when updating sol
[FIX] sale_order_dates + [IMP] procurement exceptions by scheduler
[FIX] No need to return task
[IMP] move file as name changes and add corrections
[FIX] Continue Run Schedulers wizard fix
[FIX] name issues of takss
[FIX] updating sale order line, but there is still a problem with the recompute
2017-09-08 17:08:05 +02:00
Simon Lejeune 757758624f [REF] purchase: adapt tests
avergae price is now merged back in standard_price
negative stock are only corrected by the vacuum, so call it
2017-08-25 16:10:20 +02:00
Simon Lejeune 91d6957849 [FIX] stock_account: fifo and negative stock
rename `_get_candidates_out_move` to `_get_fifo_candidates_out_move`
and `_get_candidates_move` to `_get_fifo_candidates_in_move` as it's
more explicit that they're only used in FIFO costing.

Fix `_update_future_cumulated_value` to filter only on internal moves
and to remove the value added in the past (self is always an out move to
which we added some value) and rename into
`update_fifo_future_cumulated_value`.

In `action_done`, rename `qty_taken_for_candidate` to
`qty_taken_for_candidate` as it's the qty we take to compensate the
candidate and not a quantity we take on the candidate (in this case,
some old out moves that we could not valuate in time because the stock
was negative). We fix the write on the value and cumulated value to
decrease the qty_taken_for_candidate*move.price_unit, because an out
move has always a negative value and we actually substract the value of
`move` which is always an in move and has always a positive value.

We fix the purchase test where negative out moves were valued positively
and add `test_fifo_negative_1` that tests the sending of goods we do not
have and the receipt encoded afterwards.
2017-08-25 16:10:19 +02:00
Josse Colpaert 5e5cd08123 [REF] stock_account,etc: FIFO and average costing method
The new implementation of stock moves the cost of products from quants to
moves. So we have implemented the FIFO and average cost method based on
those moves instead of using quants.
 - When average price is choosed, a field average_price is set on the
   product.
 - The tests have been completed with an example of how fifo work with
   negative stock.

As the use of real price method is really rare, because of the rigor
required on traceability for such method, we removed this functionnality.
 - The tests purchase/test/fifo_price.yml have been adapted to use the
   FIFO costing method instead of real price.

The old report stock history doesn't exist anymore, and is replaced by
the move view that contains all the cost information.

The methods `get_price_unit` have been moved from the stock to
stock_account.

The methods `_set_default_price_moves` and
`set_default_price_unit_from_product` have been removed from stock.

Explaination of FIFO and average:
 - In action_done for an out move in average and fifo, the price_unit and
   stock_value are updated.
 - For FIFO, it will use the qty_remaining on the in moves to check from
   which in moves to take the stock values for the out.
 - In case of negative stock in FIFO, it puts also qty_remaining on OUTs.
 - In the case of average, it will take the cumulated value of the last
   move and divide it by the quantity in stock.  

This commit is pretty much a 'work in progress':
 - Edit 'done' moves when the costing method is FIFO doesn't trigger the
   replay the FIFO stack.
 - The landed_costs feature doesn't work.
2017-07-14 17:08:22 +02:00
Xavier Morel 5266708db5 [FIX] P3: syntax error in yaml file 2017-05-26 10:30:25 +02:00
Christophe Simonis c08a590bb1 [FIX] purchase: correct fifo test
Oversight of previous forward-port.
2017-01-02 15:07:14 +01:00
Christophe Simonis 81f59cee2c [MERGE] forward port branch saas-11 up to b844d93889 2017-01-02 14:38:59 +01:00
Nicolas Lempereur 13063dd177 [IMP] purchase: some l10n taxes could break test
For example l10n_ch has default included purchase tax on products. This
would impact the valuation of the product and fail the tests.

This commit removes these taxes in the purchase test (they are tested
elsewhere anyway) and also use python to change the company currency
(since the current way didn't seem to work).

opw-691996
2016-12-19 08:31:12 +01:00
Denis Vermylen (dve) 8dd5af673a [REM] account_voucher, purchase, mrp_byproduct: remove dead code
purchase, mrp_byproduct: remove unused tests

account_voucher: removed unused method in account_voucher that was still
refering a removed workflow.
2016-09-02 10:16:47 +02:00
Denis Vermylen (dve) ba3d3582bc [MIG] purchase: Migrate to new API 2016-08-05 14:04:37 +02:00
Martin Trigaux b6666cbfae [FIX] base: force a symbol on a currency
To avoid scenario as in 11346 where the report expects a currency symbol.
2016-08-03 16:36:09 +02:00
Goffin Simon 4142d6ed8e [FIX] purchase: unlink PO
A PO must be in state cancel to be canceled.
Before the fix, it was possible to cancel a draft PO
then if a PO linked to a procurement was deleted with being
canceled, the procurement stayed in running state.

opw:666311
2016-01-12 16:28:01 +01:00
Nicolas Martinelli b65c67a259 [IMP] product: new product_id field on supplierinfo
We introduce a new field on supplierinfo: product_id. Thanks to this
field, the vendor information which will be used in a purchase order can
be specific to the product variant.
2015-09-25 11:34:01 +02:00
Cedric Snauwaert 3659c0113b [FIX] purchase: fix purchase test to work with new accounting if no coa installed.
add the stock_journal property in the yml test and make python test depends from AccountingTestCase to prevent errors when launching these test without a localisation. Also raise error in code if no stock_journal is found.
2015-09-17 11:37:47 +02:00
Nicolas Martinelli 367cacfc7e [FIX] purchase: use proper uom and currency
The UoM and the currency of a product depends on the vendor. Therefore,
before searching for the price and minimum quantity we need to know
this information in order to do a correct comparison.
2015-09-06 22:03:23 +02:00
Nicolas Martinelli cb01be235e [IMP] purchase: adaptation due to the new Purchase module
Major changes:
- No generation of invoice from PO
- Remove workflow

Reason: complete rewrite of the Purchase module.

Responsible: fp, nim
2015-09-02 08:19:56 +02:00
qdp-odoo e4dc50bf58 [IMP] pricelists improvements. Was PR #8228 2015-08-31 16:57:32 +02:00
Nicolas Martinelli 699f95a8c7 [IMP] purchase: adaptation due to the new Sale module
Major changes:
- No use of UoS anymore

Reason: complete rewrite of the Sale module.

Responsible: fp, dbo, nim
2015-08-27 18:15:24 +02:00
Yannick Tivisse dfbc51135c [REM] Remove res_partner_13, replace him by res_partner_2 2015-08-25 19:27:21 +02:00
Christophe Simonis 2cf91d16a5 [MERGE] forward port of branch saas-6 up to 63e92cb 2015-07-22 16:17:54 +02:00
Fabien Pinckaers 5a3d0947f2 [IMP] Supplier --> Vendor 2015-07-16 14:55:20 -07:00
Christophe Simonis b16fd16e90 [MERGE] forward port of branch 8.0 up to 7d01029 2015-06-30 15:29:03 +02:00
Xavier Morel f5b88f6309 [IMP] minor perf improvement during tests
During tests, some creation of user records would unnecessarily trigger
password reset or set a password, both of which would trigger password
hashing which takes some time (for good reasons).

Fix by:
* passing no_reset_password in YAML tests and some Python tests still
  missing it (a number of Python tests already used it)
* removing passwords from YAML records as they're never necessary, the
  test user records are not expected to ever log in
2015-06-26 14:22:29 +02:00
Mahendra barad 75d7bbb46e [REF]Account: Refactoring the account, Change some fields name according to new api guidelines
code improvement

code improvement

payment_method to payment_method_id

writeoff_account to writeoff_account_id

property_account_receivable to property_account_receivable_id

property_account_payable to property_account_payable_id

property_account_expense_categ to property_account_expense_categ_id

property_account_income_categ to property_account_income_categ_id

property_account_expense to property_account_expense_id

property_account_income to property_account_income_id

property_account_expense_categ fix

sale_tax to sale_tax_id and default_sale_tax to default_sale_tax_id

purchase_tax to purchase_tax_id and default_purchase_tax to default_purchase_tax_id

ref_companies to ref_companies_ids

property_account_position to property_account_position_id

property_payment_term to property_payment_term_id

property_supplier_payment_term to property_supplier_payment_term_id

bank_accounts_id to bank_accounts_ids

payment_method fix after rebase

user_type after rebase

payment_method fix after rebase

after rebase

invoice to invoice_id

fix payment_method_id after rebase

code improvement

[IMP]user_type to user_type_id

[IMP]property_stock_account_input_categ, property_stock_account_output_categ to _id

[IMP]improve after rebase

[IMP]fix type

[IMP]Account: code improvement
2015-06-23 14:00:43 +02:00
Josse Colpaert 2cb3a90c1c [IMP] Barcode interface and transfer wizard in picking form instead
Pack operations will not appear in a transfer wizard or bar code interface anymore, but
in the picking form itself.  Some wizards are still needed however to ask whether a
backorder needs to be created and whether we need to do an immediate transfer

The biggest change in the model is in the picking where the locations of the picking
are not a related anymore, but need to be set. That is why the tests need to be changed.
This allows also to have pickings without moves initially and just move one pack e.g.
Locations won't be visible on stock moves in a picking either.  (as they should be those of the picking)

In order to avoid confusion, the pack operations are created immediately when stock is reserved and we
are not waiting until the wizard or the bar code interface is launched anymore.

The recompute button previously in the barcode interface will only appear when the reservation changed
and the user indicated in the pack operations that something was moved already.  Otherwise it will
recompute the pack operations.  That way the reservation on the stock moves, is reflected by the pack operations.

Return pickings are not confirmed automatically when confirming the return wizard.
That should make it possible to choose another location for the return.  (Don't return in output e.g.)

Barcode scanning is not in this commit.
2015-06-15 10:18:17 +02:00
qdp-odoo c04065abd8 [IMP] accounting v9. Yeeeeaah 2015-05-05 17:28:04 +02:00
ado-odoo 2ebbcba33a [FIX] purchase, product: clean messages on price per supplier 2015-04-20 11:53:32 +02:00
Christophe Simonis 3206a35aed [MERGE] forward port of branch 8.0 up to 8ac8281 2015-04-13 12:07:58 +02:00
moylop260 820d6aa760 [FIX] purchase: avoid duplicated product codes in demo/test data
Closes #5414
2015-04-07 10:17:16 +02:00
Christophe Simonis a329aa1949 [MERGE] forward port of branch 8.0 up to e27744d 2015-03-18 14:05:02 +01:00
Josse Colpaert 20312e2880 [IMP] Deleting PO lines should work the same way as Cancelling PO
Also the test is adapted.  When a product as treated as MTO, it should not
without notice change to an MTS.
2015-03-13 13:58:19 +01:00
Christophe Simonis 21c1686f06 [FIX] purchase: since 2aeb1e5, minimum_planned_date is a datetime field. Adapt test 2015-01-22 19:24:30 +01:00
Christophe Simonis 6f841038f3 [MERGE] forward port of branch 8.0 up to 3735394 2015-01-22 18:47:13 +01:00
Martin Trigaux 8598231763 [FIX] purchase: maximum recursion when write on minimum_planned_date
Do not write on the function field when you are writing on the function field.

- Now you do know what orders is right?
- I think I know...
- Orders is orders.
- I guess no one ever taught you not to use the word you're defining in the definition.
   ~~Lucky Number Slevin
2015-01-22 14:37:53 +01:00
Josse Colpaert 30bd0ead24 [IMP] Optimize orderpoint stock get + traversal of procurement subtraction + change edi format test date_planned to datetime
[IMP] Make sure dropship route can be chosen (takes prio)
2014-12-19 11:07:49 +01:00
Josse Colpaert 2f5ca4380a Revert "[IMP] Remove unnecessary refresh statements because of new api"
This reverts commit b213438176.
2014-11-17 09:44:10 +01:00
Josse Colpaert b213438176 [IMP] Remove unnecessary refresh statements because of new api 2014-11-17 09:24:06 +01:00
Christophe Simonis 31bf30d2d0 [MERGE] forward port of branch 8.0 up to ed1c173 2014-09-05 15:28:22 +02:00
Raphael Collet 2154cc9344 [FIX] purchase: fix test merge_order (check on date_order was not correct) 2014-08-04 15:50:14 +02:00
mdi-odoo bb5fd86f73 [IMP] tests cases: use float_compare instead of == 2014-07-22 10:38:37 +02:00
qdp-odoo e9abc723c0 Changed the type of fields.date_order on purhcase.order object from date to datetime 2014-07-08 16:04:09 +02:00
Raphael Collet cbe2dbb672 [MERGE] new v8 api by rco
A squashed merge is required as the conversion of the apiculture branch from
bzr to git was not correctly done. The git history contains irrelevant blobs
and commits. This branch brings a lot of changes and fixes, too many to list
exhaustively.

- New orm api, objects are now used instead of ids
- Environements to encapsulates cr uid context while maintaining backward compatibility
- Field compute attribute is a new object oriented way to define function fields
- Shared browse record cache
- New onchange protocol
- Optional copy flag on fields
- Documentation update
- Dead code cleanup
- Lots of fixes
2014-07-06 17:05:41 +02:00
Quentin (OpenERP) 7f5a7031ac [REV] reverted commit 9606, as it was hiding a bug instead of fixing it
bzr revid: qdp-launchpad@openerp.com-20140327103733-ogralnp2ycr4kwsy
2014-03-27 11:37:33 +01:00
Josse Colpaert 2038e005dc [IMP] Copy_data instead of copy in duplicate yml
bzr revid: jco@openerp.com-20140326165619-bjn81jj9r40idzuc
2014-03-26 17:56:19 +01:00
Quentin (OpenERP) e36b32a661 [MERGE] merged with main trunk (revision 9186)
bzr revid: qdp-launchpad@openerp.com-20140228131516-ihigousbe5p1nt68
2014-02-28 14:15:16 +01:00