Compare commits
57 Commits
14.0-shopi
...
14.0-imp-a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4f90a7fd91 | ||
|
|
1fd25be02f | ||
|
|
174fac6d88 | ||
|
|
9507d1fbd8 | ||
|
|
a89f1a9ae7 | ||
|
|
abb36545d9 | ||
|
|
296746ce6e | ||
|
|
d0a9ec27ef | ||
|
|
d3989e96d7 | ||
|
|
f1a0aa6253 | ||
|
|
c7bd3319a9 | ||
|
|
fe96425d84 | ||
|
|
a59c2e774a | ||
|
|
cad0654983 | ||
|
|
55622ec6a9 | ||
|
|
f166fe93be | ||
|
|
b8a6cbcfea | ||
|
|
f6b10a7caa | ||
|
|
371229e9e5 | ||
|
|
1dbfd23524 | ||
|
|
9a9459f013 | ||
|
|
5a58ae0d9a | ||
|
|
b162227645 | ||
|
|
3c24e94122 | ||
|
|
400f316c7f | ||
|
|
86af01667a | ||
|
|
8967bf289a | ||
|
|
1fdaf52787 | ||
|
|
6907302f8e | ||
|
|
a3e23ab5e7 | ||
|
|
a850586716 | ||
|
|
fdef51ea57 | ||
|
|
806389e04b | ||
|
|
c12b496004 | ||
|
|
447b0107be | ||
|
|
f9a7983d71 | ||
|
|
870746b965 | ||
|
|
f22c6522d5 | ||
|
|
1ef97629b7 | ||
|
|
77a372b3ca | ||
|
|
221b090cc8 | ||
|
|
e4a2ff5bd4 | ||
|
|
c1d334b109 | ||
|
|
c7c9b2d341 | ||
|
|
eddab6020a | ||
|
|
d1181ca91d | ||
|
|
bb83765ee2 | ||
|
|
88615a0774 | ||
|
|
05e649fa86 | ||
|
|
08118ec4f5 | ||
|
|
6d496ba302 | ||
|
|
40b79890fe | ||
|
|
58b8d300b8 | ||
|
|
cdcf4eb406 | ||
|
|
a22f79ef44 | ||
|
|
99dd4de4f7 | ||
|
|
ce2255623d |
@@ -52,6 +52,7 @@ This modules adds the following functions:
|
||||
* don't attach PDF upon invoice report generation on supplier invoices/refunds
|
||||
* Add filter on debit and credit amount for Move Lines
|
||||
* Add supplier invoice number in invoice tree view
|
||||
* Add date in outstanding payment widget on invoice form view (requires `odoo PR 84180 <https://github.com/odoo/odoo/pull/84180>`_)
|
||||
|
||||
Together with this module, I recommend the use of the following modules:
|
||||
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
'data': [
|
||||
'views/account_account_type.xml',
|
||||
'views/account_account.xml',
|
||||
'views/account_group.xml',
|
||||
'views/account_analytic_account.xml',
|
||||
'views/account_analytic_group.xml',
|
||||
'views/account_bank_statement.xml',
|
||||
'views/account_invoice_report.xml',
|
||||
'views/account_journal.xml',
|
||||
@@ -28,11 +31,14 @@
|
||||
'views/product.xml',
|
||||
'views/res_config_settings.xml',
|
||||
'views/res_partner.xml',
|
||||
'views/res_company.xml',
|
||||
'views/account_report.xml',
|
||||
'wizard/account_invoice_mark_sent_view.xml',
|
||||
'wizard/account_group_generate_view.xml',
|
||||
'wizard/account_payment_register_views.xml',
|
||||
'security/ir.model.access.csv',
|
||||
'report/invoice_report.xml',
|
||||
],
|
||||
'qweb': ['static/src/xml/account_payment.xml'],
|
||||
'installable': True,
|
||||
}
|
||||
|
||||
732
account_usability/i18n/fr.po
Normal file
732
account_usability/i18n/fr.po
Normal file
@@ -0,0 +1,732 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * account_usability
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 14.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2022-06-01 14:17+0000\n"
|
||||
"PO-Revision-Date: 2022-06-01 16:22+0200\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
"Language: fr\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: \n"
|
||||
"X-Generator: Poedit 3.0.1\n"
|
||||
|
||||
#. module: account_usability
|
||||
#: code:addons/account_usability/wizard/account_group_generate.py:0
|
||||
#, python-format
|
||||
msgid ""
|
||||
"%d account groups already exists in company '%s'. This wizard is designed "
|
||||
"to generate account groups from scratch."
|
||||
msgstr ""
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model,name:account_usability.model_account_account
|
||||
msgid "Account"
|
||||
msgstr "Compte"
|
||||
|
||||
#. module: account_usability
|
||||
#: code:addons/account_usability/wizard/account_group_generate.py:0
|
||||
#, python-format
|
||||
msgid "Account Groups"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model,name:account_usability.model_account_move_reversal
|
||||
msgid "Account Move Reversal"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model,name:account_usability.model_account_reconciliation_widget
|
||||
msgid "Account Reconciliation widget"
|
||||
msgstr "Outils de lettrage de compte"
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_journal__account_type_current_assets_id
|
||||
msgid "Account Type Current Assets"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_journal__account_type_current_liabilities_id
|
||||
msgid "Account Type Current Liabilities"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_move_line__account_reconcile
|
||||
msgid "Allow Reconciliation"
|
||||
msgstr "Autoriser le lettrage"
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model.constraint,message:account_usability.constraint_account_analytic_account_code_company_unique
|
||||
msgid ""
|
||||
"An analytic account with the same code already exists in the same company!"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model,name:account_usability.model_account_analytic_account
|
||||
msgid "Analytic Account"
|
||||
msgstr "Compte analytique"
|
||||
|
||||
#. module: account_usability
|
||||
#: model_terms:ir.ui.view,arch_db:account_usability.view_bank_statement_form
|
||||
msgid "Are you sure to unreconcile all the entrie of the bank statement?"
|
||||
msgstr "Êtes-vous sûr de vouloir délettrer toute les écritures du relevés?"
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_move_line__balance
|
||||
#: model_terms:ir.ui.view,arch_db:account_usability.view_move_line_tree
|
||||
msgid "Balance"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model.fields,help:account_usability.field_account_bank_statement_line__partner_bank_id
|
||||
#: model:ir.model.fields,help:account_usability.field_account_move__partner_bank_id
|
||||
msgid ""
|
||||
"Bank Account Number to which the invoice will be paid. A Company bank "
|
||||
"account if this is a Customer Invoice or Vendor Credit Note, otherwise a "
|
||||
"Partner bank account number."
|
||||
msgstr ""
|
||||
"Numéro du compte bancaire sur lequel la facture sera payée. Un compte "
|
||||
"bancaire de la Société s'il s'agit d'une facture client ou d'un avoir du "
|
||||
"fournisseur, sinon un numéro de compte bancaire du tiers."
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.ui.menu,name:account_usability.res_partner_bank_account_config_menu
|
||||
msgid "Bank Accounts"
|
||||
msgstr "Comptes bancaires"
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model,name:account_usability.model_account_bank_statement
|
||||
msgid "Bank Statement"
|
||||
msgstr "Relevé bancaire"
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model,name:account_usability.model_account_bank_statement_line
|
||||
msgid "Bank Statement Line"
|
||||
msgstr "Ligne de relevé bancaire"
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.ui.menu,name:account_usability.res_bank_account_config_menu
|
||||
msgid "Banks"
|
||||
msgstr "Banques"
|
||||
|
||||
#. module: account_usability
|
||||
#: model_terms:ir.ui.view,arch_db:account_usability.account_group_generate_form
|
||||
#: model_terms:ir.ui.view,arch_db:account_usability.account_invoice_mark_sent_form
|
||||
msgid "Cancel"
|
||||
msgstr "Annuler"
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model.fields,help:account_usability.field_account_move_line__account_reconcile
|
||||
msgid ""
|
||||
"Check this box if this account allows invoices & payments matching of "
|
||||
"journal items."
|
||||
msgstr ""
|
||||
"Cochez cette case si ce compte permet de faire du rapprochement entre "
|
||||
"factures et paiements."
|
||||
|
||||
#. module: account_usability
|
||||
#: model_terms:ir.ui.view,arch_db:account_usability.view_account_search
|
||||
msgid "Code"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model,name:account_usability.model_res_company
|
||||
msgid "Companies"
|
||||
msgstr "Sociétés"
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model,name:account_usability.model_res_config_settings
|
||||
msgid "Config Settings"
|
||||
msgstr "Paramètres de configuration"
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model,name:account_usability.model_res_partner
|
||||
msgid "Contact"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_group_generate__create_uid
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_invoice_mark_sent__create_uid
|
||||
msgid "Created by"
|
||||
msgstr "Créé par"
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_group_generate__create_date
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_invoice_mark_sent__create_date
|
||||
msgid "Created on"
|
||||
msgstr "Créé le"
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model.fields,help:account_usability.field_account_move_line__matched_credit_ids
|
||||
msgid "Credit journal items that are matched with this journal item."
|
||||
msgstr "Pièces au crédit qui correspondent à cette pièce."
|
||||
|
||||
#. module: account_usability
|
||||
#: model_terms:ir.ui.view,arch_db:account_usability.view_account_move_line_filter
|
||||
msgid "Current Year"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_bank_statement_line__date
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_move__date
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_payment__date
|
||||
msgid "Date"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model.fields,help:account_usability.field_account_move_line__matched_debit_ids
|
||||
msgid "Debit journal items that are matched with this journal item."
|
||||
msgstr "Pièces au débit qui correspondent avec cette pièce."
|
||||
|
||||
#. module: account_usability
|
||||
#: model_terms:ir.ui.view,arch_db:account_usability.view_account_move_line_filter
|
||||
msgid "Debit or Credit"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_account__display_name
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_analytic_account__display_name
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_bank_statement__display_name
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_bank_statement_line__display_name
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_group_generate__display_name
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_incoterms__display_name
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_invoice_mark_sent__display_name
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_invoice_report__display_name
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_journal__display_name
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_move__display_name
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_move_line__display_name
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_move_reversal__display_name
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_partial_reconcile__display_name
|
||||
#: model:ir.model.fields,field_description:account_usability.field_product_supplierinfo__display_name
|
||||
#: model:ir.model.fields,field_description:account_usability.field_product_template__display_name
|
||||
#: model:ir.model.fields,field_description:account_usability.field_res_company__display_name
|
||||
#: model:ir.model.fields,field_description:account_usability.field_res_config_settings__display_name
|
||||
#: model:ir.model.fields,field_description:account_usability.field_res_partner__display_name
|
||||
msgid "Display Name"
|
||||
msgstr "Nom affiché"
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_bank_statement_line__invoice_date_due
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_move__invoice_date_due
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_payment__invoice_date_due
|
||||
msgid "Due Date"
|
||||
msgstr "Date d'échéance"
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_bank_statement__end_date
|
||||
#: model_terms:ir.ui.view,arch_db:account_usability.view_bank_statement_search
|
||||
msgid "End Date"
|
||||
msgstr "Date de Fin"
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model,name:account_usability.model_account_fiscal_position
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_bank_statement_line__fiscal_position_id
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_move__fiscal_position_id
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_payment__fiscal_position_id
|
||||
#: model:ir.model.fields,field_description:account_usability.field_res_partner__property_account_position_id
|
||||
#: model:ir.model.fields,field_description:account_usability.field_res_users__property_account_position_id
|
||||
msgid "Fiscal Position"
|
||||
msgstr "Position fiscale"
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model,name:account_usability.model_account_fiscalyear
|
||||
msgid "Fiscal Year"
|
||||
msgstr "Exercice"
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model.fields,help:account_usability.field_account_bank_statement_line__fiscal_position_id
|
||||
#: model:ir.model.fields,help:account_usability.field_account_move__fiscal_position_id
|
||||
#: model:ir.model.fields,help:account_usability.field_account_payment__fiscal_position_id
|
||||
msgid ""
|
||||
"Fiscal positions are used to adapt taxes and accounts for particular "
|
||||
"customers or sales orders/invoices. The default value comes from the "
|
||||
"customer."
|
||||
msgstr ""
|
||||
" Les positions fiscales sont utilisées pour adapter les taxes et les "
|
||||
"comptes à des clients particuliers ou à des bons de commande/factures. La "
|
||||
"valeur par défaut provient du client."
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_move_line__full_reconcile_id
|
||||
msgid "Full Reconcile"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_usability
|
||||
#: model_terms:ir.ui.view,arch_db:account_usability.view_account_move_line_filter
|
||||
msgid "Fully Reconciled"
|
||||
msgstr "Lettrage Complet"
|
||||
|
||||
#. module: account_usability
|
||||
#: model_terms:ir.ui.view,arch_db:account_usability.account_group_generate_form
|
||||
msgid "Generate"
|
||||
msgstr "Générer"
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.actions.act_window,name:account_usability.account_group_generate_action
|
||||
#: model:ir.model,name:account_usability.model_account_group_generate
|
||||
#: model:ir.ui.menu,name:account_usability.account_group_generate_menu
|
||||
msgid "Generate Account Groups"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_usability
|
||||
#: model_terms:ir.ui.view,arch_db:account_usability.account_group_generate_form
|
||||
msgid "Generate account groups"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_usability
|
||||
#: model_terms:ir.ui.view,arch_db:account_usability.view_account_analytic_account_search
|
||||
#: model_terms:ir.ui.view,arch_db:account_usability.view_account_search
|
||||
msgid "Group"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_usability
|
||||
#: model_terms:ir.ui.view,arch_db:account_usability.view_account_journal_search
|
||||
msgid "Group By"
|
||||
msgstr "Regrouper par"
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_bank_statement_line__has_attachment
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_move__has_attachment
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_payment__has_attachment
|
||||
msgid "Has Attachment"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_bank_statement_line__has_discount
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_move__has_discount
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_payment__has_discount
|
||||
msgid "Has Discount"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_bank_statement__hide_bank_statement_balance
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_journal__hide_bank_statement_balance
|
||||
msgid "Hide Bank Statement Balance"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_account__id
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_analytic_account__id
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_bank_statement__id
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_bank_statement_line__id
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_group_generate__id
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_incoterms__id
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_invoice_mark_sent__id
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_invoice_report__id
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_journal__id
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_move__id
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_move_line__id
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_move_reversal__id
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_partial_reconcile__id
|
||||
#: model:ir.model.fields,field_description:account_usability.field_product_supplierinfo__id
|
||||
#: model:ir.model.fields,field_description:account_usability.field_product_template__id
|
||||
#: model:ir.model.fields,field_description:account_usability.field_res_company__id
|
||||
#: model:ir.model.fields,field_description:account_usability.field_res_config_settings__id
|
||||
#: model:ir.model.fields,field_description:account_usability.field_res_partner__id
|
||||
msgid "ID"
|
||||
msgstr "Identifiant"
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model,name:account_usability.model_account_incoterms
|
||||
msgid "Incoterms"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model.fields,field_description:account_usability.field_res_config_settings__transfer_account_id
|
||||
msgid "Inter-Banks Transfer Account"
|
||||
msgstr "Compte de transfert inter-bancaire"
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model.fields,help:account_usability.field_res_config_settings__transfer_account_id
|
||||
msgid ""
|
||||
"Intermediary account used when moving money from a liquidity account to "
|
||||
"another"
|
||||
msgstr ""
|
||||
"Compte intermédiaire utilisé pour déplacer de l'argent d'un compte de "
|
||||
"trésorerie vers un autre"
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model.fields,help:account_usability.field_account_move_line__product_barcode
|
||||
msgid "International Article Number used for product identification."
|
||||
msgstr ""
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model,name:account_usability.model_account_invoice
|
||||
#: model:ir.model.fields,field_description:account_usability.field_res_partner__invoice_warn
|
||||
#: model:ir.model.fields,field_description:account_usability.field_res_users__invoice_warn
|
||||
msgid "Invoice"
|
||||
msgstr "Facture"
|
||||
|
||||
#. module: account_usability
|
||||
#: model_terms:ir.ui.view,arch_db:account_usability.view_company_form
|
||||
msgid "Invoice Legal Terms"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model,name:account_usability.model_account_invoice_line
|
||||
msgid "Invoice Line"
|
||||
msgstr "Lignes de facture"
|
||||
|
||||
#. module: account_usability
|
||||
#: model_terms:ir.ui.view,arch_db:account_usability.account_invoice_report_tree
|
||||
msgid "Invoices Analysis"
|
||||
msgstr "Analyse des factures"
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model,name:account_usability.model_account_invoice_report
|
||||
msgid "Invoices Statistics"
|
||||
msgstr "Statistiques des factures"
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model,name:account_usability.model_account_journal
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_bank_statement_line__journal_id
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_move__journal_id
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_payment__journal_id
|
||||
msgid "Journal"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model,name:account_usability.model_account_move
|
||||
msgid "Journal Entry"
|
||||
msgstr "Pièce comptable"
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model,name:account_usability.model_account_move_line
|
||||
msgid "Journal Item"
|
||||
msgstr "Écriture comptable"
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_account____last_update
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_analytic_account____last_update
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_bank_statement____last_update
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_bank_statement_line____last_update
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_group_generate____last_update
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_incoterms____last_update
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_invoice_mark_sent____last_update
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_invoice_report____last_update
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_journal____last_update
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_move____last_update
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_move_line____last_update
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_move_reversal____last_update
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_partial_reconcile____last_update
|
||||
#: model:ir.model.fields,field_description:account_usability.field_product_supplierinfo____last_update
|
||||
#: model:ir.model.fields,field_description:account_usability.field_product_template____last_update
|
||||
#: model:ir.model.fields,field_description:account_usability.field_res_company____last_update
|
||||
#: model:ir.model.fields,field_description:account_usability.field_res_config_settings____last_update
|
||||
#: model:ir.model.fields,field_description:account_usability.field_res_partner____last_update
|
||||
msgid "Last Modified on"
|
||||
msgstr "Dernière modification le"
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_group_generate__write_uid
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_invoice_mark_sent__write_uid
|
||||
msgid "Last Updated by"
|
||||
msgstr "Mis à jour par"
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_group_generate__write_date
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_invoice_mark_sent__write_date
|
||||
msgid "Last Updated on"
|
||||
msgstr "Mis à jour le"
|
||||
|
||||
#. module: account_usability
|
||||
#: model_terms:ir.ui.view,arch_db:account_usability.view_company_form
|
||||
msgid "Legal Terms"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model.fields,field_description:account_usability.field_res_company__static_invoice_terms
|
||||
msgid "Legal Terms on Invoice"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_group_generate__level
|
||||
msgid "Level"
|
||||
msgstr "Niveau"
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.actions.act_window,name:account_usability.account_invoice_mark_sent_action
|
||||
#: model_terms:ir.ui.view,arch_db:account_usability.account_invoice_mark_sent_form
|
||||
msgid "Mark as Sent"
|
||||
msgstr "Marquer comme envoyé"
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model,name:account_usability.model_account_invoice_mark_sent
|
||||
#: model_terms:ir.ui.view,arch_db:account_usability.account_invoice_mark_sent_form
|
||||
msgid "Mark invoices as sent"
|
||||
msgstr "Marquer les factures comme envoyé"
|
||||
|
||||
#. module: account_usability
|
||||
#: model_terms:ir.ui.view,arch_db:account_usability.view_account_invoice_filter
|
||||
msgid "Missing Attachment"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model,name:account_usability.model_account_partial_reconcile
|
||||
msgid "Partial Reconcile"
|
||||
msgstr "Lettrage partiel"
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_move_line__matched_credit_ids
|
||||
msgid "Partial Reconcile Credit"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_move_line__matched_debit_ids
|
||||
msgid "Partial Reconcile Debit"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_invoice_report__industry_id
|
||||
msgid "Partner Industry"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_bank_statement_line__invoice_payment_term_id
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_move__invoice_payment_term_id
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_payment__invoice_payment_term_id
|
||||
msgid "Payment Terms"
|
||||
msgstr "Conditions de paiement"
|
||||
|
||||
#. module: account_usability
|
||||
#: code:addons/account_usability/models/account_move.py:0
|
||||
#, python-format
|
||||
msgid "Please post the following entries before reconciliation :"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_group_generate__name_prefix
|
||||
msgid "Prefix"
|
||||
msgstr "Préfixe"
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model,name:account_usability.model_account_reconcile_model
|
||||
msgid ""
|
||||
"Preset to create journal entries during a invoices and payments matching"
|
||||
msgstr ""
|
||||
"Préconfigurer pour créer une écriture pendant la correspondance entre des "
|
||||
"factures et des paiements"
|
||||
|
||||
#. module: account_usability
|
||||
#: model_terms:ir.ui.view,arch_db:account_usability.view_account_move_line_filter
|
||||
msgid "Previous Year"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_usability
|
||||
#: model_terms:ir.ui.view,arch_db:account_usability.view_move_form
|
||||
msgid "Print"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_move_line__product_barcode
|
||||
msgid "Product Barcode"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model,name:account_usability.model_product_template
|
||||
msgid "Product Template"
|
||||
msgstr "Modèle de produit"
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model.fields,field_description:account_usability.field_product_product__purchase_price_type
|
||||
#: model:ir.model.fields,field_description:account_usability.field_product_supplierinfo__purchase_price_type
|
||||
#: model:ir.model.fields,field_description:account_usability.field_product_template__purchase_price_type
|
||||
msgid "Purchase Price Type"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_bank_statement_line__partner_bank_id
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_move__partner_bank_id
|
||||
msgid "Recipient Bank"
|
||||
msgstr "Compte bancaire destinataire"
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_move_line__reconcile_string
|
||||
msgid "Reconcile"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_bank_statement_line__ref
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_move__ref
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_payment__ref
|
||||
msgid "Reference"
|
||||
msgstr "Référence"
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_move_reversal__date
|
||||
msgid "Reversal date"
|
||||
msgstr "Date de renversement"
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_bank_statement_line__sale_dates
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_move__sale_dates
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_payment__sale_dates
|
||||
msgid "Sale Dates"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model.fields,field_description:account_usability.field_product_product__sale_price_type
|
||||
#: model:ir.model.fields,field_description:account_usability.field_product_template__sale_price_type
|
||||
msgid "Sale Price Type"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model.fields,help:account_usability.field_res_partner__invoice_warn
|
||||
#: model:ir.model.fields,help:account_usability.field_res_users__invoice_warn
|
||||
msgid ""
|
||||
"Selecting the \"Warning\" option will notify user with the message, "
|
||||
"Selecting \"Blocking Message\" will throw an exception with the message and "
|
||||
"block the flow. The Message has to be written in the next field."
|
||||
msgstr ""
|
||||
"Sélectionner l'option 'Avertissement' notifiera l'utilisateur avec le "
|
||||
"Message. Sélectionner 'Message Bloquant' lancera une exception avec le "
|
||||
"message et bloquera le flux. Le Message doit être encodé dans le champ "
|
||||
"suivant."
|
||||
|
||||
#. module: account_usability
|
||||
#: model_terms:ir.ui.view,arch_db:account_usability.view_account_invoice_filter
|
||||
msgid "Sent"
|
||||
msgstr "Envoyé"
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_bank_statement__start_date
|
||||
#: model_terms:ir.ui.view,arch_db:account_usability.view_bank_statement_search
|
||||
msgid "Start Date"
|
||||
msgstr "Date de Début"
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model,name:account_usability.model_product_supplierinfo
|
||||
msgid "Supplier Pricelist"
|
||||
msgstr "Liste prix fournisseur"
|
||||
|
||||
#. module: account_usability
|
||||
#: model_terms:ir.ui.view,arch_db:account_usability.product_supplierinfo_tree_view
|
||||
msgid "Tax"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_usability
|
||||
#: code:addons/account_usability/models/product.py:0
|
||||
#, python-format
|
||||
msgid "Tax excl."
|
||||
msgstr ""
|
||||
|
||||
#. module: account_usability
|
||||
#: code:addons/account_usability/models/product.py:0
|
||||
#, python-format
|
||||
msgid "Tax incl."
|
||||
msgstr ""
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model.fields,help:account_usability.field_account_move_line__balance
|
||||
msgid ""
|
||||
"Technical field holding the debit - credit in order to open meaningful "
|
||||
"graph views from reports"
|
||||
msgstr ""
|
||||
"Champ technique égal à 'débit - crédit', utilisé pour les vues graphes dans "
|
||||
"les rapports"
|
||||
|
||||
#. module: account_usability
|
||||
#: code:addons/account_usability/wizard/account_group_generate.py:0
|
||||
#, python-format
|
||||
msgid ""
|
||||
"The code of account '%s' is %d caracters. It cannot be inferior to level "
|
||||
"(%d)."
|
||||
msgstr ""
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model.fields,help:account_usability.field_res_partner__property_account_position_id
|
||||
#: model:ir.model.fields,help:account_usability.field_res_users__property_account_position_id
|
||||
msgid ""
|
||||
"The fiscal position determines the taxes/accounts used for this contact."
|
||||
msgstr ""
|
||||
"La position fiscale détermine les taxes / comptes utilisés pour ce contact."
|
||||
|
||||
#. module: account_usability
|
||||
#: code:addons/account_usability/wizard/account_group_generate.py:0
|
||||
#, python-format
|
||||
msgid "The level must be >= 1."
|
||||
msgstr ""
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model.fields,help:account_usability.field_account_bank_statement_line__sale_dates
|
||||
#: model:ir.model.fields,help:account_usability.field_account_move__sale_dates
|
||||
#: model:ir.model.fields,help:account_usability.field_account_payment__sale_dates
|
||||
msgid ""
|
||||
"This information appears on invoice qweb report (you may use it for your "
|
||||
"own report)"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_usability
|
||||
#: model_terms:ir.ui.view,arch_db:account_usability.account_group_generate_form
|
||||
msgid ""
|
||||
"This wizard is designed to auto-generate account groups from the chart of "
|
||||
"account."
|
||||
msgstr ""
|
||||
|
||||
#. module: account_usability
|
||||
#: model_terms:ir.ui.view,arch_db:account_usability.account_invoice_mark_sent_form
|
||||
msgid ""
|
||||
"This wizard will mark as <i>sent</i> all the selected invoices in open or "
|
||||
"paid state."
|
||||
msgstr ""
|
||||
|
||||
#. module: account_usability
|
||||
#: model_terms:ir.ui.view,arch_db:account_usability.view_account_invoice_filter
|
||||
msgid "To Send"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_bank_statement_line__amount_total
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_move__amount_total
|
||||
#: model:ir.model.fields,field_description:account_usability.field_account_payment__amount_total
|
||||
msgid "Total"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_usability
|
||||
#: model_terms:ir.ui.view,arch_db:account_usability.res_config_settings_view_form
|
||||
msgid ""
|
||||
"Transit account when you transfer money from a bank account of your company "
|
||||
"to another bank account of your company."
|
||||
msgstr ""
|
||||
|
||||
#. module: account_usability
|
||||
#: model_terms:ir.ui.view,arch_db:account_usability.view_account_journal_search
|
||||
msgid "Type"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_usability
|
||||
#: model_terms:ir.ui.view,arch_db:account_usability.view_bank_statement_form
|
||||
msgid "Unreconcile All"
|
||||
msgstr "Tous délettrés"
|
||||
|
||||
#. module: account_usability
|
||||
#: model_terms:ir.ui.view,arch_db:account_usability.view_account_move_line_filter
|
||||
msgid "Unreconciled or Partially Reconciled"
|
||||
msgstr "Non Lettré ou Partiellement Lettré"
|
||||
|
||||
#. module: account_usability
|
||||
#: model_terms:ir.ui.view,arch_db:account_usability.view_bank_statement_form
|
||||
msgid "View Journal Entry"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_usability
|
||||
#: model_terms:ir.ui.view,arch_db:account_usability.view_move_line_tree
|
||||
msgid "View Journal Entry Form"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_usability
|
||||
#: model:ir.model.fields,help:account_usability.field_account_bank_statement__hide_bank_statement_balance
|
||||
#: model:ir.model.fields,help:account_usability.field_account_journal__hide_bank_statement_balance
|
||||
msgid ""
|
||||
"You may want to enable this option when your bank journal is generated from "
|
||||
"a bank statement file that doesn't handle start/end balance (QIF for "
|
||||
"instance) and you don't want to enter the start/end balance manually: it "
|
||||
"will prevent the display of wrong information in the accounting dashboard "
|
||||
"and on bank statements."
|
||||
msgstr ""
|
||||
@@ -6,4 +6,6 @@ from . import account_journal
|
||||
from . import account_move
|
||||
from . import account_partial_reconcile
|
||||
from . import res_partner
|
||||
from . import res_company
|
||||
from . import product
|
||||
from . import account_invoice_report
|
||||
|
||||
@@ -27,9 +27,7 @@ class AccountBankStatement(models.Model):
|
||||
|
||||
def _check_balance_end_real_same_as_computed(self):
|
||||
for stmt in self:
|
||||
if stmt.hide_bank_statement_balance:
|
||||
continue
|
||||
else:
|
||||
if not stmt.hide_bank_statement_balance:
|
||||
super(AccountBankStatement, stmt)._check_balance_end_real_same_as_computed()
|
||||
return True
|
||||
|
||||
@@ -80,7 +78,8 @@ class AccountBankStatementLine(models.Model):
|
||||
|
||||
def show_account_move(self):
|
||||
self.ensure_one()
|
||||
action = self.env.ref('account.action_move_line_form').read()[0]
|
||||
action = self.env["ir.actions.actions"]._for_xml_id(
|
||||
'account.action_move_line_form')
|
||||
# Note: this action is on account.move, not account.move.line !
|
||||
action.update({
|
||||
'views': False,
|
||||
|
||||
@@ -14,3 +14,13 @@ class AccountIncoterms(models.Model):
|
||||
for rec in self:
|
||||
res.append((rec.id, '[%s] %s' % (rec.code, rec.name)))
|
||||
return res
|
||||
|
||||
@api.model
|
||||
def name_search(self, name='', args=None, operator='ilike', limit=100):
|
||||
if args is None:
|
||||
args = []
|
||||
if name and operator == 'ilike':
|
||||
recs = self.search([('code', '=ilike', name + '%')] + args, limit=limit)
|
||||
if recs:
|
||||
return recs.name_get()
|
||||
return super().name_search(name=name, args=args, operator=operator, limit=limit)
|
||||
|
||||
17
account_usability/models/account_invoice_report.py
Normal file
17
account_usability/models/account_invoice_report.py
Normal file
@@ -0,0 +1,17 @@
|
||||
# Copyright 2022 Akretion (http://www.akretion.com)
|
||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class AccountInvoiceReport(models.Model):
|
||||
_inherit = 'account.invoice.report'
|
||||
|
||||
industry_id = fields.Many2one('res.partner.industry', string='Partner Industry', readonly=True)
|
||||
|
||||
@api.model
|
||||
def _select(self):
|
||||
res = super()._select()
|
||||
res += ", COALESCE(partner.industry_id, commercial_partner.industry_id) AS industry_id"
|
||||
return res
|
||||
@@ -16,6 +16,13 @@ class AccountJournal(models.Model):
|
||||
"you don't want to enter the start/end balance manually: it "
|
||||
"will prevent the display of wrong information in the accounting "
|
||||
"dashboard and on bank statements.")
|
||||
# Used to set default user_type_id on account fields
|
||||
account_type_current_liabilities_id = fields.Many2one(
|
||||
'account.account.type',
|
||||
default=lambda self: self.env.ref('account.data_account_type_current_liabilities').id)
|
||||
account_type_current_assets_id = fields.Many2one(
|
||||
'account.account.type',
|
||||
default=lambda self: self.env.ref('account.data_account_type_current_assets').id)
|
||||
|
||||
@api.depends(
|
||||
'name', 'currency_id', 'company_id', 'company_id.currency_id', 'code')
|
||||
|
||||
@@ -2,10 +2,12 @@
|
||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import api, fields, models
|
||||
from odoo import api, fields, models, _
|
||||
from odoo.tools import float_is_zero
|
||||
from odoo.tools.misc import format_date
|
||||
from odoo.osv import expression
|
||||
from datetime import timedelta
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
|
||||
class AccountMove(models.Model):
|
||||
@@ -152,13 +154,13 @@ class AccountMove(models.Model):
|
||||
""" French law requires to set sale order dates into invoice
|
||||
returned string: "sale1 (date1), sale2 (date2) ..."
|
||||
"""
|
||||
for inv in self:
|
||||
sales = inv.invoice_line_ids.mapped(
|
||||
for move in self:
|
||||
sales = move.invoice_line_ids.mapped(
|
||||
'sale_line_ids').mapped('order_id')
|
||||
dates = ["%s (%s)" % (
|
||||
x.name, format_date(inv.env, self.date_order))
|
||||
x.name, format_date(move.env, x.date_order))
|
||||
for x in sales]
|
||||
inv.sale_dates = ", ".join(dates)
|
||||
move.sale_dates = ", ".join(dates)
|
||||
|
||||
# allow to manually create moves not only in general journals,
|
||||
# but also in cash journal and check journals (= bank journals not linked to a bank account)
|
||||
@@ -207,6 +209,18 @@ class AccountMove(models.Model):
|
||||
self.ensure_one()
|
||||
return '%s.pdf' % (self.name and self.name.replace('/', '_') or 'INV')
|
||||
|
||||
def _get_accounting_date(self, invoice_date, has_tax):
|
||||
# On vendor bills/refunds, we want date = invoice_date unless
|
||||
# we have a company tax_lock_date and the invoice has taxes
|
||||
# and invoice_date <= tax_lock_date
|
||||
date = super()._get_accounting_date(invoice_date, has_tax)
|
||||
if self.is_purchase_document(include_receipts=True):
|
||||
tax_lock_date = self.company_id.tax_lock_date
|
||||
if invoice_date and tax_lock_date and has_tax and invoice_date <= tax_lock_date:
|
||||
invoice_date = tax_lock_date + timedelta(days=1)
|
||||
date = invoice_date
|
||||
return date
|
||||
|
||||
|
||||
class AccountMoveLine(models.Model):
|
||||
_inherit = 'account.move.line'
|
||||
@@ -228,10 +242,22 @@ class AccountMoveLine(models.Model):
|
||||
compute='_compute_reconcile_string', string='Reconcile', store=True)
|
||||
# for optional display in tree view
|
||||
product_barcode = fields.Char(related='product_id.barcode', string="Product Barcode")
|
||||
balance = fields.Monetary(
|
||||
string='Balance',
|
||||
default=0.0,
|
||||
currency_field='company_currency_id',
|
||||
compute="_compute_balance",
|
||||
store=True)
|
||||
|
||||
@api.depends("credit", "debit")
|
||||
def _compute_balance(self):
|
||||
for line in self:
|
||||
line.balance = line.debit - line.credit
|
||||
|
||||
def show_account_move_form(self):
|
||||
self.ensure_one()
|
||||
action = self.env.ref('account.action_move_line_form').read()[0]
|
||||
action = self.env["ir.actions.actions"]._for_xml_id(
|
||||
'account.action_move_line_form')
|
||||
action.update({
|
||||
'res_id': self.move_id.id,
|
||||
'view_id': False,
|
||||
@@ -251,3 +277,25 @@ class AccountMoveLine(models.Model):
|
||||
rec_str = ', '.join([
|
||||
'a%d' % pr.id for pr in line.matched_debit_ids + line.matched_credit_ids])
|
||||
line.reconcile_string = rec_str
|
||||
|
||||
def _get_computed_name(self):
|
||||
# This is useful when you want to have the product code in a dedicated
|
||||
# column in your customer invoice report
|
||||
# The same ir.config_parameter is used in sale_usability,
|
||||
# purchase_usability and account_usability
|
||||
no_product_code_param = self.env['ir.config_parameter'].sudo().get_param(
|
||||
'usability.line_name_no_product_code')
|
||||
if no_product_code_param and no_product_code_param == 'True':
|
||||
self = self.with_context(display_default_code=False)
|
||||
return super()._get_computed_name()
|
||||
|
||||
def reconcile(self):
|
||||
"""Explicit error message if unposted lines"""
|
||||
unposted_ids = self.filtered(lambda l: l.move_id.state != "posted")
|
||||
if unposted_ids:
|
||||
m = _("Please post the following entries before reconciliation :")
|
||||
sep = "\n - "
|
||||
unpost = sep.join([am.display_name for am in unposted_ids.move_id])
|
||||
raise UserError(m + sep + unpost)
|
||||
|
||||
return super().reconcile()
|
||||
|
||||
21
account_usability/models/res_company.py
Normal file
21
account_usability/models/res_company.py
Normal file
@@ -0,0 +1,21 @@
|
||||
# Copyright 2021 Akretion France (https://akretion.com/)
|
||||
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class ResCompany(models.Model):
|
||||
_inherit = 'res.company'
|
||||
|
||||
# There is a native field invoice_terms which is displayed on res.config.settings
|
||||
# when the ir.config_parameter account.use_invoice_terms is True
|
||||
# But there are several problems with this native field:
|
||||
# - it is copied on the 'narration' field of account.move => we don't want that
|
||||
# - the text block is very small on the form view of res.config.settings
|
||||
# So I decided to have our own field "fixed_invoice_terms"
|
||||
# The native field can still be used when you need to customise some
|
||||
# terms and conditions on each invoice (not very common, but...)
|
||||
# To underline this different with the native field, I prefix it with 'static_'
|
||||
static_invoice_terms = fields.Text(
|
||||
translate=True, string="Legal Terms on Invoice")
|
||||
19
account_usability/static/src/xml/account_payment.xml
Normal file
19
account_usability/static/src/xml/account_payment.xml
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright 2022 Akretion France (http://www.akretion.com/)
|
||||
@author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
-->
|
||||
|
||||
<templates id="template" xml:space="preserve">
|
||||
|
||||
<!-- Requires https://github.com/odoo/odoo/pull/84180 -->
|
||||
<t t-extend="ShowPaymentInfo" >
|
||||
<t t-jquery="td:first" t-operation="after">
|
||||
<td style="max-width: 25em;" id="outstanding-date">
|
||||
<div class="oe_form_field" style="margin-right: 5px; text-overflow: ellipsis; overflow: hidden; white-space: nowrap;"><t t-esc="line.date"></t></div>
|
||||
</td>
|
||||
</t>
|
||||
</t>
|
||||
|
||||
</templates>
|
||||
@@ -31,6 +31,9 @@
|
||||
<field name="name" position="after">
|
||||
<field name="code" filter_domain="[('code', '=like', str(self)+'%')]" string="Code"/>
|
||||
</field>
|
||||
<filter name="accounttype" position="after">
|
||||
<filter name="group_groupby" string="Group" context="{'group_by': 'group_id'}"/>
|
||||
</filter>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
33
account_usability/views/account_analytic_account.xml
Normal file
33
account_usability/views/account_analytic_account.xml
Normal file
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright 2015-2021 Akretion France (http://www.akretion.com/)
|
||||
@author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
-->
|
||||
|
||||
<odoo>
|
||||
|
||||
|
||||
<record id="view_account_analytic_account_list" model="ir.ui.view">
|
||||
<field name="model">account.analytic.account</field>
|
||||
<field name="inherit_id" ref="analytic.view_account_analytic_account_list"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="code" position="after">
|
||||
<field name="group_id" optional="show"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="view_account_analytic_account_search" model="ir.ui.view">
|
||||
<field name="model">account.analytic.account</field>
|
||||
<field name="inherit_id" ref="analytic.view_account_analytic_account_search"/>
|
||||
<field name="arch" type="xml">
|
||||
<filter name="associatedpartner" position="before">
|
||||
<filter name="group_groupby" string="Group" context="{'group_by': 'group_id'}"/>
|
||||
</filter>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
</odoo>
|
||||
22
account_usability/views/account_analytic_group.xml
Normal file
22
account_usability/views/account_analytic_group.xml
Normal file
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright 2021 Akretion France (http://www.akretion.com/)
|
||||
@author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
-->
|
||||
|
||||
<odoo>
|
||||
|
||||
|
||||
<record id="account_analytic_group_tree_view" model="ir.ui.view">
|
||||
<field name="model">account.analytic.group</field>
|
||||
<field name="inherit_id" ref="analytic.account_analytic_group_tree_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="name" position="after">
|
||||
<field name="parent_id" optional="show"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
</odoo>
|
||||
32
account_usability/views/account_group.xml
Normal file
32
account_usability/views/account_group.xml
Normal file
@@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright 2021 Akretion France (http://www.akretion.com/)
|
||||
@author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
-->
|
||||
|
||||
<odoo>
|
||||
|
||||
|
||||
<record id="view_account_group_form" model="ir.ui.view">
|
||||
<field name="model">account.group</field>
|
||||
<field name="inherit_id" ref="account.view_account_group_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="name" position="after">
|
||||
<field name="parent_id"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_account_group_tree" model="ir.ui.view">
|
||||
<field name="model">account.group</field>
|
||||
<field name="inherit_id" ref="account.view_account_group_tree"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="name" position="after">
|
||||
<field name="parent_id" optional="show"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
</odoo>
|
||||
@@ -14,26 +14,38 @@
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Invoices Analysis">
|
||||
<field name="move_id"/>
|
||||
<field name="journal_id" optional="hide"/>
|
||||
<field name="company_id" optional="hide" groups="base.group_multi_company"/>
|
||||
<field name="invoice_date"/>
|
||||
<field name="invoice_date_due"/>
|
||||
<field name="move_type"/>
|
||||
<field name="commercial_partner_id"/>
|
||||
<field name="partner_id" optional="hide"/>
|
||||
<field name="country_id" optional="hide"/>
|
||||
<field name="industry_id" optional="hide"/>
|
||||
<field name="invoice_user_id"/>
|
||||
<field name="fiscal_position_id" optional="hide"/>
|
||||
<field name="product_id"/>
|
||||
<field name="product_categ_id" optional="hide"/>
|
||||
<field name="account_id" optional="hide"/>
|
||||
<field name="analytic_account_id" optional="hide" groups="analytic.group_analytic_accounting"/>
|
||||
<field name="quantity" sum="1"/>
|
||||
<field name="product_uom_id" groups="uom.group_uom"/>
|
||||
<field name="price_subtotal" sum="1"/>
|
||||
<field name="state"/>
|
||||
<field name="payment_state" optional="hide"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="account.action_account_invoice_report_all_supp" model="ir.actions.act_window">
|
||||
<field name="context">{'search_default_current': 1, 'search_default_supplier': 1, 'group_by': ['invoice_date']}</field> <!-- Remove group_by_no_leaf, which breaks tree view -->
|
||||
<field name="view_mode">pivot,graph</field>
|
||||
</record>
|
||||
|
||||
<record id="account.action_account_invoice_report_all" model="ir.actions.act_window">
|
||||
<field name="context">{'search_default_current': 1, 'search_default_customer': 1, 'group_by': ['invoice_date']}</field> <!-- Remove group_by_no_leaf, which breaks tree view -->
|
||||
<field name="view_mode">pivot,graph</field>
|
||||
</record>
|
||||
|
||||
<record id="view_account_invoice_report_pivot" model="ir.ui.view">
|
||||
|
||||
@@ -14,6 +14,17 @@
|
||||
<field name="arch" type="xml">
|
||||
<field name="bank_statements_source" position="after">
|
||||
<field name="hide_bank_statement_balance" groups="account.group_account_readonly"/>
|
||||
<field name="account_type_current_liabilities_id" invisible="1"/>
|
||||
<field name="account_type_current_assets_id" invisible="1"/>
|
||||
</field>
|
||||
<field name="suspense_account_id" position="attributes">
|
||||
<attribute name="context">{'default_user_type_id': account_type_current_liabilities_id, 'default_reconcile': True}</attribute>
|
||||
</field>
|
||||
<field name="payment_debit_account_id" position="attributes">
|
||||
<attribute name="context">{'default_user_type_id': account_type_current_assets_id, 'default_reconcile': True}</attribute>
|
||||
</field>
|
||||
<field name="payment_credit_account_id" position="attributes">
|
||||
<attribute name="context">{'default_user_type_id': account_type_current_assets_id, 'default_reconcile': True}</attribute>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -70,6 +70,9 @@
|
||||
<field name="matching_number" position="after">
|
||||
<button title="View Journal Entry Form" type="object" name="show_account_move_form" icon="fa-arrow-right"/>
|
||||
</field>
|
||||
<field name="credit" position="after">
|
||||
<field name="balance" sum="Balance" />
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -88,10 +91,11 @@
|
||||
<field name="debit" filter_domain="['|', ('debit', '=', self), ('credit', '=', self)]" string="Debit or Credit"/>
|
||||
</field>
|
||||
<filter name="unreconciled" position="before">
|
||||
<filter name="reconciled" string="Fully Reconciled" domain="[('full_reconcile_id', '!=', False)]"/>
|
||||
<filter name="reconciled" string="Fully Reconciled" domain="[('reconciled', '=', True)]"/>
|
||||
</filter>
|
||||
<filter name="unreconciled" position="attributes">
|
||||
<attribute name="string">Unreconciled or Partially Reconciled</attribute>
|
||||
<attribute name="domain">[('reconciled', '=', False), ('balance', '!=', 0), ('account_id.reconcile', '=', True)]</attribute>
|
||||
</filter>
|
||||
<!--
|
||||
<field name="name" position="attributes">
|
||||
|
||||
27
account_usability/views/res_company.xml
Normal file
27
account_usability/views/res_company.xml
Normal file
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright 2021 Akretion (http://www.akretion.com/)
|
||||
@author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
-->
|
||||
|
||||
<odoo>
|
||||
|
||||
|
||||
<record id="view_company_form" model="ir.ui.view">
|
||||
<field name="name">account_usability.res.company.form</field>
|
||||
<field name="model">res.company</field>
|
||||
<field name="inherit_id" ref="base.view_company_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<notebook position="inside">
|
||||
<page string="Legal Terms" name="legal_terms">
|
||||
<group string="Invoice Legal Terms" name="static_invoice_terms">
|
||||
<field name="static_invoice_terms" nolabel="1"/>
|
||||
</group>
|
||||
</page>
|
||||
</notebook>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
</odoo>
|
||||
1
base_mail_sender_bcc/__init__.py
Normal file
1
base_mail_sender_bcc/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import models
|
||||
21
base_mail_sender_bcc/__manifest__.py
Normal file
21
base_mail_sender_bcc/__manifest__.py
Normal file
@@ -0,0 +1,21 @@
|
||||
# Copyright 2017-2022 Akretion (http://www.akretion.com)
|
||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
{
|
||||
'name': 'Mail Sender Bcc',
|
||||
'version': '14.0.1.0.0',
|
||||
'category': 'Mail',
|
||||
'license': 'AGPL-3',
|
||||
'summary': "Always send a copy of the mail to the sender",
|
||||
'description': """
|
||||
Mail Sender Bcc
|
||||
===============
|
||||
|
||||
With this module, when Odoo sends an outgoing email, it adds the sender as Bcc (blind copy) of the email.
|
||||
""",
|
||||
'author': 'Akretion',
|
||||
'website': 'https://github.com/akretion/odoo-usability',
|
||||
'depends': ['base'],
|
||||
'installable': True,
|
||||
}
|
||||
1
base_mail_sender_bcc/models/__init__.py
Normal file
1
base_mail_sender_bcc/models/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import ir_mail_server
|
||||
27
base_mail_sender_bcc/models/ir_mail_server.py
Normal file
27
base_mail_sender_bcc/models/ir_mail_server.py
Normal file
@@ -0,0 +1,27 @@
|
||||
# Copyright 2017-2022 Akretion France
|
||||
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import models
|
||||
|
||||
|
||||
class IrMailServer(models.Model):
|
||||
_inherit = 'ir.mail_server'
|
||||
|
||||
def build_email(
|
||||
self, email_from, email_to, subject, body, email_cc=None,
|
||||
email_bcc=None, reply_to=False, attachments=None,
|
||||
message_id=None, references=None, object_id=False,
|
||||
subtype='plain', headers=None,
|
||||
body_alternative=None, subtype_alternative='plain'):
|
||||
if email_from:
|
||||
if email_bcc is None:
|
||||
email_bcc = [email_from]
|
||||
elif isinstance(email_bcc, list) and email_from not in email_bcc:
|
||||
email_bcc.append(email_from)
|
||||
return super().build_email(
|
||||
email_from, email_to, subject, body, email_cc=email_cc,
|
||||
email_bcc=email_bcc, reply_to=reply_to, attachments=attachments,
|
||||
message_id=message_id, references=references, object_id=object_id,
|
||||
subtype=subtype, headers=headers,
|
||||
body_alternative=body_alternative, subtype_alternative=subtype_alternative)
|
||||
0
mail_no_portal/__init__.py
Normal file
0
mail_no_portal/__init__.py
Normal file
25
mail_no_portal/__manifest__.py
Normal file
25
mail_no_portal/__manifest__.py
Normal file
@@ -0,0 +1,25 @@
|
||||
# Copyright 2022 Akretion France (http://www.akretion.com/)
|
||||
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
{
|
||||
'name': 'Mail no portal',
|
||||
'version': '14.0.1.0.0',
|
||||
'category': 'Productivity/Discuss',
|
||||
'license': 'AGPL-3',
|
||||
'summary': 'Remove portal button in mails sent by Odoo',
|
||||
'description': """
|
||||
This module remove the buttons such as *View Request for Quotation* in emails sent by Odoo.
|
||||
|
||||
This module has been written by Alexis de Lattre from Akretion
|
||||
<alexis.delattre@akretion.com>.
|
||||
""",
|
||||
'author': 'Akretion',
|
||||
'maintainers': ['alexis-via'],
|
||||
'website': 'https://www.akretion.com',
|
||||
'depends': ['mail'],
|
||||
'data': [
|
||||
'data/mail.xml',
|
||||
],
|
||||
'installable': True,
|
||||
}
|
||||
23
mail_no_portal/data/mail.xml
Normal file
23
mail_no_portal/data/mail.xml
Normal file
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright 2022 Akretion France (http://www.akretion.com/)
|
||||
@author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
-->
|
||||
|
||||
<odoo>
|
||||
|
||||
|
||||
<template id="mail_notification_paynow" inherit_id="mail.mail_notification_paynow">
|
||||
<!-- Remove the portal button -->
|
||||
<xpath expr="//t[@t-set='is_online']" position="attributes">
|
||||
<attribute name="t-value">False</attribute>
|
||||
</xpath>
|
||||
<!-- Remove the Powered by Odoo -->
|
||||
<xpath expr="//a[@target='_blank']/.." position="replace">
|
||||
<td align="center" style="min-width: 590px; padding: 8px; font-size:11px;"></td>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
|
||||
</odoo>
|
||||
@@ -29,4 +29,15 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="mrp_production_tree_view" model="ir.ui.view">
|
||||
<field name="model">mrp.production</field>
|
||||
<field name="inherit_id" ref="mrp.mrp_production_tree_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="reservation_state" position="after">
|
||||
<field name="location_src_id" optional="hide" groups="stock.group_stock_multi_locations"/>
|
||||
<field name="location_dest_id" optional="hide" groups="stock.group_stock_multi_locations"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
|
||||
@@ -4,20 +4,119 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 12.0\n"
|
||||
"Project-Id-Version: Odoo Server 14.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2019-10-11 13:11+0000\n"
|
||||
"PO-Revision-Date: 2019-10-11 15:11+0200\n"
|
||||
"Last-Translator: <>\n"
|
||||
"POT-Creation-Date: 2022-05-09 16:56+0000\n"
|
||||
"PO-Revision-Date: 2022-05-09 18:57+0200\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
"Language: fr\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: \n"
|
||||
"Language: fr\n"
|
||||
"X-Generator: Poedit 2.0.6\n"
|
||||
"X-Generator: Poedit 3.0.1\n"
|
||||
|
||||
#. module: pos_usability
|
||||
#: model:ir.model.fields,field_description:pos_usability.field_pos_category__product_count
|
||||
msgid "# Products"
|
||||
msgstr ""
|
||||
|
||||
#. module: pos_usability
|
||||
#: model_terms:ir.ui.view,arch_db:pos_usability.product_pos_category_form_view
|
||||
msgid "<span class=\"o_stat_text\"> Products</span>"
|
||||
msgstr ""
|
||||
|
||||
#. module: pos_usability
|
||||
#: model_terms:ir.ui.view,arch_db:pos_usability.report_saledetails
|
||||
msgid "Amount"
|
||||
msgstr "Montant"
|
||||
|
||||
#. module: pos_usability
|
||||
#: model:ir.model.fields,field_description:pos_usability.field_product_product__available_in_pos
|
||||
#: model:ir.model.fields,field_description:pos_usability.field_product_template__available_in_pos
|
||||
msgid "Available in POS"
|
||||
msgstr "Disponible dans le PdV"
|
||||
|
||||
#. module: pos_usability
|
||||
#: model:ir.model.fields,field_description:pos_usability.field_pos_payment_method__cash_journal_id
|
||||
msgid "Cash Journal"
|
||||
msgstr "Journal de caisse"
|
||||
|
||||
#. module: pos_usability
|
||||
#: model:ir.model.fields,help:pos_usability.field_product_product__pos_categ_id
|
||||
#: model:ir.model.fields,help:pos_usability.field_product_template__pos_categ_id
|
||||
msgid "Category used in the Point of Sale."
|
||||
msgstr "Catégorie utilisé dans le point de vente"
|
||||
|
||||
#. module: pos_usability
|
||||
#: model:ir.model.fields,help:pos_usability.field_product_product__available_in_pos
|
||||
#: model:ir.model.fields,help:pos_usability.field_product_template__available_in_pos
|
||||
msgid "Check if you want this product to appear in the Point of Sale."
|
||||
msgstr ""
|
||||
"Cochez si vous souhaitez faire apparaître ce produit dans le Point de Vente"
|
||||
|
||||
#. module: pos_usability
|
||||
#: model:ir.model.fields,field_description:pos_usability.field_pos_category__display_name
|
||||
#: model:ir.model.fields,field_description:pos_usability.field_pos_payment_method__display_name
|
||||
#: model:ir.model.fields,field_description:pos_usability.field_product_template__display_name
|
||||
msgid "Display Name"
|
||||
msgstr "Nom affiché"
|
||||
|
||||
#. module: pos_usability
|
||||
#: model:ir.model.fields,field_description:pos_usability.field_pos_category__id
|
||||
#: model:ir.model.fields,field_description:pos_usability.field_pos_payment_method__id
|
||||
#: model:ir.model.fields,field_description:pos_usability.field_product_template__id
|
||||
msgid "ID"
|
||||
msgstr ""
|
||||
|
||||
#. module: pos_usability
|
||||
#: model:ir.model.fields,field_description:pos_usability.field_pos_category____last_update
|
||||
#: model:ir.model.fields,field_description:pos_usability.field_pos_payment_method____last_update
|
||||
#: model:ir.model.fields,field_description:pos_usability.field_product_template____last_update
|
||||
msgid "Last Modified on"
|
||||
msgstr "Dernière modification le"
|
||||
|
||||
#. module: pos_usability
|
||||
#: model:ir.model,name:pos_usability.model_pos_category
|
||||
#: model:ir.model.fields,field_description:pos_usability.field_product_product__pos_categ_id
|
||||
#: model:ir.model.fields,field_description:pos_usability.field_product_template__pos_categ_id
|
||||
#: model_terms:ir.ui.view,arch_db:pos_usability.product_template_search_view
|
||||
msgid "Point of Sale Category"
|
||||
msgstr "Catégorie du point de vente"
|
||||
|
||||
#. module: pos_usability
|
||||
#: model:ir.model,name:pos_usability.model_pos_payment_method
|
||||
msgid "Point of Sale Payment Methods"
|
||||
msgstr "Modes de paiement au point de vente"
|
||||
|
||||
#. module: pos_usability
|
||||
#: model:ir.model,name:pos_usability.model_product_template
|
||||
msgid "Product Template"
|
||||
msgstr "Modèle d'article"
|
||||
|
||||
#. module: pos_usability
|
||||
#: model_terms:ir.ui.view,arch_db:pos_usability.view_pos_session_form
|
||||
msgid "Starting Balance"
|
||||
msgstr "Montant à l'ouverture"
|
||||
|
||||
#. module: pos_usability
|
||||
#: model_terms:ir.ui.view,arch_db:pos_usability.view_pos_session_form
|
||||
msgid "Stats"
|
||||
msgstr ""
|
||||
|
||||
#. module: pos_usability
|
||||
#: model:ir.model.fields,help:pos_usability.field_pos_category__product_count
|
||||
msgid ""
|
||||
"The number of products under this point of sale category (does not consider "
|
||||
"the children categories)"
|
||||
msgstr ""
|
||||
|
||||
#. module: pos_usability
|
||||
#: model:ir.model.fields,help:pos_usability.field_pos_payment_method__cash_journal_id
|
||||
msgid ""
|
||||
"The payment method is of type cash. A cash statement will be automatically "
|
||||
"generated."
|
||||
msgstr ""
|
||||
"Cette méthode de paiement est de type cash. Un relevé sera automatiquement "
|
||||
"généré. "
|
||||
|
||||
@@ -15,6 +15,20 @@
|
||||
<button name="show_journal_items" position="after">
|
||||
<button name="%(point_of_sale.action_report_pos_order_all)d" type="action" class="oe_stat_button" icon="fa-table" string="Stats" context="{'search_default_session_id': active_id}"/>
|
||||
</button>
|
||||
<xpath
|
||||
expr="//field[@name='cash_register_total_entry_encoding']/parent::group"
|
||||
position="before"
|
||||
>
|
||||
<group>
|
||||
<field
|
||||
style="text-align:right;margin:0;padding:0;"
|
||||
name="cash_register_balance_start"
|
||||
widget="monetary"
|
||||
options="{'currency_field': 'currency_id'}"
|
||||
string="Starting Balance"
|
||||
/>
|
||||
</group>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
@@ -21,17 +21,22 @@ The usability enhancements include:
|
||||
|
||||
* hide description field on product (description_sale must be use instead of description)
|
||||
|
||||
* add a field barcode_type in product form view
|
||||
|
||||
This module has been written by Alexis de Lattre from Akretion <alexis.delattre@akretion.com>.
|
||||
""",
|
||||
'author': 'Akretion',
|
||||
'website': 'http://www.akretion.com',
|
||||
'depends': ['product'],
|
||||
"external_dependencies": {"python": ["stdnum"]},
|
||||
'data': [
|
||||
'views/product_supplierinfo_view.xml',
|
||||
'views/product_pricelist_view.xml',
|
||||
'views/product_pricelist_item.xml',
|
||||
'views/product_template_view.xml',
|
||||
'views/product_product.xml',
|
||||
'views/uom_uom.xml',
|
||||
'views/product_category_view.xml',
|
||||
],
|
||||
'installable': True,
|
||||
}
|
||||
|
||||
@@ -2,3 +2,4 @@ from . import product_product
|
||||
from . import product_template
|
||||
from . import product_supplierinfo
|
||||
from . import product_pricelist
|
||||
from . import product_category
|
||||
|
||||
13
product_usability/models/product_category.py
Normal file
13
product_usability/models/product_category.py
Normal file
@@ -0,0 +1,13 @@
|
||||
# Copyright 2022 Akretion (https://www.akretion.com).
|
||||
# @author Sébastien BEAU <sebastien.beau@akretion.com>
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class ProductCategory(models.Model):
|
||||
_inherit = ['product.category', "mail.thread", "mail.activity.mixin"]
|
||||
_name = 'product.category'
|
||||
|
||||
name = fields.Char(tracking=10)
|
||||
parent_id = fields.Many2one(tracking=20)
|
||||
@@ -1,21 +1,20 @@
|
||||
# Copyright 2015-2020 Akretion (http://www.akretion.com)
|
||||
# Copyright 2015-2021 Akretion (http://www.akretion.com)
|
||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# @author Raphaël Valyi <rvalyi@akretion.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import models, fields
|
||||
from odoo import api, models, fields
|
||||
from stdnum.ean import is_valid
|
||||
|
||||
|
||||
class ProductProduct(models.Model):
|
||||
_inherit = 'product.product'
|
||||
|
||||
default_code = fields.Char(copy=False)
|
||||
# track_visibility='onchange',
|
||||
|
||||
# barcode = fields.Char(track_visibility='onchange',
|
||||
|
||||
# weight = fields.Float(track_visibility='onchange')
|
||||
# active = fields.Boolean(track_visibility='onchange')
|
||||
default_code = fields.Char(copy=False, tracking=10)
|
||||
barcode = fields.Char(tracking=20)
|
||||
weight = fields.Float(tracking=30)
|
||||
active = fields.Boolean(tracking=40)
|
||||
barcode_type = fields.Char(compute='_compute_barcode_type')
|
||||
|
||||
_sql_constraints = [(
|
||||
# Maybe it could be better to have a constrain per company
|
||||
@@ -26,3 +25,19 @@ class ProductProduct(models.Model):
|
||||
'default_code_uniq',
|
||||
'unique(default_code)',
|
||||
'This internal reference already exists!')]
|
||||
|
||||
@api.model
|
||||
def _get_barcode_type(self, barcode):
|
||||
barcode_type = False
|
||||
if barcode:
|
||||
size = len(barcode)
|
||||
if size == 13 and is_valid(barcode):
|
||||
barcode_type = 'EAN13'
|
||||
elif size == 8 and is_valid(barcode):
|
||||
barcode_type = 'EAN8'
|
||||
return barcode_type
|
||||
|
||||
@api.depends('barcode')
|
||||
def _compute_barcode_type(self):
|
||||
for product in self:
|
||||
product.barcode_type = self._get_barcode_type(product.barcode)
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
# Copyright 2015-2020 Akretion (http://www.akretion.com)
|
||||
# Copyright 2015-2021 Akretion (http://www.akretion.com)
|
||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# @author Raphaël Valyi <rvalyi@akretion.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import models, fields
|
||||
from odoo import api, models, fields
|
||||
|
||||
|
||||
class ProductTemplate(models.Model):
|
||||
@@ -21,9 +21,24 @@ class ProductTemplate(models.Model):
|
||||
# are only shown in the form view of product.template, not in the form
|
||||
# view of product.product
|
||||
name = fields.Char(tracking=10)
|
||||
categ_id = fields.Many2one(tracking=20)
|
||||
type = fields.Selection(tracking=30)
|
||||
list_price = fields.Float(tracking=40)
|
||||
sale_ok = fields.Boolean(tracking=50)
|
||||
purchase_ok = fields.Boolean(tracking=60)
|
||||
active = fields.Boolean(tracking=70)
|
||||
barcode = fields.Char(tracking=20)
|
||||
default_code = fields.Char(tracking=30)
|
||||
categ_id = fields.Many2one(tracking=40)
|
||||
type = fields.Selection(tracking=50)
|
||||
list_price = fields.Float(tracking=60)
|
||||
weight = fields.Float(tracking=70)
|
||||
sale_ok = fields.Boolean(tracking=80)
|
||||
purchase_ok = fields.Boolean(tracking=90)
|
||||
active = fields.Boolean(tracking=100)
|
||||
company_id = fields.Many2one(tracking=110)
|
||||
barcode_type = fields.Char(compute='_compute_template_barcode_type')
|
||||
|
||||
@api.depends('product_variant_ids.barcode')
|
||||
def _compute_template_barcode_type(self):
|
||||
ppo = self.env['product.product']
|
||||
for template in self:
|
||||
barcode_type = False
|
||||
if len(template.product_variant_ids) == 1:
|
||||
barcode = template.product_variant_ids.barcode
|
||||
barcode_type = ppo._get_barcode_type(barcode)
|
||||
template.barcode_type = barcode_type
|
||||
|
||||
19
product_usability/views/product_category_view.xml
Normal file
19
product_usability/views/product_category_view.xml
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<odoo>
|
||||
|
||||
<record id="product_category_form_view" model="ir.ui.view">
|
||||
<field name="model">product.category</field>
|
||||
<field name="inherit_id" ref="product.product_category_form_view" />
|
||||
<field name="arch" type="xml">
|
||||
<sheet position="after">
|
||||
<div class="oe_chatter">
|
||||
<field name="message_follower_ids"/>
|
||||
<field name="activity_ids"/>
|
||||
<field name="message_ids"/>
|
||||
</div>
|
||||
</sheet>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
|
||||
@@ -21,4 +21,16 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="product_normal_form_view" model="ir.ui.view">
|
||||
<field name="name">usability.product.product.form</field>
|
||||
<field name="model">product.product</field>
|
||||
<field name="inherit_id" ref="product.product_normal_form_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="barcode" position="after">
|
||||
<field name="barcode_type" attrs="{'invisible': [('barcode', '=', False)]}"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
</odoo>
|
||||
|
||||
@@ -19,4 +19,17 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- product template ONLY form view -->
|
||||
<record id="product_template_only_form_view" model="ir.ui.view">
|
||||
<field name="name">usability.product.template.ONLY.form</field>
|
||||
<field name="model">product.template</field>
|
||||
<field name="inherit_id" ref="product.product_template_only_form_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="barcode" position="after">
|
||||
<!-- barcode is False when the template has several variants anyway -->
|
||||
<field name="barcode_type" attrs="{'invisible': [('barcode', '=', False)]}"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
|
||||
22
product_usability/views/uom_uom.xml
Normal file
22
product_usability/views/uom_uom.xml
Normal file
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright 2022 Akretion France (http://www.akretion.com/)
|
||||
@author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
-->
|
||||
|
||||
<odoo>
|
||||
|
||||
<!-- When the module stock and sale are not installed,
|
||||
there is no menu entry for UoM ! These menu entry fixes this -->
|
||||
|
||||
<menuitem id="uom_config_menu" parent="base.menu_custom"
|
||||
name="Units of Measure" sequence="150"/>
|
||||
|
||||
<menuitem id="uom_categ_config_menu" parent="uom_config_menu"
|
||||
action="uom.product_uom_categ_form_action" sequence="10" />
|
||||
|
||||
<menuitem id="uom_uom_config_menu" parent="uom_config_menu"
|
||||
action="uom.product_uom_form_action" sequence="20" />
|
||||
|
||||
</odoo>
|
||||
185
purchase_usability/i18n/fr.po
Normal file
185
purchase_usability/i18n/fr.po
Normal file
@@ -0,0 +1,185 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * purchase_usability
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 14.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2021-11-30 13:35+0000\n"
|
||||
"PO-Revision-Date: 2021-11-30 13:35+0000\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: \n"
|
||||
|
||||
#. module: purchase_usability
|
||||
#: model_terms:ir.ui.view,arch_db:purchase_usability.purchase_order_line_search
|
||||
msgid "Analytic Account"
|
||||
msgstr ""
|
||||
|
||||
#. module: purchase_usability
|
||||
#: model_terms:ir.ui.view,arch_db:purchase_usability.purchase_order_form
|
||||
msgid "Are you sure you want to cancel this purchase order?"
|
||||
msgstr "Êtes-vous sûr de vouloir annuler cette commande?"
|
||||
|
||||
#. module: purchase_usability
|
||||
#: model_terms:ir.ui.view,arch_db:purchase_usability.view_purchase_order_filter
|
||||
msgid "Billing Status"
|
||||
msgstr ""
|
||||
|
||||
#. module: purchase_usability
|
||||
#: model:ir.model,name:purchase_usability.model_res_partner
|
||||
msgid "Contact"
|
||||
msgstr ""
|
||||
|
||||
#. module: purchase_usability
|
||||
#: model:ir.model.fields,field_description:purchase_usability.field_product_product__purchase_method
|
||||
#: model:ir.model.fields,field_description:purchase_usability.field_product_template__purchase_method
|
||||
msgid "Control Policy"
|
||||
msgstr "Politique de contrôle"
|
||||
|
||||
#. module: purchase_usability
|
||||
#: model:ir.model.fields,field_description:purchase_usability.field_purchase_order__currency_id
|
||||
msgid "Currency"
|
||||
msgstr "Devise"
|
||||
|
||||
#. module: purchase_usability
|
||||
#: model:ir.model.fields,field_description:purchase_usability.field_purchase_order__delivery_partner_id
|
||||
msgid "Delivery Partner"
|
||||
msgstr ""
|
||||
|
||||
#. module: purchase_usability
|
||||
#: model:ir.model.fields,field_description:purchase_usability.field_product_template__display_name
|
||||
#: model:ir.model.fields,field_description:purchase_usability.field_purchase_order__display_name
|
||||
#: model:ir.model.fields,field_description:purchase_usability.field_purchase_order_line__display_name
|
||||
#: model:ir.model.fields,field_description:purchase_usability.field_res_partner__display_name
|
||||
msgid "Display Name"
|
||||
msgstr "Nom"
|
||||
|
||||
#. module: purchase_usability
|
||||
#: model:ir.model.fields,field_description:purchase_usability.field_purchase_order__dest_address_id
|
||||
msgid "Drop Ship Address"
|
||||
msgstr "Adresse de livraison directe"
|
||||
|
||||
#. module: purchase_usability
|
||||
#: model:ir.model.fields,field_description:purchase_usability.field_purchase_order__fiscal_position_id
|
||||
msgid "Fiscal Position"
|
||||
msgstr "Position fiscale"
|
||||
|
||||
#. module: purchase_usability
|
||||
#: model:ir.model.fields,field_description:purchase_usability.field_product_template__id
|
||||
#: model:ir.model.fields,field_description:purchase_usability.field_purchase_order__id
|
||||
#: model:ir.model.fields,field_description:purchase_usability.field_purchase_order_line__id
|
||||
#: model:ir.model.fields,field_description:purchase_usability.field_res_partner__id
|
||||
msgid "ID"
|
||||
msgstr ""
|
||||
|
||||
#. module: purchase_usability
|
||||
#: model:ir.model.fields,help:purchase_usability.field_purchase_order_line__product_barcode
|
||||
msgid "International Article Number used for product identification."
|
||||
msgstr ""
|
||||
|
||||
#. module: purchase_usability
|
||||
#: model:ir.model.fields,field_description:purchase_usability.field_product_template____last_update
|
||||
#: model:ir.model.fields,field_description:purchase_usability.field_purchase_order____last_update
|
||||
#: model:ir.model.fields,field_description:purchase_usability.field_purchase_order_line____last_update
|
||||
#: model:ir.model.fields,field_description:purchase_usability.field_res_partner____last_update
|
||||
msgid "Last Modified on"
|
||||
msgstr "Dernière modification le"
|
||||
|
||||
#. module: purchase_usability
|
||||
#: model:ir.model.fields,help:purchase_usability.field_product_product__purchase_method
|
||||
#: model:ir.model.fields,help:purchase_usability.field_product_template__purchase_method
|
||||
msgid ""
|
||||
"On ordered quantities: Control bills based on ordered quantities.\n"
|
||||
"On received quantities: Control bills based on received quantities."
|
||||
msgstr ""
|
||||
"Sur base des quantités commandées: factures de controle basées sur les quantités commandées. \n"
|
||||
"Sur base des quantités reçues: factures de controle basées sur les quantités reçues."
|
||||
|
||||
#. module: purchase_usability
|
||||
#: model:ir.model.fields,field_description:purchase_usability.field_purchase_order__payment_term_id
|
||||
msgid "Payment Terms"
|
||||
msgstr "Conditions de paiement"
|
||||
|
||||
#. module: purchase_usability
|
||||
#: model_terms:ir.ui.view,arch_db:purchase_usability.purchase_order_form
|
||||
msgid "Print"
|
||||
msgstr "Imprimer"
|
||||
|
||||
#. module: purchase_usability
|
||||
#: model:ir.model.fields,field_description:purchase_usability.field_purchase_order_line__product_barcode
|
||||
msgid "Product Barcode"
|
||||
msgstr ""
|
||||
|
||||
#. module: purchase_usability
|
||||
#: model:ir.model,name:purchase_usability.model_product_template
|
||||
msgid "Product Template"
|
||||
msgstr "Modèle de produit"
|
||||
|
||||
#. module: purchase_usability
|
||||
#: model:ir.model,name:purchase_usability.model_purchase_order
|
||||
#: model:ir.model.fields,field_description:purchase_usability.field_res_partner__purchase_warn
|
||||
#: model:ir.model.fields,field_description:purchase_usability.field_res_users__purchase_warn
|
||||
msgid "Purchase Order"
|
||||
msgstr "Commande fournisseur"
|
||||
|
||||
#. module: purchase_usability
|
||||
#: model:ir.model,name:purchase_usability.model_purchase_order_line
|
||||
msgid "Purchase Order Line"
|
||||
msgstr "Ligne de commande d'achat"
|
||||
|
||||
#. module: purchase_usability
|
||||
#: model:ir.model.fields,field_description:purchase_usability.field_product_product__purchase_line_warn
|
||||
#: model:ir.model.fields,field_description:purchase_usability.field_product_template__purchase_line_warn
|
||||
msgid "Purchase Order Line Warning"
|
||||
msgstr "Avertissement Ligne de Commande "
|
||||
|
||||
#. module: purchase_usability
|
||||
#: model:ir.model.fields,help:purchase_usability.field_purchase_order__dest_address_id
|
||||
msgid ""
|
||||
"Put an address if you want to deliver directly from the vendor to the "
|
||||
"customer. Otherwise, keep empty to deliver to your own company."
|
||||
msgstr ""
|
||||
"Ajoutez une adresse si vous voulez livrer directement du fournisseur au "
|
||||
"client. Sinon, laissez vide pour vous faire livrer à votre société."
|
||||
|
||||
#. module: purchase_usability
|
||||
#: model:ir.model.fields,help:purchase_usability.field_purchase_order__partner_ref
|
||||
msgid ""
|
||||
"Reference of the sales order or bid sent by the vendor. It's used to do the "
|
||||
"matching when you receive the products as this reference is usually written "
|
||||
"on the delivery order sent by your vendor."
|
||||
msgstr ""
|
||||
"Référence de la commande client ou offre envoyée par le fournisseur. Utilisé"
|
||||
" principalement pour faire la correspondance lors de la réception des "
|
||||
"articles, puisque cette référence est généralement écrite sur le bon de "
|
||||
"livraison envoyé par votre fournisseur."
|
||||
|
||||
#. module: purchase_usability
|
||||
#: model_terms:ir.ui.view,arch_db:purchase_usability.view_purchase_order_filter
|
||||
msgid "Reference, Origin or Vendor Reference"
|
||||
msgstr ""
|
||||
|
||||
#. module: purchase_usability
|
||||
#: model:ir.model.fields,help:purchase_usability.field_product_product__purchase_line_warn
|
||||
#: model:ir.model.fields,help:purchase_usability.field_product_template__purchase_line_warn
|
||||
#: model:ir.model.fields,help:purchase_usability.field_res_partner__purchase_warn
|
||||
#: model:ir.model.fields,help:purchase_usability.field_res_users__purchase_warn
|
||||
msgid ""
|
||||
"Selecting the \"Warning\" option will notify user with the message, "
|
||||
"Selecting \"Blocking Message\" will throw an exception with the message and "
|
||||
"block the flow. The Message has to be written in the next field."
|
||||
msgstr ""
|
||||
"Sélectionner l'option 'Avertissement' notifiera l'utilisateur avec le "
|
||||
"Message. Sélectionner 'Message Bloquant' lancera une exception avec le "
|
||||
"message et bloquera le flux. Le Message doit être encodé dans le champ "
|
||||
"suivant."
|
||||
|
||||
#. module: purchase_usability
|
||||
#: model:ir.model.fields,field_description:purchase_usability.field_purchase_order__partner_ref
|
||||
msgid "Vendor Reference"
|
||||
msgstr "Référence fournisseur"
|
||||
@@ -73,3 +73,28 @@ class PurchaseOrderLine(models.Model):
|
||||
|
||||
# for optional display in tree view
|
||||
product_barcode = fields.Char(related='product_id.barcode', string="Product Barcode")
|
||||
product_supplier_code = fields.Char(
|
||||
compute='_compute_product_supplier_code', string='Vendor Product Code')
|
||||
|
||||
def _compute_product_supplier_code(self):
|
||||
for line in self:
|
||||
code = False
|
||||
if not line.display_type and line.product_id and line.order_id:
|
||||
partner_id = line.order_id.partner_id.commercial_partner_id.id
|
||||
if partner_id:
|
||||
for supplier_info in line.product_id.seller_ids:
|
||||
if supplier_info.name.id == partner_id:
|
||||
code = supplier_info.product_code
|
||||
break
|
||||
line.product_supplier_code = code
|
||||
|
||||
def _get_product_purchase_description(self, product_lang):
|
||||
# This is useful when you want to have the product code in a dedicated
|
||||
# column in your purchase order report
|
||||
# The same ir.config_parameter is used in sale_usability,
|
||||
# purchase_usability and account_usability
|
||||
no_product_code_param = self.env['ir.config_parameter'].sudo().get_param(
|
||||
'usability.line_name_no_product_code')
|
||||
if no_product_code_param and no_product_code_param == 'True':
|
||||
product_lang = product_lang.with_context(display_default_code=False)
|
||||
return super()._get_product_purchase_description(product_lang)
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
<attribute name="groups">analytic.group_analytic_tags</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='order_line']/tree//field[@name='product_id']" position="after">
|
||||
<field name="product_supplier_code" optional="hide"/>
|
||||
<field name="product_barcode" optional="hide"/>
|
||||
</xpath>
|
||||
</field>
|
||||
|
||||
2
sale_order_add_bom/__init__.py
Normal file
2
sale_order_add_bom/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
||||
from . import models
|
||||
from . import wizard
|
||||
29
sale_order_add_bom/__manifest__.py
Normal file
29
sale_order_add_bom/__manifest__.py
Normal file
@@ -0,0 +1,29 @@
|
||||
# Copyright 2016-2022 Akretion France (http://www.akretion.com/)
|
||||
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
{
|
||||
'name': 'Sale Order Add Bom',
|
||||
'version': '14.0.1.0.0',
|
||||
'category': 'Sales',
|
||||
'license': 'AGPL-3',
|
||||
'summary': 'Wizard to select a bom from a sale order',
|
||||
'description': """
|
||||
This module adds a wizard *Add Kit* on the form view of a quotation that allows the user to select a 'kit' BOM: Odoo will automatically add the components of the kit as sale order lines.
|
||||
|
||||
The wizard *Add Kit* is also available on a draft picking.
|
||||
|
||||
This module has been written by Alexis de Lattre from Akretion
|
||||
<alexis.delattre@akretion.com>.
|
||||
""",
|
||||
'author': 'Akretion',
|
||||
'website': 'https://github.com/akretion/odoo-usability',
|
||||
'depends': ['sale', 'mrp'],
|
||||
'data': [
|
||||
'wizard/sale_add_phantom_bom_view.xml',
|
||||
'views/sale_order.xml',
|
||||
'views/stock_picking.xml',
|
||||
'security/ir.model.access.csv',
|
||||
],
|
||||
'installable': True,
|
||||
}
|
||||
1
sale_order_add_bom/models/__init__.py
Normal file
1
sale_order_add_bom/models/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import mrp_bom
|
||||
11
sale_order_add_bom/models/mrp_bom.py
Normal file
11
sale_order_add_bom/models/mrp_bom.py
Normal file
@@ -0,0 +1,11 @@
|
||||
# Copyright 2016-2022 Akretion France (http://www.akretion.com/)
|
||||
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import models, fields
|
||||
|
||||
|
||||
class MrpBom(models.Model):
|
||||
_inherit = 'mrp.bom'
|
||||
|
||||
sale_ok = fields.Boolean(related='product_tmpl_id.sale_ok', store=True)
|
||||
3
sale_order_add_bom/security/ir.model.access.csv
Normal file
3
sale_order_add_bom/security/ir.model.access.csv
Normal file
@@ -0,0 +1,3 @@
|
||||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
||||
access_sale_add_phantom_bom_sale,Full access on sale.add.phantom.bom wizard to sale user,model_sale_add_phantom_bom,sales_team.group_sale_salesman,1,1,1,1
|
||||
access_sale_add_phantom_bom_stock,Full access on sale.add.phantom.bom wizard to stock user,model_sale_add_phantom_bom,stock.group_stock_user,1,1,1,1
|
||||
|
22
sale_order_add_bom/views/sale_order.xml
Normal file
22
sale_order_add_bom/views/sale_order.xml
Normal file
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright 2016-2022 Akretion France (http://www.akretion.com/)
|
||||
@author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
-->
|
||||
|
||||
<odoo>
|
||||
|
||||
<record id="view_order_form" model="ir.ui.view">
|
||||
<field name="name">add.bom.sale.order.form</field>
|
||||
<field name="model">sale.order</field>
|
||||
<field name="inherit_id" ref="sale.view_order_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<button name="action_quotation_send" position="before">
|
||||
<button name="%(sale_add_phantom_bom_action)d" type="action"
|
||||
string="Add Kit" states="draft,sent"/>
|
||||
</button>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
24
sale_order_add_bom/views/stock_picking.xml
Normal file
24
sale_order_add_bom/views/stock_picking.xml
Normal file
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright 2021-2022 Akretion France (http://www.akretion.com/)
|
||||
@author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
-->
|
||||
|
||||
<odoo>
|
||||
<data>
|
||||
|
||||
<record id="view_picking_form" model="ir.ui.view">
|
||||
<field name="name">add.bom.stock.picking.form</field>
|
||||
<field name="model">stock.picking</field>
|
||||
<field name="inherit_id" ref="stock.view_picking_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<button name="action_confirm" position="after">
|
||||
<button name="%(sale_add_phantom_bom_action)d" type="action"
|
||||
string="Add Kit" states="draft" groups="stock.group_stock_user"/>
|
||||
</button>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</odoo>
|
||||
1
sale_order_add_bom/wizard/__init__.py
Normal file
1
sale_order_add_bom/wizard/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import sale_add_phantom_bom
|
||||
96
sale_order_add_bom/wizard/sale_add_phantom_bom.py
Normal file
96
sale_order_add_bom/wizard/sale_add_phantom_bom.py
Normal file
@@ -0,0 +1,96 @@
|
||||
# Copyright 2016-2022 Akretion France (http://www.akretion.com/)
|
||||
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import models, fields, api, _
|
||||
from odoo.exceptions import UserError
|
||||
from odoo.tools import float_is_zero
|
||||
|
||||
|
||||
class SaleAddPhantomBom(models.TransientModel):
|
||||
_name = 'sale.add.phantom.bom'
|
||||
_description = 'Add Kit to Quotation'
|
||||
|
||||
@api.model
|
||||
def default_get(self, fields_list):
|
||||
res = super().default_get(fields_list)
|
||||
if self._context.get('active_model') == 'sale.order':
|
||||
res['sale_id'] = self._context['active_id']
|
||||
sale = self.env['sale.order'].browse(res['sale_id'])
|
||||
res['company_id'] = sale.company_id.id
|
||||
elif self._context.get('active_model') == 'stock.picking':
|
||||
res['picking_id'] = self._context['active_id']
|
||||
picking = self.env['stock.picking'].browse(res['picking_id'])
|
||||
res['company_id'] = picking.company_id.id
|
||||
else:
|
||||
raise UserError(_(
|
||||
"The wizard can only be started from a sale order or a picking."))
|
||||
return res
|
||||
|
||||
bom_id = fields.Many2one(
|
||||
'mrp.bom', 'Kit', required=True,
|
||||
domain="['|', ('company_id', '=', False), ('company_id', '=', company_id), ('type', '=', 'phantom'), ('sale_ok', '=', True)]")
|
||||
company_id = fields.Many2one('res.company', string='Company', required=True)
|
||||
qty = fields.Integer(
|
||||
string='Number of Kits to Add', default=1, required=True)
|
||||
sale_id = fields.Many2one(
|
||||
'sale.order', string='Quotation')
|
||||
picking_id = fields.Many2one(
|
||||
'stock.picking', string='Picking')
|
||||
|
||||
@api.model
|
||||
def _prepare_sale_order_line(self, bom_line, sale_order, wizard_qty):
|
||||
qty_in_product_uom = bom_line.product_uom_id._compute_quantity(
|
||||
bom_line.product_qty,
|
||||
bom_line.product_id.uom_id)
|
||||
vals = {
|
||||
'product_id': bom_line.product_id.id,
|
||||
'product_uom_qty': qty_in_product_uom * wizard_qty,
|
||||
'order_id': sale_order.id,
|
||||
}
|
||||
# on sale.order.line, company_id is a related field
|
||||
return vals
|
||||
|
||||
@api.model
|
||||
def _prepare_stock_move(self, bom_line, picking, wizard_qty):
|
||||
product = bom_line.product_id
|
||||
qty_in_product_uom = bom_line.product_uom_id._compute_quantity(
|
||||
bom_line.product_qty, product.uom_id)
|
||||
vals = {
|
||||
'product_id': product.id,
|
||||
'product_uom_qty': qty_in_product_uom * wizard_qty,
|
||||
'product_uom': product.uom_id.id,
|
||||
'picking_id': picking.id,
|
||||
'company_id': picking.company_id.id,
|
||||
'location_id': picking.location_id.id,
|
||||
'location_dest_id': picking.location_dest_id.id,
|
||||
'name': product.partner_ref,
|
||||
}
|
||||
return vals
|
||||
|
||||
def add(self):
|
||||
self.ensure_one()
|
||||
assert self.sale_id or self.picking_id, 'No related sale_id or picking_id'
|
||||
if self.qty < 1:
|
||||
raise UserError(_(
|
||||
"The number of kits to add must be 1 or superior"))
|
||||
assert self.bom_id.type == 'phantom', 'The BOM is not a kit'
|
||||
if not self.bom_id.bom_line_ids:
|
||||
raise UserError(_("The selected kit is empty !"))
|
||||
prec = self.env['decimal.precision'].precision_get(
|
||||
'Product Unit of Measure')
|
||||
solo = self.env['sale.order.line']
|
||||
smo = self.env['stock.move']
|
||||
for line in self.bom_id.bom_line_ids:
|
||||
if float_is_zero(line.product_qty, precision_digits=prec):
|
||||
continue
|
||||
# The onchange is played in the inherit of the create()
|
||||
# of sale order line in the 'sale' module
|
||||
# TODO: if needed, we could increment existing order lines
|
||||
# with the same product instead of always creating new lines
|
||||
if self.sale_id:
|
||||
vals = self._prepare_sale_order_line(line, self.sale_id, self.qty)
|
||||
solo.create(vals)
|
||||
elif self.picking_id:
|
||||
vals = self._prepare_stock_move(line, self.picking_id, self.qty)
|
||||
smo.create(vals)
|
||||
38
sale_order_add_bom/wizard/sale_add_phantom_bom_view.xml
Normal file
38
sale_order_add_bom/wizard/sale_add_phantom_bom_view.xml
Normal file
@@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright 2016-2022 Akretion France (http://www.akretion.com/)
|
||||
@author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
-->
|
||||
|
||||
<odoo>
|
||||
|
||||
<record id="sale_add_phantom_bom_form" model="ir.ui.view">
|
||||
<field name="name">sale.add.phantom.bom.form</field>
|
||||
<field name="model">sale.add.phantom.bom</field>
|
||||
<field name="arch" type="xml">
|
||||
<form>
|
||||
<group name="main">
|
||||
<field name="sale_id" invisible="1"/>
|
||||
<field name="picking_id" invisible="1"/>
|
||||
<field name="company_id" invisible="1"/>
|
||||
<field name="bom_id" default_focus="1"/>
|
||||
<field name="qty"/>
|
||||
</group>
|
||||
<footer>
|
||||
<button name="add" type="object"
|
||||
class="btn-primary" string="Add"/>
|
||||
<button special="cancel" string="Cancel"/>
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="sale_add_phantom_bom_action" model="ir.actions.act_window">
|
||||
<field name="name">Add Kit</field>
|
||||
<field name="res_model">sale.add.phantom.bom</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
@@ -18,4 +18,25 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_quotation_tree" model="ir.ui.view">
|
||||
<field name="model">sale.order</field>
|
||||
<field name="inherit_id" ref="sale_stock.view_quotation_tree"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="warehouse_id" position="after">
|
||||
<field name="route_id" optional="hide"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_order_tree" model="ir.ui.view">
|
||||
<field name="model">sale.order</field>
|
||||
<field name="inherit_id" ref="sale_stock.view_order_tree"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="warehouse_id" position="after">
|
||||
<field name="route_id" optional="hide"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
</odoo>
|
||||
|
||||
0
sale_purchase_no_product_template_menu/__init__.py
Normal file
0
sale_purchase_no_product_template_menu/__init__.py
Normal file
29
sale_purchase_no_product_template_menu/__manifest__.py
Normal file
29
sale_purchase_no_product_template_menu/__manifest__.py
Normal file
@@ -0,0 +1,29 @@
|
||||
# Copyright 2015-2019 Akretion France (http://www.akretion.com/)
|
||||
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
{
|
||||
"name": "Sale Purchase No Product Template Menu",
|
||||
"version": "14.0.1.0.0",
|
||||
"category": "Sale and Purchase",
|
||||
"license": "AGPL-3",
|
||||
"summary": "Replace product.template menu entries by product.product menu entries",
|
||||
"description": """
|
||||
Sale Purchase No Product Template
|
||||
=================================
|
||||
|
||||
This module replaces the menu entries for product.template by menu entries for product.product in the *Sales* and *Purchases* menu entries. With this module, the only menu entry for product.template is in the menu *Sales > Configuration > Product Categories and Attributes*.
|
||||
|
||||
This module also switches to the tree view by default for Product menu entries, instead of the kanban view.
|
||||
|
||||
This module has been written by Alexis de Lattre from Akretion <alexis.delattre@akretion.com>.
|
||||
""",
|
||||
"author": "Akretion",
|
||||
"website": "http://www.akretion.com",
|
||||
"depends": [
|
||||
"purchase",
|
||||
"sale",
|
||||
],
|
||||
"data": ["view.xml"],
|
||||
"installable": True,
|
||||
}
|
||||
29
sale_purchase_no_product_template_menu/i18n/fr.po
Normal file
29
sale_purchase_no_product_template_menu/i18n/fr.po
Normal file
@@ -0,0 +1,29 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * sale_purchase_no_product_template_menu
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 8.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: \n"
|
||||
"PO-Revision-Date: 2022-03-28 17:19+0200\n"
|
||||
"Last-Translator: <>\n"
|
||||
"Language-Team: \n"
|
||||
"Language: fr\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: \n"
|
||||
"X-Generator: Poedit 3.0\n"
|
||||
|
||||
#. module: sale_purchase_no_product_template_menu
|
||||
#: model:ir.ui.menu,name:sale_purchase_no_product_template_menu.sale_config_product_template_menu
|
||||
msgid "Product Templates"
|
||||
msgstr "Modèles d'article"
|
||||
|
||||
#. module: sale_purchase_no_product_template_menu
|
||||
#: model:ir.actions.act_window,name:sale_purchase_no_product_template_menu.product_product_action_purchased
|
||||
#: model:ir.actions.act_window,name:sale_purchase_no_product_template_menu.product_product_action_sell
|
||||
msgid "Products"
|
||||
msgstr "Articles"
|
||||
@@ -0,0 +1,25 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * sale_purchase_no_product_template_menu
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 14.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: \n"
|
||||
|
||||
#. module: sale_purchase_no_product_template_menu
|
||||
#: model:ir.ui.menu,name:sale_purchase_no_product_template_menu.sale_config_product_template_menu
|
||||
msgid "Product Templates"
|
||||
msgstr ""
|
||||
|
||||
#. module: sale_purchase_no_product_template_menu
|
||||
#: model:ir.actions.act_window,name:sale_purchase_no_product_template_menu.product_product_action_purchased
|
||||
#: model:ir.actions.act_window,name:sale_purchase_no_product_template_menu.product_product_action_sell
|
||||
msgid "Products"
|
||||
msgstr ""
|
||||
63
sale_purchase_no_product_template_menu/view.xml
Normal file
63
sale_purchase_no_product_template_menu/view.xml
Normal file
@@ -0,0 +1,63 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright 2015-2019 Akretion France (http://www.akretion.com/)
|
||||
@author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
-->
|
||||
|
||||
<odoo>
|
||||
|
||||
<!-- PURCHASE -->
|
||||
<record id="product_product_action_purchased" model="ir.actions.act_window">
|
||||
<field name="name">Products</field>
|
||||
<field name="res_model">product.product</field>
|
||||
<field name="view_mode">tree,form,kanban</field>
|
||||
<field name="context">{'search_default_filter_to_purchase': 1}</field>
|
||||
<field name="search_view_id" eval="False"/> <!-- Force empty -->
|
||||
<field name="view_id" eval="False"/> <!-- Force empty -->
|
||||
</record>
|
||||
|
||||
<record id="purchase.menu_procurement_partner_contact_form" model="ir.ui.menu">
|
||||
<field name="action" ref="product_product_action_purchased"/>
|
||||
</record>
|
||||
|
||||
<!-- SALE -->
|
||||
<!-- I'd prefer to inherit product.product_normal_action_sell and
|
||||
change the "name" field, but it doesn't work with translation,
|
||||
so I redefine a new menu entry -->
|
||||
<record id="product_product_action_sell" model="ir.actions.act_window">
|
||||
<field name="name">Products</field>
|
||||
<field name="res_model">product.product</field>
|
||||
<field name="view_mode">tree,form,kanban</field>
|
||||
<field name="context">{'search_default_filter_to_sell': 1}</field>
|
||||
<field name="search_view_id" eval="False"/>
|
||||
<field name="view_id" ref="product.product_product_tree_view"/>
|
||||
<field name="search_view_id" ref="product.product_search_form_view"/>
|
||||
</record>
|
||||
|
||||
<!-- To keep good translations, we re-use the product.template menu
|
||||
entry and link it to product product -->
|
||||
<record id="sale.menu_product_template_action" model="ir.ui.menu">
|
||||
<!-- related action is "product.product_template_action" -->
|
||||
<field name="action" ref="product_product_action_sell"/>
|
||||
</record>
|
||||
|
||||
<record id="product.product_template_action" model="ir.actions.act_window">
|
||||
<field name="name">Product Templates</field> <!-- native value is "Products" -->
|
||||
<field name="view_mode">tree,form,kanban</field>
|
||||
<field name="view_id" eval="False"/>
|
||||
<field name="context">{}</field>
|
||||
</record>
|
||||
|
||||
|
||||
<!-- Create a product template menu entry in configuration -->
|
||||
<menuitem id="sale_config_product_template_menu" action="product.product_template_action"
|
||||
parent="sale.prod_config_main"/>
|
||||
|
||||
|
||||
<record id="product.product_normal_action_sell" model="ir.actions.act_window">
|
||||
<field name="view_mode">tree,form,kanban</field>
|
||||
</record>
|
||||
|
||||
|
||||
</odoo>
|
||||
@@ -12,6 +12,7 @@
|
||||
'website': 'http://www.akretion.com',
|
||||
'depends': [
|
||||
'sale',
|
||||
'account_usability', # for company view
|
||||
'base_view_inheritance_extension',
|
||||
],
|
||||
'data': [
|
||||
@@ -20,6 +21,8 @@
|
||||
'views/sale_report.xml',
|
||||
'views/product_pricelist_item.xml',
|
||||
'views/account_move.xml',
|
||||
'views/res_company.xml',
|
||||
"views/res_partner.xml",
|
||||
],
|
||||
'installable': True,
|
||||
}
|
||||
|
||||
@@ -2,3 +2,4 @@ from . import sale_order
|
||||
from . import account_move
|
||||
from . import product_template
|
||||
from . import res_partner
|
||||
from . import res_company
|
||||
|
||||
13
sale_usability/models/res_company.py
Normal file
13
sale_usability/models/res_company.py
Normal file
@@ -0,0 +1,13 @@
|
||||
# Copyright 2021 Akretion France (https://akretion.com/)
|
||||
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class ResCompany(models.Model):
|
||||
_inherit = 'res.company'
|
||||
|
||||
# Similar to the field static_invoice_terms in account_usability
|
||||
static_sale_terms = fields.Text(
|
||||
translate=True, string="Legal Terms on Quotation")
|
||||
@@ -124,3 +124,14 @@ class SaleOrderLine(models.Model):
|
||||
self.env, new_price, currency_obj=pricelist.currency_id))
|
||||
}
|
||||
return res
|
||||
|
||||
def get_sale_order_line_multiline_description_sale(self, product):
|
||||
# This is useful when you want to have the product code in a dedicated
|
||||
# column in your sale order report
|
||||
# The same ir.config_parameter is used in sale_usability,
|
||||
# purchase_usability and account_usability
|
||||
no_product_code_param = self.env['ir.config_parameter'].sudo().get_param(
|
||||
'usability.line_name_no_product_code')
|
||||
if no_product_code_param and no_product_code_param == 'True':
|
||||
product = product.with_context(display_default_code=False)
|
||||
return super().get_sale_order_line_multiline_description_sale(product)
|
||||
|
||||
25
sale_usability/views/res_company.xml
Normal file
25
sale_usability/views/res_company.xml
Normal file
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright 2021 Akretion (http://www.akretion.com/)
|
||||
@author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
-->
|
||||
|
||||
<odoo>
|
||||
|
||||
|
||||
<record id="view_company_form" model="ir.ui.view">
|
||||
<field name="name">sale_usability.res.company.form</field>
|
||||
<field name="model">res.company</field>
|
||||
<field name="inherit_id" ref="account_usability.view_company_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<group name="static_invoice_terms" position="after">
|
||||
<group name="static_sale_terms" string="Quotation Legal Terms">
|
||||
<field name="static_sale_terms" nolabel="1"/>
|
||||
</group>
|
||||
</group>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
</odoo>
|
||||
15
sale_usability/views/res_partner.xml
Normal file
15
sale_usability/views/res_partner.xml
Normal file
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<odoo>
|
||||
|
||||
<record id="res_partner_view_team" model="ir.ui.view">
|
||||
<field name="model">res.partner</field>
|
||||
<field name="inherit_id" ref="sales_team.res_partner_view_team" />
|
||||
<field name="arch" type="xml">
|
||||
<!-- team_id should be visible in no developper mode -->
|
||||
<field name="team_id" position="attributes">
|
||||
<attribute name="groups"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
@@ -54,4 +54,9 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="sale.action_order_report_all" model="ir.actions.act_window">
|
||||
<!-- native order is graph,pivot -->
|
||||
<field name="view_mode">pivot,graph</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
from . import models
|
||||
|
||||
@@ -22,6 +22,9 @@ This module has been written by Alexis de Lattre from Akretion <alexis.delattre@
|
||||
'author': 'Akretion',
|
||||
'website': 'http://www.akretion.com',
|
||||
'depends': ['stock_account', 'stock_usability'],
|
||||
'data': ['views/stock_move.xml'],
|
||||
'data': [
|
||||
'views/stock_move.xml',
|
||||
'views/product.xml',
|
||||
],
|
||||
'installable': True,
|
||||
}
|
||||
|
||||
1
stock_account_usability/models/__init__.py
Normal file
1
stock_account_usability/models/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import product
|
||||
38
stock_account_usability/models/product.py
Normal file
38
stock_account_usability/models/product.py
Normal file
@@ -0,0 +1,38 @@
|
||||
# Copyright 2022 Akretion France (http://www.akretion.com/)
|
||||
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import api, models
|
||||
|
||||
|
||||
class ProductTemplate(models.Model):
|
||||
_inherit = 'product.template'
|
||||
|
||||
def action_open_stock_valuation_layer(self):
|
||||
self.ensure_one()
|
||||
ppo = self.env['product.product']
|
||||
if len(self.product_variant_ids) == 1:
|
||||
action = ppo._get_stock_valuation_layer_action(self.product_variant_ids.id)
|
||||
else:
|
||||
action = ppo._get_stock_valuation_layer_action()
|
||||
action["domain"] = [('product_id', 'in', self.product_variant_ids.ids)]
|
||||
return action
|
||||
|
||||
|
||||
class ProductProduct(models.Model):
|
||||
_inherit = 'product.product'
|
||||
|
||||
def action_open_stock_valuation_layer(self):
|
||||
self.ensure_one()
|
||||
return self._get_stock_valuation_layer_action(self.id)
|
||||
|
||||
@api.model
|
||||
def _get_stock_valuation_layer_action(self, product_id=None):
|
||||
action = self.env["ir.actions.actions"]._for_xml_id(
|
||||
"stock_account.stock_valuation_layer_action")
|
||||
if product_id:
|
||||
action["context"] = {
|
||||
'search_default_product_id': product_id,
|
||||
'search_default_group_by_product_id': 1,
|
||||
}
|
||||
return action
|
||||
54
stock_account_usability/views/product.xml
Normal file
54
stock_account_usability/views/product.xml
Normal file
@@ -0,0 +1,54 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright 2022 Akretion France (http://www.akretion.com/)
|
||||
@author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
-->
|
||||
|
||||
<odoo>
|
||||
|
||||
<!--
|
||||
<record id="product_product_to_inventory_valuation" model="ir.actions.act_window">
|
||||
<field name="name">Inventory Valuation</field>
|
||||
<field name="res_model">stock.valuation.layer</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="groups_id" eval="[(4, ref('stock.group_stock_manager'))]"/>
|
||||
<field name="context">{'search_default_group_by_product_id': 1, 'search_default_product_id': active_id}</field>
|
||||
<field name="binding_model_id" ref="product.model_product_product" />
|
||||
<field name="binding_view_types">form</field>
|
||||
</record>
|
||||
|
||||
-->
|
||||
<!-- product template only form view -->
|
||||
<record id="product_template_form_view_procurement_button" model="ir.ui.view">
|
||||
<field name="model">product.template</field>
|
||||
<field name="inherit_id" ref="stock.product_template_form_view_procurement_button"/>
|
||||
<field name="arch" type="xml">
|
||||
<div name="button_box" position="inside">
|
||||
<button class="oe_stat_button"
|
||||
name="action_open_stock_valuation_layer"
|
||||
string="Inventory Valuation"
|
||||
icon="fa-usd"
|
||||
type="object" attrs="{'invisible': [('type', '!=', 'product')]}">
|
||||
</button>
|
||||
</div>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- product.product only form view -->
|
||||
<record id="product_form_view_procurement_button" model="ir.ui.view">
|
||||
<field name="model">product.product</field>
|
||||
<field name="inherit_id" ref="stock.product_form_view_procurement_button"/>
|
||||
<field name="arch" type="xml">
|
||||
<div name="button_box" position="inside">
|
||||
<button class="oe_stat_button"
|
||||
name="action_open_stock_valuation_layer"
|
||||
string="Inventory Valuation"
|
||||
icon="fa-usd"
|
||||
type="object" attrs="{'invisible': [('type', '!=', 'product')]}">
|
||||
</button>
|
||||
</div>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
@@ -22,5 +22,5 @@ This module has been written by Alexis de Lattre from Akretion <alexis.delattre@
|
||||
'website': 'http://www.akretion.com',
|
||||
'depends': ['stock'],
|
||||
'data': ['view.xml'],
|
||||
'installable': False,
|
||||
'installable': True,
|
||||
}
|
||||
|
||||
1
stock_reception_usability/__init__.py
Normal file
1
stock_reception_usability/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import models
|
||||
24
stock_reception_usability/__manifest__.py
Normal file
24
stock_reception_usability/__manifest__.py
Normal file
@@ -0,0 +1,24 @@
|
||||
# Copyright 2021 Akretion (https://www.akretion.com).
|
||||
# @author Kévin Roche <kevin.roche@akretion.com>
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
{
|
||||
"name": "Stock relation usability",
|
||||
"summary": "SUMMARY",
|
||||
"version": "14.0.1.0.0",
|
||||
"category": "Inventory, Logistic, Storage",
|
||||
"website": "http://www.akretion.com",
|
||||
"author": "Akretion",
|
||||
"license": "AGPL-3",
|
||||
"application": False,
|
||||
"installable": True,
|
||||
"depends": [
|
||||
"stock",
|
||||
"purchase",
|
||||
],
|
||||
"data": [
|
||||
"views/stock_picking.xml",
|
||||
],
|
||||
"demo": [],
|
||||
"qweb": [],
|
||||
}
|
||||
2
stock_reception_usability/models/__init__.py
Normal file
2
stock_reception_usability/models/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
||||
from . import stock_move
|
||||
|
||||
36
stock_reception_usability/models/stock_move.py
Normal file
36
stock_reception_usability/models/stock_move.py
Normal file
@@ -0,0 +1,36 @@
|
||||
# Copyright (C) 2021 Akretion (<http://www.akretion.com>).
|
||||
# @author Kévin Roche <kevin.roche@akretion.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class StockMove(models.Model):
|
||||
_inherit = "stock.move"
|
||||
|
||||
location_dest_list = fields.Text(
|
||||
string="Locations", compute="_compute_locations_dest_list"
|
||||
)
|
||||
|
||||
@api.depends(
|
||||
"move_line_ids", "move_line_ids.location_dest_id", "move_line_ids.qty_done"
|
||||
)
|
||||
def _compute_locations_dest_list(self):
|
||||
for move in self:
|
||||
data = []
|
||||
separator = ", "
|
||||
dest_list = move.move_line_ids.location_dest_id
|
||||
for dest in dest_list:
|
||||
lines_qty = move.move_line_ids.search(
|
||||
[("move_id", "=", move.id), ("location_dest_id", "=", dest.id)]
|
||||
).mapped("qty_done")
|
||||
quantity = int(sum(lines_qty))
|
||||
location = dest.name
|
||||
data.append("{}: {}".format(quantity, location))
|
||||
move.location_dest_list = separator.join(data)
|
||||
|
||||
def _compute_is_quantity_done_editable(self):
|
||||
super()._compute_is_quantity_done_editable()
|
||||
for move in self:
|
||||
if len(move.move_line_ids) == 1 and move.show_details_visible:
|
||||
move.is_quantity_done_editable = True
|
||||
17
stock_reception_usability/views/stock_picking.xml
Normal file
17
stock_reception_usability/views/stock_picking.xml
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo>
|
||||
<record id="view_picking_form" model="ir.ui.view">
|
||||
<field name="model">stock.picking</field>
|
||||
<field name="inherit_id" ref="stock.view_picking_form" />
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='product_uom']" position="after">
|
||||
<field name="location_dest_list" />
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='product_uom_qty']" position="attributes">
|
||||
<attribute
|
||||
name="attrs"
|
||||
>{'column_invisible': [('parent.state', '=', 'done')]}</attribute>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright 2020 Akretion France (http://www.akretion.com)
|
||||
# Copyright 2020-2021 Akretion France (http://www.akretion.com)
|
||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
Stock Valuation XLSX
|
||||
====================
|
||||
|
||||
This module is designed to work with *Cost Method* = **Average Cost (AVCO)**.
|
||||
|
||||
This module generate nice XLSX stock valuation reports either:
|
||||
|
||||
* from a physical inventory,
|
||||
|
||||
1
stock_valuation_xlsx/models/__init__.py
Normal file
1
stock_valuation_xlsx/models/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import stock_expiry_depreciation_rule
|
||||
@@ -0,0 +1,35 @@
|
||||
# Copyright 2021 Akretion France (http://www.akretion.com/)
|
||||
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class StockExpiryDepreciationRule(models.Model):
|
||||
_name = 'stock.expiry.depreciation.rule'
|
||||
_description = 'Stock Expiry Depreciation Rule'
|
||||
_order = 'company_id, start_limit_days'
|
||||
|
||||
company_id = fields.Many2one(
|
||||
'res.company', string='Company',
|
||||
ondelete='cascade', required=True,
|
||||
default=lambda self: self.env.company)
|
||||
start_limit_days = fields.Integer(
|
||||
string='Days Before/After Expiry', required=True,
|
||||
help="Enter negative value for days before expiry. Enter positive values for days after expiry. This value is the START of the time interval when going from future to past.")
|
||||
ratio = fields.Integer(string='Depreciation Ratio (%)', required=True)
|
||||
name = fields.Char(string='Label')
|
||||
|
||||
_sql_constraints = [(
|
||||
'ratio_positive',
|
||||
'CHECK(ratio >= 0)',
|
||||
'The depreciation ratio must be positive.'
|
||||
), (
|
||||
'ratio_max',
|
||||
'CHECK(ratio <= 100)',
|
||||
'The depreciation ratio cannot be above 100%.'
|
||||
), (
|
||||
'start_limit_days_unique',
|
||||
'unique(company_id, start_limit_days)',
|
||||
'This depreciation rule already exists in this company.'
|
||||
)]
|
||||
5
stock_valuation_xlsx/security/ir.model.access.csv
Normal file
5
stock_valuation_xlsx/security/ir.model.access.csv
Normal file
@@ -0,0 +1,5 @@
|
||||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
||||
access_stock_expiry_depreciation_rule_full,Full access on stock.expiry.depreciation.rule to account manager,model_stock_expiry_depreciation_rule,account.group_account_manager,1,1,1,1
|
||||
access_stock_expiry_depreciation_rule_read,Read access on stock.expiry.depreciation.rule to stock manager,model_stock_expiry_depreciation_rule,stock.group_stock_manager,1,0,0,0
|
||||
access_stock_valuation_xlsx,stock.valuation.xlsx wizard,model_stock_valuation_xlsx,stock.group_stock_user,1,1,1,0
|
||||
access_stock_variation_xlsx,stock.variation.xlsx wizard,model_stock_variation_xlsx,stock.group_stock_user,1,1,1,0
|
||||
|
@@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright 2021 Akretion France (http://www.akretion.com/)
|
||||
@author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
-->
|
||||
|
||||
<odoo>
|
||||
<data>
|
||||
|
||||
<record id="stock_expiry_depreciation_rule_tree" model="ir.ui.view">
|
||||
<field name="model">stock.expiry.depreciation.rule</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree editable="bottom">
|
||||
<field name="start_limit_days"/>
|
||||
<field name="ratio"/>
|
||||
<field name="name"/>
|
||||
<field name="company_id" groups="base.group_multi_company"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="stock_expiry_depreciation_rule_action" model="ir.actions.act_window">
|
||||
<field name="name">Stock Depreciation Rules</field>
|
||||
<field name="res_model">stock.expiry.depreciation.rule</field>
|
||||
<field name="view_mode">tree</field>
|
||||
</record>
|
||||
|
||||
<menuitem id="stock_expiry_depreciation_rule_menu"
|
||||
action="stock_expiry_depreciation_rule_action"
|
||||
parent="account.account_management_menu"
|
||||
sequence="100"/>
|
||||
|
||||
</data>
|
||||
</odoo>
|
||||
@@ -17,69 +17,53 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
class StockValuationXlsx(models.TransientModel):
|
||||
_name = 'stock.valuation.xlsx'
|
||||
_check_company_auto = True
|
||||
_description = 'Generate XLSX report for stock valuation'
|
||||
|
||||
export_file = fields.Binary(string='XLSX Report', readonly=True, attachment=True)
|
||||
export_filename = fields.Char(readonly=True)
|
||||
# I don't use ir.actions.url on v12, because it renders
|
||||
# the wizard unusable after the first report generation, which creates
|
||||
# a lot of confusion for users
|
||||
state = fields.Selection([
|
||||
('setup', 'Setup'),
|
||||
('done', 'Done'),
|
||||
], string='State', default='setup', readonly=True)
|
||||
company_id = fields.Many2one(
|
||||
'res.company', string='Company', default=lambda self: self.env.company,
|
||||
required=True)
|
||||
warehouse_id = fields.Many2one(
|
||||
'stock.warehouse', string='Warehouse',
|
||||
states={'done': [('readonly', True)]})
|
||||
'stock.warehouse', string='Warehouse', check_company=True,
|
||||
domain="[('company_id', '=', company_id)]")
|
||||
location_id = fields.Many2one(
|
||||
'stock.location', string='Root Stock Location', required=True,
|
||||
domain=[('usage', 'in', ('view', 'internal'))],
|
||||
default=lambda self: self._default_location(),
|
||||
states={'done': [('readonly', True)]},
|
||||
domain="[('usage', 'in', ('view', 'internal')), ('company_id', '=', company_id)]",
|
||||
default=lambda self: self._default_location(), check_company=True,
|
||||
help="The childen locations of the selected locations will "
|
||||
u"be taken in the valuation.")
|
||||
"be taken in the valuation.")
|
||||
categ_ids = fields.Many2many(
|
||||
'product.category', string='Product Category Filter',
|
||||
help="Leave this field empty to have a stock valuation for all your products.",
|
||||
states={'done': [('readonly', True)]},
|
||||
)
|
||||
source = fields.Selection([
|
||||
('inventory', 'Physical Inventory'),
|
||||
('stock', 'Stock Levels'),
|
||||
], string='Source data', default='stock', required=True,
|
||||
states={'done': [('readonly', True)]})
|
||||
], string='Source data', default='stock', required=True)
|
||||
inventory_id = fields.Many2one(
|
||||
'stock.inventory', string='Inventory', domain=[('state', '=', 'done')],
|
||||
states={'done': [('readonly', True)]})
|
||||
'stock.inventory', string='Inventory', check_company=True,
|
||||
domain="[('state', '=', 'done'), ('company_id', '=', company_id)]")
|
||||
stock_date_type = fields.Selection([
|
||||
('present', 'Present'),
|
||||
('past', 'Past'),
|
||||
], string='Present or Past', default='present',
|
||||
states={'done': [('readonly', True)]})
|
||||
], string='Present or Past', default='present')
|
||||
past_date = fields.Datetime(
|
||||
string='Past Date', states={'done': [('readonly', True)]},
|
||||
default=fields.Datetime.now)
|
||||
string='Past Date', default=fields.Datetime.now)
|
||||
categ_subtotal = fields.Boolean(
|
||||
string='Subtotals per Categories', default=True,
|
||||
states={'done': [('readonly', True)]},
|
||||
help="Show a subtotal per product category.")
|
||||
standard_price_date = fields.Selection([
|
||||
('past', 'Past Date or Inventory Date'),
|
||||
('present', 'Current'),
|
||||
], default='past', string='Cost Price Date',
|
||||
states={'done': [('readonly', True)]})
|
||||
# I can't put a compute field for has_expiry_date
|
||||
# because I want to have the value when the wizard is started,
|
||||
# and not wait until run
|
||||
], default='past', string='Cost Price Date')
|
||||
has_expiry_date = fields.Boolean(
|
||||
default=lambda self: self._default_has_expiry_date(), readonly=True)
|
||||
apply_depreciation = fields.Boolean(
|
||||
string='Apply Depreciation Rules', default=True,
|
||||
states={'done': [('readonly', True)]})
|
||||
split_by_lot = fields.Boolean(
|
||||
string='Display Lots', states={'done': [('readonly', True)]})
|
||||
split_by_location = fields.Boolean(
|
||||
string='Display Stock Locations', states={'done': [('readonly', True)]})
|
||||
string='Apply Depreciation Rules', default=True)
|
||||
split_by_lot = fields.Boolean(string='Display Lots')
|
||||
split_by_location = fields.Boolean(string='Display Stock Locations')
|
||||
|
||||
@api.model
|
||||
def _default_has_expiry_date(self):
|
||||
@@ -113,7 +97,7 @@ class StockValuationXlsx(models.TransientModel):
|
||||
raise UserError(_(
|
||||
"The selected inventory (%s) is not in done state.")
|
||||
% self.inventory_id.display_name)
|
||||
cost_method_real_count = self.env['ir.property'].search([
|
||||
cost_method_real_count = self.env['ir.property'].sudo().search([
|
||||
('company_id', '=', company_id),
|
||||
('name', '=', 'property_cost_method'),
|
||||
('value_text', '=', 'real'),
|
||||
@@ -140,12 +124,12 @@ class StockValuationXlsx(models.TransientModel):
|
||||
return products.ids
|
||||
|
||||
def _prepare_product_fields(self):
|
||||
return ['uom_id', 'name', 'default_code', 'categ_id']
|
||||
return ['uom_id', 'name', 'default_code', 'barcode', 'categ_id']
|
||||
|
||||
def _prepare_expiry_depreciation_rules(self, company_id, past_date):
|
||||
rules = self.env['stock.expiry.depreciation.rule'].search_read([('company_id', '=', company_id)], ['start_limit_days', 'ratio'], order='start_limit_days desc')
|
||||
if past_date:
|
||||
date_dt = past_date
|
||||
date_dt = fields.Date.to_date(past_date) # convert datetime to date
|
||||
else:
|
||||
date_dt = fields.Date.context_today(self)
|
||||
for rule in rules:
|
||||
@@ -153,31 +137,40 @@ class StockValuationXlsx(models.TransientModel):
|
||||
logger.debug('depreciation_rules=%s', rules)
|
||||
return rules
|
||||
|
||||
def compute_product_data(
|
||||
self, company_id, in_stock_product_ids, standard_price_past_date=False):
|
||||
self.ensure_one()
|
||||
logger.debug('Start compute_product_data')
|
||||
ppo = self.env['product.product']
|
||||
ppho = self.env['product.price.history']
|
||||
@api.model
|
||||
def compute_product_data(self, company_id, filter_product_ids, standard_price_dict):
|
||||
# standard_price_dict is a dictionnary with:
|
||||
# keys = the keys that we expect in the result dict
|
||||
# values : a datetime object (for past date) or False (False means PRESENT)
|
||||
logger.debug(
|
||||
'Start compute_product_data standard_price_dict=%s', standard_price_dict)
|
||||
ppo = self.env['product.product'].with_company(company_id)
|
||||
svlo = self.env['stock.valuation.layer']
|
||||
fields_list = self._prepare_product_fields()
|
||||
if not standard_price_past_date:
|
||||
# Do we need the present date?
|
||||
if not all(standard_price_dict.values()):
|
||||
fields_list.append('standard_price')
|
||||
products = ppo.search_read([('id', 'in', in_stock_product_ids)], fields_list)
|
||||
products = ppo.search_read([('id', 'in', filter_product_ids)], fields_list)
|
||||
product_id2data = {}
|
||||
for p in products:
|
||||
logger.debug('p=%d', p['id'])
|
||||
# I don't call the native method get_history_price()
|
||||
# because it requires a browse record and it is too slow
|
||||
if standard_price_past_date:
|
||||
history = ppho.search_read([
|
||||
('company_id', '=', company_id),
|
||||
('product_id', '=', p['id']),
|
||||
('datetime', '<=', standard_price_past_date)],
|
||||
['cost'], order='datetime desc, id desc', limit=1)
|
||||
standard_price = history and history[0]['cost'] or 0.0
|
||||
else:
|
||||
standard_price = p['standard_price']
|
||||
product_id2data[p['id']] = {'standard_price': standard_price}
|
||||
product_id2data[p['id']] = {}
|
||||
for std_price_field_name, std_price_date in standard_price_dict.items():
|
||||
if not std_price_date: # present
|
||||
product_id2data[p['id']][std_price_field_name] = p['standard_price']
|
||||
else:
|
||||
layer_rg = svlo.read_group(
|
||||
[
|
||||
('product_id', '=', p['id']),
|
||||
('company_id', '=', company_id),
|
||||
('create_date', '<=', std_price_date),
|
||||
],
|
||||
['value', 'quantity'],
|
||||
[])
|
||||
standard_price = 0
|
||||
if layer_rg and layer_rg[0]['quantity']:
|
||||
standard_price = layer_rg[0]['value'] / layer_rg[0]['quantity']
|
||||
product_id2data[p['id']][std_price_field_name] = standard_price
|
||||
for pfield in fields_list:
|
||||
if pfield.endswith('_id'):
|
||||
product_id2data[p['id']][pfield] = p[pfield][0]
|
||||
@@ -363,10 +356,9 @@ class StockValuationXlsx(models.TransientModel):
|
||||
def generate(self):
|
||||
self.ensure_one()
|
||||
logger.debug('Start generate XLSX stock valuation report')
|
||||
splo = self.env['stock.production.lot'].with_context(active_test=False)
|
||||
prec_qty = self.env['decimal.precision'].precision_get('Product Unit of Measure')
|
||||
prec_price = self.env['decimal.precision'].precision_get('Product Price')
|
||||
company = self.env.user.company_id
|
||||
company = self.company_id
|
||||
company_id = company.id
|
||||
prec_cur_rounding = company.currency_id.rounding
|
||||
self._check_config(company_id)
|
||||
@@ -396,9 +388,13 @@ class StockValuationXlsx(models.TransientModel):
|
||||
elif self.source == 'inventory':
|
||||
past_date = self.inventory_id.date
|
||||
data, in_stock_products = self.compute_data_from_inventory(product_ids, prec_qty)
|
||||
standard_price_past_date = past_date
|
||||
if not (self.source == 'stock' and self.stock_date_type == 'present') and self.standard_price_date == 'present':
|
||||
if self.source == 'stock' and self.stock_date_type == 'present':
|
||||
standard_price_past_date = False
|
||||
else: # field standard_price_date is shown on screen
|
||||
if self.standard_price_date == 'present':
|
||||
standard_price_past_date = False
|
||||
else:
|
||||
standard_price_past_date = past_date
|
||||
depreciation_rules = []
|
||||
if apply_depreciation:
|
||||
depreciation_rules = self._prepare_expiry_depreciation_rules(company_id, past_date)
|
||||
@@ -409,7 +405,7 @@ class StockValuationXlsx(models.TransientModel):
|
||||
in_stock_product_ids = list(in_stock_products.keys())
|
||||
product_id2data = self.compute_product_data(
|
||||
company_id, in_stock_product_ids,
|
||||
standard_price_past_date=standard_price_past_date)
|
||||
{'standard_price': standard_price_past_date})
|
||||
data_res = self.group_result(data, split_by_lot, split_by_location)
|
||||
categ_id2name = self.product_categ_id2name(self.categ_ids)
|
||||
uom_id2name = self.uom_id2name()
|
||||
@@ -521,11 +517,10 @@ class StockValuationXlsx(models.TransientModel):
|
||||
sheet.write_formula(i, cols['subtotal']['pos'], subtotal_formula, styles['regular_currency'], l['subtotal'])
|
||||
for col_name, col in cols.items():
|
||||
if not col.get('formula'):
|
||||
if col.get('type') == 'date':
|
||||
if l[col_name]:
|
||||
l[col_name] = fields.Date.from_string(l[col_name])
|
||||
else:
|
||||
l[col_name] = '' # to avoid display of 31/12/1899
|
||||
if not l[col_name]:
|
||||
l[col_name] = '' # to avoid display of 31/12/1899 (dates) or '0' (char)
|
||||
if col.get('type') == 'date' and l[col_name]:
|
||||
l[col_name] = fields.Date.from_string(l[col_name])
|
||||
sheet.write(i, col['pos'], l[col_name], styles[col['style']])
|
||||
if categ_subtotal:
|
||||
if categ_has_line:
|
||||
@@ -548,21 +543,17 @@ class StockValuationXlsx(models.TransientModel):
|
||||
filename = 'Odoo_stock_%s.xlsx' % stock_time_str.replace(' ', '-').replace(':', '_')
|
||||
export_file_b64 = base64.b64encode(file_data.read())
|
||||
self.write({
|
||||
'state': 'done',
|
||||
'export_filename': filename,
|
||||
'export_file': export_file_b64,
|
||||
})
|
||||
# action = {
|
||||
# 'name': _('Stock Valuation XLSX'),
|
||||
# 'type': 'ir.actions.act_url',
|
||||
# 'url': "web/content/?model=%s&id=%d&filename_field=export_filename&"
|
||||
# "field=export_file&download=true&filename=%s" % (
|
||||
# self._name, self.id, self.export_filename),
|
||||
# 'target': 'self',
|
||||
# }
|
||||
action = self.env['ir.actions.act_window'].for_xml_id(
|
||||
'stock_valuation_xlsx', 'stock_valuation_xlsx_action')
|
||||
action['res_id'] = self.id
|
||||
action = {
|
||||
'name': _('Stock Valuation XLSX'),
|
||||
'type': 'ir.actions.act_url',
|
||||
'url': "web/content/?model=%s&id=%d&filename_field=export_filename&"
|
||||
"field=export_file&download=true&filename=%s" % (
|
||||
self._name, self.id, self.export_filename),
|
||||
'target': 'new',
|
||||
}
|
||||
return action
|
||||
|
||||
def _prepare_styles(self, workbook, company, prec_price):
|
||||
@@ -570,8 +561,8 @@ class StockValuationXlsx(models.TransientModel):
|
||||
categ_bg_color = '#e1daf5'
|
||||
col_title_bg_color = '#fff9b4'
|
||||
regular_font_size = 10
|
||||
currency_num_format = u'# ### ##0.00 %s' % company.currency_id.symbol
|
||||
price_currency_num_format = u'# ### ##0.%s %s' % ('0' * prec_price, company.currency_id.symbol)
|
||||
currency_num_format = '# ### ##0.00 %s' % company.currency_id.symbol
|
||||
price_currency_num_format = '# ### ##0.%s %s' % ('0' * prec_price, company.currency_id.symbol)
|
||||
styles = {
|
||||
'doc_title': workbook.add_format({
|
||||
'bold': True, 'font_size': regular_font_size + 10,
|
||||
@@ -591,7 +582,7 @@ class StockValuationXlsx(models.TransientModel):
|
||||
'regular_date': workbook.add_format({'num_format': 'dd/mm/yyyy'}),
|
||||
'regular_currency': workbook.add_format({'num_format': currency_num_format}),
|
||||
'regular_price_currency': workbook.add_format({'num_format': price_currency_num_format}),
|
||||
'regular_int_percent': workbook.add_format({'num_format': u'0.%'}),
|
||||
'regular_int_percent': workbook.add_format({'num_format': '0.%'}),
|
||||
'regular': workbook.add_format({}),
|
||||
'regular_small': workbook.add_format({'font_size': regular_font_size - 2}),
|
||||
'categ_title': workbook.add_format({
|
||||
@@ -609,6 +600,7 @@ class StockValuationXlsx(models.TransientModel):
|
||||
def _prepare_cols(self):
|
||||
cols = {
|
||||
'default_code': {'width': 18, 'style': 'regular', 'sequence': 10, 'title': _('Product Code')},
|
||||
'barcode': {'width': 18, 'style': 'regular', 'sequence': 10, 'title': _('Product Barcode')},
|
||||
'product_name': {'width': 40, 'style': 'regular', 'sequence': 20, 'title': _('Product Name')},
|
||||
'loc_name': {'width': 25, 'style': 'regular_small', 'sequence': 30, 'title': _('Location Name')},
|
||||
'lot_name': {'width': 18, 'style': 'regular', 'sequence': 40, 'title': _('Lot')},
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<p>The generated XLSX report has the valuation of stockable products located on the selected stock locations (and their childrens).</p>
|
||||
</div>
|
||||
<group name="setup">
|
||||
<field name="state" invisible="1"/>
|
||||
<field name="company_id" groups="base.group_multi_company"/>
|
||||
<field name="categ_ids" widget="many2many_tags"/>
|
||||
<field name="warehouse_id"/>
|
||||
<field name="location_id"/>
|
||||
@@ -32,32 +32,23 @@
|
||||
<field name="split_by_location" attrs="{'invisible': [('source', '=', 'stock'), ('stock_date_type', '=', 'past')]}"/>
|
||||
<field name="apply_depreciation" groups="stock.group_production_lot" attrs="{'invisible': ['|', '|', ('split_by_lot', '=', False), ('has_expiry_date', '=', False), '&', ('source', '=', 'stock'), ('stock_date_type', '=', 'past')]}"/>
|
||||
</group>
|
||||
<group name="done" states="done" string="Result">
|
||||
<field name="export_file" filename="export_filename"/>
|
||||
<field name="export_filename" invisible="1"/>
|
||||
</group>
|
||||
<footer>
|
||||
<button name="generate" type="object" states="setup"
|
||||
class="btn-primary" string="Generate"/>
|
||||
<button special="cancel" string="Cancel" class="btn-default" states="setup"/>
|
||||
<button special="cancel" string="Close" class="btn-default" states="done"/>
|
||||
<button name="generate" type="object" class="btn-primary" string="Generate"/>
|
||||
<button special="cancel" string="Close" class="btn-default"/>
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="stock_valuation_xlsx_action" model="ir.actions.act_window">
|
||||
<field name="name">Stock Valuation XLSX</field>
|
||||
<field name="name">Inventory Valuation XLSX</field>
|
||||
<field name="res_model">stock.valuation.xlsx</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<!-- Replace native menu, to avoid user confusion -->
|
||||
<record id="stock_account.menu_valuation" model="ir.ui.menu">
|
||||
<field name="action" ref="stock_valuation_xlsx.stock_valuation_xlsx_action"/>
|
||||
<field name="name">Stock Valuation XLSX</field>
|
||||
<field name="sequence">0</field>
|
||||
</record>
|
||||
<!-- in v14, I don't replace the native menu any more, because the native menu shows valuation layers,
|
||||
which can be useful -->
|
||||
<menuitem id="stock_valuation_xlsx_menu" action="stock_valuation_xlsx_action" sequence="115" parent="stock.menu_warehouse_report"/>
|
||||
|
||||
</odoo>
|
||||
|
||||
406
stock_valuation_xlsx/wizard/stock_variation_xlsx.py
Normal file
406
stock_valuation_xlsx/wizard/stock_variation_xlsx.py
Normal file
@@ -0,0 +1,406 @@
|
||||
# Copyright 2020-2021 Akretion France (http://www.akretion.com/)
|
||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import models, fields, api, _
|
||||
from odoo.exceptions import UserError
|
||||
from odoo.tools import float_is_zero, float_round
|
||||
from io import BytesIO
|
||||
import base64
|
||||
from datetime import datetime
|
||||
import xlsxwriter
|
||||
import logging
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class StockVariationXlsx(models.TransientModel):
|
||||
_name = 'stock.variation.xlsx'
|
||||
_check_company_auto = True
|
||||
_description = 'Generate XLSX report for stock valuation variation between 2 dates'
|
||||
|
||||
export_file = fields.Binary(string='XLSX Report', readonly=True, attachment=True)
|
||||
export_filename = fields.Char(readonly=True)
|
||||
company_id = fields.Many2one(
|
||||
'res.company', string='Company', default=lambda self: self.env.company,
|
||||
required=True)
|
||||
warehouse_id = fields.Many2one(
|
||||
'stock.warehouse', string='Warehouse', check_company=True,
|
||||
domain="[('company_id', '=', company_id)]")
|
||||
location_id = fields.Many2one(
|
||||
'stock.location', string='Root Stock Location', required=True,
|
||||
domain="[('usage', 'in', ('view', 'internal')), ('company_id', '=', company_id)]",
|
||||
default=lambda self: self._default_location(), check_company=True,
|
||||
help="The childen locations of the selected locations will "
|
||||
"be taken in the valuation.")
|
||||
categ_ids = fields.Many2many(
|
||||
'product.category', string='Product Category Filter',
|
||||
help="Leave this fields empty to have a stock valuation for all your products.")
|
||||
start_date = fields.Datetime(
|
||||
string='Start Date', required=True)
|
||||
standard_price_start_date_type = fields.Selection([
|
||||
('start', 'Start Date'),
|
||||
('present', 'Current'),
|
||||
], default='start', required=True,
|
||||
string='Cost Price for Start Date')
|
||||
end_date_type = fields.Selection([
|
||||
('present', 'Present'),
|
||||
('past', 'Past'),
|
||||
], string='End Date Type', default='present', required=True)
|
||||
end_date = fields.Datetime(
|
||||
string='End Date', default=fields.Datetime.now)
|
||||
standard_price_end_date_type = fields.Selection([
|
||||
('end', 'End Date'),
|
||||
('present', 'Current'),
|
||||
], default='end', string='Cost Price for End Date', required=True)
|
||||
categ_subtotal = fields.Boolean(
|
||||
string='Subtotals per Categories', default=True,
|
||||
help="Show a subtotal per product category.")
|
||||
|
||||
@api.model
|
||||
def _default_location(self):
|
||||
wh = self.env.ref('stock.warehouse0')
|
||||
return wh.lot_stock_id
|
||||
|
||||
@api.onchange('warehouse_id')
|
||||
def warehouse_id_change(self):
|
||||
if self.warehouse_id:
|
||||
self.location_id = self.warehouse_id.view_location_id.id
|
||||
|
||||
def _check_config(self, company_id):
|
||||
self.ensure_one()
|
||||
present = fields.Datetime.now()
|
||||
if self.end_date_type == 'past':
|
||||
if not self.end_date:
|
||||
raise UserError(_("End Date is missing."))
|
||||
if self.end_date > present:
|
||||
raise UserError(_("The end date must be in the past."))
|
||||
if self.end_date <= self.start_date:
|
||||
raise UserError(_("The start date must be before the end date."))
|
||||
else:
|
||||
if self.start_date >= present:
|
||||
raise UserError(_("The start date must be in the past."))
|
||||
cost_method_real_count = self.env['ir.property'].sudo().search([
|
||||
('company_id', '=', company_id),
|
||||
('name', '=', 'property_cost_method'),
|
||||
('value_text', '=', 'real'),
|
||||
('type', '=', 'selection'),
|
||||
], count=True)
|
||||
if cost_method_real_count:
|
||||
raise UserError(_(
|
||||
"There are %d properties that have "
|
||||
"'Costing Method' = 'Real Price'. This costing "
|
||||
"method is not supported by this module.")
|
||||
% cost_method_real_count)
|
||||
|
||||
def _prepare_product_domain(self):
|
||||
self.ensure_one()
|
||||
domain = [('type', '=', 'product')]
|
||||
if self.categ_ids:
|
||||
domain += [('categ_id', 'child_of', self.categ_ids.ids)]
|
||||
return domain
|
||||
|
||||
def get_product_ids(self):
|
||||
self.ensure_one()
|
||||
domain = self._prepare_product_domain()
|
||||
# Should we also add inactive products ??
|
||||
products = self.env['product.product'].search(domain)
|
||||
return products.ids
|
||||
|
||||
def compute_data_from_stock(self, product_ids, prec_qty, start_date, end_date_type, end_date, company_id):
|
||||
self.ensure_one()
|
||||
logger.debug('Start compute_data_from_stock past_date=%s end_date_type=%s, end_date=%s', start_date, end_date_type, end_date)
|
||||
ppo = self.env['product.product']
|
||||
smo = self.env['stock.move']
|
||||
sqo = self.env['stock.quant']
|
||||
ppo_loc = ppo.with_context(location=self.location_id.id).with_company(company_id)
|
||||
# Inspired by odoo/addons/stock/models/product.py
|
||||
# method _compute_quantities_dict()
|
||||
domain_quant_loc, domain_move_in_loc, domain_move_out_loc = ppo_loc._get_domain_locations()
|
||||
domain_quant = [('product_id', 'in', product_ids)] + domain_quant_loc
|
||||
domain_move_in = [('product_id', 'in', product_ids), ('state', '=', 'done')] + domain_move_in_loc
|
||||
domain_move_out = [('product_id', 'in', product_ids), ('state', '=', 'done')] + domain_move_out_loc
|
||||
quants_res = dict((item['product_id'][0], item['quantity']) for item in sqo.read_group(domain_quant, ['product_id', 'quantity'], ['product_id'], orderby='id'))
|
||||
domain_move_in_start_to_end = [('date', '>', start_date)] + domain_move_in
|
||||
domain_move_out_start_to_end = [('date', '>', start_date)] + domain_move_out
|
||||
if end_date_type == 'past':
|
||||
|
||||
domain_move_in_end_to_present = [('date', '>', end_date)] + domain_move_in
|
||||
domain_move_out_end_to_present = [('date', '>', end_date)] + domain_move_out
|
||||
moves_in_res_end_to_present = dict((item['product_id'][0], item['product_qty']) for item in smo.read_group(domain_move_in_end_to_present, ['product_id', 'product_qty'], ['product_id'], orderby='id'))
|
||||
moves_out_res_end_to_present = dict((item['product_id'][0], item['product_qty']) for item in smo.read_group(domain_move_out_end_to_present, ['product_id', 'product_qty'], ['product_id'], orderby='id'))
|
||||
|
||||
domain_move_in_start_to_end += [('date', '<', end_date)]
|
||||
domain_move_out_start_to_end += [('date', '<', end_date)]
|
||||
|
||||
moves_in_res_start_to_end = dict((item['product_id'][0], item['product_qty']) for item in smo.read_group(domain_move_in_start_to_end, ['product_id', 'product_qty'], ['product_id'], orderby='id'))
|
||||
moves_out_res_start_to_end = dict((item['product_id'][0], item['product_qty']) for item in smo.read_group(domain_move_out_start_to_end, ['product_id', 'product_qty'], ['product_id'], orderby='id'))
|
||||
|
||||
product_data = {} # key = product_id , value = dict
|
||||
for product in ppo.browse(product_ids):
|
||||
end_qty = quants_res.get(product.id, 0.0)
|
||||
if end_date_type == 'past':
|
||||
end_qty += moves_out_res_end_to_present.get(product.id, 0.0) - moves_in_res_end_to_present.get(product.id, 0.0)
|
||||
in_qty = moves_in_res_start_to_end.get(product.id, 0.0)
|
||||
out_qty = moves_out_res_start_to_end.get(product.id, 0.0)
|
||||
start_qty = end_qty - in_qty + out_qty
|
||||
if (
|
||||
not float_is_zero(start_qty, precision_digits=prec_qty) or
|
||||
not float_is_zero(in_qty, precision_digits=prec_qty) or
|
||||
not float_is_zero(out_qty, precision_digits=prec_qty) or
|
||||
not float_is_zero(end_qty, precision_digits=prec_qty)):
|
||||
product_data[product.id] = {
|
||||
'product_id': product.id,
|
||||
'start_qty': start_qty,
|
||||
'in_qty': in_qty,
|
||||
'out_qty': out_qty,
|
||||
'end_qty': end_qty,
|
||||
}
|
||||
logger.debug('End compute_data_from_stock')
|
||||
return product_data
|
||||
|
||||
def stringify_and_sort_result(
|
||||
self, product_data, product_id2data, prec_qty, prec_price, prec_cur_rounding,
|
||||
categ_id2name, uom_id2name):
|
||||
logger.debug('Start stringify_and_sort_result')
|
||||
res = []
|
||||
for product_id, l in product_data.items():
|
||||
start_qty = float_round(l['start_qty'], precision_digits=prec_qty)
|
||||
in_qty = float_round(l['in_qty'], precision_digits=prec_qty)
|
||||
out_qty = float_round(l['out_qty'], precision_digits=prec_qty)
|
||||
end_qty = float_round(l['end_qty'], precision_digits=prec_qty)
|
||||
start_standard_price = float_round(
|
||||
product_id2data[product_id]['start_standard_price'],
|
||||
precision_digits=prec_price)
|
||||
end_standard_price = float_round(
|
||||
product_id2data[product_id]['end_standard_price'],
|
||||
precision_digits=prec_price)
|
||||
start_subtotal = float_round(
|
||||
start_standard_price * start_qty, precision_rounding=prec_cur_rounding)
|
||||
end_subtotal = float_round(
|
||||
end_standard_price * end_qty, precision_rounding=prec_cur_rounding)
|
||||
variation = float_round(
|
||||
end_subtotal - start_subtotal, precision_rounding=prec_cur_rounding)
|
||||
res.append(dict(
|
||||
product_id2data[product_id],
|
||||
product_name=product_id2data[product_id]['name'],
|
||||
start_qty=start_qty,
|
||||
start_standard_price=start_standard_price,
|
||||
start_subtotal=start_subtotal,
|
||||
in_qty=in_qty,
|
||||
out_qty=out_qty,
|
||||
end_qty=end_qty,
|
||||
end_standard_price=end_standard_price,
|
||||
end_subtotal=end_subtotal,
|
||||
variation=variation,
|
||||
uom_name=uom_id2name[product_id2data[product_id]['uom_id']],
|
||||
categ_name=categ_id2name[product_id2data[product_id]['categ_id']],
|
||||
))
|
||||
sort_res = sorted(res, key=lambda x: x['product_name'])
|
||||
logger.debug('End stringify_and_sort_result')
|
||||
return sort_res
|
||||
|
||||
def generate(self):
|
||||
self.ensure_one()
|
||||
logger.debug('Start generate XLSX stock variation report')
|
||||
svxo = self.env['stock.valuation.xlsx']
|
||||
prec_qty = self.env['decimal.precision'].precision_get('Product Unit of Measure')
|
||||
prec_price = self.env['decimal.precision'].precision_get('Product Price')
|
||||
company = self.company_id
|
||||
company_id = company.id
|
||||
prec_cur_rounding = company.currency_id.rounding
|
||||
self._check_config(company_id)
|
||||
|
||||
product_ids = self.get_product_ids()
|
||||
if not product_ids:
|
||||
raise UserError(_("There are no products to analyse."))
|
||||
|
||||
product_data = self.compute_data_from_stock(
|
||||
product_ids, prec_qty, self.start_date, self.end_date_type, self.end_date,
|
||||
company_id)
|
||||
standard_price_start_date = standard_price_end_date = False
|
||||
if self.standard_price_start_date_type == 'start':
|
||||
standard_price_start_date = self.start_date
|
||||
if self.standard_price_end_date_type == 'end' and self.end_date_type == 'past':
|
||||
standard_price_end_date = self.end_date
|
||||
|
||||
product_id2data = svxo.compute_product_data(
|
||||
company_id, list(product_data.keys()), {
|
||||
'start_standard_price': standard_price_start_date,
|
||||
'end_standard_price': standard_price_end_date})
|
||||
categ_id2name = svxo.product_categ_id2name(self.categ_ids)
|
||||
uom_id2name = svxo.uom_id2name()
|
||||
res = self.stringify_and_sort_result(
|
||||
product_data, product_id2data, prec_qty, prec_price, prec_cur_rounding,
|
||||
categ_id2name, uom_id2name)
|
||||
|
||||
logger.debug('Start create XLSX workbook')
|
||||
file_data = BytesIO()
|
||||
workbook = xlsxwriter.Workbook(file_data)
|
||||
sheet = workbook.add_worksheet('Stock_Variation')
|
||||
styles = svxo._prepare_styles(workbook, company, prec_price)
|
||||
cols = self._prepare_cols()
|
||||
categ_subtotal = self.categ_subtotal
|
||||
# remove cols that we won't use
|
||||
if not categ_subtotal:
|
||||
cols.pop('categ_subtotal', None)
|
||||
|
||||
j = 0
|
||||
for col, col_vals in sorted(cols.items(), key=lambda x: x[1]['sequence']):
|
||||
cols[col]['pos'] = j
|
||||
cols[col]['pos_letter'] = chr(j + 97).upper()
|
||||
sheet.set_column(j, j, cols[col]['width'])
|
||||
j += 1
|
||||
|
||||
# HEADER
|
||||
now_dt = fields.Datetime.context_timestamp(self, datetime.now())
|
||||
now_str = fields.Datetime.to_string(now_dt)
|
||||
start_time_utc_dt = self.start_date
|
||||
start_time_dt = fields.Datetime.context_timestamp(self, start_time_utc_dt)
|
||||
start_time_str = fields.Datetime.to_string(start_time_dt)
|
||||
if self.end_date_type == 'past':
|
||||
end_time_utc_dt = self.end_date
|
||||
end_time_dt = fields.Datetime.context_timestamp(self, end_time_utc_dt)
|
||||
end_time_str = fields.Datetime.to_string(end_time_dt)
|
||||
else:
|
||||
end_time_str = now_str
|
||||
if standard_price_start_date:
|
||||
standard_price_start_date_str = start_time_str
|
||||
else:
|
||||
standard_price_start_date_str = now_str
|
||||
if standard_price_end_date:
|
||||
standard_price_end_date_str = end_time_str
|
||||
else:
|
||||
standard_price_end_date_str = now_str
|
||||
i = 0
|
||||
sheet.write(i, 0, 'Odoo - Stock Valuation Variation', styles['doc_title'])
|
||||
sheet.set_row(0, 26)
|
||||
i += 1
|
||||
sheet.write(i, 0, 'Start Date: %s' % start_time_str, styles['doc_subtitle'])
|
||||
i += 1
|
||||
sheet.write(i, 0, 'Cost Price Start Date: %s' % standard_price_start_date_str, styles['doc_subtitle'])
|
||||
i += 1
|
||||
sheet.write(i, 0, 'End Date: %s' % end_time_str, styles['doc_subtitle'])
|
||||
i += 1
|
||||
sheet.write(i, 0, 'Cost Price End Date: %s' % standard_price_end_date_str, styles['doc_subtitle'])
|
||||
i += 1
|
||||
sheet.write(i, 0, 'Stock location (children included): %s' % self.location_id.complete_name, styles['doc_subtitle'])
|
||||
if self.categ_ids:
|
||||
i += 1
|
||||
sheet.write(i, 0, 'Product Categories: %s' % ', '.join([categ.display_name for categ in self.categ_ids]), styles['doc_subtitle'])
|
||||
i += 1
|
||||
sheet.write(i, 0, 'Generated on %s by %s' % (now_str, self.env.user.name), styles['regular_small'])
|
||||
|
||||
# TITLE of COLS
|
||||
i += 2
|
||||
for col in cols.values():
|
||||
sheet.write(i, col['pos'], col['title'], styles['col_title'])
|
||||
|
||||
i += 1
|
||||
sheet.write(i, 0, _("TOTALS:"), styles['total_title'])
|
||||
total_row = i
|
||||
|
||||
# LINES
|
||||
if categ_subtotal:
|
||||
categ_ids = categ_id2name.keys()
|
||||
else:
|
||||
categ_ids = [0]
|
||||
|
||||
start_total = end_total = variation_total = 0.0
|
||||
letter_start_qty = cols['start_qty']['pos_letter']
|
||||
letter_in_qty = cols['in_qty']['pos_letter']
|
||||
letter_out_qty = cols['out_qty']['pos_letter']
|
||||
letter_end_qty = cols['end_qty']['pos_letter']
|
||||
letter_start_price = cols['start_standard_price']['pos_letter']
|
||||
letter_end_price = cols['end_standard_price']['pos_letter']
|
||||
letter_start_subtotal = cols['start_subtotal']['pos_letter']
|
||||
letter_end_subtotal = cols['end_subtotal']['pos_letter']
|
||||
letter_variation = cols['variation']['pos_letter']
|
||||
crow = 0
|
||||
lines = res
|
||||
for categ_id in categ_ids:
|
||||
ctotal = 0.0
|
||||
categ_has_line = False
|
||||
if categ_subtotal:
|
||||
# skip a line and save it's position as crow
|
||||
i += 1
|
||||
crow = i
|
||||
lines = filter(lambda x: x['categ_id'] == categ_id, res)
|
||||
for l in lines:
|
||||
i += 1
|
||||
start_total += l['start_subtotal']
|
||||
end_total += l['end_subtotal']
|
||||
variation_total += l['variation']
|
||||
ctotal += l['variation']
|
||||
categ_has_line = True
|
||||
end_qty_formula = '=%s%d+%s%d-%s%d' % (letter_start_qty, i + 1, letter_in_qty, i + 1, letter_out_qty, i + 1)
|
||||
sheet.write_formula(i, cols['end_qty']['pos'], end_qty_formula, styles[cols['end_qty']['style']], l['end_qty'])
|
||||
start_subtotal_formula = '=%s%d*%s%d' % (letter_start_qty, i + 1, letter_start_price, i + 1)
|
||||
sheet.write_formula(i, cols['start_subtotal']['pos'], start_subtotal_formula, styles[cols['start_subtotal']['style']], l['start_subtotal'])
|
||||
end_subtotal_formula = '=%s%d*%s%d' % (letter_end_qty, i + 1, letter_end_price, i + 1)
|
||||
sheet.write_formula(i, cols['end_subtotal']['pos'], end_subtotal_formula, styles[cols['end_subtotal']['style']], l['end_subtotal'])
|
||||
variation_formula = '=%s%d-%s%d' % (letter_end_subtotal, i + 1, letter_start_subtotal, i + 1)
|
||||
sheet.write_formula(i, cols['variation']['pos'], variation_formula, styles[cols['variation']['style']], l['variation'])
|
||||
sheet.write_formula(i, cols['end_subtotal']['pos'], end_subtotal_formula, styles[cols['end_subtotal']['style']], l['end_subtotal'])
|
||||
for col_name, col in cols.items():
|
||||
if not col.get('formula'):
|
||||
if col.get('type') == 'date' and l[col_name]:
|
||||
l[col_name] = fields.Date.from_string(l[col_name])
|
||||
sheet.write(i, col['pos'], l[col_name], styles[col['style']])
|
||||
if categ_subtotal:
|
||||
if categ_has_line:
|
||||
sheet.write(crow, 0, categ_id2name[categ_id], styles['categ_title'])
|
||||
for x in range(cols['categ_subtotal']['pos'] - 1):
|
||||
sheet.write(crow, x + 1, '', styles['categ_title'])
|
||||
|
||||
cformula = '=SUM(%s%d:%s%d)' % (letter_variation, crow + 2, letter_variation, i + 1)
|
||||
sheet.write_formula(crow, cols['categ_subtotal']['pos'], cformula, styles['categ_currency'], float_round(ctotal, precision_rounding=prec_cur_rounding))
|
||||
else:
|
||||
i -= 1 # go back to skipped line
|
||||
|
||||
# Write total
|
||||
start_total_formula = '=SUM(%s%d:%s%d)' % (letter_start_subtotal, total_row + 2, letter_start_subtotal, i + 1)
|
||||
sheet.write_formula(total_row, cols['start_subtotal']['pos'], start_total_formula, styles['total_currency'], float_round(start_total, precision_rounding=prec_cur_rounding))
|
||||
end_total_formula = '=SUM(%s%d:%s%d)' % (letter_end_subtotal, total_row + 2, letter_end_subtotal, i + 1)
|
||||
sheet.write_formula(total_row, cols['end_subtotal']['pos'], end_total_formula, styles['total_currency'], float_round(end_total, precision_rounding=prec_cur_rounding))
|
||||
variation_total_formula = '=SUM(%s%d:%s%d)' % (letter_variation, total_row + 2, letter_variation, i + 1)
|
||||
sheet.write_formula(total_row, cols['variation']['pos'], variation_total_formula, styles['total_currency'], float_round(variation_total, precision_rounding=prec_cur_rounding))
|
||||
|
||||
workbook.close()
|
||||
logger.debug('End create XLSX workbook')
|
||||
file_data.seek(0)
|
||||
filename = 'Odoo_stock_%s_%s.xlsx' % (
|
||||
start_time_str.replace(' ', '-').replace(':', '_'),
|
||||
end_time_str.replace(' ', '-').replace(':', '_'))
|
||||
export_file_b64 = base64.b64encode(file_data.read())
|
||||
self.write({
|
||||
'export_filename': filename,
|
||||
'export_file': export_file_b64,
|
||||
})
|
||||
action = {
|
||||
'name': _('Stock Variation XLSX'),
|
||||
'type': 'ir.actions.act_url',
|
||||
'url': "web/content/?model=%s&id=%d&filename_field=export_filename&"
|
||||
"field=export_file&download=true&filename=%s" % (
|
||||
self._name, self.id, self.export_filename),
|
||||
'target': 'new',
|
||||
}
|
||||
return action
|
||||
|
||||
def _prepare_cols(self):
|
||||
cols = {
|
||||
'default_code': {'width': 18, 'style': 'regular', 'sequence': 10, 'title': _('Product Code')},
|
||||
'product_name': {'width': 40, 'style': 'regular', 'sequence': 20, 'title': _('Product Name')},
|
||||
'uom_name': {'width': 5, 'style': 'regular_small', 'sequence': 30, 'title': _('UoM')},
|
||||
'start_qty': {'width': 8, 'style': 'regular', 'sequence': 40, 'title': _('Start Qty')},
|
||||
'start_standard_price': {'width': 14, 'style': 'regular_price_currency', 'sequence': 50, 'title': _('Start Cost Price')},
|
||||
'start_subtotal': {'width': 16, 'style': 'regular_currency', 'sequence': 60, 'title': _('Start Value'), 'formula': True},
|
||||
'in_qty': {'width': 8, 'style': 'regular', 'sequence': 70, 'title': _('In Qty')},
|
||||
'out_qty': {'width': 8, 'style': 'regular', 'sequence': 80, 'title': _('Out Qty')},
|
||||
'end_qty': {'width': 8, 'style': 'regular', 'sequence': 90, 'title': _('End Qty'), 'formula': True},
|
||||
'end_standard_price': {'width': 14, 'style': 'regular_price_currency', 'sequence': 100, 'title': _('End Cost Price')},
|
||||
'end_subtotal': {'width': 16, 'style': 'regular_currency', 'sequence': 110, 'title': _('End Value'), 'formula': True},
|
||||
'variation': {'width': 16, 'style': 'regular_currency', 'sequence': 120, 'title': _('Variation'), 'formula': True},
|
||||
'categ_subtotal': {'width': 16, 'style': 'regular_currency', 'sequence': 130, 'title': _('Categ Sub-total'), 'formula': True},
|
||||
'categ_name': {'width': 40, 'style': 'regular_small', 'sequence': 140, 'title': _('Product Category')},
|
||||
}
|
||||
return cols
|
||||
55
stock_valuation_xlsx/wizard/stock_variation_xlsx_view.xml
Normal file
55
stock_valuation_xlsx/wizard/stock_variation_xlsx_view.xml
Normal file
@@ -0,0 +1,55 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright 2021 Akretion France (http://www.akretion.com/)
|
||||
@author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
-->
|
||||
|
||||
<odoo>
|
||||
|
||||
|
||||
<record id="stock_variation_xlsx_form" model="ir.ui.view">
|
||||
<field name="name">stock.variation.xlsx.form</field>
|
||||
<field name="model">stock.variation.xlsx</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Stock variation XLSX">
|
||||
<div name="help">
|
||||
<p>The generated XLSX report has the valuation of stockable products located on the selected stock locations (and their childrens).</p>
|
||||
</div>
|
||||
<group name="setup">
|
||||
<field name="company_id" groups="base.group_multi_company"/>
|
||||
<field name="categ_ids" widget="many2many_tags"/>
|
||||
<field name="warehouse_id"/>
|
||||
<field name="location_id"/>
|
||||
<field name="categ_subtotal" />
|
||||
</group>
|
||||
<group name="start_end">
|
||||
<group name="start" string="Start">
|
||||
<field name="start_date"/>
|
||||
<field name="standard_price_start_date_type"/>
|
||||
</group>
|
||||
<group name="end" string="End">
|
||||
<field name="end_date_type"/>
|
||||
<field name="end_date" attrs="{'invisible': [('end_date_type', '!=', 'past')], 'required': [('end_date_type', '=', 'past')]}"/>
|
||||
<field name="standard_price_end_date_type"/>
|
||||
</group>
|
||||
</group>
|
||||
<footer>
|
||||
<button name="generate" type="object" class="btn-primary" string="Generate"/>
|
||||
<button special="cancel" string="Close" class="btn-default"/>
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="stock_variation_xlsx_action" model="ir.actions.act_window">
|
||||
<field name="name">Inventory Variation XLSX</field>
|
||||
<field name="res_model">stock.variation.xlsx</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<!-- Replace native menu, to avoid user confusion -->
|
||||
<menuitem id="stock_variation_xlsx_menu" action="stock_variation_xlsx_action" parent="stock.menu_warehouse_report" sequence="119"/>
|
||||
|
||||
</odoo>
|
||||
0
web_tab_title/__init__.py
Normal file
0
web_tab_title/__init__.py
Normal file
23
web_tab_title/__manifest__.py
Normal file
23
web_tab_title/__manifest__.py
Normal file
@@ -0,0 +1,23 @@
|
||||
# Copyright 2021 Akretion
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
{
|
||||
'name': 'Web Tab Title',
|
||||
'description': """
|
||||
Automatically set tab document.title when empty.
|
||||
Important limitation: the tab will get its title only once you browse it.
|
||||
""",
|
||||
'version': '14.0.1.0.0',
|
||||
'license': 'AGPL-3',
|
||||
'author': 'Akretion',
|
||||
'website': 'akretion.com',
|
||||
'depends': [
|
||||
'web',
|
||||
],
|
||||
'data': [
|
||||
],
|
||||
'demo': [
|
||||
],
|
||||
"data": ["views/web_tab_title.xml"],
|
||||
"maintainers": ["rvalyi"],
|
||||
}
|
||||
29
web_tab_title/static/src/js/abstract_web_client.js
Normal file
29
web_tab_title/static/src/js/abstract_web_client.js
Normal file
@@ -0,0 +1,29 @@
|
||||
/* global vis, py */
|
||||
odoo.define("web_tab_title.AbstractWebClient", function (require) {
|
||||
"use strict";
|
||||
|
||||
var AbstractWebClient = require('web.AbstractWebClient');
|
||||
|
||||
var TabTitleAbstractWebClient = AbstractWebClient.include({
|
||||
|
||||
_title_changed: function () {
|
||||
// like the original except we change the title
|
||||
// only when it's different from "Odoo" to avoid
|
||||
// resetting the tab title when switching tabs.
|
||||
var parts = _.sortBy(_.keys(this.get("title_part")), function (x) { return x; });
|
||||
var tmp = "";
|
||||
_.each(parts, function (part) {
|
||||
var str = this.get("title_part")[part];
|
||||
if (str) {
|
||||
tmp = tmp ? tmp + " - " + str : str;
|
||||
}
|
||||
}, this);
|
||||
if (tmp != "Odoo") {
|
||||
document.title = tmp;
|
||||
}
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
return TabTitleAbstractWebClient;
|
||||
});
|
||||
31
web_tab_title/static/src/js/form_controller.js
Normal file
31
web_tab_title/static/src/js/form_controller.js
Normal file
@@ -0,0 +1,31 @@
|
||||
/* global vis, py */
|
||||
odoo.define("web_tab_title.FormController", function (require) {
|
||||
"use strict";
|
||||
|
||||
var FormController = require('web.FormController');
|
||||
|
||||
var TabTitleController = FormController.include({
|
||||
|
||||
on_attach_callback: function () {
|
||||
this._super.apply(this, arguments);
|
||||
|
||||
if (document.title == "Odoo") {
|
||||
var form_name_elem = $("div.oe_title>h1");
|
||||
if (form_name_elem.length == 0) {
|
||||
form_name_elem = $('span.o_field_char[name="name"]')
|
||||
}
|
||||
var title = form_name_elem.text();
|
||||
if (title !== '') {
|
||||
// alternatively we could access the record
|
||||
// in views/basic/basic_model.js
|
||||
// but we would also we miss the model name
|
||||
document.title = title + " - Odoo";
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
return TabTitleController;
|
||||
});
|
||||
19
web_tab_title/views/web_tab_title.xml
Normal file
19
web_tab_title/views/web_tab_title.xml
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo>
|
||||
<template
|
||||
id="assets_backend"
|
||||
name="web_timeline assets"
|
||||
inherit_id="web.assets_backend"
|
||||
>
|
||||
<xpath expr="." position="inside">
|
||||
<script
|
||||
type="text/javascript"
|
||||
src="/web_tab_title/static/src/js/form_controller.js"
|
||||
/>
|
||||
<script
|
||||
type="text/javascript"
|
||||
src="/web_tab_title/static/src/js/abstract_web_client.js"
|
||||
/>
|
||||
</xpath>
|
||||
</template>
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user