Compare commits

..

1 Commits

Author SHA1 Message Date
Alexis de Lattre
819b1370e7 [IMP] product_print_zpl_barcode: remove dep on base_report_to_printer. Use direct print. 2025-03-24 22:34:44 +00:00
76 changed files with 235 additions and 1118 deletions

View File

@@ -6,4 +6,3 @@ from . import res_company
from . import ir_mail_server
from . import ir_actions_report
from . import ir_model
from . import misc

View File

@@ -1,36 +0,0 @@
# Copyright 2016-2025 Akretion France (https://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
from odoo.tools import misc, float_compare
class BaseUsabilityInstalled(models.AbstractModel):
_name = "base.usability.installed"
_description = "Base Usability Installed"
formatLang_original = misc.formatLang
def formatLang(
env, value, digits=None, grouping=True,
monetary=False, dp=False, currency_obj=False, int_no_digits=True):
if (
'base.usability.installed' in env and
int_no_digits and
not monetary and
isinstance(value, float) and
dp):
prec = env['decimal.precision'].precision_get(dp)
if not float_compare(value, int(value), precision_digits=prec):
digits = 0
dp = False
res = formatLang_original(
env, value, digits=digits, grouping=grouping,
monetary=monetary, dp=dp, currency_obj=currency_obj)
return res
misc.formatLang = formatLang

View File

@@ -24,9 +24,6 @@
<xpath expr="//div[hasclass('o_address_format')]/field[@name='city']" position="before">
<field name="zip" position="move"/>
</xpath>
<field name="industry_id" position="attributes">
<attribute name="attrs">{'invisible': [('parent_id', '!=', False)]}</attribute>
</field>
</field>
</record>
@@ -63,9 +60,6 @@
<field name="phone" position="after">
<field name="mobile" optional="show" widget="phone" class="o_force_ltr"/>
</field>
<field name="category_id" position="after">
<field name="industry_id" optional="hide"/>
</field>
</field>
</record>
@@ -79,9 +73,6 @@
<!-- for 'ref', change '=' to 'start with' -->
<attribute name="filter_domain">['|','|',('display_name','ilike',self),('ref','=ilike',self + '%'),('email','ilike',self)]</attribute>
</field>
<filter name="group_country" position="after">
<filter name="industry_groupby" string="Industry" context="{'group_by': 'industry_id'}"/>
</filter>
</field>
</record>

View File

@@ -1,3 +1,2 @@
from . import models
from . import wizards
from . import reports

View File

@@ -30,17 +30,16 @@ This module has been written by Alexis de Lattre from Akretion
'depends': [
'account',
'date_range',
'report_xlsx',
],
'data': [
'security/ir.model.access.csv',
'security/rule.xml',
'reports/report.xml',
'data/decimal_precision.xml',
'views/commission_profile.xml',
'views/commission_rule.xml',
'views/commission_result.xml',
'views/account_move_line.xml',
'views/res_config_settings.xml',
'wizards/commission_compute_view.xml',
],
'installable': True,

View File

