Commit Graph
941 Commits
Author SHA1 Message Date
Merel Geens (mege) 0a273651d2 [FIX] point_of_sale: prevent closing a POS session multiple times in a
row

When it comes to closing POS sessions, both the frontend and the backend
currently have some way to prevent the same operations from executing
simultaneously because of repeated clicks. `closeSession` in the
frontend has a `closeSessionClicked` boolean that prevents the operation
 from triggering multiple times at once. `close_session_from_ui`
in the backend checks if the session state isn't already `closed`.

A flaw in the current logic is that
`update_closing_control_state_session`, which is called by the frontend
before `close_session_from_ui`, doesn't check the session state before
writing it to be `closing_control`. This means that if you time things
in such a way that the `closeSession` logic in the frontend triggers
again right after it finishes, it will call
`update_closing_control_state_session` and `close_session_from_ui`
again, which will happily close the session again, duplicating stock
moves and account moves resulting from it.

This fix has `update_closing_control_state_session` check if the session
is already closed and raises a UserError if so. This prevents the
duplicate closings and records from happening.

There were two variants in the UI I observed when the issue occurred:
the first is when the repeated execution of
`update_closing_control_state_session` and `close_session_from_ui`
successfully finished. In that case the session would be closed with
duplicate stock moves and journal entries.

In the second variant, from the repeated calls only
`update_closing_control_state_session` executed but not
`close_session_from_ui`. This could happen if the timing of the
frontend was such that it redirected to the POS dashboard before it was
able to call `close_session_from_ui`. In that case, the session would
be in the `closing_control` state, which is visible in the POS dashboard
. If the user then closed the session, it would be closed twice and the
duplicate records would again be created.

opw-2988701

closes odoo/odoo#107961

X-original-commit: 6b12c64e09c92fba96532658f959daf7d234223c
Signed-off-by: Trinh Jacky (trj) <trj@odoo.com>
2022-12-14 17:18:03 +01:00
niyasraphy 89c95544d6 [FIX] *: make some user errors translatable
*: base, account_payment, l10n_ar, mrp_subcontracting, point_of_sale, pos_restaurant, purchase, sale

closes odoo/odoo#107264

X-original-commit: edd928cd0c63a01d1ee8b28ed344f61e9b6d0b54
Related: odoo/enterprise#34676
Signed-off-by: Julien Castiaux <juc@odoo.com>
2022-12-09 11:48:50 +01:00
Jacky (trj) 149d5a9972 [FIX] point_of_sale: picking breadcrump display name
When clicking on the picking smart button through the `pos.order` and the `pos.session` views,
the displayed name shown was "To do" instead of "Pickings"

closes odoo/odoo#107330

X-original-commit: f39d96d6d9fb0c5f80188504d47523461c1b4ba2
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
Signed-off-by: Trinh Jacky (trj) <trj@odoo.com>
2022-12-06 17:12:16 +01:00
Brice bib Bartoletti 55f1a6ecd7 [FIX] account,pos,stock_account:add/update indexes
1) forward-port of this PR: https://github.com/odoo/odoo/pull/97000
   commit: c9209664ce3a4b10142bba4da6afb912afc983c2

2) use btree_not_null instead of simple btree for space optimisation

closes odoo/odoo#106484

X-original-commit: b743e736f764fd7d6e232d2c8eaf6b2e314c5f31
Signed-off-by: William André (wan) <wan@odoo.com>
Signed-off-by: Brice Bartoletti (bib) <bib@odoo.com>
2022-11-24 23:18:44 +01:00
Jacky (trj) d0f89b3478 [IMP] point_of_sale,pos_*: back to basics
Overall improvement and simplification (along with some minor re-alignment)
for the point of sale.

POS Dashboard:
- added a new check for companies that hasn't installed any chart of account,
this gives them a better understanding of the real problem.
- added a new `menuitem` in the configuration tab that list all the pos configs,
this gives the user a way to access the sub-config of a pos (and indirectly give
access to its whole settings)

Opening/closing control:
- the `MoneyDetailsPopup` is now opened through the `showPopup` method, we're
no longer using the css to show/hide.
- the details of the money (if it exists) is now given to the `MoneyDetailsPopup`
component, this allows to have a record data usable of the details and
the user doesn't have to start from scratch if he just wants to modify
one thing
- opening the `MoneyDetailsPopup` no longer resets the cash input, that way the
user can just quickly check if everything is correct again without having
to recount everything and this won't reset the outcome

Customer display:
- added "Powered by" before the Odoo logo in order to accentuate that
it's from the software used is from Odoo

