Initialize v18 branch

Rename *_usability modules to *_usability_akretion
This commit is contained in:
Alexis de Lattre
2024-12-24 10:11:21 +01:00
parent 9913924202
commit 13744fc404
264 changed files with 50 additions and 87 deletions

View File

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

View File

@@ -0,0 +1,39 @@
# Copyright 2014-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).
{
"name": "POS Usability",
"version": "16.0.1.0.0",
"category": "Point of sale",
"license": "AGPL-3",
"summary": "Misc usability improvement for point of sale",
"description": """
POS Usability
=============
- Sales Details report : add sub total amount by tax
authors
-------
Akretion:
* David Béal <david.beal@akretion.com>
""",
"author": "Akretion",
"website": "http://www.akretion.com",
"depends": ["point_of_sale"],
"data": [
"report/pos.xml",
"views/report_pos_order.xml",
"views/pos_category.xml",
"views/pos_session.xml",
"views/pos_payment_method.xml",
"views/pos_order.xml",
"views/product.xml",
],
"installable": False,
}

View File

@@ -0,0 +1,164 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * pos_usability
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-07-07 14:27+0000\n"
"PO-Revision-Date: 2024-07-07 14:27+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: pos_usability
#: model:ir.model.fields,field_description:pos_usability.field_pos_category__product_count
msgid "# Products"
msgstr "Nb de produits"
#. 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 "<span class=\"o_stat_text\"> Produits</span>"
#. 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,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ée sur le Point de Vente."
#. module: pos_usability
#: model:ir.model.fields,help:pos_usability.field_product_product__to_weight
#: model:ir.model.fields,help:pos_usability.field_product_template__to_weight
msgid ""
"Check if the product should be weighted using the hardware scale "
"integration."
msgstr ""
"Cochez cette case si le produit doit être pesé sur la balance électronique."
#. 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 cette case 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_payment_method__receivable_account_id
msgid "Intermediary Account"
msgstr "Compte intermédiaire"
#. module: pos_usability
#: model:ir.model.fields,field_description:pos_usability.field_pos_payment_method__journal_id
msgid "Journal"
msgstr "Journal"
#. module: pos_usability
#: model:ir.model.fields,help:pos_usability.field_pos_payment_method__outstanding_account_id
msgid ""
"Leave empty to use the default account from the company setting.\n"
"Account used as outstanding account when creating accounting payment records for bank payments."
msgstr ""
"Laisser vide pour utiliser le compte par défaut défini dans les paramètres de la société.\n"
"Compte utilisé comme compte en suspens lors de la création des lignes comptables pour les paiements."
#. module: pos_usability
#: model:ir.model.fields,help:pos_usability.field_pos_payment_method__receivable_account_id
msgid ""
"Leave empty to use the default account from the company setting.\n"
"Overrides the company's receivable account (for Point of Sale) used in the journal entries."
msgstr ""
"Laisser vide pour utiliser le compte par défaut défini dans les paramètres de la société.\n"
"Remplace le compte débiteur de la société (pour le point de vente) utilisé dans les pièces comptables."
#. module: pos_usability
#: model:ir.model.fields,help:pos_usability.field_pos_payment_method__journal_id
msgid ""
"Leave empty to use the receivable account of customer.\n"
"Defines the journal where to book the accumulated payments (or individual payment if Identify Customer is true) after closing the session.\n"
"For cash journal, we directly write to the default account in the journal via statement lines.\n"
"For bank journal, we write to the outstanding account specified in this payment method.\n"
"Only cash and bank journals are allowed."
msgstr ""
"Laisser vide pour utiliser le compte débiteur du client.\n"
"Définit le journal où seront comptabilisés les paiements cumulés (ou les paiements individuels si l'identifiant du client est coché) après avoir fermé la session. \n"
"Pour le journal de caisse, nous écrivons directement dans le compte par défaut du journal par des lignes de relevé.\n"
"Pour le journal de banque, nous écrivons dans le compte en suspens défini pour ce mode de paiement.\n"
"Seuls les journaux de caisse et de banque sont autorisés. "
#. module: pos_usability
#: model:ir.model.fields,field_description:pos_usability.field_pos_payment_method__outstanding_account_id
msgid "Outstanding Account"
msgstr "Compte en suspens"
#. module: pos_usability
#: model:ir.model.fields,field_description:pos_usability.field_pos_order__payments_char
msgid "Payment Methods"
msgstr "Modes de paiement"
#. 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
msgid "Point of Sale Category"
msgstr "Catégorie du point de vente"
#. module: pos_usability
#: model:ir.model,name:pos_usability.model_pos_order
msgid "Point of Sale Orders"
msgstr "Commandes 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 du point de vente"
#. module: pos_usability
#: model:ir.model,name:pos_usability.model_pos_session
msgid "Point of Sale Session"
msgstr "Session du point de vente"
#. module: pos_usability
#: model:ir.model,name:pos_usability.model_product_template
msgid "Product"
msgstr "Produit"
#. module: pos_usability
#: model:ir.model.fields,field_description:pos_usability.field_pos_payment_method__sequence
msgid "Sequence"
msgstr "Séquence"
#. module: pos_usability
#: model_terms:ir.ui.view,arch_db:pos_usability.view_pos_session_form
msgid "Stats"
msgstr "Stats"
#. 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 (children "
"categories included)"
msgstr ""
"Le nombre de produits de cette catégorie du point de vente (catégories enfant incluses)"
#. module: pos_usability
#: model:ir.model.fields,field_description:pos_usability.field_product_product__to_weight
#: model:ir.model.fields,field_description:pos_usability.field_product_template__to_weight
msgid "To Weigh With Scale"
msgstr "À peser sur une balance"