@@ -4,28 +4,17 @@
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-10-17 20:36+0000\n"
"PO-Revision-Date: 2025-10-17 20:36+0000\n"
"Last-Translator: Alexis de Lattre <alexis.delattre@akretion.com>\n"
"POT-Creation-Date: 2024-11-29 23:38+0000\n"
"PO-Revision-Date: 2024-11-29 23:38+0000\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: \n"
"Plural-Forms: \n"
#. module: commission_simple
#: code:addons/commission_simple/wizards/commission_compute.py:0
#, python-format
msgid ""
"%(count)s commissions already exist(s) with start date %(date_start)s in "
"company %(company)s."
msgstr ""
"%(count)s il existe déjà des commissions avec la date de début "
"%(date_start)s dans la société %(company)s."
#. module: commission_simple
#: model:ir.model.constraint,message:commission_simple.constraint_commission_result_salesman_period_company_unique
msgid ""
@@ -36,6 +25,7 @@ msgstr ""
"période."
#. module: commission_simple
#. odoo-python
#: code:addons/commission_simple/models/commission_profile.py:0
#, python-format
msgid "A salesman must be selected when the assignment type is 'Salesman'."
@@ -43,12 +33,6 @@ msgstr ""
"Un vendeur doit être sélectionné lorsque le type d'affectation est "
"\"Vendeur\"."
#. module: commission_simple
#: code:addons/commission_simple/models/commission_rule.py:0
#, python-format
msgid "AND"
msgstr "ET"
#. module: commission_simple
#: model:ir.model.fields,field_description:commission_simple.field_commission_result__message_needaction
msgid "Action Needed"
@@ -80,12 +64,6 @@ msgstr "État de l'activité"
msgid "Activity Type Icon"
msgstr "Îcone du type d'activité"
#. module: commission_simple
#: code:addons/commission_simple/reports/commission_result_xlsx.py:0
#, python-format
msgid "Amount Total"
msgstr "Montant Total"
#. module: commission_simple
#: model:ir.model.fields,field_description:commission_simple.field_commission_rule__applied_on
msgid "Apply On"
@@ -93,7 +71,6 @@ msgstr "Conditions"
#. module: commission_simple
#: model_terms:ir.ui.view,arch_db:commission_simple.commission_profile_form
#: model_terms:ir.ui.view,arch_db:commission_simple.commission_profile_search
#: model_terms:ir.ui.view,arch_db:commission_simple.commission_rule_search
msgid "Archived"
msgstr "Archivé"
@@ -125,54 +102,34 @@ msgstr "Nombre de pièces jointes"
msgid "Back to Draft"
msgstr "Remettre en brouillon"
#. module: commission_simple
#: code:addons/commission_simple/reports/commission_result_xlsx.py:0
#, python-format
msgid "Base Total"
msgstr "Total Base"
#. module: commission_simple
#: model_terms:ir.ui.view,arch_db:commission_simple.commission_compute_form
msgid "Cancel"
msgstr "Annuler"
#. module: commission_simple
#: model_terms:ir.ui.view,arch_db:commission_simple.view_move_line_form
msgid "Commission"
msgstr "Commission"
#. module: commission_simple
#: code:addons/commission_simple/reports/commission_result_xlsx.py:0
#: model:ir.model.fields,field_description:commission_simple.field_account_invoice_report__commission_amount
#: model:ir.model.fields,field_description:commission_simple.field_account_move_line__commission_amount
#, python-format
msgid "Commission Amount"
msgstr "Montant de la commission"
#. module: commission_simple
#: code:addons/commission_simple/reports/commission_result_xlsx.py:0
#: model:ir.model.fields,field_description:commission_simple.field_account_move_line__commission_base
#: model:ir.model.fields,field_description:commission_simple.field_commission_rule__base
#, python-format
msgid "Commission Base"
msgstr "Base de la commission"
#. module: commission_simple
#: model:ir.model.fields,field_description:commission_simple.field_commission_result__base_total
msgid "Commission Base Total"
msgstr "Total base des commissions"
#. module: commission_simple
#: model:ir.model.fields,field_description:commission_simple.field_commission_result__line_ids
#: model_terms:ir.ui.view,arch_db:commission_simple.commission_result_form
msgid "Commission Lines"
msgstr "Lignes de commission"
msgstr "Lignes commission"
#. module: commission_simple
#: model:ir.model.fields,field_description:commission_simple.field_commission_profile__date_range_type_id
#: model_terms:ir.ui.view,arch_db:commission_simple.commission_profile_search
#: model:ir.model.fields,field_description:commission_simple.field_commission_compute__date_range_type_id
#: model:ir.model.fields,field_description:commission_simple.field_res_company__commission_date_range_type_id
#: model:ir.model.fields,field_description:commission_simple.field_res_config_settings__commission_date_range_type_id
msgid "Commission Periodicity"
msgstr "Périodicité des commissions"
msgstr "Périodicité de commission"
#. module: commission_simple
#: model:ir.model,name:commission_simple.model_commission_profile
@@ -183,7 +140,7 @@ msgstr "Profil de commission"
#. module: commission_simple
#: model:ir.model,name:commission_simple.model_commission_profile_assignment
msgid "Commission Profile Assignment"
msgstr "Affectation des profils de commission"
msgstr "Affectation du profil de commission"
#. module: commission_simple
#: model:ir.actions.act_window,name:commission_simple.commission_profile_action
@@ -192,10 +149,8 @@ msgid "Commission Profiles"
msgstr "Profils de commission"
#. module: commission_simple
#: code:addons/commission_simple/reports/commission_result_xlsx.py:0
#: model:ir.model.fields,field_description:commission_simple.field_account_move_line__commission_rate
#: model:ir.model.fields,field_description:commission_simple.field_commission_rule__rate
#, python-format
msgid "Commission Rate"
msgstr "Taux de commission"
@@ -205,11 +160,6 @@ msgstr "Taux de commission"
msgid "Commission Result"
msgstr "État des commissions"
#. module: commission_simple
#: model:ir.model,name:commission_simple.model_report_commission_simple_report_xlsx
msgid "Commission Result XLSX"
msgstr "État des commission XLSX"
#. module: commission_simple
#: model:ir.model,name:commission_simple.model_commission_rule
msgid "Commission Rule"
@@ -232,14 +182,22 @@ msgstr "Total des commissions"
#: model:ir.ui.menu,name:commission_simple.commission_config_root
#: model:ir.ui.menu,name:commission_simple.commission_result_menu
#: model:ir.ui.menu,name:commission_simple.commission_root
#: model_terms:ir.ui.view,arch_db:commission_simple.res_config_settings_view_form
msgid "Commissions"
msgstr "Commissions"
msgstr ""
#. module: commission_simple
#: code:addons/commission_simple/reports/commission_result_xlsx.py:0
#. odoo-python
#: code:addons/commission_simple/wizards/commission_compute.py:0
#, python-format
msgid "Commissions of %(partner)s for period %(period)s"
msgstr "Commissions de %(partner)s pour la période %(period)s"
msgid "Commissions already exist for %(period)s in company %(company)s."
msgstr ""
"Des commissions existent déjà pour %(period)s dans la société %(company)s."
#. module: commission_simple
#: model:ir.model,name:commission_simple.model_res_company
msgid "Companies"
msgstr "Sociétés"
#. module: commission_simple
#: model:ir.model.fields,field_description:commission_simple.field_commission_compute__company_id
@@ -268,6 +226,11 @@ msgstr "Calculer"
msgid "Compute Commissions"
msgstr "Calculer les commissions"
#. module: commission_simple
#: model:ir.model,name:commission_simple.model_res_config_settings
msgid "Config Settings"
msgstr "Configuration"
#. module: commission_simple
#: model_terms:ir.ui.view,arch_db:commission_simple.commission_result_form
msgid "Confirm"
@@ -291,43 +254,17 @@ msgstr "Créé par"
msgid "Created on"
msgstr "Créé le"
#. module: commission_simple
#: code:addons/commission_simple/reports/commission_result_xlsx.py:0
#, python-format
msgid "Currency"
msgstr "Devise"
#. module: commission_simple
#: code:addons/commission_simple/reports/commission_result_xlsx.py:0
#, python-format
msgid "Customer"
msgstr "Client"
#. module: commission_simple
#: model:ir.model.fields,field_description:commission_simple.field_commission_rule__partner_ids
msgid "Customers"
msgstr "Clients"
#. module: commission_simple
#: code:addons/commission_simple/models/commission_rule.py:0
#, python-format
msgid "Customers:"
msgstr "Clients :"
#. module: commission_simple
#: model_terms:ir.ui.view,arch_db:commission_simple.commission_result_form
msgid "Disc.%"
msgstr "Rem.%"
#. module: commission_simple
#: model:ir.model.fields,field_description:commission_simple.field_account_invoice_report__display_name
#: model:ir.model.fields,field_description:commission_simple.field_account_move_line__display_name
#: model:ir.model.fields,field_description:commission_simple.field_commission_compute__display_name
#: model:ir.model.fields,field_description:commission_simple.field_commission_profile__display_name
#: model:ir.model.fields,field_description:commission_simple.field_commission_profile_assignment__display_name
#: model:ir.model.fields,field_description:commission_simple.field_commission_result__display_name
#: model:ir.model.fields,field_description:commission_simple.field_commission_rule__display_name
#: model:ir.model.fields,field_description:commission_simple.field_report_commission_simple_report_xlsx__display_name
msgid "Display Name"
msgstr "Nom affiché"
@@ -335,7 +272,7 @@ msgstr "Nom affiché"
#: model:ir.model.fields.selection,name:commission_simple.selection__commission_result__state__done
#: model_terms:ir.ui.view,arch_db:commission_simple.commission_result_search
msgid "Done"
msgstr "Terminé"
msgstr "Validé"
#. module: commission_simple
#: model:ir.model.fields.selection,name:commission_simple.selection__commission_result__state__draft
@@ -344,37 +281,21 @@ msgid "Draft"
msgstr "Brouillon"
#. module: commission_simple
#: model:ir.actions.report,name:commission_simple.commission_result_xlsx_report
msgid "Détails Excel"
msgstr "Détails Excel"
#. module: commission_simple
#: code:addons/commission_simple/reports/commission_result_xlsx.py:0
#: model:ir.model.fields,field_description:commission_simple.field_commission_rule__date_end
#, python-format
msgid "End Date"
msgstr "Date de fin"
#. module: commission_simple
#: model:ir.model.fields,field_description:commission_simple.field_commission_compute__date_end
#: model:ir.model.fields,field_description:commission_simple.field_commission_result__date_end
msgid "End date"
msgstr "Date de fin"
#. module: commission_simple
#: model_terms:ir.ui.view,arch_db:commission_simple.commission_result_form
msgid "Excel Export"
msgstr "Export Excel"
#. module: commission_simple
#: model:ir.model.fields,field_description:commission_simple.field_commission_result__message_follower_ids
msgid "Followers"
msgstr "Abonnés"
#. module: commission_simple
#: model:ir.model.fields,field_description:commission_simple.field_commission_result__message_channel_ids
msgid "Followers (Channels)"
msgstr "Suiveurs (chaînes)"
#. module: commission_simple
#: model:ir.model.fields,field_description:commission_simple.field_commission_result__message_partner_ids
msgid "Followers (Partners)"
@@ -386,29 +307,23 @@ msgid "Font awesome icon e.g. fa-tasks"
msgstr "Îcone font-awesome, par exemple fa-task"
#. module: commission_simple
#: code:addons/commission_simple/reports/commission_result_xlsx.py:0
#, python-format
msgid "Generated from Odoo on %s by %s"
msgstr "Généré à partir d'Odoo le %s par %s"
#. module: commission_simple
#: code:addons/commission_simple/models/commission_rule.py:0
#: model:ir.model.fields.selection,name:commission_simple.selection__commission_rule__applied_on__4_global
#, python-format
msgid "Global"
msgstr "Global"
msgstr ""
#. module: commission_simple
#: model:ir.model.fields,field_description:commission_simple.field_commission_result__has_message
msgid "Has Message"
msgstr "A un message"
#. module: commission_simple
#: model:ir.model.fields,field_description:commission_simple.field_account_invoice_report__id
#: model:ir.model.fields,field_description:commission_simple.field_account_move_line__id
#: model:ir.model.fields,field_description:commission_simple.field_commission_compute__id
#: model:ir.model.fields,field_description:commission_simple.field_commission_profile__id
#: model:ir.model.fields,field_description:commission_simple.field_commission_profile_assignment__id
#: model:ir.model.fields,field_description:commission_simple.field_commission_result__id
#: model:ir.model.fields,field_description:commission_simple.field_commission_rule__id
#: model:ir.model.fields,field_description:commission_simple.field_report_commission_simple_report_xlsx__id
msgid "ID"
msgstr "ID"
msgstr ""
#. module: commission_simple
#: model:ir.model.fields,field_description:commission_simple.field_commission_result__activity_exception_icon
@@ -422,7 +337,6 @@ msgstr "Îcone pour indiquer une activité-alerte"
#. module: commission_simple
#: model:ir.model.fields,help:commission_simple.field_commission_result__message_needaction
#: model:ir.model.fields,help:commission_simple.field_commission_result__message_unread
msgid "If checked, new messages require your attention."
msgstr "Si activé, de nouveaux messages nécessitent votre attention."
@@ -433,25 +347,11 @@ msgstr "Si activé, des messages ont une erreur d'envoi."
#. module: commission_simple
#: model:ir.model.fields.selection,name:commission_simple.selection__commission_profile__trigger_type__in_payment
#: model_terms:ir.ui.view,arch_db:commission_simple.commission_profile_search
msgid "In Payment and Paid"
msgstr "En paiement et payé"
#. module: commission_simple
#: code:addons/commission_simple/reports/commission_result_xlsx.py:0
#, python-format
msgid "Invoice"
msgstr "Facture"
#. module: commission_simple
#: code:addons/commission_simple/reports/commission_result_xlsx.py:0
#, python-format
msgid "Invoice Date"
msgstr "Date de facture"
#. module: commission_simple
#: model:ir.model.fields.selection,name:commission_simple.selection__commission_profile__trigger_type__invoice
#: model_terms:ir.ui.view,arch_db:commission_simple.commission_profile_search
msgid "Invoiced"
msgstr "Facturé"
@@ -461,11 +361,6 @@ msgstr "Facturé"
msgid "Invoiced Amount"
msgstr "Montant facturé"
#. module: commission_simple
#: model:ir.model,name:commission_simple.model_account_invoice_report
msgid "Invoices Statistics"
msgstr "Statistiques des factures"
#. module: commission_simple
#: model:ir.model.fields,field_description:commission_simple.field_commission_result__message_is_follower
msgid "Is Follower"
@@ -477,14 +372,11 @@ msgid "Journal Item"
msgstr "Écriture comptable"
#. module: commission_simple
#: model:ir.model.fields,field_description:commission_simple.field_account_invoice_report____last_update
#: model:ir.model.fields,field_description:commission_simple.field_account_move_line____last_update
#: model:ir.model.fields,field_description:commission_simple.field_commission_compute____last_update
#: model:ir.model.fields,field_description:commission_simple.field_commission_profile____last_update
#: model:ir.model.fields,field_description:commission_simple.field_commission_profile_assignment____last_update
#: model:ir.model.fields,field_description:commission_simple.field_commission_result____last_update
#: model:ir.model.fields,field_description:commission_simple.field_commission_rule____last_update
#: model:ir.model.fields,field_description:commission_simple.field_report_commission_simple_report_xlsx____last_update
msgid "Last Modified on"
msgstr "Dernière modification le"
@@ -519,12 +411,7 @@ msgstr "Marge"
#. module: commission_simple
#: model_terms:ir.ui.view,arch_db:commission_simple.commission_rule_form
msgid "Match"
msgstr "Correspondance"
#. module: commission_simple
#: model:ir.model.fields,field_description:commission_simple.field_commission_rule__apply_description
msgid "Match Criteria"
msgstr "Critères de correspondance"
msgstr ""
#. module: commission_simple
#: model:ir.model.fields,field_description:commission_simple.field_account_move_line__commission_rule_id
@@ -539,20 +426,7 @@ msgstr "Erreur d'envoi du message"
#. module: commission_simple
#: model:ir.model.fields,field_description:commission_simple.field_commission_result__message_ids
msgid "Messages"
msgstr "Messages"
#. module: commission_simple
#: code:addons/commission_simple/wizards/commission_compute.py:0
#, python-format
msgid "Missing Period Start Date."
msgstr "Date de début de la période manquante."
#. module: commission_simple
#: code:addons/commission_simple/wizards/commission_compute.py:0
#, python-format
msgid "Missing commission periodicity on commission profile '%s'."
msgstr ""
"Périodicité des commissions manquante sur le profil de commission '%s'."
#. module: commission_simple
#: model:ir.model.fields,field_description:commission_simple.field_commission_result__my_activity_date_deadline
@@ -564,6 +438,11 @@ msgstr "Date butoir de l'activité"
msgid "Name of the Profile"
msgstr "Nom du profil"
#. module: commission_simple
#: model:ir.model.fields,field_description:commission_simple.field_commission_result__activity_calendar_event_id
msgid "Next Activity Calendar Event"
msgstr "Prochaine activité du calendrier"
#. module: commission_simple
#: model:ir.model.fields,field_description:commission_simple.field_commission_result__activity_date_deadline
msgid "Next Activity Deadline"
@@ -580,6 +459,7 @@ msgid "Next Activity Type"
msgstr "Type de l'activité suivante"
#. module: commission_simple
#. odoo-python
#: code:addons/commission_simple/wizards/commission_compute.py:0
#, python-format
msgid "No commissions generated."
@@ -597,7 +477,7 @@ msgstr "Nombre d'erreurs"
#. module: commission_simple
#: model:ir.model.fields,help:commission_simple.field_commission_result__message_needaction_counter
msgid "Number of messages which requires an action"
msgid "Number of messages requiring action"
msgstr "Nombre de messages nécessitant une action"
#. module: commission_simple
@@ -605,39 +485,18 @@ msgstr "Nombre de messages nécessitant une action"
msgid "Number of messages with delivery error"
msgstr "Nombre de messages en échec d'envoi"
#. module: commission_simple
#: model:ir.model.fields,help:commission_simple.field_commission_result__message_unread_counter
msgid "Number of unread messages"
msgstr "Nombre de messages non lus"
#. module: commission_simple
#: model:ir.model.fields.selection,name:commission_simple.selection__commission_profile__trigger_type__paid
#: model_terms:ir.ui.view,arch_db:commission_simple.commission_profile_search
msgid "Paid"
msgstr "Payé"
#. module: commission_simple
#: model:ir.model.fields,field_description:commission_simple.field_commission_compute__date_range_id
#: model:ir.model.fields,field_description:commission_simple.field_commission_result__date_range_id
#: model_terms:ir.ui.view,arch_db:commission_simple.commission_result_search
msgid "Period"
msgstr "Période"
#. module: commission_simple
#: model:ir.model.fields,field_description:commission_simple.field_commission_compute__date_start
msgid "Period Start Date"
msgstr "Date de début des périodes"
#. module: commission_simple
#: model_terms:ir.ui.view,arch_db:commission_simple.commission_result_form
msgid "Price"
msgstr "Prix"
#. module: commission_simple
#: code:addons/commission_simple/reports/commission_result_xlsx.py:0
#, python-format
msgid "Product"
msgstr "Produit"
#. module: commission_simple
#: model:ir.model.fields,field_description:commission_simple.field_commission_rule__product_categ_ids
#: model:ir.model.fields.selection,name:commission_simple.selection__commission_rule__applied_on__3_product_category
@@ -649,12 +508,6 @@ msgstr "Catégories de produits"
msgid "Product Categories and Customers"
msgstr "Catégories de produits et clients"
#. module: commission_simple
#: code:addons/commission_simple/models/commission_rule.py:0
#, python-format
msgid "Product Categories:"
msgstr "Catégories de produits :"
#. module: commission_simple
#: model:ir.model.fields,field_description:commission_simple.field_account_move_line__product_categ_id
msgid "Product Category"
@@ -671,12 +524,6 @@ msgstr "Produits"
msgid "Products and Customers"
msgstr "Produits et clients"
#. module: commission_simple
#: code:addons/commission_simple/models/commission_rule.py:0
#, python-format
msgid "Products:"
msgstr "Produits :"
#. module: commission_simple
#: model:ir.model.fields,field_description:commission_simple.field_commission_profile_assignment__profile_id
#: model:ir.model.fields,field_description:commission_simple.field_commission_rule__profile_id
@@ -684,12 +531,6 @@ msgstr "Produits :"
msgid "Profile"
msgstr "Profil"
#. module: commission_simple
#: code:addons/commission_simple/reports/commission_result_xlsx.py:0
#, python-format
msgid "Quantity"
msgstr "Quantité"
#. module: commission_simple
#: model_terms:ir.ui.view,arch_db:commission_simple.commission_result_form
#: model_terms:ir.ui.view,arch_db:commission_simple.commission_rule_tree
@@ -712,6 +553,7 @@ msgid "Rules"
msgstr "Règles"
#. module: commission_simple
#. odoo-python
#: code:addons/commission_simple/models/commission_profile.py:0
#: model:ir.model.fields,field_description:commission_simple.field_commission_profile_assignment__user_id
#: model_terms:ir.ui.view,arch_db:commission_simple.commission_result_search
@@ -724,24 +566,18 @@ msgstr "Vendeur"
msgid "Salesman/Agent"
msgstr "Vendeur/Agent"
#. module: commission_simple
#: model:ir.model.fields,help:commission_simple.field_account_move_line__product_categ_id
msgid "Select category for the current product"
msgstr "Sélectionnez la catégorie du produit"
#. module: commission_simple
#: model:ir.model.fields,field_description:commission_simple.field_commission_profile__sequence
msgid "Sequence"
msgstr "Séquence"
#. module: commission_simple
#: code:addons/commission_simple/reports/commission_result_xlsx.py:0
#: model:ir.model.fields,field_description:commission_simple.field_commission_rule__date_start
#, python-format
msgid "Start Date"
msgstr "Date de début"
#. module: commission_simple
#: model:ir.model.fields,field_description:commission_simple.field_commission_compute__date_start
#: model:ir.model.fields,field_description:commission_simple.field_commission_result__date_start
msgid "Start date"
msgstr "Date de début"
@@ -777,29 +613,13 @@ msgstr "Déclencheur"
#. module: commission_simple
#: model:ir.model.fields,field_description:commission_simple.field_commission_profile_assignment__assign_type
msgid "Type"
msgstr "Type"
msgstr ""
#. module: commission_simple
#: model:ir.model.fields,help:commission_simple.field_commission_result__activity_exception_decoration
msgid "Type of the exception activity on record."
msgstr "Type de l'activité-alerte sur l'enregistrement."
#. module: commission_simple
#: code:addons/commission_simple/reports/commission_result_xlsx.py:0
#, python-format
msgid "Unit"
msgstr "Unité"
#. module: commission_simple
#: model:ir.model.fields,field_description:commission_simple.field_commission_result__message_unread
msgid "Unread Messages"
msgstr "Messages non lus"
#. module: commission_simple
#: model:ir.model.fields,field_description:commission_simple.field_commission_result__message_unread_counter
msgid "Unread Messages Counter"
msgstr "Compteur de messages non lus"
#. module: commission_simple
#: model:ir.model.fields,field_description:commission_simple.field_commission_result__website_message_ids
msgid "Website Messages"
@@ -811,9 +631,10 @@ msgid "Website communication history"
msgstr "Historique des échanges sur le site Web"
#. module: commission_simple
#. odoo-python
#: code:addons/commission_simple/models/commission_result.py:0
#, python-format
msgid "You cannot delete commission result %s because it is in done state."
msgstr ""
"Vous ne pouvez pas supprimer l'état de commission %s parce qu'il est à "
"l'état \"terminé\"."
"l'état \"validé\"."