Product screen:
- visual improvement of the `EditListInput` component which is mostly
used by the lot/serial number, it gives more information to the user
and better UX
- "Cash out" is now automatically selected upon opening the
`CashMovePopup`. No more minus sign (-) in the input amount. This
should give better intuitiveness and one less click to do
- no more clear search button shown if the search input is empty
- removed the hover and clickable effect on `CashierName` component
in the normal point_of_sale since nothing happens when we click on it
- increased the width of the click zone with a label in the
`ProductConfiguratorPopup` which makes it easier to select a radio input
- the `PrintBillButton`, `SplitBillButton`, `RewardButton` and
`ResetProgramsButton` are now disabled when nothing happens
- the `textarea` of the `TextAreaPopup` component has been fixed
and is no longer resizable

Partner list screen:
- fixed phone, mobile and mail icons the contact area
- increased details button size

Floor screen:
- when idle, no longer redirect to the floor screen if there's
an open error popup. An error popup is opened for a specific
reason, we shouldn't redirect while having this open or
automatically close it. Other kinds of popup will be
closed since those are issued by the user that went away.

task-2916197

closes odoo/odoo#97803

Signed-off-by: Masereel Pierre <pim@odoo.com>
2022-11-14 12:03:51 +01:00
Florent de Labarre e2fe70495a [FIX] point_of_sale : wrong api
Before this PR when you select a pos.payment in custom, it raise.
It doesn't make sens to use api.model here

closes odoo/odoo#104615

X-original-commit: 2abeb8cc5b015263ce49d765315712f92ec25c25
Signed-off-by: Trinh Jacky (trj) <trj@odoo.com>
2022-10-31 14:34:02 +01:00
niyasraphy 28ff040602 [FIX] point_of_sale: redirect to correct settings
Since the settings in POS have been moved to the general settings, we
have two way to access those general settings. First throug the general
settings, second when you open the shortlist of settings editable by
every pos manager and follow the link to the general ones.

In the second case, when we arrive into the general settings, the
settings displayed are not always the one of the POS config you come
from, because by default it only show the settings of the latest pos
config editted.

So we are now checking if we are comming from a pos config to display
the correct one.

closes odoo/odoo#104391

X-original-commit: b0df10c1e497f65b891f7141055e7f339d11b4b1
Signed-off-by: Masereel Pierre <pim@odoo.com>
2022-10-28 10:17:54 +02:00
niyasraphy 03a855d30e [FIX] point_of_sale: pos_config_ids field label
closes odoo/odoo#104342

X-original-commit: 27ff3e0f64f53caa62c3022bd3b7c41e29a8e721
Signed-off-by: Masereel Pierre <pim@odoo.com>
2022-10-28 10:17:52 +02:00
roen-odoo 029fa85831 [FIX] point_of_sale: fix traceback in pos_order studio
Current behavior:
If you try to edit the form view of pos.order in studio, you get a
traceback.

Steps to reproduce:
- Install point_of_sale
- Go to PoS order
- Click on studio
- Click on the button to edit the form view
- You get a traceback

opw-3008565

closes odoo/odoo#103838

X-original-commit: b616cad62a66aaaf8bfc7c79dbafd87174b9a1f6
Signed-off-by: Trinh Jacky (trj) <trj@odoo.com>
2022-10-24 13:05:54 +02:00
Jacky (trj) 503213e3cf [FIX] point_of_sale: duplicate message in the chatter session
Due to the 7e23eda02f change, cash control is now
independent of accounting and is only done in the Point of Sale. A mistake was made
in the refactor, a message was sent in the bank statement and in the session before.
Now we don't use the bank statement chatter so it should only be sent to the session

closes odoo/odoo#103684

X-original-commit: 6968c7761ef7b564950b9a672ee875975d249c83
Signed-off-by: Masereel Pierre <pim@odoo.com>
Signed-off-by: Trinh Jacky (trj) <trj@odoo.com>
2022-10-21 09:17:01 +02:00
lejeune quentin e032acc44e [IMP] point_of_sale: Add the possiblity to enable auto validate order
Actually if the customer pay with a electronic payment method the order
is automatically validated.

With this commit we add the possibility to activate or not this functionality

closes odoo/odoo#103569

Signed-off-by: Masereel Pierre <pim@odoo.com>
2022-10-20 11:18:45 +02:00
Goffin Simon af6178e628 [FIX] point_of_sale: Payment term 30% Now, Balance 60 Days not supported in POS
Steps to reproduce the bug:

- Let's consider a customer C with default sale payment term 30% Now, Balance 60 Days
- Go to the POS and open a session
- Select a product and set C as customer
- Click on Payment and select Cash and check Invoice

Bug:

