We also inject a context key to ignore prediction in case account_predictive_bills (enterprise) is installed. This way, having the same label on invoice lines generated by the helper will still behave in the same way, even if enterprise is installed.
closesodoo/odoo#67998
X-original-commit: b6c37754532ae6a7cc1f68a345fde6258abdc893
Related: odoo/enterprise#17125
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
Before this, due to the order the lines were interated on (their sequence), some lines were duplicated without parent, making the duplicate report's layout different from its parent. We now ensure we treat the lines in an order that guarantees the parent line has always been copied before its children.
closesodoo/odoo#68011
X-original-commit: c815342b986851e0a4733ed5bf9fbcc7f8fb7442
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
The current behavior was to set the label as memo in the payment register wizard.
However, this is to restrictive when a vendor bill hasn't any payment reference but a bill reference.
In that case, the user is expecting to have the bill 'ref' in the payment 'memo'.
Since the matching rules in the reconciliation widget are matching line.name, then line.move_id.ref and then line.move_id.name, the same logic is applied here to construct the payment 'memo'.
closesodoo/odoo#68004
Opw: 2440389
X-original-commit: 92ceb86d58f4d78c8a4256f29d101d3730517b93
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
It shouldn't be possible to create refunds on misc journals, as the tax report would compute the wrong multiplicator sign, and hence end up being entirely wrong.
Introducing the constraint also allowed finding an issue within _move_autocomplete_invoice_lines_create: some tests directly create an invoice by giving it line_ids instead of using the invoice_line_ids helper. The former implementation of this function made it so that the default type wasn't set in the context properly, and these tests were putting their invoices on misc journals. We fix this here as well.
closesodoo/odoo#67965
X-original-commit: fdc96de0e411760f84a78c36543f9157332346de
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
Allow creating a journal entry in the past after having changed the
sequence number reset on newer sequences.
opw-2445559
closesodoo/odoo#67963
X-original-commit: 26a43f23ec2b2490aec0731e25568703729581f0
Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
Signed-off-by: William André (wan) <wan@odoo.com>
The crash manager doesn't recognize ImbalanceJournalEntryError as
a user error and when creating a journal entry that is not balanced,
a traceback is shown instead of the normal UserError dialog.
In this commit, we fix this issue by getting rid of the new error
and put back the use of UserError when checking the balance of an
account move. We also make sure that the feature in pos where we
show a wizard to unblock the user from closing session with
imbalance amount is intact.
closesodoo/odoo#67743
Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
Fine tuning of f816c326f348ff78a982f91a736cc005d3e0cd31
We should not look at the `seq` when grouping again.
opw-2472061
closesodoo/odoo#67788
X-original-commit: fd36a69a6ed1484d6b7570dae3ff63d3f12ad035
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
Signed-off-by: William André (wan) <wan@odoo.com>
Issue:
- Activate "Analytic Tags" and "Analytic Accounting" Settings
- Create an Analytic Tags and select "Analytic Distribution"
- Create Product -> Product type: Storable product, Update Quantity as
100, Sales Price like 100
- Product category -> Costing Method: Average Cost (AVCO)
Inventory Valuation: Automated
- Create Analytic Defaults Rules -> select created Analytic Tags
& Product.
- Create a SO -> Confirm it -> Delivery -> Validate it
then system give validation message message:
"The operation cannot be completed: another model requires the record
being deleted. If possible, archive it instead.
Model: Analytic Line (account.analytic.line),
Constraint: account_analytic_line_group_id_fkey”
But can be validated from the Inventory app.
Technical information:
It is due to the `default_group_id` in context put in
`action_view_delivery` method, it context key allows to create delivery
(tree view of `stock.picking`) with the correct `group_id`
("Procurement Group").
But the this name field is also used in the
`account.analytic.line` model. Moreover, the
the `_prepare_analytic_distribution_line` doesn't return any value for
`group_id` which means, that at the creation of the
`account.analytic.line` the `group_id` (id of `procurement.group`)
which will wrongly used.
Solution:
Because the `group_id` field on `account.analytic.line` is a related
store of `account_id.group_id`. We can set it directly in the
`_prepare_analytic_distribution_line` with the correct value.
opw-2442493
closesodoo/odoo#67780
X-original-commit: c9f55c5ecf174414f8e9ed6df56170ac2c6d6e3e
Signed-off-by: William André (wan) <wan@odoo.com>
Before this commit, in the kanban view of sale order lines, the
product's image was not visible.
This commit adds the image to be more consistent with the kanban view in
accounting.
Note: we have also tweaked the view in accounting for better clarity.
Task ID : 2200168 (6.b)
closesodoo/odoo#67691
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
Before this commit, on mobile in the Accounting app, the link in a
kanban card was not well placed.
After this commit, in mobile we consider a link as a block so he is
moved below.
Steps to reproduce:
* Open Odoo on Mobile
* Go to Accounting => Bug ("Create Manually" is in a strange position)
Task ID : 2200168 (4.a)
closesodoo/odoo#67692
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
Steps to reproduce the bug:
- Create an Expense E
- Create a report R from E in the journal J (type=purchase)
- Generate the journal entry JE from R
- Go to Accounting Dashboard and click on J in the kanban view
Bug:
JE was not displayed in the entries filtered for J
PS: When creating a journal entry from an expense sheet, the move_type of the entry
is 'entry'.
opw:2474729
closesodoo/odoo#67674
X-original-commit: 31ca461ee3a6b9560fe6d78642e8fe5017b1085e
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
In India, we need to configure taxes like this:
- 6% applied on base amount
- 6% applied on base amount
- 1% applied on 1.12 * base amount
If both 6% taxes are affected the base of subsequent taxes, it gives the following result:
- 6% applied on base amount
- 6% applied on 1.06 * base amount
- 1% applied on 1.06 * 1.06 * base amount
Thanks to the new 'is_base_affected' field set on the second tax, it gives the expected results.
closesodoo/odoo#66134
Task: 2343958
Related: odoo/upgrade#2254
Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
Account move synchronization has already taken place during the creation
of the moves. No need for this additional check during the
reconciliation itself.
This commit helps when a lot of move lines are being reconciled at once.
For instance, the duration of the reconciliation of a batch of about 700
payments on a large database took 20 minutes before this commit, and
takes about 4 minutes after this commit.
closesodoo/odoo#67447
X-original-commit: e883fffaebd05727b399b26ca86cc54df79cde93
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
The test is running in sudo mode, so we need to specify the company in
the search.
Also do not load the demo data when installing as we would do the work
twice for most localization.
closesodoo/odoo#67235
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
- Add "payment_status" field to be more explicit.
- Turn error message "Expenses must have an expense journal specified to
generate accounting entries." into "Specify expense journal in tab
Other Info to generate accounting entries."
closesodoo/odoo#65528
Task: 2424870
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Tests are crashing when the number of months between the data date and today is higher than 18 months due to the 'past_months_limit' field on account.reconcile.model.
closesodoo/odoo#67051
X-original-commit: fd2c14374598b7009b70196ccc6ac3607b30245a
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Since 14.0, 'currency_id' and 'amount_currency' should always be filled when creating account.move.lines.
X-original-commit: 7827875271adafbfc656fe09c87e37e7d1a3802f
A move with type 'entry' cannot be posted in a 'sales' journal. It should be
the default 'miscellaneous' journal instead.
closesodoo/odoo#66851
X-original-commit: 1c45685922b5561b8bce1c91b158184837391089
Signed-off-by: William André (wan) <wan@odoo.com>
Signed-off-by: Alex Tuyls <alt-odoo@users.noreply.github.com>
In case a yearly sequence is set for out_invoice/in_invoice types and if we set
a monthly sequence on the corresponding out_refund/in_refund type, we will not be
able to validate the refund the next month as it will be wrongly identified as a
yearly sequence. We should include the move type when retrieving the last
sequence name instead.
X-original-commit: 612f453a7424c582ba0f581b241d9a41f8908e2c
When reconciling a statement line from the bank reconciliation widget, the journal entry of the statement line is already posted and then, the analytic lines was never created.
This commit fixes the issue by refreshing the analytic lines at the end of the statement line's reconciliation.
closesodoo/odoo#66850
Opw: 2466236
X-original-commit: 2c38dc6e34ebb8d4590adead74ebf02fee40d66a
Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Suppose an invoice of 1200USD = 3600EUR reconciled with a payment 1800USD = 3600EUR.
The generated exchange difference journal entry is:
600USD = 0EUR because 1800 - 1200 - 600 = 0 and 3600 - 3600 = 0
=> Everything is reconciled and all residual amounts are 0.
Remove the reconciliation. The exchange difference entry is reversed in other to cancel it.
Because the current exchange difference entry contains a line of 600USD, the reversal is creating a line of -600USD.
Before this commit:
Because both lines were sharing the same foreign currency (EUR) but have an amount_residual_currency of 0, no partial was created and then, a new exchange difference was generated in order to fix the amount_residual of 600 in USD.
After this commit:
A partial is created to handle the residual amount in USD even the residual amount in foreign currency is already zero.
Note: this issue is also there when the reconciliation is made using the company's currency with different foreign currencies.
In that case, amount_residual is zero but not amount_residual_currency.
closesodoo/odoo#66825
Opw: 2450699
X-original-commit: 07d5735de0e1b3080676ab26e872e55120fa2628
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Now when duplicating a bank or cash journal, the outstanding accounts are
the same as the original journal.
Added a compute method for payment_credit_account_id and payment_debit_account_id
to retrieve the default value from the company. These default accounts can be
changed in the settings.
Change UI for some settings (Default accounts).
Moving transfer_account_id into account module (from account_accountant).
Changing the tree view of account.journal:
- Edit journal_group_ids: Optional show
- Add currency_id: Optional hide
- Add code: Optional show
- Add default_account_id
- Add payment_debit_account_id: Optional hide
- Add payment_credit_account_id: Optional hide
- Add active: Optional hide
- Edit company_id: Optional hide
Task ID: #2451842closesodoo/odoo#66087
Related: odoo/enterprise#16314
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
The search panel showing app categories in the app list is unnecessary
when opening the list with the context of searching for a localization.
This will change it so that panel is hidden in this case.
task id #2370971closesodoo/odoo#61456
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
When printing an invoice, the server tries to register one attachment as
main one (see #65320). However, if there is not any attachment, this
will raise an error.
OPW-2465995
closesodoo/odoo#66755
X-original-commit: 03d2e457b69b07f315187cd7f7299be4c838e177
Signed-off-by: Adrien Widart <adwid@users.noreply.github.com>
There is only a single mail template for invoices at the moment.
To make things easier to work with, this will add a new template for
credit notes.
Task id #2343331closesodoo/odoo#58244
Signed-off-by: William André (wan) <wan@odoo.com>
When printing a draft invoice, it raises an error.
The error comes from fix#65320: the latter registers the printed
invoice as main attachment, but this needs to be done only with posted
invoices.
OPW-2427247
closesodoo/odoo#66563
X-original-commit: 49a57dd5b34b66733564b31ed861fe9bfcbda2b3
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: Adrien Widart <adwid@users.noreply.github.com>
Issue
- Install "Accounting" module
- Create a new bill :
- Set vendor
- Set no payment reference
- Set a bill reference
- Add products to bill
- Confirm and click on Register Payment
Memo field has no value.
Cause
The memo field is based on lines name.
Lines name is computed in `_onchange_payment_reference`
and depends only on payment_referecence.
Solution
If no `payment_reference`, fallback on `ref` to set line name.
opw-2440389
closesodoo/odoo#66491
Co-author: nboulif <bon@odoo.com>
X-original-commit: 7a7dc212af7279544cffba362bce7daa4fc00865
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
For odoo-master Transifex project, no demo data
closesodoo/odoo#66500
X-original-commit: 813931ac850e5ba4181259a5957ec72226fb670c
Related: odoo/enterprise#16510
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
Solution is different in the case of the foward-port, see bellow.
Issue
- Init an instances of Odoo v13.0 'A' and v14.0 'B'.
- Install "Accounting" app on instance A & B.
- Set your email server on instance A & B.
- Activate 'External email server' in settings of instance A.
- Set an email alias for "Vendor Bills" on instance A.
- Send a "Customer Invoice" from instance B to alias of instance A.
- Fetch for new mail (in case new vendor bill don't appear) on instance A.
- Open the new Vendor bill on instance A.
Data are not parsed from pdf attachment.
Cause
No managing all attachements types:
- list(tuple(str,str), tuple(str,str, dict) or int) attachments : list of attachment tuples in the form
``(name,content)`` or ``(name,content, info)``, where content is NOT base64 encoded
- list id attachment_ids: list of existing attachement to link to this message
- Should only be setted by chatter
- Attachement object attached to mail.compose.message(0) will be attached
to the related document.
Solution
In this fw-port, we override `_message_post_after_hook` instead of
`_message_post_process_attachments` because the later is also called
from portal and with sudo rights. We don't want to update invoices with
files coming from portal, since it could cause a security issue.
Also, because of the way attachments are parsed for invoice, this could
cause the OCR not to work any longer because at the time
`_message_post_process_attachments` is called,`move.message_main_attachment_id`
is not set yet, and OCR relies on it.
The solution is rather to override `_message_post_after_hook` because
it ensures that all the attachments have been properly treated and are
present in `new_message.attachment_ids`, and `message_main_attachment_id`
is properly set.
opw-2411002
closesodoo/odoo#66458
X-original-commit: 0f6ad2a690f76d6bbbe92106fc8360f99eaac6c2
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: bon-odoo <nboulif@users.noreply.github.com>
This commit ba32244c10396ff8605e5533e08675a64fbf9d88 introduced an error when
validating pickings or reconciling
closesodoo/odoo#66366
X-original-commit: b20e689659a3e1c89279caf028592bf18a17c4f7
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
Reproduce:
* Create one move in a journal
* Create another move in another journal but in the same year
* Both journals should have a yearly sequence reset
* Post both moves at the same time
Bug:
They both are using the same sequence.
Expected:
Both should be using their own sequence.
closesodoo/odoo#66383
X-original-commit: f816c326f348ff78a982f91a736cc005d3e0cd31
Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
Signed-off-by: William André (wan) <wan@odoo.com>
When printing some invoices, they are not registered as main
attachment. Therefore, when sending a follow-up report, a UserError
message asks the user to print the invoices first.
To reproduce the error:
(Need account_accountant, use demo data)
1. Go to Accounting > Configuration > Invoicing > Follow-up Levels
2. Select "First Reminder Email"
3. Enable "Join open Invoices"
4. Create an invoice INV01 for customer C01 + Post INV01
5. Go back to Accounting > Customers > Invoices, select INV01
- ! Do not open the invoice. Just select it.
6. Print > Invoices
7. Go to Follow-up Reports
8. Select C01
9. Send by mail
Error: An error message is displayed: "You are trying to send a followup
report to a partner for which you didn't print all the invoices" but it
does not make sense because the invoice has been printed.
For a follow-up report to be sent, the invoices must have the field
`message_main_attachment_id` defined (see
[code](https://github.com/odoo/enterprise/blob/476d862aba396c54c7a47950e02af7aed008a2db/account_followup/models/account_followup_report.py#L311-L313)).
There are two ways for this field to be set:
- When sending the invoice, `_message_set_main_attachment_id` is called,
select one attachment and mark it as main one
https://github.com/odoo/odoo/blob/437b49860b46b5abb8f55ced349fece984968998/addons/mail/models/mail_thread.py#L1918-L1924
- When opening the invoice, if the sreen is large enough, a pdf viewer
is opened next to the invoice. This pdf viewer will call
`register_as_main_attachment`, the latter marks the `ir_attachment` as
main one:
https://github.com/odoo/odoo/blob/e6a41b118a94c5b101d127f6b70fc54958e9346b/addons/mail/models/ir_attachment.py#L17-L20
However, when the user only prints an invoice, nothing will set the
`message_main_attachment_id` field. Thus, this fix will call
`register_as_main_attachment` when a pdf is generated and will mark it
as main attachment.
OPW-2427247
closesodoo/odoo#66356
X-original-commit: 643e7b06aee2a91190a3a7271211e70e4888d595
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: Adrien Widart <adwid@users.noreply.github.com>
Task 2124952
Extract all the demo data from `l10n_generic_coa` to a new way of
generating the demo data for accounting modules.
Because the data needs to be created multiple times, and right after the
chart template instanciation, it cannot be done the usual way. Instead,
we use python generators to declare the data. It allows us to reference
data that was not created yet at the start of the creation of the demo.
An xml_id is given, prefixed with the id of the company it is created
for (just like the instanciation of the chart template)
To find the correct accounts, a helper method has been added to
`account.account`. It will look for an account with the correct xml_id
(which is the one of the l10n_generic_coa, that we have to put on the
other l10n modules too, in the future). If it didn't find the xml_id, it
will look for an account with the correct type. If it still didn't find
one, just take any account.
When closing pos.session and it turned out that during the creation
of journal entry the move lines are not balanced, pos automatically
balances the lines by crediting the amount to balance and recording
it to the default pos receivable account.
In this commit, we are changing the behavior by allowing the user
to choose which account the imbalance amount be recorded. So the
workflow becomes:
1. Close pos session fails.
2. Wizard shows the amount to balance and asks which account to
record it.
3. Confirm the wizard to successfully close the session.
closesodoo/odoo#62425
Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
- Go to Accounting > Configuration > Reconciliation Models
- Create a Reconciliation Model:
* Type: Suggest counterpart values
* Amount Nature: Amount Paid/Received
* Label: Contains test
* Counterpart Values: [Add a line with "Percentage of balance" as Amount Type and 100 as Amount, for example]
- Create a Bank Statement of any amount with "test" as Label and no Partner
- Post Bank Statement and Reconcile it
Created Bank Statement matches conditions of Reconciliation Model but Counterpart Values are not suggested.
No counterpart values are suggested if there is no Partner on Bank Statement
During preparation of reconciliation, reconciliation is skipped because an open balance
has to be created but no receivable/payable account is retrieved as there is no Partner
on Bank Statement.
If no Partner is set, receivable/payable account is retrieved from company.
opw-2441484
opw-2442491
closesodoo/odoo#66167
X-original-commit: b9052f30dd8c26e0402a7f4a55b72204e9f1e633
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>