View File

@@ -1,5 +1,5 @@
from . import commission_profile
from . import commission_rule
from . import commission_result
from . import res_company
from . import account_move_line
from . import account_invoice_report

View File

@@ -1,17 +0,0 @@
# Copyright 2018-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).
from odoo import api, fields, models
class AccountInvoiceReport(models.Model):
_inherit = 'account.invoice.report'
commission_amount = fields.Float(readonly=True)
@api.model
def _select(self):
select_str = super()._select()
select_str += ", line.commission_amount * currency_table.rate AS commission_amount"
return select_str

View File

@@ -11,7 +11,7 @@ class AccountMoveLine(models.Model):
_inherit = 'account.move.line'
commission_result_id = fields.Many2one(
'commission.result', string='Commission Result', check_company=True, index=True)
'commission.result', string='Commission Result', check_company=True)
commission_rule_id = fields.Many2one(
'commission.rule', 'Matched Commission Rule', ondelete='restrict', check_company=True)
commission_base = fields.Monetary('Commission Base', currency_field='company_currency_id')
@@ -88,18 +88,3 @@ class AccountMoveLine(models.Model):
if float_is_zero(lvals['commission_rate'], precision_digits=rate_prec) or self.company_currency_id.is_zero(lvals['commission_base']):
return False
return lvals
def _prepare_commission_xlsx(self):
self.ensure_one()
vals = {
"inv.name": self.move_id.name,
"inv.date": self.move_id.invoice_date,
"inv.partner": self.move_id.commercial_partner_id.display_name,
"product": self.product_id and self.product_id.display_name or self.name,
"qty": self.quantity,
"uom": self.product_uom_id.name,
"commission_base": self.commission_base,
"commission_rate": self.commission_rate / 100,
"commission_amount": self.commission_amount,
}
return vals

View File

@@ -27,9 +27,6 @@ class CommissionProfile(models.Model):
('paid', 'Paid'),
('in_payment', 'In Payment and Paid'),
], default='paid', string='Trigger', required=True)
date_range_type_id = fields.Many2one(
'date.range.type', string='Commission Periodicity', ondelete='restrict',
domain="[('company_id', 'in', (False, company_id))]")
class CommissionProfileAssignment(models.Model):
@@ -79,7 +76,6 @@ class CommissionProfileAssignment(models.Model):
self.ensure_one()
domain = [
('display_type', '=', False),
('exclude_from_invoice_tab', '=', False),
('move_id.move_type', 'in', ('out_invoice', 'out_refund')),
('date', '<=', date_range.date_end),
('company_id', '=', self.company_id.id),
@@ -104,7 +100,6 @@ class CommissionProfileAssignment(models.Model):
'profile_id': self.profile_id.id,
'date_range_id': date_range.id,
'assign_type': self.assign_type,
'assignment_id': self.id,
'company_id': self.company_id.id,
}
return vals

View File

@@ -17,8 +17,6 @@ class CommissionResult(models.Model):
readonly=True, tracking=True)
profile_id = fields.Many2one(
'commission.profile', string='Commission Profile', readonly=True, tracking=True)
assignment_id = fields.Many2one(
'commission.profile.assignment', string="Commission Profile Assignment", readonly=True)
assign_type = fields.Selection('_assign_type_selection', readonly=True, tracking=True)
company_id = fields.Many2one(
'res.company', string='Company', ondelete='cascade',
@@ -34,10 +32,7 @@ class CommissionResult(models.Model):
states={'done': [('readonly', True)]})
amount_total = fields.Monetary(
string='Commission Total', currency_field='company_currency_id',
compute='_compute_totals', store=True, tracking=True)
base_total = fields.Monetary(
string="Commission Base Total", currency_field='company_currency_id',
compute='_compute_totals', store=True, tracking=True)
compute='_compute_amount_total', store=True, tracking=True)
state = fields.Selection([
('draft', 'Draft'),
('done', 'Done'),
@@ -49,13 +44,12 @@ class CommissionResult(models.Model):
def _assign_type_selection(self):
return self.env['commission.profile.assignment']._assign_type_selection()
@api.depends('line_ids.commission_amount', 'line_ids.commission_base')
def _compute_totals(self):
rg_res = self.env['account.move.line'].read_group([('commission_result_id', 'in', self.ids)], ['commission_result_id', 'commission_amount:sum', 'commission_base:sum'], ['commission_result_id'])
mapped_data = dict([(x['commission_result_id'][0], {'amount': x['commission_amount'], 'base': x['commission_base']}) for x in rg_res])
@api.depends('line_ids.commission_amount')
def _compute_amount_total(self):
rg_res = self.env['account.move.line'].read_group([('commission_result_id', 'in', self.ids)], ['commission_result_id', 'commission_amount:sum'], ['commission_result_id'])
mapped_data = dict([(x['commission_result_id'][0], x['commission_amount']) for x in rg_res])
for rec in self:
rec.amount_total = mapped_data.get(rec.id, {}).get('amount')
rec.base_total = mapped_data.get(rec.id, {}).get('base')
rec.amount_total = mapped_data.get(rec.id, 0)
def unlink(self):
for result in self:
@@ -65,7 +59,7 @@ class CommissionResult(models.Model):
return super().unlink()
def draft2done(self):
self.filtered(lambda x: x.state == 'draft').write({'state': 'done'})
self.write({'state': 'done'})
def backtodraft(self):
self.write({'state': 'draft'})
@@ -81,7 +75,3 @@ class CommissionResult(models.Model):
'salesman_period_company_unique',
'unique(company_id, partner_id, date_range_id)',
'A commission result already exists for this salesman/agent for the same period.')]
def _prepare_xlsx_lines(self):
self.ensure_one()
return self.line_ids.sorted(key=lambda x: x.move_id.invoice_date)

