Browse Source

Merge PR #459 into 12.0

Signed-off-by legalsylvain
pull/409/head
OCA-git-bot 5 years ago
parent
commit
d0368ad871
  1. 1
      pos_ticket_salesman_firstname/__init__.py
  2. 26
      pos_ticket_salesman_firstname/__manifest__.py
  3. 1
      pos_ticket_salesman_firstname/models/__init__.py
  4. 10
      pos_ticket_salesman_firstname/models/pos_config.py
  5. 3
      pos_ticket_salesman_firstname/readme/CONFIGURE.rst
  6. 3
      pos_ticket_salesman_firstname/readme/CONTRIBUTORS.rst
  7. 3
      pos_ticket_salesman_firstname/readme/DESCRIPTION.rst
  8. 3
      pos_ticket_salesman_firstname/readme/USAGE.rst
  9. BIN
      pos_ticket_salesman_firstname/static/description/icon.png
  10. BIN
      pos_ticket_salesman_firstname/static/description/receipt.png
  11. 25
      pos_ticket_salesman_firstname/static/src/js/models.js
  12. 16
      pos_ticket_salesman_firstname/static/src/xml/pos.xml
  13. 11
      pos_ticket_salesman_firstname/views/assets.xml
  14. 25
      pos_ticket_salesman_firstname/views/pos_config.xml

1
pos_ticket_salesman_firstname/__init__.py

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

26
pos_ticket_salesman_firstname/__manifest__.py

@ -0,0 +1,26 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Pos Ticket Salesman Firstname",
"category": "Point Of Sale",
"version": "12.0.1.0.0",
"author": "Druidoo, "
"Odoo Community Association (OCA)",
"website": "https://github.com/OCA/pos",
"license": "AGPL-3",
"depends": [
"point_of_sale",
"partner_firstname",
],
"data": [
"views/assets.xml",
"views/pos_config.xml",
],
"qweb": [
"static/src/xml/pos.xml",
],
"maintainers": [
"ivantodorovich",
],
"installable": True,
}

1
pos_ticket_salesman_firstname/models/__init__.py

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

10
pos_ticket_salesman_firstname/models/pos_config.py

@ -0,0 +1,10 @@
from odoo import models, fields
class PosConfig(models.Model):
_inherit = 'pos.config'
receipt_salesman_firstname = fields.Boolean(
"Print only the salesman's first name",
default=True,
)

3
pos_ticket_salesman_firstname/readme/CONFIGURE.rst

@ -0,0 +1,3 @@
#. Go to *Point of Sale > Configuration > Point of Sale*.
#. Edit the one you want to configure.
#. Enable *Print only the salesman's first name*

3
pos_ticket_salesman_firstname/readme/CONTRIBUTORS.rst

@ -0,0 +1,3 @@
* `Druidoo <https://www.druidoo.io>`_:
* Iván Todorovich

3
pos_ticket_salesman_firstname/readme/DESCRIPTION.rst

@ -0,0 +1,3 @@
On the POS ticket, prints only the salesman's first name.
.. image:: ../static/description/receipt.png

3
pos_ticket_salesman_firstname/readme/USAGE.rst

@ -0,0 +1,3 @@
#. Open a new PoS session.
#. Make an order and validate it.
#. You should see only the salesman's firstname on the receipt

BIN
pos_ticket_salesman_firstname/static/description/icon.png

After

Width: 128  |  Height: 128  |  Size: 9.3 KiB

BIN
pos_ticket_salesman_firstname/static/description/receipt.png

After

Width: 331  |  Height: 281  |  Size: 15 KiB

25
pos_ticket_salesman_firstname/static/src/js/models.js

@ -0,0 +1,25 @@
/* License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). */
odoo.define("pos_ticket_salesman_firstname.models", function (require) {
"use strict";
var models = require("point_of_sale.models");
models.load_fields('res.users', ['firstname', 'lastname']);
var _super_Order = models.Order.prototype;
models.Order = models.Order.extend({
export_for_printing: function() {
var receipt = _super_Order.export_for_printing.apply(this, arguments);
if (this.pos.config.receipt_salesman_firstname) {
var cashier = this.pos.get_cashier();
receipt.cashier = cashier ? cashier.firstname : null;
}
return receipt;
}
});
return models;
});

16
pos_ticket_salesman_firstname/static/src/xml/pos.xml

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
<t t-extend="PosTicket">
<t t-jquery="div[class='receipt-user']" t-operation="replace">
<div class="receipt-user">
User:
<t t-if="widget.pos.config.receipt_salesman_firstname" t-esc="widget.pos.get_cashier().firstname"/>
<t t-else="" t-esc="widget.pos.get_cashier().name"/>
<br />
</div>
</t>
</t>
</templates>

11
pos_ticket_salesman_firstname/views/assets.xml

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="assets" inherit_id="point_of_sale.assets">
<xpath expr=".">
<script type="text/javascript" src="/pos_ticket_salesman_firstname/static/src/js/models.js"/>
</xpath>
</template>
</odoo>

25
pos_ticket_salesman_firstname/views/pos_config.xml

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_pos_config_form" model="ir.ui.view">
<field name="model">pos.config</field>
<field name="inherit_id" ref="point_of_sale.pos_config_view_form"/>
<field name="arch" type="xml">
<xpath expr="//div[@id='iface_invoicing']" position="before">
<div class="col-12 col-lg-6 o_setting_box" id="receipt_salesman_firstname">
<div class="o_setting_left_pane">
<field name="receipt_salesman_firstname"/>
</div>
<div class="o_setting_right_pane">
<label for="receipt_salesman_firstname"/>
<div class="text-muted">
On the receipt, prints only the salesman's firstname instead of the full name.
</div>
</div>
</div>
</xpath>
</field>
</record>
</odoo>
Loading…
Cancel
Save