A traceback was raised because several account move lines are created.

opw:3009062

closes odoo/odoo#103589

X-original-commit: 15f586b3dec5c951b10a7eea5aca219ad466da9b
Signed-off-by: Masereel Pierre <pim@odoo.com>
2022-10-20 09:21:03 +02:00
Victor Piryns (pivi) 44d4c65560 [FIX] point_of_sale: open POS sessions with restricted categories
Current behaviour:
We get a traceback when opening a POS session with restricted categories

Expected behaviour:
We should be able to start a POS session with restricted categories.

Steps to reproduce:
- Install POS
- In POS global settings add any category in the restricted categories
- Try opening a new POS session

Reason for the problem:
Incorrect domain right leaf, the reference field that is a pos.category
is not de-referenced.

Fix:
Add `.ids` at the tail end of the record reference

Affected versions:
- 16.0
- master

opw-3021490

closes odoo/odoo#103548

X-original-commit: 8c76afc161133b78239cf91d746a159d67f67c4e
Signed-off-by: Grazioso Andrea (agr) <agr@odoo.com>
Signed-off-by: Piryns Victor (pivi) <pivi@odoo.com>
2022-10-19 18:06:53 +02:00
Walid HANNICHE (waha) 6c903ddf53 [FIX] point_of_sale: group split taxes on product info
Steps to reproduce;
Create a tax with two accounts that take 50% each.

Bug:
In the info tab on the pos of a product with the tax
the tax will show as two lines.

Fix:
group taxes with the same id

opw-3006360

closes odoo/odoo#103365

X-original-commit: 860103130fd5de880d9b179f5e1218107f4be0de
Signed-off-by: Trinh Jacky (trj) <trj@odoo.com>
2022-10-18 13:17:16 +02:00
Nicolas Martinelli fbcec9e1f8 [FIX] mrp, mrp_subcontracting, point_of_sale: proper override
The overrides of the method have an incorrect signature [1] leading to
a crash.

[1] https://github.com/odoo/odoo/blob/1903f7aa2553b555b58df066f584feb4caf25e71/addons/stock/models/stock_warehouse.py#L1016

closes odoo/odoo#103149

X-original-commit: 46737295655a0d2280809a80f5bff45644410fc7
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2022-10-12 14:19:48 +02:00
rhe-odoo 9e6315924e [FIX] point_of_sale: close session from pos config
There was a traceback when closing the session from the pos config.
Step to reproduce:
 1. Open a session
 2. Go to the pos config
 3. Try to close the session

 This commit allows the user to close the session from the config.

closes odoo/odoo#102581

X-original-commit: a34c9ab209c7859ed500fb44d580cc546e56bd37
Signed-off-by: Trinh Jacky (trj) <trj@odoo.com>
2022-10-07 14:37:06 +02:00
rhe-odoo 6b54532093 [FIX] point_of_sale: sales_report payment issue
Problem:
In the point of sale, when a sale report is printed, the payment methods were written as [object object] because of the new translation behavior.

The sql function and the rendering is now written differently in order to see the labels of the payment methods

closes odoo/odoo#102497

X-original-commit: d17003541ec6a1ff23a4d21488352f360aee822d
Signed-off-by: Masereel Pierre <pim@odoo.com>
2022-10-06 19:59:16 +02:00
Pierre Masereel 0535e86216 [FIX] point_of_sale: display bank statement lines
Since the bank statements have been removed, we don't have anymore a
stat button to show the bank statement.

So we re)introduce a button that display the statement lines.

caused by: https://github.com/odoo/odoo/pull/99092

closes odoo/odoo#101929

X-original-commit: dd21c708cc08d484530bc7c8433ebbb79f59323a
Signed-off-by: Masereel Pierre <pim@odoo.com>
2022-10-03 19:22:45 +02:00
roen-odoo 16889c7120 [FIX] point_of_sale: invoice correctly marked as paid
Current behavior:
When the default intermediary account is the same as the default
receivable account define on customers, and you make a payment with
2 differents payment methods the invoice is not marked as paid.

Steps to reproduce:
- Set the Default Intermediary Account to be the same as the default
  receivable account on customers. (You can get the default account
  by creating a new customer and go in the accounting section and
  look for "Account receivable")
- Start a PoS session, select a customer
- Add some product to the order and click on payment
- Click on invoice
- Pay with 2 differents payment methods (cash and bank)
- Validate the order
- The invoice is not marked as paid (Amount due > 0)

opw-2972726

closes odoo/odoo#101106