View File

@@ -3,13 +3,13 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models, api, _
from odoo import fields, models, api
class CommissionRule(models.Model):
_name = 'commission.rule'
_description = 'Commission Rule'
_order = 'profile_id, applied_on, rate desc'
_order = 'profile_id, applied_on'
partner_ids = fields.Many2many(
'res.partner', string='Customers', domain=[('parent_id', '=', False)])
@@ -34,31 +34,6 @@ class CommissionRule(models.Model):
('4_global', 'Global')],
string='Apply On', default='4_global', required=True)
active = fields.Boolean(string='Active', default=True)
apply_description = fields.Html(compute='_compute_apply_description', string="Match Criteria")
_sql_constraints = [(
'rate_positive',
'CHECK(rate >= 0)',
'Rate must be positive !')]
def _compute_apply_description(self):
customer_label = "<strong>" + _("Customers:") + "</strong>"
product_label = "<strong>" + _("Products:") + "</strong>"
product_categ_label = "<strong>" + _("Product Categories:") + "</strong>"
and_label = "<strong>" + _('AND') + "</strong>"
for rule in self:
desc = False
if rule.applied_on == '0_customer_product':
desc = f"{customer_label} {', '.join([part.ref or part.name for part in rule.partner_ids])} {and_label} {product_label} {', '.join([pp.default_code or pp.name for pp in rule.product_ids])}"
elif rule.applied_on == '1_customer_product_category':
desc = f"{customer_label} {', '.join([part.ref or part.name for part in rule.partner_ids])} {and_label} {product_categ_label} {', '.join([categ.display_name for categ in rule.product_categ_ids])}"
elif rule.applied_on == '2_product':
desc = f"{product_label} {', '.join([pp.default_code or pp.name for pp in rule.product_ids])}"
elif rule.applied_on == '3_product_category':
desc = f"{product_categ_label} {', '.join([categ.display_name for categ in rule.product_categ_ids])}"
elif rule.applied_on == '4_global':
desc = _('Global')
rule.apply_description = desc
@api.model
def load_all_rules(self):
@@ -70,3 +45,8 @@ class CommissionRule(models.Model):
else:
res[rule['profile_id'][0]].append(rule)
return res
_sql_constraints = [(
'rate_positive',
'CHECK(rate >= 0)',
'Rate must be positive !')]

View File

@@ -0,0 +1,13 @@
# Copyright 2019-2024 Akretion France (https://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 fields, models
class ResCompany(models.Model):
_inherit = 'res.company'
commission_date_range_type_id = fields.Many2one(
'date.range.type', string='Commission Periodicity', ondelete='restrict')

View File

@@ -1 +0,0 @@
from . import commission_result_xlsx

View File

@@ -1,112 +0,0 @@
# Copyright 2025 Akretion France (https://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, fields, models, tools, _
from odoo.exceptions import UserError
from datetime import datetime
from odoo.tools.misc import format_datetime
class CommissionResultXlsx(models.AbstractModel):
_name = "report.commission_simple.report_xlsx"
_inherit = "report.report_xlsx.abstract"
_description = "Commission Result XLSX"
def generate_xlsx_report(self, workbook, data, objects):
# for some strange reasons, lang is not kept in context
self = self.with_context(lang=self.env.user.lang)
result = objects[0]
sheet = workbook.add_worksheet(result.date_range_id.name)
styles = self._prepare_styles(workbook, result.company_id)
title = _("Commissions of %(partner)s for period %(period)s", partner=result.partner_id.name, period=result.date_range_id.name)
now_str = format_datetime(self.env, datetime.now())
i = 0
sheet.write(i, 0, title, styles['title'])
sheet.write(i, 5, _('Generated from Odoo on %s by %s') % (now_str, self.env.user.name), styles['regular_small'])
i += 1
sheet.write(i, 0, _('Start Date'), styles['subtitle'])
sheet.write(i, 1, result.date_start, styles['subtitle_date'])
i += 1
sheet.write(i, 0, _('End Date'), styles['subtitle'])
sheet.write(i, 1, result.date_end, styles['subtitle_date'])
i += 1
sheet.write(i, 0, _('Currency'), styles['subtitle'])
sheet.write(i, 1, result.company_id.currency_id.name, styles['subtitle'])
i += 1
sheet.write(i, 0, _('Base Total'), styles['subtitle'])
sheet.write(i, 1, result.base_total, styles['subtitle_amount'])
i += 1
sheet.write(i, 0, _('Amount Total'), styles['subtitle'])
sheet.write(i, 1, result.amount_total, styles['subtitle_amount'])
i += 3
cols = self._prepare_xlsx_cols()
coldict = {}
pos = 0
for key, label, width, style_suffix in cols:
coldict[key] = {
"label": label,
"width": width,
"pos": pos,
"style": style_suffix and f"regular_{style_suffix}" or "regular",
}
pos += 1
# header
for col_key, col_vals in coldict.items():
sheet.write(i, col_vals['pos'], col_vals['label'], styles['col_title'])
sheet.set_column(col_vals['pos'], col_vals['pos'], col_vals['width'])
# table content
for line in result._prepare_xlsx_lines():
i += 1
for col_key, value in line._prepare_commission_xlsx().items():
sheet.write(i, coldict[col_key]["pos"], value, styles[coldict[col_key]["style"]])
def _prepare_xlsx_cols(self):
cols = [ # key, label, width, style_suffix
("inv.name", _("Invoice"), 14, False),
("inv.date", _("Invoice Date"), 11, "date"),
("inv.partner", _("Customer"), 50, False),
("product", _("Product"), 35, False),
("qty", _("Quantity"), 8, "qty"),
("uom", _("Unit"), 8, False),
("commission_base", _("Commission Base"), 14, "amount"),
("commission_rate", _("Commission Rate"), 10, "rate"),
("commission_amount", _("Commission Amount"), 14, "amount"),
]
return cols
def _prepare_styles(self, workbook, company):
col_title_bg_color = '#eeeeee'
prec_qty = self.env['decimal.precision'].precision_get('Product Unit of Measure')
prec_rate = self.env['decimal.precision'].precision_get('Commission Rate')
prec_price = self.env['decimal.precision'].precision_get('Product Price')
regular_font_size = 10
date_format = "dd/mm/yyyy" # TODO depend on lang
num_format_amount = f"# ##0.{'0' * company.currency_id.decimal_places}"
num_format_qty = f"# ##0.{'0' * prec_qty}"
num_format_rate = f"""0.{'0' * prec_rate} " "%"""
num_format_price = f"# ##0.{'0' * prec_price}"
styles = {
'title': workbook.add_format({
'bold': True, 'font_size': regular_font_size + 10,
'font_color': '#003b6f'}),
'subtitle': workbook.add_format({
'bold': True, 'font_size': regular_font_size}),
'subtitle_date': workbook.add_format({
'bold': True, 'font_size': regular_font_size, 'num_format': date_format}),
'subtitle_amount': workbook.add_format({
'bold': True, 'font_size': regular_font_size, 'num_format': num_format_amount}),
'col_title': workbook.add_format({
'bold': True, 'bg_color': col_title_bg_color,
'text_wrap': True, 'font_size': regular_font_size,
'align': 'center',
}),
'regular_date': workbook.add_format({'num_format': date_format}),
'regular_amount': workbook.add_format({'num_format': num_format_amount}),
'regular_rate': workbook.add_format({'num_format': num_format_rate}),
'regular_qty': workbook.add_format({'num_format': num_format_qty}),
'regular_price': workbook.add_format({'num_format': num_format_price}),
'regular': workbook.add_format({}),
'regular_small': workbook.add_format({'font_size': regular_font_size - 2}),
}
return styles

View File

