Task 2003965
*** New menuitems for the accounting menu:
Miscellaneous
Journal Entries (default search on misc op journal, like in v12)
Journal Items (debug mode, same as V12)
Journals (=journal items)
Sales (group by entry, filter sales journal)
Purchase (group by entry, filter purchase journal)
Bank & Cash (group by entry, filter bank,cash journal)
Miscellaneous (group by entry, filter misc journal)
Ledgers (=journal items)
General Ledger (group by account)
Partner Ledger (group by partner)
Taxes (no group by)
*** Expand group by by default
*** Adapt the name of the groups for group by moves
*** Fold the attachment viewer
*** Correct the optional tree fields on invoices
closesodoo/odoo#34083
Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
Since 1594f82 a user can no longer checkin/checkout if not
in kiosk mode (warning "Wrong Pin").
The mentionned commit revealed a previous mistake: the pin was
never checked if `None` was provided because superuser does not have
group `hr_attendance.group_hr_attendance_use_pin`.
Pin checking should work as follows:
- For the logged in user: he should be able to checkin/checkout
without his pin through the "My attendances" action and with his pin
in kiosk mode
- For other employees: they should only be able to checkin/checkout with
their pin through kiosk mode.
The opportunity is taken to make method `attendance_action_change` private.
closesodoo/odoo#34058
Signed-off-by: Romain Libert (rli) <rli@odoo.com>
Since the use of the polib module in commit 632fa04, the Byte Order
Mark at the beginning of a po file is causing a traceback.
As stated on https://en.wikipedia.org/wiki/Byte_order_mark, the UTF-8
BOM (0xEF, 0xBB, 0xBF) may interfere with software that does not expect
non-ascii bytes at the start of a file, as it seems to be the case with
polib.
As the l10n_* modules are black-listed on the runbot, the traceback only
appeared in the lightly l10nall test.
closesodoo/odoo#34003
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
It seems to be a better solution to keep starting tests without being in debug
mode to avoid having new fields and menus appearing.
This commit simply drop the debug mode in test mode and retrieve the test
assets by checking if test mode is enabled directly.
closesodoo/odoo#34012
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
The purpose of this modification is to add the route buy on the
component of the desk combination. So it's more easy to setup a
production order that trigger multiple purchase order.
closesodoo/odoo#34021
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
This merge replaces the stage based probability on leads by a new Predictive Lead scoring mechanism based on Naive Bayes Probability computation theorem.
Probability are now computed automatically based on past experience (already lost and won leads)
and based on multiple criteria (field values on leads). The user is still able to set a probability on a lead manually, or come back to a automated probability, both via the lead form.
A cron runs every day to rebuild the frequency table and to recompute all the active pending leads.
See sub commits for more details.
Special thanks to @awa-odoo who did his job. Quite well indeed!
Special thanks to @tbe-odoo who helped me for testing and performance optimisation.
Task ID : 1925439
NOTE : This task must be followed by task ID 2008365 : Remove old lead scoring system
closesodoo/odoo#33589
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
The "BoM Structure report" should not include the cost of the products
as it is often shared with third parties. We now only display the cost
on the "BoM Structure and Cost report" and remove the "BoM Cost report"
as it is redundant with the former.
Task Id: 1969709
closesodoo/odoo#33323
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
Before this commit, those pages would be flag as noupdate.
If not modified, those view would not get modification on module update, which
is not logic.
Now, those view will benefit from any update. It makes even more sense since
multi-website as those views will never get modified directly (it will COW).
closesodoo/odoo#33920
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
The tests relative to workcenters planning takes (sometimes) long time
to be executed. Before investigation more deeply, this commit relax a
bit more the tolerance delta in the test comparison
closesodoo/odoo#33939
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
This commit aims to propagate the cancellation of a purchase order or a
request for quotation to the relative stock moves. And thus respect the
configuration of the stock rule.
Task 1913297
closesodoo/odoo#33803
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
cancelling propagation in a move chain was True be default. That means,
without any configuration, a cancel move will always cancel its next ones
This commit change the default to allow only cancelation of move chain
until the stock location. Here are 2 examples :
1. Reception and delivery in 3 steps. The moves chain is the following:
Vendor -> Input -> Quality -> Stock -> Pack -> Output -> Customer
In case the Purchase order is cancelled, we want to move from Vendor to
Stock are cancelled but not the ones from Stock.
2. pbm + sam. The manufacturing process is the following;
Stock -> Pre-prod -> Production -> Post-prod -> Stock
cancelling the first move should cancelled until Production and not after
Task : 1913297
This new Predictive Lead Scoring (aka PLS) replaces the stage based probability mechanism.
It uses Naive Bayes probability computation theorem.
The lead probability is now computated automatically based on multiple criteria (= frequency fields).
Some are mandatory and will always be used, some are optional and can be activated
in the settings.
- Mandatory fields :
- team_id
- stage_id
- tag_ids
- Optional fields :
- email_state (validity of the email_from field: correct / incorrect or empty if email_from is empty)
- phone_state (validity of the phone field !! not the mobile one !!: correct / incorrect or empty if phone is empty)
- country_id
- state_id
- source_id (UTM Source)
PLS uses a start date to consider only the lead created after that date to generate the frequency table
and to recompute the lead probability. This date is also configurable in the CRM settings.
Default start date is date.todays() (at module install).
The settings for PLS are NOT company related :
PLS Fields = Many2many to a model that store only the fields allowed for PLS computation.
PLS Start Date = Date
As Date and Many2many fields are not allowed for config_parameters,
Char fields are used to store the configuration
and Date and m2m fields are used to ease the configuration by the user in the config panel.
Date and m2m fields are both computed fields based on their corresponding Char fields.
Char field for Date store a strigified date.
char field for Many2many store a comma separated string which is a list of activated fields.
Each mandatory field is used in a specific way
- Team_id : the frequency table is split for every team_id, plus once for leads that don't have a team_id.
Considering Lead A from Team 1 and Lead B from Team 2.
Even if Lead A and Lead B have the exact same attributes (country, phone, email,stage, ...),
their probability will most likely not be the same.
That's because each teams compute their leads' probability based on their own won/lost leads.
- Stage_id : if no optional fields are activated and if there is no tag on the lead,
this will make PLS work quite the same way as it was working with removed stage based probability,
as only the stage will count in the computation.
But here, instead of fixing manually the probability for each stage,
this stage related probability is automatically computed based on past experience (won and lost leads).
- Tag_ids : each tag is considered separatelly, as if the lead had only one tag.
(no link between tag on same lead is made). To avoid that a tag take to much importance if his subset is too
small, we include the tag frequencies in the frequency table only if at least 50 won or lost leads had this tag.
The frequency table is a table where all won and lost leads are aggregated by fields
(mandatory or optional if activated). For each team_id / field couple, we store the number of
won and lost leads that has that fields values.
For example: Lead A is assigned to team 1 and client comes from France and has been won.
If we consider only this lead A, the frequency table will looks like :
id | variable | value | won_count | lost_count | team_id
--------+-------------+-------+-----------+------------+---------
1 country_id FR 1 0 1
To computed the probability of a lead, we get all the records for the frequency table
that match all fields (per team_id) and we compute a won score and a lost score.
The probability is computed and normalized based on those scores
- P = S(Won) / (S(Won) + S(Lost))
Considering two variables A and B :
- S(Won) ∝ P(A∩B | Won)*P(Won) = P(A|Won) * P(B|Won) * P(Won)
- S(Lost) ∝ P(A∩B | Lost)*P(Lost) = P(A|Lost) * P(B|Lost) * P(Lost)
To overcome the 'zero frequency problem',
we do not start at 0 for the won or lost count for each variable / value combination.
It suggested to start at 1, but to avoid that a small subset take to much weight compared to
a larger one, we start at 0.1.
For example :
If we start at 1 : If team 1 has few records from France,
it can get high probability to win even if every lead where lost.
variable | value | won_count | lost_count | team_id | Probability
-------------+-------+-----------+------------+---------+-------------
country_id FR 1 7 1 0.125
country_id FR 198 7306 2 0.0263
If we start at 0.1 :
variable | value | won_count | lost_count | team_id | Probability
-------------+-------+-----------+------------+---------+-------------
country_id FR 0.1 6.1 1 0.0161
country_id FR 197.1 7305.1 2 0.0263
The more we have records for each couple, the more the computation become precise.
The allow the user to decide himself which probability should be set on the lead,
a manual probabiltiy system has been implemented using 2 stored fields + 1 computed field :
- probability (stored): Probability set on the lead, can be set manually in the lead form.
- automated_probability (stored): Probability computed by PLS.
- is_automated_probability (computed): If both previous fields are equal, the probability is considered
as automatic. and each time the automated_probability is updated, the probability is aligned.
If both are not equal, the probability is considered as manual. The automated_probability is still
updated but the probability is not aligned. The user can reset the probability in automatic mode
by clicking on the estimated probability displayed in edit mode in the lead form.
probability and automated_probability are not computed fields as they are manually computed at write and create.
The computation is triggered if one of the activated frequency fields is modified or set.
To trigger also the computation when modifying the lead values on the lead views (form and kanban),
_onchange methods have been added for each frequency field.
Also, a cron has been added to run every day to rebuild the frequency table and to recompute all active
and pending leads (not won nor lost) probability.
Task ID : 1925439
PR #33589
remove rerun cron on action lost and won
This commit prepares the next Predictive Lead Scoring (aka PLS) ones.
With the new PLS implementation, stage based probablility is not relevant anymore
as the probability will be computed based on multiple criteria
following the Naive Bayes probabilist theorem.
To determine if the stage is a won stage, a new 'won_stage' boolean field replaces
the old probability field that is now removed.
won_stage = True is equivalent to stage.probability = 100.
Task ID : 1925439
PR #33589
This commit moves phone validation from bridge module to crm directly.
This commit prepares the PLS feature (see next commits).
PLS needs the phone state to evaluate the probability to closes a lead.
So as crm will depend of phone_validation, the content of the bridge
module is moved in crm module.
Task ID : 1925439
PR #33589
As Flanker can be used to validate an email address and was originally
used in website_crm_score module, the Flanker usage is now moved into tools.
This commit prepares the next Predictive Lead Scoring (aka PLS) ones
as PLS will use the email state as computation variable,
it will need this flanker validation to compute first the email state.
We use also the already implemented normalized email as a double validation.
Flanker is not in the required dependencies of Odoo :
So if flanker is installed, it will check if email is valid
(checking DNS and other standard rules).
If Flanker is not installed, email_validate will only normalize the email.
Anyway, the email must at least be normalizable.
Task ID : 1925439
PR #33589
Since 72f7139f52, config.debug does not exist anymore, config.isDebug()
should be used.
Two commits merged at the same time were still using config.debug, 87a35d4263
and 88a26235caCloses#33961
In order for the map view to work properly:
- I moved scss property to a file only scoped to website module.
- moved the definiton of "partner_latitude" and "partner_longitude" from
base_geolocalise to base/res.partner
closesodoo/odoo#32487
Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com>
Since recent changes in multi company of odoo, the self.env.company is
only the preffered company and not the only selected anymore. So the
currency of a pos config is based on the pos config one and has nothing
to do with the one choosen by the current user.
closesodoo/odoo#33947
Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
The variable 'shop' that was set for POS receipt, was actually the stock
location and has been removed. But we forgot to remove its use in
pos_retaurant.
related commit: 8e30349fd1
Sale adds valued products in the default category, some tests change the
valuation of the default category and input_aml is hence wrong since it
contains aml of other products. Create a new product and category to
avoid side efffects.
Also, copying a product template and accessing its variant doesn't seem
to work anymore, i don't know why yet.
task-1875873
The examples are implemented at TestStockValuationChangeCostMethod.
The idea is that we want to keep some trace of cost method change and
keep the consistency of the data (eg what about a fifo stack when
changing to standard, that sort of things). We thus implement a simple
logic: when changing the cost method, empty the current valued stock
with the old cost method and refill the stock with the new one.
Some cost method changes are neutral accounting wise, others not.
The rationale is that cost method changes are a hard configuration changes
and databases where users changed cost method are undebuggable because
it is not possible to understand the resulting accounting entries.
The change of valuation (auto to manual and conversely) is not well
defined at the moment.
task-1875873
We need to increment the value of another layer. We don't want to write
on this layer in place as we used to do for multiple reasons:
- valuation at date: before the application of an lc, the value should
not change
- if the layer was consumed, we would need to adapt the consumers and
if one day we would have needed to understand what happened in the
fifo stack it would be hell
So we allow to create a valuation layer linked to another valuation
layer through a simple M2O O2M. At the time it is only used on the
landed costs to add value and no quantity so the code expects it would
be the case and it is not enforced. We adapt `_run_fifo` to use the full
value.
We also add a stat button on the landed cost to access the valuation
layers, like what is done for the picking and manufacturing orders.
task-1875873
Marking the invoice as open before creating the account moves breaks the
anglo saxon code as the invoice is considered openned before the account
moves are even created, see _get_anglo_saxon_price_unit of sale_stock
and the computation of qty_done (which should be renamed invoiced qty).
We did not test all the implications of this commit since the invoice
model will be removed anyway.
related to rev 299f9f1eb0
task-1875873
The tests of this module showed multiple issues with the anglos axon
accounting entries creation so we fix them by getting the value on the
valuation layer and not directly on the stock moves.
About the changes in
test_crossdock.py
> To change a standard price, we need to open the wizard
test_lifo_price.py
> To change a standard price, we need to open the wizard + read the
valuation on the layers.
test_stockvaluation.py
> Now that we create a layer in and out for a dropshipped move, the
accounting entries are similar to an in followed by an out, thus we need
to increment the number of generated AML. Not that the balance of the
accounts stay the same.
There's a slight change in fifo_perpetual_anglosaxon_ordered though.
Let's say for a start that this config doesn't make sense. Ordered means
we don't read the value on the stock move to create the accounting
entries but only the standard price. We had to change 8 by 10 in this
test because, before this task, the standard price was updated when
running fifo, even in dropshipped. As the PO line was valued at 8, the
anglos axon in stock out was at 8 because the standard price was changed
to 8 after the delivery.
task-1875873
No more hijacking _account_entry_move with context keys.
_get_accounting_data_for_valuation
> no changes
_prepare_account_move_line
> only use the cost, not the value in context
> take description as arg to pass it to _generate_valuation_lines_data
_generate_valuation_lines_data
> use the description received in arg
> remove forced ref in context
_create_account_move_line
> add a qty, descritpion, cost, svl_id as arguments
> remove forced_quantity fron context
_account_entry_move
> add a qty, descritpion, cost, svl_id as arguments
task-1875873
The new code was sitting next to the old one, now that everything is
adapted (minus the cost method changes), we can remove the old one.
We also adapt the valuation wizard to use the stock valuation layer
action, now that the others are removed.
task-1875873
A finished move is considered as an incoming move and will pass by
_create_in_svl. We thus compute the price_unit that will be set on the
valuation layer.
We also set a stat button on the MO displaying the valuation
layers, similar to the one on the picking.
task-1875873
We standardize the dropshipping by handling it as it was an receipt
directly followed by an out.
We also follow the same logic whatever the cost method, ie we don't run
fifo or update the AVCO.
task-1875873
Now that the vacuum is implemented and ran in AVCO, we can unskip the
old avco negative tests and implement new ones in
test_stockvaluationlayer to explain why we wanted to run the vacuum in
AVCO (see test_negative_1).
task-1875873
Re-implement _run_fifo_vacuum on the product this time with
float_is_zero and without remaining_value.
Trigger the vacuum at each receipt. Before it was done in the scheduler
each night, meaning the valuation on the move was not really
understandable nor consistent (the estimated value could be fixed by
some other move than the next receipt).
task-1875873
We don't implement fifo negative handling in this commit.
We make sure we run fifo in average mode to get a proper remaining_qty
field.
`_run_fifo` is now a method on product (since it could be user outside
of a stock move context). It is really similar to its ancestor on the
stock move, with a few float_is_zero and compare more and a missing
remaing_value.
We move the valuation sanity check into a proper helper,
_sanity_check_for_valuation.
We complete the _create_correction_svl method with accounting entries.
task-1875873
One of the goal of this refactoring is also to run the vacuum when the
cost method is AVCO. This will be used allow already out landed cost
on AVCO and also to have a consistent value when going into negative.
We update `_prepare_in_svl_vals` to set the remaining_qty field that
will be used when fifo is implemented. On the stock move, we create the
layer in with the real price unit of the move and adapt
product_price_update_before_done. This method will now compute the AVCO
according to the quantity valued in stock (quantity_svl) instead of all
the quantities in stock (qty_available), which was wrong (qty_available
could contain consigned quants).
We also make sure to recompute the avco when editing a done move.
We don't implement yet the negative handling as we'll need fifo for
that.
task-1875873
Valuation of standard move: We introduce _create_in_svl and
_create_out_svl and call these method in _action_done only on the
standard move, the other valuation methods still use the old code. We
hijack _account_entry_move to create journal entries anyway for the
valuation layer with a minimal diff. Helpers for the valuation layers
creation are added on the product because we will need to create similar
layer without stock move later on when we'll implement changes of cost
method. We also make a first implementation of the edition in the past
to make some tests pass, it will be completed with other cost method
implementation
Change of standard price: Before this commit, the wizard to change the
standard price was only displayed in perpetual, because it was used to
create accountign entries. We also use this wizard in manual now,
because we want to create a stock valuation layer. Fortunetaly, the
accounting fields of this wizard are not required if the product has a
manual valuation. And the new method is private.
We adapt the existing tests as well as we can and include the start of a
new battery of tests: test_stockvaluationlayer.py
task-1875873
This commit brings the model, views and compute method for the value and
the quantity valued. An ir rule prevents to read the value of another
company. Stat button are added on done picking to access the generated
layers.
Further commits will adapt one by one the cost method to actually use
the stock valuation layer when
As the goal is to move the valuation fields away from the stock move, we
set the necessary fields on the layer. Note the absence of `remaining_value`.
task-1875873