X-original-commit: 439f7ee0ceae01eaba6a5a352e45531d5e9c9167
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
Signed-off-by: Engels Robin (roen) <roen@odoo.com>
2022-09-26 14:43:06 +02:00
PoMa 4fb0933986 [IMP] account: Optional bank statements
Bank statements are now optional in accounting. The users add statements directly and can assign statements for control reasons.
The users can enter end date and end balance real for the statements and attach the bank statement scan.

The system checks if there is a gap (lines without statement) before current statement and warns the user
with decoration, also we check if the ending balance match the accumulated balance of the last line.

Bank statement lines now show an accumulated balance and can be sorted by drag and drop in the same date, if the user drags a line
to a position with lines of another date, it simply doesn't have any effect.
Rename accumulated balance to cumulative balance, a better name

closes odoo/odoo#99092

Task: 2879904
Related: odoo/upgrade#3906
Related: odoo/enterprise#30824
Signed-off-by: Laurent Smet <las@odoo.com>
2022-09-20 15:24:23 +02:00
PoMa 7e23eda02f [IMP] point_of_sale: Implement cash control independent of accounting
Since bank statements are now optional in accounting, cash control logic is moved to `pos.session`.

Part-of: odoo/odoo#99092
2022-09-20 15:24:23 +02:00
Pierre Masereel 30a700ffe7 [FIX] point_of_sale: load pricelists in pos
When we were loading pricelists for POS, we were putting the
base_pricelist of an item in it. It comes from the prveious
implementation on javascript side when it was the reference to the
object that was shared.

As we have put it in python in a dictionnary and we need to serilize the
data.

We also only take the fields we need in POS

ISSUE-2968489

closes odoo/odoo#100425

X-original-commit: f15ac2b2688f68a049cdaa0580bb54f1e7784cab
Signed-off-by: Masereel Pierre <pim@odoo.com>
2022-09-19 13:20:46 +02:00
Pierre Masereel e01137bc21 [FIX] point_of_sale: apply payment terms on invoices from POS
When an invoice is generated from the POS there are no payment terms and
due dates put on the invoices. It was not really an issue before the pay
later feature, but now it is needed.

closes odoo/odoo#100189

X-original-commit: ed49bc766cf6956691ca87be50f352247828453f
Signed-off-by: Trinh Jacky (trj) <trj@odoo.com>
2022-09-14 23:38:11 +02:00
pedrambiria 8e81e00813 [FIX] point_of_sale: get the archived products in pos UI for a refund
Before this commit: If one of the PoS order lines' products were
archived, when clicking on the "Refund", it wouldn't show any line and
got an error.

Steps to reproduce the first issue:

	- Install the' Point of Sale' module
	- Open a PoS session
	- Add a product to the order
	- Validate the order and close the session
	- Archive that product_product
	- Clear your browser cache
	- Open a new PoS session
	- click on the "Refund"

	You get an error, and it wouldn't show any order lines.

Solution

	An archived product shouldn't be shown on the PoS UI, but it should
be available for the refund if it exists in one of the order lines. So
the solution is to modify the domain to get archived products if needed
for the refund.

opw-2849240

closes odoo/odoo#99965

X-original-commit: 084d3800f3cbd84941f0761c6668f959504f83cb
Signed-off-by: Masereel Pierre <pim@odoo.com>
2022-09-10 11:55:21 +02:00
Pierre Masereel 7734be4219 [FIX] point_of_sale: Invoice and close session without accounting
When you are POS user or manager and don't have any accounting acces
rights, yau get and access error when you try to invoice or close the
pos session because it tries to create account.move.

As the behavior in previous version let it do, we are putting the
missing sudo call to properly create an invoice and close a session.

closes odoo/odoo#99902

X-original-commit: 84347b43063fc3032da3e03b49fc57375d8324fc
Signed-off-by: Masereel Pierre <pim@odoo.com>
2022-09-09 14:41:31 +02:00
Eleftherios Kritsotakis 41273923f8 [IMP] pos_loyalty, point_of_sale: settings integration with new loyalty module
After this commit, the settings of coupons, promotions,
gift cards and loyalty cards are now managed under a
single one field in PoS Settings configuration. Moreover,
this settings field is "global" and shared between the
eCommerce and Sales app.

task-2959620

closes odoo/odoo#99060

Related: odoo/upgrade#3842
Signed-off-by: Masereel Pierre <pim@odoo.com>
2022-09-07 23:10:48 +02:00
Aurélien (avd) d6dc795e20 [IMP] pos: add some indexes to speedup Tax Report
Tax Report _compute_from_amls_grids query calls
two method overriden in pos_account_reports.

The resulting query contains EXISTS subqueries on pos_session.move_id
and pos_order.account_move. Because these two fields are not indexed
by default, the cost of the query can skyrocket in large databases,
leading to slow tax report generation.

closes odoo/odoo#99095

X-original-commit: 51e607a70be804b0cd614cccc36ea0145c934676
Signed-off-by: Rémy Voet <ryv@odoo.com>
2022-09-02 08:14:47 +02:00
Nicolas (vin) 1418388343 [IMP] POS: allows to create invoices for a pos order at a later time
Some countries, such as mexico, require a seller to be able to
generate an invoices from a ticket from a sale done in a shop,
even after a few days.
This change aims to allow this, by allowing to create an invoice at
a later date after the POS has been closed.
This is done by partially reversing the POS closing entry, and then
generating an invoice the same way it would be done at the POS closing.

The customer can scan a QR code if enabled in order to request the
invoice by himself, requiring him to fill a for to give the customer
information required for the invoicing.

Allows to fill additional fields dependent on the localization that are
required to be set on the partner or the invoice.

Task id #2946604

closes odoo/odoo#97675

Related: odoo/enterprise#30599
Signed-off-by: Laurent Smet <las@odoo.com>
2022-09-01 19:16:34 +02:00
Yannick Tivisse 39f92c2993 [IMP] point_of_sale: Remove pos_config_form js_class
Purpose
=======

The logic has been moved from the pos.config to the res.config.settings
model/views, and therefore this js_class is not used anymore.

closes odoo/odoo#98641

Taskid: 2958057
Related: odoo/enterprise#30658
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2022-08-23 15:05:43 +02:00
Ahmad Khanalizadeh ea4ee4e7ef [IMP] point_of_sale: better error message for identify customer failure
Before this commit if Identify Customer option was enabled for a
payment method in point of sale but no customer was set for an order,
we get a SQL constraint error that has no hints on where the problem
comes from.

This process can be improved by a better error message that directly
points out the problem.

opw-2907152

closes odoo/odoo#97566

X-original-commit: 06c8765d362f81aa92f25029cb5d4e9d4069b3d3
Signed-off-by: Trinh Jacky (trj) <trj@odoo.com>
2022-08-10 13:23:53 +02:00
Jacky (trj) a520745230 [IMP] point_of_sale: visual improvement
Small visual changes that should improve the user experience.
The loading demo data popup has been moved to the backend.
Created an Alert Popup that is less aggressive than an Error Popup

closes odoo/odoo#83780

Task-id: 2485062
Related: odoo/enterprise#26104
Signed-off-by: Masereel Pierre <pim@odoo.com>
2022-08-08 10:50:14 +02:00
william-andre d8d47f9ff8 [REF] accounting v16. Yeeeeaah
TLDR:
* invoices are implemented using computed methods instead of onchange
* the synchronization only happens when switching tabs in the Form view
  to improve perfs.

_______________________________________________________________________

The whole engine of the synchronization of Invoices to the Journal
Entries has been refactored
* by using computed fields instead of onchange functions
* by synchronizing only from invoice to journal entry in `create` and
  `write`
* by saving when switching tabs on the Invoice form, to synchronize
  before showing the values

This comes with numerous advantages:
* no need to call the onchange methods manually
* no need to use the Form emulator to build invoices (i.e. EDI, OCR,
  intercompany, ...)
* the performance for invoices with many lines improves drastically, going
  from 2 minutes to 4 seconds to create an invoice with 500 lines
* the model is more declarative, we can now see how the values are computed
  instead of having the values being copied from various places.
* remove the hack in `onchange` that disabled the recursivity of it,
  which was unexpected and needed to be managed manually in all the
  onchange methods

This means that:
* Some fields need to be exclusively computed on journal entries values
  or invoice values, more specifically the Tax Summary widget.
  It is now
    - computed from entry lines, when opening the view
    - computed from invoice lines when changing those, because the tax lines
      will need to be recomputed anyways, erasing previously set values
    - set with an inverse function when saving; after the sync has been done
* Some possible operations previously possible have been dropped.
  (i.e. look at the removed test test_in_invoice_line_onchange_accounting_fields_1)
  This is because such a behavior was undefined (how is changing the balance going
  to affect the unit price? How is the amount currency going to affect it?)

_______________________________________________________________________

Implementation Details
----------------------

The "dynamic lines", meaning the payment terms and the tax lines are now
only created in the `create` and `write` functions.
In order to reduce code duplication, it has been implemented using
context managers used in both `account.move` and `account.move.line`
These context managers help comparing the values before/after, acting
like a local `onchange`, but getting benefit from the dirty flags from
the `compute` dependences.
This is relying on computed fields on the move (`needed_terms`) and on
the lines (`compute_all_tax`) which contain the values needed for the
related move.
Depending on the needed values and the existing values (`term_key` and
`tax_key`, respectively) the context manager will determine what needs
to be created/updated/deleted.