@@ -1,20 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2025 Akretion France (https://www.akretion.com/)
@author: Alexis de Lattre <alexis.delattre@akretion.com>
The licence is in the file __manifest__.py
-->
<odoo>
<record id="commission_result_xlsx_report" model="ir.actions.report">
<field name="name">Détails Excel</field>
<field name="model">commission.result</field>
<field name="report_type">xlsx</field>
<field name="report_name">commission_simple.report_xlsx</field>
<field name="report_file">commission_simple.report_xlsx</field>
<field name="print_report_name">'commission-%s-%s' % (object.date_range_id.name.replace(' ', '_'), object.partner_id.name.replace(' ', '_'))</field>
<field name="binding_model_id" ref="model_commission_result" />
</record>
</odoo>

View File

@@ -8,4 +8,4 @@ access_commission_rule_audit,Read access on commission.rule for viewer group,mod
access_commission_result_full,Full access on commission.result to accountant,model_commission_result,account.group_account_user,1,1,1,1
access_commission_result_read,Read access on commission.result to invoicing grp,model_commission_result,account.group_account_invoice,1,0,0,0
access_commission_result_audit,Read access on commission.result to viewer grp,model_commission_result,account.group_account_readonly,1,0,0,0
access_commission_compute_full,Full access to wizard commission.compute to Accountant,model_commission_compute,account.group_account_user,1,1,1,1
access_commission_compute_full,Full access to wizard commission.compute,model_commission_compute,account.group_account_manager,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
8 access_commission_result_full Full access on commission.result to accountant model_commission_result account.group_account_user 1 1 1 1
9 access_commission_result_read Read access on commission.result to invoicing grp model_commission_result account.group_account_invoice 1 0 0 0
10 access_commission_result_audit Read access on commission.result to viewer grp model_commission_result account.group_account_readonly 1 0 0 0
11 access_commission_compute_full Full access to wizard commission.compute to Accountant Full access to wizard commission.compute model_commission_compute account.group_account_user account.group_account_manager 1 1 1 1

View File

@@ -22,7 +22,6 @@
<field name="name"/>
<field name="active" invisible="1"/>
<field name="trigger_type" widget="radio"/>
<field name="date_range_type_id"/>
</group>
<group name="main-right">
<field name="company_id" invisible="1"/>
@@ -56,31 +55,12 @@
<tree>
<field name="sequence" widget="handle"/>
<field name="name" decoration-bf="1"/>
<field name="trigger_type" optional="show" widget="badge" decoration-info="trigger_type == 'invoice'" decoration-success="trigger_type == 'paid'" decoration-warning="trigger_type == 'in_payment'"/>
<field name="date_range_type_id" optional="show"/>
<field name="trigger_type" optional="show"/>
<field name="company_id" groups="base.group_multi_company"/>
</tree>
</field>
</record>
<record id="commission_profile_search" model="ir.ui.view">
<field name="model">commission.profile</field>
<field name="arch" type="xml">
<search>
<field name="name"/>
<filter string="Invoiced" name="invoice" domain="[('trigger_type', '=', 'invoice')]"/>
<filter string="Paid" name="paid" domain="[('trigger_type', '=', 'paid')]"/>
<filter string="In Payment and Paid" name="in_payment" domain="[('trigger_type', '=', 'in_payment')]"/>
<separator/>
<filter string="Archived" name="inactive" domain="[('active', '=', False)]"/>
<separator/>
<group name="groupby">
<filter name="date_range_type_groupby" string="Commission Periodicity" context="{'group_by': 'date_range_type_id'}"/>
</group>
</search>
</field>
</record>
<record id="commission_profile_action" model="ir.actions.act_window">
<field name="name">Commission Profiles</field>
<field name="res_model">commission.profile</field>

View File

@@ -15,7 +15,6 @@
<header>
<button name="draft2done" type="object" states="draft" string="Confirm" class="btn-primary"/>
<button name="backtodraft" type="object" states="done" string="Back to Draft" confirm="Are you sure you want to go back to draft?"/>
<button name="%(commission_simple.commission_result_xlsx_report)d" type="action" string="Excel Export"/>
<field name="state" widget="statusbar"/>
</header>
<group name="main">
@@ -24,7 +23,6 @@
<field name="date_range_id"/>
<field name="date_start"/>
<field name="date_end"/>
<field name="base_total"/>
<field name="amount_total"/>
<field name="company_currency_id" invisible="1"/>
<field name="company_id" invisible="1"/>
@@ -36,7 +34,7 @@
</group>
</group>
<group name="lines" string="Commission Lines">
<field nolabel="1" name="line_ids" colspan="2" widget="many2many">
<field nolabel="1" name="line_ids" colspan="2">
<tree>
<field name="move_id"/>
<field name="date" optional="hide"/>
@@ -44,12 +42,8 @@
<field name="product_id"/>
<field name="product_categ_id" optional="hide"/>
<field name="name" optional="hide"/>
<field name="quantity" optional="hide"/>
<field name="product_uom_id" optional="hide" groups="uom.group_uom"/>
<field name="price_unit" string="Price" optional="hide"/>
<field name="discount" string="Disc.%" optional="hide"/>
<field name="price_subtotal" optional="hide" string="Invoiced Amount"/>
<field name="commission_base" sum="1"/>
<field name="commission_base"/>
<field name="commission_rate" string="Rate (%)"/>
<field name="commission_amount" sum="1"/>
<field name="commission_rule_id" optional="hide"/>
@@ -72,13 +66,6 @@
<field name="model">commission.result</field>
<field name="arch" type="xml">
<tree decoration-info="state == 'draft'">
<header>
<button
name="draft2done"
type="object"
string="Validate"
/>
</header>
<field name="date_range_id" optional="show"/>
<field name="date_start" optional="hide"/>
<field name="date_end" optional="hide"/>
@@ -87,7 +74,6 @@
<field name="assign_type" optional="hide" widget="badge" decoration-warning="assign_type == 'user'"/>
<field name="company_currency_id" invisible="1"/>
<field name="company_id" groups="base.group_multi_company"/>
<field name="base_total" sum="1" optional="hide"/>
<field name="amount_total" sum="1" optional="show"/>
<field name="state" decoration-info="state == 'draft'" decoration-success="state == 'done'" widget="badge"/>
</tree>

View File

@@ -43,12 +43,11 @@
<field name="arch" type="xml">
<tree>
<field name="profile_id" invisible="not context.get('commission_rule_main_view')"/>
<field name="applied_on" widget="badge" decoration-danger="applied_on == '0_customer_product'" decoration-warning="applied_on == '1_customer_product_category'" decoration-info="applied_on == '2_product'" decoration-success="applied_on == '3_product_category'"/>
<field name="apply_description"/>
<field name="date_start" optional="show"/>
<field name="date_end" optional="show"/>
<field name="applied_on"/>
<field name="date_start"/>
<field name="date_end"/>
<field name="rate" string="Rate (%)"/>
<field name="base" widget="badge" decoration-success="base == 'invoiced'" decoration-warning="base == 'margin'"/>
<field name="base"/>
</tree>
</field>
</record>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2019-2024 Akretion France (https://www.akretion.com)
Copyright 2019-2025 Akretion France (https://www.akretion.com)
@author: Alexis de Lattre <alexis.delattre@akretion.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
@@ -19,13 +19,12 @@
<div class="col-12 col-lg-12 o_setting_box" id="commission_simple-settings">
<div class="o_setting_left_pane" />
<div class="o_setting_right_pane">
<div class="row" id="commission_product_id">
<label for="commission_product_id" class="col-md-5" />
<field name="commission_product_id" context="{'default_type': 'service', 'default_purchase_ok': True, 'default_sale_ok': False, 'default_available_in_pos': False, 'default_purchase_method': 'purchase'}"/>
</div>
<div class="row" id="commission_po_config">
<label for="commission_po_config" class="col-md-5" string="Purchase Order"/>
<field name="commission_po_config" />
<div class="row" id="commission_date_range_type_id">
<label
for="commission_date_range_type_id"
class="col-md-5"
/>
<field name="commission_date_range_type_id" />
</div>
</div>
</div>

View File

@@ -1 +1,2 @@
from . import commission_compute
from . import res_config_settings

View File

@@ -3,9 +3,8 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, fields, models, _
from datetime import datetime, timedelta
from dateutil.relativedelta import relativedelta
from odoo.exceptions import UserError
from odoo.tools.misc import format_date
import logging
logger = logging.getLogger(__name__)
@@ -14,45 +13,47 @@ class CommissionCompute(models.TransientModel):
_name = 'commission.compute'
_description = 'Compute Commissions'
company_id = fields.Many2one('res.company', required=True)
date_start = fields.Date(string="Period Start Date", required=True)
company_id = fields.Many2one('res.company', required=True, default=lambda self: self.env.company)
date_range_type_id = fields.Many2one(related='company_id.commission_date_range_type_id')
date_range_id = fields.Many2one(
'date.range', required=True, string='Period',
compute='_compute_date_range_id', store=True, readonly=False,
domain="[('type_id', '=', date_range_type_id)]")
date_start = fields.Date(related='date_range_id.date_start')
date_end = fields.Date(related='date_range_id.date_end')
@api.model
def default_get(self, fields_list):
res = super().default_get(fields_list)
company = self.env.company
last_commission_result = self.env['commission.result'].search([
('company_id', '=', company.id),
], order='date_start desc', limit=1)
if last_commission_result:
last_start_date = last_commission_result.date_start
commissions_last_start_date = self.env['commission.result'].search([
('date_start', '=', last_start_date),
('company_id', '=', company.id),
], order="date_end asc", limit=1)
min_end_date = commissions_last_start_date.date_end
date_start = min_end_date + timedelta(1)
else:
today = fields.Date.context_today(self)
date_start = datetime(today.year, today.month, 1)
res.update({
'company_id': company.id,
'date_start': date_start,
})
return res
@api.depends('company_id')
def _compute_date_range_id(self):
for wiz in self:
date_range_id = False
company = wiz.company_id
if company and company.commission_date_range_type_id:
type_id = company.commission_date_range_type_id.id
last_commission_result = self.env['commission.result'].search([
('company_id', '=', company.id),
], order='date_end desc', limit=1)
limit_date = last_commission_result and last_commission_result.date_end or (fields.Date.context_today(self) + relativedelta(months=-2, day=31))
date_range = self.env['date.range'].search([
('company_id', 'in', (company.id, False)),
('type_id', '=', type_id),
('date_start', '>', limit_date)
], order='date_start', limit=1)
date_range_id = date_range and date_range.id or False
wiz.date_range_id = date_range_id
def run(self):
self.ensure_one()
if not self.date_start:
raise UserError(_("Missing Period Start Date."))
creso = self.env['commission.result']
existing_commissions = creso.search_read([
('date_start', '=', self.date_start),
date_range = self.date_range_id
existing_commissions = creso.search([
('date_range_id', '=', date_range.id),
('company_id', '=', self.company_id.id),
], ['assignment_id'])
exclude_assignment_ids = [x['assignment_id'][0] for x in existing_commissions if x['assignment_id']]
com_result_ids = self._core_compute(exclude_assignment_ids)
])
if existing_commissions:
raise UserError(_(
'Commissions already exist for %(period)s in company %(company)s.',
period=date_range.display_name, company=self.company_id.display_name))
com_result_ids = self._core_compute()
if not com_result_ids:
raise UserError(_('No commissions generated.'))
action = self.env['ir.actions.actions']._for_xml_id(
@@ -63,32 +64,12 @@ class CommissionCompute(models.TransientModel):
})
return action
def _core_compute(self, exclude_assignment_ids):
def _core_compute(self):
rules = self.env['commission.rule'].load_all_rules()
com_result_ids = []
assignments = self.env['commission.profile.assignment'].search(
[('company_id', '=', self.company_id.id), ('id', 'not in', exclude_assignment_ids)])
date_range_type2date_range = {}
assignments = self.env['commission.profile.assignment'].search([('company_id', '=', self.company_id.id)])
for assignment in assignments:
profile = assignment.profile_id
date_range_type = profile.date_range_type_id
if not date_range_type:
raise UserError(_("Missing commission periodicity on commission profile '%s'.") % profile.display_name)
if date_range_type not in date_range_type2date_range:
domain = [
('date_start', '=', self.date_start),
('type_id', '=', date_range_type.id),
]
date_range = self.env['date.range'].search(
domain + [('company_id', '=', self.company_id.id)], limit=1)
if not date_range:
date_range = self.env['date.range'].search(
domain + [('company_id', '=', False)], limit=1)
if not date_range:
logger.info('There is no date range with type %s starting on %s. Skipping commission generation for assignment ID %s', date_range_type.name, self.date_start, assignment.id)
continue
date_range_type2date_range[date_range_type] = date_range
com_result = assignment._generate_commission_result(date_range_type2date_range[date_range_type], rules)
com_result = assignment._generate_commission_result(self.date_range_id, rules)
if com_result:
com_result_ids.append(com_result.id)
else:

View File

@@ -15,7 +15,10 @@
<group name="main">
<field name="company_id" groups="base.group_multi_company"/>
<field name="company_id" invisible="1"/>
<field name="date_range_type_id" invisible="1"/>
<field name="date_range_id"/>
<field name="date_start"/>
<field name="date_end"/>
</group>
<footer>
<button name="run" type="object" string="Compute"
@@ -33,6 +36,6 @@
<field name="target">new</field>
</record>
<menuitem id="commission_compute_menu" action="commission_compute_action" parent="commission_root" sequence="15"/>
<menuitem id="commission_compute_menu" action="commission_compute_action" parent="commission_root" sequence="15" groups="account.group_account_user"/>
</odoo>

View File

@@ -8,6 +8,5 @@ from odoo import fields, models
class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings'
commission_product_id = fields.Many2one(
related='company_id.commission_product_id', readonly=False)
commission_po_config = fields.Selection(related="company_id.commission_po_config", readonly=False)
commission_date_range_type_id = fields.Many2one(
related='company_id.commission_date_range_type_id', readonly=False)

View File

@@ -4,18 +4,20 @@
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-10-17 20:49+0000\n"
"PO-Revision-Date: 2025-10-17 20:49+0000\n"
"Last-Translator: \n"
"POT-Creation-Date: 2024-11-29 23:32+0000\n"
"PO-Revision-Date: 2024-11-29 23:32+0000\n"
"Last-Translator: Alexis de Lattre <alexis.delattre@akretion.com>\n"
"Language-Team: \n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: commission_simple_agent
#. odoo-python
#: code:addons/commission_simple_agent/models/commission_profile_assignment.py:0
#: model:ir.model.fields,field_description:commission_simple_agent.field_commission_profile_assignment__agent_id
#: model_terms:ir.ui.view,arch_db:commission_simple_agent.commission_result_search
@@ -24,6 +26,7 @@ msgid "Agent"
msgstr "Agent"
#. module: commission_simple_agent
#. odoo-python
#: code:addons/commission_simple_agent/models/commission_profile_assignment.py:0
#, python-format
msgid "An agent must be selected when the assignment type is 'Agent'."
@@ -35,21 +38,6 @@ msgstr ""
msgid "Commission Profile Assignment"
msgstr "Affectation du profil de commission"
#. module: commission_simple_agent
#: model:ir.model.fields,field_description:commission_simple_agent.field_commission_profile_assignment__display_name
msgid "Display Name"
msgstr "Nom affiché"
#. module: commission_simple_agent
#: model:ir.model.fields,field_description:commission_simple_agent.field_commission_profile_assignment__id
msgid "ID"
msgstr ""
#. module: commission_simple_agent
#: model:ir.model.fields,field_description:commission_simple_agent.field_commission_profile_assignment____last_update
msgid "Last Modified on"
msgstr "Dernière modification le"
#. module: commission_simple_agent
#: model:ir.model.constraint,message:commission_simple_agent.constraint_commission_profile_assignment_company_agent_uniq
msgid "This agent already has an assignment in this company."

View File

@@ -1,2 +0,0 @@
from . import models
from . import wizards

View File

@@ -1,23 +0,0 @@
# Copyright 2019-2024 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': 'Commission Simple Agent Purchase',
'version': '14.0.1.0.0',
'category': 'Sales',
'license': 'AGPL-3',
'summary': 'Glue module between commission_simple_agent and purchase',
'author': 'Akretion',
'website': 'https://github.com/akretion/odoo-usability',
'depends': [
'commission_simple_agent',
'purchase',
],
'data': [
'views/commission_result.xml',
'views/commission_profile.xml',
'wizards/res_config_settings.xml',
],
'installable': True,
}

View File

@@ -1,79 +0,0 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * commission_simple_agent_purchase
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-11-29 23:33+0000\n"
"PO-Revision-Date: 2024-11-29 23:34+0000\n"
"Last-Translator: Alexis de Lattre <alexis.delattre@akretion.com>\n"
"Language-Team: \n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: commission_simple_agent_purchase
#. odoo-python
#: code:addons/commission_simple_agent_purchase/models/commission_result.py:0
#, python-format
msgid ""
"Cannot delete commission %(commission)s because it is linked to purchase "
"order %(po)s. You must delete the purchase order first."
msgstr ""
"Impossible de supprimer la commission %(commission)s car elle est liée à la "
"commande fournisseur %(po)s. Vous devez d'abord supprimer la commande "
"fournisseur."
#. module: commission_simple_agent_purchase
#. odoo-python
#: code:addons/commission_simple_agent_purchase/models/commission_result.py:0
#, python-format
msgid "Commission %s"
msgstr "Commission %s"
#. module: commission_simple_agent_purchase
#: model:ir.model.fields,field_description:commission_simple_agent_purchase.field_res_company__commission_product_id
#: model:ir.model.fields,field_description:commission_simple_agent_purchase.field_res_config_settings__commission_product_id
msgid "Commission Product"
msgstr "Produit de commission"
#. module: commission_simple_agent_purchase
#: model:ir.model,name:commission_simple_agent_purchase.model_commission_result
msgid "Commission Result"
msgstr "État des commissions"
#. module: commission_simple_agent_purchase
#. odoo-python
#: code:addons/commission_simple_agent_purchase/models/commission_result.py:0
#, python-format
msgid "Commission product is not set on company %s."
msgstr "Le produit de commission n'est pas défini sur la société %s."
#. module: commission_simple_agent_purchase
#: model:ir.model,name:commission_simple_agent_purchase.model_res_company
msgid "Companies"
msgstr "Sociétés"
#. module: commission_simple_agent_purchase
#: model:ir.model,name:commission_simple_agent_purchase.model_res_config_settings
msgid "Config Settings"
msgstr "Configuration"
#. module: commission_simple_agent_purchase
#: model:ir.model.fields,field_description:commission_simple_agent_purchase.field_commission_result__purchase_id
msgid "Purchase Order"
msgstr "Commande fournisseur"
#. module: commission_simple_agent_purchase
#. odoo-python
#: code:addons/commission_simple_agent_purchase/models/commission_result.py:0
#, python-format
msgid ""
"Purchase Order %s has already been confirmed. You should cancel it first."
msgstr ""
"La commande fournisseur %s a déjà été confirmée. Vous devez d'abord "
"l'annuler."

View File

@@ -1,3 +0,0 @@
from . import commission_result
from . import commission_profile
from . import res_company

View File

@@ -1,20 +0,0 @@
# Copyright 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 fields, models, api, _
from odoo.exceptions import ValidationError
class CommissionProfile(models.Model):
_inherit = 'commission.profile'
commission_product_id = fields.Many2one(
'product.product', string='Specific Commission Product', ondelete='restrict',
check_company=True,
domain=[('type', '=', 'service')],
help="If not set, Odoo will use the commission product configured on the accounting "
"configuration page."
)

View File

@@ -1,111 +0,0 @@
# Copyright Akretion France (https://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 fields, models, _
from odoo.exceptions import UserError
from odoo.tools.misc import format_amount, formatLang
from markupsafe import Markup
class CommissionResult(models.Model):
_inherit = 'commission.result'
purchase_id = fields.Many2one('purchase.order', string="Purchase Order", tracking=True, readonly=True)
def draft2done(self):
for result in self:
if result.assign_type == 'agent':
if not result.purchase_id:
vals = result._prepare_purchase_order()
po = self.env['purchase.order'].create(vals)
po.message_post(body=Markup(_("Generated from commission <a href=# data-oe-model=commission.result data-oe-id=%d>%s</a>.") % (result.id, result.display_name)))
result.write({'purchase_id': po.id})
else:
po = self.purchase_id
if po.state in ('draft', 'sent', 'cancel'):
po.order_line.unlink()
po.message_post(body=Markup(_("Purchase order lines re-generated from commission <a href=# data-oe-model=commission.result data-oe-id=%d>%s</a>.") % (result.id, result.display_name)))
else:
raise UserError(_("Purchase Order %s has already been confirmed. You should cancel it first.") % po.display_name)
if po.state == 'cancel':
po.button_draft()
assert not po.order_line
# create lines
line_vals = []
if not result.company_id.commission_po_config:
raise UserError(_(
"Purchase order configuration for commission is not set on "
"the accounting configuration page of company '%s'.")
% result.company_id.display_name)
if result.company_id.commission_po_config == 'single_line':
line_vals.append(result._prepare_purchase_order_line_single_line(po))
else:
for move_line in result.line_ids:
line_vals.append(result._prepare_purchase_order_line(move_line, po))
po_lines = self.env['purchase.order.line'].create(line_vals)
po_lines._compute_tax_id()
return super().draft2done()
def _prepare_purchase_order(self):
self.ensure_one()
fp = self.env['account.fiscal.position'].get_fiscal_position(self.partner_id.id)
vals = {
'partner_id': self.partner_id.id,
'origin': _('Commission %s') % self.date_range_id.display_name,
'company_id': self.company_id.id,
'currency_id': self.company_id.currency_id.id,
'fiscal_position_id': fp and fp.id or False,
'payment_term_id': self.partner_id.property_supplier_payment_term_id.id,
}
return vals
def _prepare_purchase_order_line(self, move_line, order):
self.ensure_one()
move = move_line.move_id
company_currency = move_line.company_id.currency_id
lang = self.partner_id.lang or self.env.lang
env = self.with_context(lang=lang).env
product = self.profile_id.commission_product_id or self.company_id.commission_product_id
if not product:
raise UserError(_(
"Commission product is not set on profile '%(profile)s' "
"nor on company '%(company)s'.",
profile=self.profile_id.display_name,
company=self.company_id.display_name))
vals = {
'order_id': order.id,
'product_id': product.id,
'name': f"""{move.name} {move.commercial_partner_id.name}: {move_line.product_id.display_name} x {formatLang(env, move_line.quantity, dp='Product Unit of Measure')} {move_line.product_uom_id.display_name}\n{_('Base:')} {format_amount(env, move_line.commission_base, company_currency)} - {_('Rate:')} {formatLang(env, move_line.commission_rate, dp='Commission Rate')} %""",
'product_qty': 1,
'product_uom': product.uom_id.id,
'price_unit': move_line.commission_amount,
}
return vals
def _prepare_purchase_order_line_single_line(self, order):
product = self.profile_id.commission_product_id or self.company_id.commission_product_id
if not product:
raise UserError(_(
"Commission product is not set on profile '%(profile)s' "
"nor on company '%(company)s'.",
profile=self.profile_id.display_name,
company=self.company_id.display_name))
vals = {
'order_id': order.id,
'product_id': product.id,
'name': _("Commissions for period %(period)s", period=self.date_range_id.name),
'product_qty': 1,
'product_uom': product.uom_id.id,
'price_unit': self.amount_total,
}
return vals
def unlink(self):
for result in self:
if result.purchase_id:
raise UserError(_(
"Cannot delete commission %(commission)s because it is linked to "
"purchase order %(po)s. You must delete the purchase order first.",
commission=result.display_name, po=result.purchase_id.display_name))
return super().unlink()

View File

@@ -1,18 +0,0 @@
# Copyright 2024 Akretion France (https://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 fields, models
class ResCompany(models.Model):
_inherit = 'res.company'
commission_product_id = fields.Many2one(
'product.product', string='Commission Product', ondelete='restrict', check_company=True,
domain=[('type', '=', 'service')])
commission_po_config = fields.Selection([
('single_line', 'Single Line'),
('details', 'One line per commission line'),
], default='details', string="Purchase Order Configuration")

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.2 KiB

View File

@@ -1,22 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2025 Akretion France (https://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="commission_profile_form" model="ir.ui.view">
<field name="model">commission.profile</field>
<field name="inherit_id" ref="commission_simple_agent.commission_profile_form"/>
<field name="arch" type="xml">
<group name="main-right" position="inside">
<field name="commission_product_id"/>
</group>
</field>
</record>
</odoo>

View File

@@ -1,21 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 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>
<record id="commission_result_form" model="ir.ui.view">
<field name="model">commission.result</field>
<field name="inherit_id" ref="commission_simple.commission_result_form"/>
<field name="arch" type="xml">
<group name="main-right" position="inside">
<field name="purchase_id" attrs="{'invisible': [('assign_type', '!=', 'agent')]}"/>
</group>
</field>
</record>
</odoo>

View File

@@ -1 +0,0 @@
from . import res_config_settings

View File

@@ -7,7 +7,7 @@ MRP Usability
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:020a9d9474cfd9d4445a4ea664e6acbfdb6c863d85029a3bad67962b934be139
!! source digest: sha256:1ed999a373f7a5f44bcdeaa09a9b656603a5ef94249420ad4ba5c5788aa56dad
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png

View File

@@ -12,7 +12,6 @@
'website': 'http://www.akretion.com',
'depends': ['mrp'],
'data': [
'security/ir.model.access.csv',
'views/mrp_production.xml',
'views/product_template.xml',
'views/stock_move_line.xml',

View File

@@ -1,3 +0,0 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
mrp.access_uom_category_mrp_manager,Read access on uom.category (inherited in usability module to remove full access),uom.model_uom_category,mrp.group_mrp_manager,1,0,0,0
mrp.access_uom_uom_mrp_manager,Read access on uom.uom (inherited in usability module to remove full access),uom.model_uom_uom,mrp.group_mrp_manager,1,0,0,0
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 mrp.access_uom_category_mrp_manager Read access on uom.category (inherited in usability module to remove full access) uom.model_uom_category mrp.group_mrp_manager 1 0 0 0
3 mrp.access_uom_uom_mrp_manager Read access on uom.uom (inherited in usability module to remove full access) uom.model_uom_uom mrp.group_mrp_manager 1 0 0 0

View File

@@ -367,7 +367,7 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:020a9d9474cfd9d4445a4ea664e6acbfdb6c863d85029a3bad67962b934be139
!! source digest: sha256:1ed999a373f7a5f44bcdeaa09a9b656603a5ef94249420ad4ba5c5788aa56dad
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/akretion/odoo-usability/tree/14.0/mrp_usability"><img alt="akretion/odoo-usability" src="https://img.shields.io/badge/github-akretion%2Fodoo--usability-lightgray.png?logo=github" /></a></p>
<p>Small usability improvements on MRP:</p>

View File

@@ -27,7 +27,6 @@ Akretion:
"website": "http://www.akretion.com",
"depends": ["point_of_sale"],
"data": [
"security/ir.model.access.csv",
"report/pos.xml",
"views/report_pos_order.xml",
"views/pos_category.xml",

View File

@@ -1,3 +0,0 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
point_of_sale.access_uom_uom_manager,Read access on uom.uom (inherited in usability module to remove full access),uom.model_uom_uom,point_of_sale.group_pos_manager,1,0,0,0
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 point_of_sale.access_uom_uom_manager Read access on uom.uom (inherited in usability module to remove full access) uom.model_uom_uom point_of_sale.group_pos_manager 1 0 0 0

View File

@@ -39,12 +39,12 @@ This module has been written by Alexis de Lattre from Akretion
'depends': [
'point_of_sale',
'barcodes',
'base_report_to_printer',
],
'external_dependencies': {'python': ['python-barcode>=0.14.0']},
'data': [
'security/ir.model.access.csv',
'wizard/product_print_zpl_barcode_view.xml',
'wizard/res_config_settings_view.xml',
'views/product.xml',
'views/stock_picking.xml',
'data/barcode_sequence.xml',

View File

@@ -1 +1,2 @@
from . import product_print_zpl_barcode
from . import res_config_settings

View File

@@ -8,8 +8,12 @@ from odoo.tools import float_compare, float_is_zero
from stdnum.ean import is_valid, calc_check_digit
import base64
import re
import socket
import ipaddress
import logging
PRINTER_PORT = 9100
PRINTER_TIMEOUT = 10
logger = logging.getLogger(__name__)
@@ -36,7 +40,8 @@ class ProductPrintZplBarcode(models.TransientModel):
raise UserError(_(
"There are no pricelist in company '%s'.") % company.name)
printer = self.env['printing.printer'].get_default()
printer_ip = self.env['ir.config_parameter'].sudo().get_param(
'product_print_zpl_barcode.printer_ip')
line_ids = []
if self._context.get('active_model') == 'product.product':
@@ -71,7 +76,7 @@ class ProductPrintZplBarcode(models.TransientModel):
'company_id': company.id,
'nomenclature_id': nomenclature.id,
'pricelist_id': pricelist.id,
'zpl_printer_id': printer and printer.id or False,
'zpl_printer_ip': printer_ip,
'line_ids': line_ids,
})
return res
@@ -108,8 +113,7 @@ class ProductPrintZplBarcode(models.TransientModel):
], default='step1', readonly=True)
zpl_file = fields.Binary(string='ZPL File', readonly=True)
zpl_filename = fields.Char('ZPL Filename')
zpl_printer_id = fields.Many2one(
'printing.printer', string='ZPL Printer')
zpl_printer_ip = fields.Char(string='ZPL Printer IP Address')
line_ids = fields.One2many(
'product.print.zpl.barcode.line', 'parent_id',
string='Lines', states={'step2': [('readonly', True)]})
@@ -168,11 +172,21 @@ class ProductPrintZplBarcode(models.TransientModel):
return action
def print_zpl(self):
if not self.zpl_printer_id:
if not self.zpl_printer_ip:
raise UserError(_(
"You must select a ZPL Printer."))
self.zpl_printer_id.print_document(
self.zpl_filename, base64.decodebytes(self.zpl_file), format='raw')
"You must configure the IP address of the ZPL Printer."))
zpl_file_bytes = base64.decodebytes(self.zpl_file)
try:
with socket.create_connection((self.zpl_printer_ip, PRINTER_PORT), timeout=PRINTER_TIMEOUT) as sock:
sock.send(zpl_file_bytes)
except Exception as e:
raise UserError(_(
"Failure in the connection to the ZPL printer "
"on %(ip_addr)s port %(port)s: %(error)s.",
ip_addr=self.zpl_printer_ip,
port=PRINTER_PORT,
error=e,
))
class ProductPrintZplBarcodeLine(models.TransientModel):

View File

@@ -23,7 +23,7 @@
<group name="step2" states="step2">
<field name="zpl_file" filename="zpl_filename" />
<field name="zpl_filename" invisible="1"/>
<field name="zpl_printer_id" attrs="{'required': [('state', '=', 'step2')]}"/>
<field name="zpl_printer_ip" attrs="{'required': [('state', '=', 'step2')]}"/>
</group>
<group name="lines">
<field name="line_ids" colspan="2" nolabel="1">

View File

@@ -0,0 +1,24 @@
# Copyright 2023 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, fields, models
from odoo.exceptions import ValidationError
import ipaddress
class ResConfigSettings(models.TransientModel):
_inherit = "res.config.settings"
zpl_printer_ip = fields.Char(
config_parameter="product_print_zpl_barcode.printer_ip",
string="ZPL Printer IP Address")
@api.constrains('zpl_printer_ip')
def _check_zpl_printer_ip(self):
for wiz in self:
if wiz.zpl_printer_ip:
try:
ipaddress.ip_address(wiz.zpl_printer_ip)
except Exception as e:
raise ValidationError(str(e))

View File

@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2024 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="res_config_settings_view_form" model="ir.ui.view">
<field name="model">res.config.settings</field>
<field name="inherit_id" ref="base_setup.res_config_settings_view_form" />
<field name="arch" type="xml">
<xpath expr="//div[@id='companies']" position='after'>
<h2>Barcode printing</h2>
<div class="row mt16 o_settings_container" name="zpl_printer">
<div class="col-xs-12 col-md-6 o_setting_box">
<div class="o_setting_right_pane" id="zpl_printer_ip">
<div class="row">
<label for="zpl_printer_ip" class="col-md-5" />
<field name="zpl_printer_ip" />
</div>
</div>
</div>
</div>
</xpath>
</field>
</record>
</odoo>

View File

@@ -1 +0,0 @@
from . import models

View File

@@ -1,24 +0,0 @@
# Copyright (C) 2025 Akretion (https://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
'name': 'Purchase Stock Default Picking Type on Partner',
'version': '14.0.1.0.0',
'category': 'Purchases',
'license': 'AGPL-3',
'summary': 'Configure the default picking type for purchase orders on partners',
'description': """
Purchase Stock Default Picking Type on Partner
==============================================
Allow to configure on partners the default picking type for purchase orders.
Please contact Alexis de Lattre from Akretion <alexis.delattre@akretion.com> for any help or question about this module.
""",
'author': 'Akretion',
'website': 'https://github.com/akretion/odoo-usability',
'depends': ['purchase_stock'],
'data': ['views/res_partner.xml'],
'installable': True,
}

View File

@@ -1,2 +0,0 @@
from . import res_partner
from . import purchase_order

View File

@@ -1,23 +0,0 @@
# Copyright 2025 Akretion France (https://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, fields, models
class PurchaseOrder(models.Model):
_inherit = "purchase.order"
# If I set picking_type_id as computed field with store=True and readonly=False
# it doesn't work when creating a PO from the smartbutton of the partner form view
# So, for v14, I use a good old onchange !
@api.onchange("partner_id", "company_id")
def onchange_partner_id(self):
super(PurchaseOrder, self).onchange_partner_id()
if self.partner_id and self.company_id:
partner = self.partner_id.commercial_partner_id.with_company(self.company_id.id)
if partner.purchase_picking_type_id:
self.picking_type_id = partner.purchase_picking_type_id
else:
self.picking_type_id = self._get_picking_type(self.company_id.id)