View File

@@ -0,0 +1,5 @@
from . import product
from . import pos_category
from . import pos_payment_method
from . import pos_order
from . import pos_session

View File

@@ -0,0 +1,28 @@
# Copyright 2017-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).
from odoo import fields, models
class PosCategory(models.Model):
_inherit = 'pos.category'
product_count = fields.Integer(
'# Products', compute='_compute_product_count',
help="The number of products under this point of sale category "
"(children categories included)")
# inspired by the code of odoo/addons/product/models/product_category.py
def _compute_product_count(self):
read_group_res = self.env['product.template'].read_group(
[('pos_categ_id', 'child_of', self.ids)],
['pos_categ_id'], ['pos_categ_id'])
group_data = dict(
(data['pos_categ_id'][0], data['pos_categ_id_count']) for data
in read_group_res)
for pos_categ in self:
product_count = 0
for sub_categ_id in pos_categ.search([('id', 'child_of', pos_categ.ids)]).ids:
product_count += group_data.get(sub_categ_id, 0)
pos_categ.product_count = product_count

View File

@@ -0,0 +1,23 @@
# 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).
from odoo import api, fields, models
class PosOrder(models.Model):
_inherit = 'pos.order'
# field displayed in pos.order list view
payments_char = fields.Char(
string="Payment Methods", compute="_compute_payments_char", store=True)
@api.depends('payment_ids')
def _compute_payments_char(self):
for order in self:
payments = set()
for pay in order.payment_ids:
if pay.payment_method_id.name:
# unfortunately, 'name' of pos.payment.method is translate=True
payments.add(pay.payment_method_id.name)
order.payments_char = ', '.join(payments)

View File

@@ -0,0 +1,16 @@
# 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).
from odoo import fields, models
class PosPaymentMethod(models.Model):
_inherit = 'pos.payment.method'
_check_company_auto = True
_order = 'sequence, id'
outstanding_account_id = fields.Many2one(check_company=True)
receivable_account_id = fields.Many2one(check_company=True)
journal_id = fields.Many2one(check_company=True)
sequence = fields.Integer(default=10)

View File

@@ -0,0 +1,14 @@
# Copyright 2023 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
class PosSession(models.Model):
_inherit = 'pos.session'
def _loader_params_pos_payment_method(self):
res = super()._loader_params_pos_payment_method()
res['search_params']['order'] = "sequence, id"
return res

View File

@@ -0,0 +1,13 @@
# Copyright 2017-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).
from odoo import fields, models
class ProductTemplate(models.Model):
_inherit = 'product.template'
available_in_pos = fields.Boolean(tracking=True, default=True)
to_weight = fields.Boolean(tracking=True)
pos_categ_id = fields.Many2one(tracking=True)

View File