Some related changes are to produce a `dict` instead of a `str` for the
`tax_totals` (previously `tax_totals_json`) fields, by simplicity to
reduce the complexity of IO, and simplicity of debugging, because the
logic of the field needed to change (cannot be computed at the same time
anymore since it needed the lines to be synced)

By simplicity, and also because it makes more sense, some boolean fields
have been merged into `display_type`:
* `is_rounding_line`
* `exclude_from_invoice_tab`
* `is_anglo_saxon_line`

The `price_unit`, `quantity` and other "invoice fields" are now not set
anymore on lines that are not product lines since it didn't make any
sense to have it.

Performances
------------

You have to keep in mind that a simple `create` didn't compute a lot of
fields, for instance not taxes were set, no payment terms,...
Now it does.

```python
import random
from timeit import timeit
from odoo import Command
domain = [('company_id', 'in', (False, self.env.company.id))]
products = self.env['product.product'].search(domain).ids
partners = self.env['res.partner'].search(domain).ids
taxes = self.env['account.tax'].search(domain).ids
def create(nmove, nline):
    self.env['account.move'].create([
        {
            'move_type': 'out_invoice',
            'partner_id': random.choice(partners),
            'invoice_line_ids': [
                Command.create({
                    'name': f'line{i}',
                    'product_id': random.choice(products),
                    'tax_ids': [Command.set([random.choice(taxes)])],
                })
                for i in range(nline)
            ]
        }
        for j in range(nmove)
    ])
                                                             # After  | Before
print(timeit("create(1, 1)", globals=globals(), number=1))   # 0.11   | 0.09
print(timeit("create(100, 1)", globals=globals(), number=1)) # 2.76   | 2.50
print(timeit("create(500, 1)", globals=globals(), number=1)) # 14.56  | 12.34
print(timeit("create(1, 100)", globals=globals(), number=1)) # 1.03   | 5.52
print(timeit("create(1, 500)", globals=globals(), number=1)) # 3.99   | 125.02
print(timeit("create(50, 50)", globals=globals(), number=1)) # 19.44  | 79.55
```

Another metric that can be used is running the test suite with
`--test-tags=/account` (only `account` installed)
* before: 404s, 267127 queries (366 tests)
* after: 318s, 232125 queries (362 tests)

Why this commit title?
----------------------

Someone told me that this was the perfect way of naming your commits.
c04065abd8

task-2711317

closes odoo/odoo#96134

Related: odoo/upgrade#3715
Related: odoo/enterprise#29758
Signed-off-by: Laurent Smet <las@odoo.com>
2022-08-03 13:44:49 +02:00
Martin Trigaux ffc525419a [IMP] base: avoid render with env mixup
The render API was confusing as mixing the access to the report and
the rendering env.

The ambiguity was present for code such as
`report.sudo()._render(record_ids)` where it was not clear if the
`sudo()` is needed to access to `report` or to `record_ids`. For low
priviledge users (such as portal or public), it was common to use
`report.with_user(SUPERUSER_ID)._render(record_ids)`.

This PR changes the render methods signature to be `api.model`. The
`report_ref` can be:
- ir.actions.report external id
- ir.actions.report id
- ir.actions.report recod
- `report_name` value

This will allow to call the report methods with any user and no longer
need to use `with_user(1)` to render reports as public user.

Task-id 2670865

closes odoo/odoo#91341

Related: odoo/upgrade#3650
Related: odoo/enterprise#27323
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2022-08-02 11:48:46 +02:00
Fabien Pinckaers 3363e55cac [IMP] cleanup of help messages in all modules
This commit aims at removing unuseful help message to:
1/ reduce translators work, to focus on more useful translations
2/ not sending unuseful information in load_views
3/ reduce help message to useful messages, so that we can mark
   fields having a tooltip in the future UI.
4/ some cleanup of existing messages too

The main use cases:
- REMOVED: help redundant with the field name, providing no extra info
- MOVED TO COMMENT: technical help messages, that should not be in UX

closes odoo/odoo#97279

Signed-off-by: Fabien Pinckaers <fp@odoo.com>
2022-08-02 00:26:53 +02:00
Pierre Masereel 4a996060e6 [FIX] point_of_sale: unable to change pos.config currency
This change moves the compute of the available pricelists to the compute of
the default pricelist. This reduces complexity in the compute of the pricelists
in response to the changes in the journal and/or it's currency.
This also avoid using the default method in the compute field that lead to errors.