View File

@@ -1,15 +0,0 @@
# Copyright 2025 Akretion France (https://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 ResPartner(models.Model):
_inherit = 'res.partner'
# Used only for manual POs
purchase_picking_type_id = fields.Many2one(
'stock.picking.type', string="Purchase Picking Type",
company_dependent=True,
domain="[('code', '=', 'incoming'), ('company_id', '=', current_company_id)]")

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.2 KiB

View File

@@ -1,21 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2025 Akretion France (https://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_partner_property_form" model="ir.ui.view">
<field name="model">res.partner</field>
<field name="inherit_id" ref="purchase.view_partner_property_form"/>
<field name="arch" type="xml">
<field name="property_purchase_currency_id" position="before">
<field name="purchase_picking_type_id" attrs="{'invisible': [('parent_id', '!=', False)]}"/>
</field>
</field>
</record>
</odoo>

View File

@@ -7,7 +7,7 @@ Purchase Usability
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:23bdae4eb98dd24f1247782ec786337d70802d8c820a88a87395f7f8ead6267b
!! source digest: sha256:6f446fb5c348931178ab424cdfb7c3bb89e8c01492867bc79fd1c643e52662e0
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png

View File

@@ -12,7 +12,6 @@
'website': 'http://www.akretion.com',
'depends': ['purchase'],
'data': [
'security/ir.model.access.csv',
'views/purchase_order.xml',
'views/purchase_report.xml',
'views/account_move.xml',

View File

@@ -1,3 +0,0 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
purchase.access_uom_category_purchase_manager,Read access on uom.category (inherited in usability module to remove full access),uom.model_uom_category,purchase.group_purchase_manager,1,0,0,0
purchase.access_uom_uom_purchase_manager,Read access on uom.uom (inherited in usability module to remove full access),uom.model_uom_uom,purchase.group_purchase_manager,1,0,0,0
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 purchase.access_uom_category_purchase_manager Read access on uom.category (inherited in usability module to remove full access) uom.model_uom_category purchase.group_purchase_manager 1 0 0 0
3 purchase.access_uom_uom_purchase_manager Read access on uom.uom (inherited in usability module to remove full access) uom.model_uom_uom purchase.group_purchase_manager 1 0 0 0

View File

@@ -367,7 +367,7 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:23bdae4eb98dd24f1247782ec786337d70802d8c820a88a87395f7f8ead6267b
!! source digest: sha256:6f446fb5c348931178ab424cdfb7c3bb89e8c01492867bc79fd1c643e52662e0
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/akretion/odoo-usability/tree/14.0/purchase_usability"><img alt="akretion/odoo-usability" src="https://img.shields.io/badge/github-akretion%2Fodoo--usability-lightgray.png?logo=github" /></a></p>
<dl class="docutils">

View File

@@ -1,5 +1,3 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_sale_invoice_discount_all_lines_sale,Full access on sale.invoice.discount.all.lines to Sale user,model_sale_invoice_discount_all_lines,sales_team.group_sale_salesman,1,1,1,1
access_sale_invoice_discount_all_lines_invoice,Full access on sale.invoice.discount.all.lines to Invoice user,model_sale_invoice_discount_all_lines,account.group_account_invoice,1,1,1,1
sale.access_uom_category_sale_manager,Read access on uom.category (inherited in usability module to remove full access),uom.model_uom_category,sales_team.group_sale_manager,1,0,0,0
sale.access_uom_uom_sale_manager,Read access on uom.uom (inherited in usability module to remove full access),uom.model_uom_uom,sales_team.group_sale_manager,1,0,0,0
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_sale_invoice_discount_all_lines_sale Full access on sale.invoice.discount.all.lines to Sale user model_sale_invoice_discount_all_lines sales_team.group_sale_salesman 1 1 1 1
3 access_sale_invoice_discount_all_lines_invoice Full access on sale.invoice.discount.all.lines to Invoice user model_sale_invoice_discount_all_lines account.group_account_invoice 1 1 1 1
sale.access_uom_category_sale_manager Read access on uom.category (inherited in usability module to remove full access) uom.model_uom_category sales_team.group_sale_manager 1 0 0 0
sale.access_uom_uom_sale_manager Read access on uom.uom (inherited in usability module to remove full access) uom.model_uom_uom sales_team.group_sale_manager 1 0 0 0

View File

@@ -1 +1 @@
14.0.20251015.0
14.0.20250315.0

View File

@@ -25,7 +25,6 @@ setuptools.setup(
'odoo14-addon-base_usability',
'odoo14-addon-commission_simple',
'odoo14-addon-commission_simple_agent',
'odoo14-addon-commission_simple_agent_purchase',
'odoo14-addon-crm_usability',
'odoo14-addon-delivery_usability',
'odoo14-addon-developer_menu',
@@ -58,7 +57,6 @@ setuptools.setup(
'odoo14-addon-product_usability',
'odoo14-addon-project_usability',
'odoo14-addon-purchase_product_tree_default',
'odoo14-addon-purchase_stock_partner_default_picking_type',
'odoo14-addon-purchase_stock_usability',
'odoo14-addon-purchase_usability',
'odoo14-addon-sale_agent',
@@ -89,7 +87,6 @@ setuptools.setup(
'odoo14-addon-stock_reception_usability',
'odoo14-addon-stock_usability',
'odoo14-addon-stock_valuation_xlsx',
'odoo14-addon-stock_valuation_xlsx_viewer',
'odoo14-addon-web_tab_title',
],
classifiers=[

View File

@@ -1 +0,0 @@
../../../../commission_simple_agent_purchase

View File

@@ -1,6 +0,0 @@
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)

View File

@@ -1 +0,0 @@
../../../../purchase_stock_partner_default_picking_type

View File

@@ -1,6 +0,0 @@
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)

View File

@@ -1 +0,0 @@
../../../../stock_valuation_xlsx_viewer

View File

@@ -1,6 +0,0 @@
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)

View File

@@ -4,5 +4,3 @@ access_procurement_scheduler_log_user,Read/Create procurement.scheduler.log to S
access_procurement_scheduler_log_read,Read access on procurement.scheduler.log to Employee,model_procurement_scheduler_log,base.group_user,1,0,0,0
access_stock_warehouse_orderpoint_employee,Read access on stock.warehouse.orderpoint to employee (needed to open product form view with employee-only group),stock.model_stock_warehouse_orderpoint,base.group_user,1,0,0,0
stock.access_stock_inventory_line_user,stock.inventory.line user,stock.model_stock_inventory_line,stock.group_stock_user,1,1,1,1
stock.access_uom_category_stock_manager,Read access on uom.category (inherited in usability module to remove full access),uom.model_uom_category,stock.group_stock_manager,1,0,0,0
stock.access_uom_uom_stock_manager,Read access on uom.uom (inherited in usability module to remove full access),uom.model_uom_uom,stock.group_stock_manager,1,0,0,0
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
4 access_procurement_scheduler_log_read Read access on procurement.scheduler.log to Employee model_procurement_scheduler_log base.group_user 1 0 0 0
5 access_stock_warehouse_orderpoint_employee Read access on stock.warehouse.orderpoint to employee (needed to open product form view with employee-only group) stock.model_stock_warehouse_orderpoint base.group_user 1 0 0 0
6 stock.access_stock_inventory_line_user stock.inventory.line user stock.model_stock_inventory_line stock.group_stock_user 1 1 1 1
stock.access_uom_category_stock_manager Read access on uom.category (inherited in usability module to remove full access) uom.model_uom_category stock.group_stock_manager 1 0 0 0
stock.access_uom_uom_stock_manager Read access on uom.uom (inherited in usability module to remove full access) uom.model_uom_uom stock.group_stock_manager 1 0 0 0

View File

@@ -1,5 +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 user,model_stock_expiry_depreciation_rule,stock.group_stock_user,1,0,0,0
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
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 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
3 access_stock_expiry_depreciation_rule_read Read access on stock.expiry.depreciation.rule to stock user Read access on stock.expiry.depreciation.rule to stock manager model_stock_expiry_depreciation_rule stock.group_stock_user stock.group_stock_manager 1 0 0 0
4 access_stock_valuation_xlsx stock.valuation.xlsx wizard model_stock_valuation_xlsx stock.group_stock_user 1 1 1 0
5 access_stock_variation_xlsx stock.variation.xlsx wizard model_stock_variation_xlsx stock.group_stock_user 1 1 1 0

View File

@@ -1,28 +0,0 @@
# Copyright 2025 Akretion France (https://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
'name': 'Stock Valuation XLSX Viewer',
'version': '14.0.1.0.0',
'category': 'Tools',
'license': 'AGPL-3',
'summary': 'Glue module between stock_viewer and stock_valuation_xlsx',
'description': """
Stock Valuation XLSX Viewer
===========================
Allows to use the module stock_valuation_xlsx when the user is part of the Stock/Viewer group.
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': ['stock_viewer', 'stock_valuation_xlsx'],
'data': [
'security/ir.model.access.csv',
'views/stock_menu.xml',
],
'installable': True,
}

View File

@@ -1,4 +0,0 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_stock_expiry_depreciation_rule_read,Read access on stock.expiry.depreciation.rule to stock user,stock_valuation_xlsx.model_stock_expiry_depreciation_rule,stock_viewer.group_stock_viewer,1,0,0,0
access_stock_valuation_xlsx,stock.valuation.xlsx wizard,stock_valuation_xlsx.model_stock_valuation_xlsx,stock_viewer.group_stock_viewer,1,1,1,0
access_stock_variation_xlsx,stock.variation.xlsx wizard,stock_valuation_xlsx.model_stock_variation_xlsx,stock_viewer.group_stock_viewer,1,1,1,0
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_stock_expiry_depreciation_rule_read Read access on stock.expiry.depreciation.rule to stock user stock_valuation_xlsx.model_stock_expiry_depreciation_rule stock_viewer.group_stock_viewer 1 0 0 0
3 access_stock_valuation_xlsx stock.valuation.xlsx wizard stock_valuation_xlsx.model_stock_valuation_xlsx stock_viewer.group_stock_viewer 1 1 1 0
4 access_stock_variation_xlsx stock.variation.xlsx wizard stock_valuation_xlsx.model_stock_variation_xlsx stock_viewer.group_stock_viewer 1 1 1 0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.2 KiB

View File

@@ -1,16 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2025 Akretion France (https://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.menu_warehouse_report" model="ir.ui.menu">
<field name="groups_id" eval="[(4, ref('stock_viewer.group_stock_viewer'))]"/>
</record>
</odoo>