@@ -0,0 +1,15 @@
diff --git a/addons/point_of_sale/static/src/js/Screens/PaymentScreen/PaymentScreen.js b/addons/point_of_sale/static/src/js/Screens/PaymentScreen/PaymentScreen.js
index e8ddb4d173c..684be2484a2 100644
--- a/addons/point_of_sale/static/src/js/Screens/PaymentScreen/PaymentScreen.js
+++ b/addons/point_of_sale/static/src/js/Screens/PaymentScreen/PaymentScreen.js
@@ -190,7 +190,9 @@ odoo.define('point_of_sale.PaymentScreen', function (require) {
}
}
async _finalizeValidation() {
- if ((this.currentOrder.is_paid_with_cash() || this.currentOrder.get_change()) && this.env.pos.config.iface_cashdrawer && this.env.proxy && this.env.proxy.printer) {
+ //if ((this.currentOrder.is_paid_with_cash() || this.currentOrder.get_change()) && this.env.pos.config.iface_cashdrawer && this.env.proxy && this.env.proxy.printer) {
+ // Always open cashbox (by default, Odoo only opens cashbox for cash payments)
+ if (this.env.pos.config.iface_cashdrawer && this.env.proxy && this.env.proxy.printer) {
this.env.proxy.printer.open_cashbox();
}

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="report_saledetails" inherit_id="point_of_sale.report_saledetails">
<!-- In tax table, add a column for the TTC amount -->
<xpath expr="//table[3]/thead/tr/th[3]" position="after">
<th>Amount</th>
</xpath>
<xpath expr="//table[3]/tbody/tr" position="inside">
<td><t t-esc="tax['tax_amount'] + tax['base_amount']"
t-options="{'widget': 'float', 'precision': currency_precision}" /></td>
</xpath>
</template>
</odoo>

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

View File

@@ -0,0 +1,35 @@
<?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="product_pos_category_form_view" model="ir.ui.view">
<field name="name">pos_usability.pos.category.form</field>
<field name="model">pos.category</field>
<field name="inherit_id" ref="point_of_sale.product_pos_category_form_view"/>
<field name="arch" type="xml">
<div class="oe_title" position="before">
<div class="oe_button_box" name="button_box">
<button class="oe_stat_button"
name="%(product.product_template_action_all)d"
icon="fa-th-list"
type="action"
context="{'search_default_pos_categ_id': active_id}">
<div class="o_form_field o_stat_info">
<span class="o_stat_value"><field name="product_count"/></span>
<span class="o_stat_text"> Products</span>
</div>
</button>
</div>
</div>
</field>
</record>
</odoo>

View File

@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2023 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_pos_pos_form" model="ir.ui.view">
<field name="model">pos.order</field>
<field name="inherit_id" ref="point_of_sale.view_pos_pos_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='lines']/form//field[@name='full_product_name']" position="before">
<field name="product_id"/>
</xpath>
</field>
</record>
<record id="view_pos_order_tree" model="ir.ui.view">
<field name="model">pos.order</field>
<field name="inherit_id" ref="point_of_sale.view_pos_order_tree"/>
<field name="arch" type="xml">
<field name="amount_total" position="after">
<field name="payments_char" optional="show"/>
</field>
</field>
</record>
</odoo>

View File

@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2023 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="pos_payment_method_view_tree" model="ir.ui.view">
<field name="model">pos.payment.method</field>
<field name="inherit_id" ref="point_of_sale.pos_payment_method_view_tree"/>
<field name="arch" type="xml">
<field name="name" position="before">
<field name="sequence" widget="handle"/>
</field>
</field>
</record>
<record id="pos_payment_method_view_form" model="ir.ui.view">
<field name="model">pos.payment.method</field>
<field name="inherit_id" ref="point_of_sale.pos_payment_method_view_form"/>
<field name="arch" type="xml">
<field name="company_id" position="after">
<!-- company_id without groups="base.group_multi_company" is missing -->
<field name="company_id" invisible="1"/>
</field>
</field>
</record>
</odoo>

View File

@@ -0,0 +1,31 @@
<?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_pos_session_form" model="ir.ui.view">
<field name="model">pos.session</field>
<field name="inherit_id" ref="point_of_sale.view_pos_session_form"/>
<field name="arch" type="xml">
<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>
</field>
</record>
<record id="view_pos_session_tree" model="ir.ui.view">
<field name="model">pos.session</field>
<field name="inherit_id" ref="point_of_sale.view_pos_session_tree"/>
<field name="arch" type="xml">
<field name="state" position="attributes">
<attribute name="decoration-success">state == 'opened'</attribute>
</field>
</field>
</record>
</odoo>

View File

@@ -0,0 +1,42 @@
<?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>
<!-- put option "available in POS" at the top of product form view -->
<record id="product_template_form_view" model="ir.ui.view">
<field name="name">usability.pos.product.template</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="point_of_sale.product_template_form_view"/>
<field name="arch" type="xml">
<xpath expr="//group[@name='pos']//field[@name='available_in_pos']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<xpath expr="//div[@name='options']//field[@name='sale_ok']/.." position="after">
<div name="available_in_pos">
<field name="available_in_pos"/>
<label for="available_in_pos"/>
</div>
</xpath>
</field>
</record>
<record id="product_template_search_view" model="ir.ui.view">
<field name="name">pos_usability.product.template.search</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_search_view"/>
<field name="arch" type="xml">
<field name="categ_id" position="after">
<field name="pos_categ_id" filter_domain="[('pos_categ_id', 'child_of', raw_value)]"/>
</field>
</field>
</record>
</odoo>

View File

@@ -0,0 +1,26 @@
<?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_report_pos_order_search" model="ir.ui.view">
<field name="model">report.pos.order</field>
<field name="inherit_id" ref="point_of_sale.view_report_pos_order_search"/>
<field name="arch" type="xml">
<field name="product_categ_id" position="after">
<field name="session_id"/>
</field>
</field>
</record>
<record id="point_of_sale.action_report_pos_order_all" model="ir.actions.act_window">
<field name="view_mode">pivot,graph</field> <!-- invert native order -->
</record>
</odoo>