closes odoo/odoo#97032

Related: odoo/enterprise#29931
Signed-off-by: Masereel Pierre <pim@odoo.com>
2022-07-29 01:51:13 +02:00
Joseph Caburnay 48aff86c42 [FIX] point_of_sale,*pos*: remove 'pos' field attribute
With this change, we are now assuming each field that starts with
'pos_' to be a 'pos.config' field that has value that will be saved
to the 'pos_config_id' record. We made that modification because by keeping
some related fields not written at the same time can trigger contraints at the
wrong moments that would lead to validation errors when not supposed to be.

Part-of: odoo/odoo#97032
2022-07-29 01:51:13 +02:00
Joseph Caburnay 633f0b6330 [FIX] point_of_sale: payment method check
When we are validating a pos configuration, a constraint is triggered to check
that the payment methods in cash have a journal with the correct currency. Since
there is also a journal_id on bank methods, we should also check those ones, and
also correctly set the defaults payment methods according to the current journal_id.

Part-of: odoo/odoo#97032
2022-07-29 01:51:13 +02:00
Eleftherios Kritsotakis b3067091ca [IMP] point_of_sale: download/print saleDetailsReport from closePosPopup
In this commit we make it possible for a user to
download/print the Sales Report of the current
session by clicking at the "download"/"printer"
icon at the lower right corner of the closing pos
popup. This is a commonly used feature. Thus, we
make the UI more usable.

In general, the sales report can be generated by two
different ways:

- either by providing a start and end time (products
within that time span will be included).

- or by providing a session_id (products that are sold
during this specific pos_session will be included) which
is used in some localisation modules (e.g. pos_l10n_se).

To achieve this, we generalized the `_get_report_values`
function to consider both possibilities. As a result,
the inherited version of the function at the
pos_l10n_se module was made reduntant, so we deleted
it.

NOTE: the "Printer" button will be displayed only when
a printer is connected to the IoT box.

task-2755384

Part-of: odoo/odoo#88006
2022-07-28 11:54:09 +02:00
Joseph Caburnay 5f22c8bf7f [FIX] point_of_sale: pos config label misalign
Also includes a fix that properly opens the pos ui when clicking
the button (link) "Click here to close the session".

closes odoo/odoo#96765

Signed-off-by: Trinh Jacky (trj) <trj@odoo.com>
2022-07-27 08:00:03 +02:00
root 8b62d124bf [FIX] point_of_sale: allow overriding mail values
closes odoo/odoo#96407

X-original-commit: 7a884b5cd46d943ed52e8c5aac2406010b013411
Signed-off-by: Masereel Pierre <pim@odoo.com>
2022-07-25 12:39:54 +02:00
aliya 26b2472f49 [IMP] account: refactor account types
Task: 2856281

- Remove user_type_id, account.account.type model, internal_type
- Add account_type that is a simple selection field
- Move internal_group and include_initial_balance to account.account
- Because of these changes, type_control_ids on account.journal is also removed

closes odoo/odoo#93212

Related: odoo/documentation#2223
Related: odoo/upgrade#3595
Related: odoo/enterprise#28205
Signed-off-by: Cedric Snauwaert <csn@odoo.com>
2022-07-08 19:52:15 +02:00
pedrambiria ae28f02912 [FIX] point_of_sale: wrong fixed taxes sign for zero amount products
Before this commit: If a fixed tax is used for a product with the price
of zero, the tax line sign would be positive and lead to an unbalanced
move. The solution is to use its sign in its context for correct
calculation.
Also, in the PoS front-end, when you want to return a zero amount
product with a fixed tax, its sign would be positive, which is
incorrect.

Steps to reproduce the first issue:

	- Install 'Point of Sale' module
	- Create a new 'Tax' X with a fixed price (e.g.: 1 $)
	- Create a new 'Product' with zero Sales Price
	- Create a PoS session
	- Add the product to the order
	- Close the session

	It creates a line for the "Difference at closing PoS session," and
doesn't prevent closing. But the problem is that the tax capture as
debit is incorrect. The tax for the invoice must be credit.

Steps to reproduce the second issue:

	- Install 'Point of Sale' module
	- Create a new 'Tax' X with a fixed price (e.g.: 1 $)
	- Create a new 'Product' with zero Sales Price
	- Create a PoS session
	- Add the product to the order
	- Change the quantity to -1 (refund)

	The final amount is positive, while it should be negative.

Solution

	The sign must be sent in the context, and for the PoS front-end, it
should consider zero amount cases.

opw-2833590

closes odoo/odoo#95067

X-original-commit: c5fb4f778db95fb33845b9a5e0c2190d4d9037ee
Signed-off-by: Masereel Pierre <pim@odoo.com>
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
2022-07-01 17:48:08 +02:00
pedrambiria f15902fea3 [FIX] point_of_sale: load archived payment methods
Before this commit, if one of the used payment methods was archived,
it would raise an error when loading the paid orders.

The solution is to load archived payment methods.

opw-2892321

closes odoo/odoo#94687

X-original-commit: 5c7b6bee2bdcaba0a2cde3d22d472e30640d9f09
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
2022-06-29 12:19:33 +02:00
Joseph Caburnay 055dbc25a4 [IMP] point_of_sale,pos_restaurant: use company's barcode nomenclature
This change removes the `barcode_nomenclature_id` in the `pos.config`.
Each pos session now starts based on the company's barcode nomenclature.

closes odoo/odoo#93072

Task-id: 2849415
Related: odoo/upgrade#3575
Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
2022-06-21 09:17:50 +02:00
Pierrot (prro) d2bd3427b6 [IMP] account: improve Journal Items UX
Journal items:
- 2 list views were available for the journal items. As these changes
    make them very similar, the "grouped" view is dropped and only
    the simple/normal list view is used.
- As the usefull information is now available from the list items,
    the more complex name that was previously used on the group by
    lines is not useful anymore.
- Removed duplicated filters.
- Added and modified columns of the list view.
- Removed the button opening the move form from the move line, and
    made the move name clickable (with same behaviour as the button).
- Removed edit button on some group by lines, as it can lead to
    unwanted access errors.
- Removed 2 filters and added 1.
- Added a field to use for the matching widget.
- `move_id` was replaced by `move_name`, because the sorting of the
    Many2One `move_id` is not based on its name and was thus not
    working as intended.

task 2855459

closes odoo/odoo#93586

Related: odoo/enterprise#28361
Related: odoo/upgrade#3598
Signed-off-by: Cedric Snauwaert <csn@odoo.com>
2022-06-17 16:31:00 +02:00
Pierre Masereel 0c555b6b5a [FIX] point_of_sale: stop creating double picking on pos order refund
When you are in anglo saxon accounting with posting stock changes at the
end of the session, we get an issue by using the refund feature in
backend.

If you have an order invoiced, and want to refund it, it'll create the
picking of the order immediately, which is not normal as it should only
be done when there is an invoice.

The problem is that the value of the field 'to_invoice' from the
original order is copied to the refund, and so act as the invoice is
made for the return.

To avoid this behavior, we are avoiding to copy it.

OPW-2848356

closes odoo/odoo#93645

X-original-commit: e8ef74397c0b02d051823142c3457413aabfeb21
Signed-off-by: Masereel Pierre <pim@odoo.com>
2022-06-15 10:00:12 +02:00
Pierre Masereel 2719014fb4 [FIX] point_of_sale: unlink move lines before creating custom ones
As we are trying to create custom move lines before unlinking the
reserved ones, we can be unable to reserve the lot we need if already in
another move line.

closes odoo/odoo#93508

X-original-commit: 64cc7ef34341043cf3a9a87e0a073cd9587696b5
Signed-off-by: Masereel Pierre <pim@odoo.com>
2022-06-14 15:59:54 +02:00
Pierre Masereel e65ddaf2d7 [FIX] point_of_sale: avoid unreserve more than reserved
When you are shipping later from POS and have a multi-step
configuration, you get an error saying that you cannot unreserve more
than what is reserved. It comes form a bad filtered list of move.

Now as we are correctly filtering the move on their product_id it
correctly works.

OPW-2854159

closes odoo/odoo#93336

X-original-commit: 93e0509d0ba7302ecdf5d0f6dbc2dbe90e98229d
Signed-off-by: Masereel Pierre <pim@odoo.com>
2022-06-10 20:40:21 +02:00
Joseph Caburnay fa111d449d [IMP] point_of_sale,*pos*: configure pos from general settings
Purpose:

- Move PoS settings in general settings to be consistent with the rest
  of Odoo (PoS being the only app where settings are split in two locations)
- Clean settings by enabling obvious settings or dropping unnecessary ones.

closes odoo/odoo#84719

Task-id: 2753430
Related: odoo/upgrade#3260
Related: odoo/enterprise#24425
Signed-off-by: Masereel Pierre <pim@odoo.com>
2022-06-03 16:39:51 +02:00
Joseph Caburnay b0b75575a0 [IMP] point_of_sale: do not reload when module is installed
When a module corresponding to a pos.config field is already
installed, do not reload the page.

Part-of: odoo/odoo#84719
2022-06-03 16:39:51 +02:00