pos_cashdro_allow_manual: move config from paymet.method to res.config
This commit is contained in:
parent
d994ab600e
commit
86101218e9
8 changed files with 48 additions and 38 deletions
|
|
@ -11,7 +11,7 @@
|
||||||
"pos_payment_method_cashdro",
|
"pos_payment_method_cashdro",
|
||||||
],
|
],
|
||||||
"data": [
|
"data": [
|
||||||
"views/pos_payment_method_views.xml",
|
"views/pos_config_views.xml",
|
||||||
],
|
],
|
||||||
"assets": {
|
"assets": {
|
||||||
"point_of_sale.assets": [
|
"point_of_sale.assets": [
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
# Copyright 2026 Criptomart
|
# Copyright 2026 Criptomart
|
||||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||||
from . import pos_payment_method
|
from . import pos_config
|
||||||
from . import pos_session
|
from . import res_config_settings
|
||||||
|
|
|
||||||
|
|
@ -3,11 +3,11 @@
|
||||||
from odoo import fields, models
|
from odoo import fields, models
|
||||||
|
|
||||||
|
|
||||||
class PosPaymentMethod(models.Model):
|
class PosConfig(models.Model):
|
||||||
_inherit = "pos.payment.method"
|
_inherit = "pos.config"
|
||||||
|
|
||||||
cashdro_allow_manual_amount = fields.Boolean(
|
cashdro_allow_manual_amount = fields.Boolean(
|
||||||
string="Permitir importe manual",
|
string="Permitir importe manual CashDro",
|
||||||
help=(
|
help=(
|
||||||
"Cuando está activado, aparece un botón 'Manual' en la pantalla de "
|
"Cuando está activado, aparece un botón 'Manual' en la pantalla de "
|
||||||
"pago del TPV que permite confirmar el importe de la línea sin pasar "
|
"pago del TPV que permite confirmar el importe de la línea sin pasar "
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
# Copyright 2026 Criptomart
|
|
||||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
|
||||||
from odoo import models
|
|
||||||
|
|
||||||
|
|
||||||
class PosSession(models.Model):
|
|
||||||
_inherit = "pos.session"
|
|
||||||
|
|
||||||
def _loader_params_pos_payment_method(self):
|
|
||||||
result = super()._loader_params_pos_payment_method()
|
|
||||||
result["search_params"]["fields"].append("cashdro_allow_manual_amount")
|
|
||||||
return result
|
|
||||||
12
pos_cashdro_allow_manual/models/res_config_settings.py
Normal file
12
pos_cashdro_allow_manual/models/res_config_settings.py
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
# Copyright 2026 Criptomart
|
||||||
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||||
|
from odoo import fields, models
|
||||||
|
|
||||||
|
|
||||||
|
class ResConfigSettings(models.TransientModel):
|
||||||
|
_inherit = "res.config.settings"
|
||||||
|
|
||||||
|
pos_cashdro_allow_manual_amount = fields.Boolean(
|
||||||
|
related="pos_config_id.cashdro_allow_manual_amount",
|
||||||
|
readonly=False,
|
||||||
|
)
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
The button is shown when:
|
The button is shown when:
|
||||||
- the payment method is of type "cashdro"
|
- the payment method is of type "cashdro"
|
||||||
- cashdro_allow_manual_amount is True on that payment method
|
- cashdro_allow_manual_amount is True on the pos.config
|
||||||
- the line is in "pending" or "retry" state (the two states where
|
- the line is in "pending" or "retry" state (the two states where
|
||||||
the numpad is already active and the cashier can edit the amount)
|
the numpad is already active and the cashier can edit the amount)
|
||||||
|
|
||||||
|
|
@ -32,7 +32,7 @@
|
||||||
<xpath expr="//div[hasclass('send_payment_request')]" position="before">
|
<xpath expr="//div[hasclass('send_payment_request')]" position="before">
|
||||||
<t
|
<t
|
||||||
t-if="line.payment_method.use_payment_terminal === 'cashdro'
|
t-if="line.payment_method.use_payment_terminal === 'cashdro'
|
||||||
and line.payment_method.cashdro_allow_manual_amount"
|
and env.pos.config.cashdro_allow_manual_amount"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="button cashdro-manual-button"
|
class="button cashdro-manual-button"
|
||||||
|
|
|
||||||
28
pos_cashdro_allow_manual/views/pos_config_views.xml
Normal file
28
pos_cashdro_allow_manual/views/pos_config_views.xml
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!-- Copyright 2026 Criptomart
|
||||||
|
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
|
||||||
|
<odoo>
|
||||||
|
<record id="res_config_settings_cashdro_allow_manual_form" model="ir.ui.view">
|
||||||
|
<field name="name">res.config.settings.cashdro.allow.manual.form</field>
|
||||||
|
<field name="model">res.config.settings</field>
|
||||||
|
<field name="inherit_id" ref="point_of_sale.res_config_settings_view_form"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<xpath expr="//div[@id='payment_methods_new']" position="after">
|
||||||
|
<div class="col-12 col-lg-6 o_setting_box">
|
||||||
|
<div class="o_setting_left_pane">
|
||||||
|
<field name="pos_cashdro_allow_manual_amount"/>
|
||||||
|
</div>
|
||||||
|
<div class="o_setting_right_pane">
|
||||||
|
<label for="pos_cashdro_allow_manual_amount"
|
||||||
|
string="Permitir importe manual CashDro"/>
|
||||||
|
<div class="text-muted">
|
||||||
|
Muestra un botón "Manual" en la pantalla de pago para
|
||||||
|
confirmar el importe CashDro sin pasar por la máquina.
|
||||||
|
Útil ante fallos de comunicación o situaciones de emergencia.
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</xpath>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
</odoo>
|
||||||
|
|
@ -1,18 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
<!-- Copyright 2026 Criptomart
|
|
||||||
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
|
|
||||||
<odoo>
|
|
||||||
<record id="pos_payment_method_cashdro_allow_manual_form" model="ir.ui.view">
|
|
||||||
<field name="name">pos.payment.method.cashdro.allow.manual.form</field>
|
|
||||||
<field name="model">pos.payment.method</field>
|
|
||||||
<field name="inherit_id" ref="pos_payment_method_cashdro.pos_payment_method_view_form"/>
|
|
||||||
<field name="arch" type="xml">
|
|
||||||
<field name="cashdro_password" position="after">
|
|
||||||
<field
|
|
||||||
name="cashdro_allow_manual_amount"
|
|
||||||
attrs="{'invisible': [('use_payment_terminal', '!=', 'cashdro')]}"
|
|
||||||
/>
|
|
||||||
</field>
|
|
||||||
</field>
|
|
||||||
</record>
|
|
||||||
</odoo>
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue