[MIG] pos_usability to v16
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
|
||||
{
|
||||
"name": "POS Usability",
|
||||
"version": "14.0.1.0.0",
|
||||
"version": "16.0.1.0.0",
|
||||
"category": "Point of sale",
|
||||
"license": "AGPL-3",
|
||||
"summary": "Misc usability improvement for point of sale",
|
||||
@@ -33,5 +33,5 @@ Akretion:
|
||||
"views/pos_session.xml",
|
||||
"views/product.xml",
|
||||
],
|
||||
"installable": False,
|
||||
"installable": True,
|
||||
}
|
||||
|
||||
@@ -11,15 +11,18 @@ class PosCategory(models.Model):
|
||||
product_count = fields.Integer(
|
||||
'# Products', compute='_compute_product_count',
|
||||
help="The number of products under this point of sale category "
|
||||
"(does not consider the children categories)")
|
||||
"(children categories included)")
|
||||
|
||||
# inspired by the code of odoo/addons/product/models/product.py
|
||||
# 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', 'in', self.ids)],
|
||||
[('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:
|
||||
pos_categ.product_count = group_data.get(pos_categ.id, 0)
|
||||
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
|
||||
|
||||
@@ -9,4 +9,6 @@ class PosPaymentMethod(models.Model):
|
||||
_inherit = 'pos.payment.method'
|
||||
_check_company_auto = True
|
||||
|
||||
cash_journal_id = fields.Many2one(check_company=True)
|
||||
outstanding_account_id = fields.Many2one(check_company=True)
|
||||
receivable_account_id = fields.Many2one(check_company=True)
|
||||
journal_id = fields.Many2one(check_company=True)
|
||||
|
||||
@@ -8,5 +8,6 @@ from odoo import fields, models
|
||||
class ProductTemplate(models.Model):
|
||||
_inherit = 'product.template'
|
||||
|
||||
available_in_pos = fields.Boolean(tracking=True)
|
||||
available_in_pos = fields.Boolean(tracking=True, default=True)
|
||||
to_weight = fields.Boolean(tracking=True)
|
||||
pos_categ_id = fields.Many2one(tracking=True)
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
<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>
|
||||
|
||||
@@ -15,20 +15,6 @@
|
||||
<button name="show_journal_items" position="after">
|
||||
<button name="%(point_of_sale.action_report_pos_order_all)d" type="action" class="oe_stat_button" icon="fa-table" string="Stats" context="{'search_default_session_id': active_id}"/>
|
||||
</button>
|
||||
<xpath
|
||||
expr="//field[@name='cash_register_total_entry_encoding']/parent::group"
|
||||
position="before"
|
||||
>
|
||||
<group>
|
||||
<field
|
||||
style="text-align:right;margin:0;padding:0;"
|
||||
name="cash_register_balance_start"
|
||||
widget="monetary"
|
||||
options="{'currency_field': 'currency_id'}"
|
||||
string="Starting Balance"
|
||||
/>
|
||||
</group>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
@@ -15,7 +15,9 @@
|
||||
<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="replace"/>
|
||||
<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"/>
|
||||
@@ -33,9 +35,6 @@
|
||||
<field name="categ_id" position="after">
|
||||
<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>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user