[IMP] pre-commit: first run on whole repo

This commit is contained in:
Kevin Khao
2021-11-26 18:54:38 +03:00
parent a04b8980e1
commit 167aefee13
289 changed files with 6020 additions and 4170 deletions

View File

@@ -24,7 +24,7 @@ Akretion:
""",
"author": "Akretion",
"website": "http://www.akretion.com",
"website": "https://github.com/OCA/odoo-usability",
"depends": ["point_of_sale"],
"data": [
"report/pos.xml",
@@ -32,6 +32,6 @@ Akretion:
"views/pos_category.xml",
"views/pos_session.xml",
"views/product.xml",
],
],
"installable": True,
}

View File

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

View File

@@ -6,7 +6,7 @@ from odoo import fields, models
class PosPaymentMethod(models.Model):
_inherit = 'pos.payment.method'
_inherit = "pos.payment.method"
_check_company_auto = True
cash_journal_id = fields.Many2one(check_company=True)

View File

@@ -6,7 +6,7 @@ from odoo import fields, models
class ProductTemplate(models.Model):
_inherit = 'product.template'
_inherit = "product.template"
available_in_pos = fields.Boolean(tracking=True)
pos_categ_id = fields.Many2one(tracking=True)

View File

@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<template id="report_saledetails" inherit_id="point_of_sale.report_saledetails">
@@ -8,8 +7,10 @@
<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>
<td><t
t-esc="tax['tax_amount'] + tax['base_amount']"
t-options="{'widget': 'float', 'precision': currency_precision}"
/></td>
</xpath>
</template>

View File

@@ -1,28 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<?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="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"
<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}">
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_value"><field name="product_count" /></span>
<span class="o_stat_text"> Products</span>
</div>
</button>

View File

@@ -1,29 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<?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="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
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="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>
<attribute
name="decoration-success"
>state == 'opened'</attribute>
</field>
</field>
</record>

View File

@@ -1,11 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<?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>
@@ -13,13 +11,19 @@
<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="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="replace"/>
<xpath expr="//div[@name='options']//field[@name='sale_ok']/.." position="after">
<xpath
expr="//group[@name='pos']//field[@name='available_in_pos']"
position="replace"
/>
<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"/>
<field name="available_in_pos" />
<label for="available_in_pos" />
</div>
</xpath>
</field>
@@ -28,13 +32,20 @@
<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="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
name="pos_categ_id"
filter_domain="[('pos_categ_id', 'child_of', raw_value)]"
/>
</field>
<filter name="categ_id" position="after">
<filter name="pos_categ_groupby" string="Point of Sale Category" context="{'group_by': 'pos_categ_id'}"/>
<filter
name="pos_categ_groupby"
string="Point of Sale Category"
context="{'group_by': 'pos_categ_id'}"
/>
</filter>
</field>
</record>

View File

@@ -1,19 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<?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="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 name="session_id" />
</field>
</field>
</record>