Showing posts with label Point Of Sale. Show all posts
Showing posts with label Point Of Sale. Show all posts

Wednesday, 15 March 2017

ValueError Expected singleton in Odoo

Expected Singleton:

Class methods required single invoking object (Single Browsable Record) to invoke the method and suppose it will call by multiple invoking objects (Browsable Recordsets) then method is not able to identify for which object it should process, therefore it will raise an error Expected Singleton.

New API decorator is used to define method calling pattern whether methods allows only single object or multiple objects to invoke this method.


For Example:


if self.location_id:     #face ValueError Expected singleton because self contains multiple recordset.

    ########

Need to change with following:

for warehouse in self:

    if warehouse.location_id:

        ########


@api.one

This decorator loops automatically on Records of RecordSet for you. Self is redefined as current record

Note:

Caution: the returned value is put in a list. This is not always supported by the web client, e.g. on button action
methods. In that case, you should use @api.multi to decorate your method, and probably call self.ensure_one() in
the method definition.

@api.multi

Self will be the current RecordSet without iteration. It is the default behavior (multiple browsable objects). Methods which returns non premitive type data(list, dictionary, function) must be decorated with @api.multi

@api.model

This decorator will convert old API calls to decorated function to new API signature. It allows to be polite when
migrating code. Self does not contain any record/recordset in methods which are decorated by this decorator.

So simply call like this

self.env['model_name'].method_name(arguments)

Thursday, 24 September 2015

What kind of hardware is supported by the Point of Sale? | Odoo

I want to set up a Point of Sale at my shop, and I wonder what kind of hardware is supported ??

Point Of Sale OpenERP Odoo



Standard Hardware



  • Barcode scanners : 

  • any kind of EAN13 usb barcode scanner should be supported. Make sure you configure it to always emit 13 characters. 

  • Touchscreens :

  • Any kind of resistive or multitouch screen should work. In those cases you may want to activate the on screen keyboard in the Point of Sale settings.

  • Printers :

  • In the default settings, the Point of sale will use the browser to print. In this case any laser or inkjet printer supported by your operating system will work. But those kinds of printers are not ideally suited for printing receipts. There is a 'Print by Proxy' settings that enables you to bypass the browser and directly use your printer, but in this case you'll need to develop a driver for your printer or find one provided by the community.

 

Custom Hardware

Because the Point of Sale runs in your browser, it is sandboxed and cannot access your hardware directly. To solve that problem, we developed a custom proxy server that must be run on the client machine while running the point of sale. The Proxy server can access your hardware and forward commands to and from the Point of Sale.
The proxy server is part of a standard Odoo install. All you have to do is install Odoo on the client machine and run it with a default setup. What you'll need to do, however, is to customize the proxy to talk to your hardware.
The proxy is located in addons/point_of_sale/controllers/main.py In that file there are several stub rpc methods that will be called by the point of sale to control the hardware. You will need to implement these methods to use your hardware. There is more documentation available for these methods in the addons/point_of_sale/static/src/js/devices.js file. 

Friday, 18 September 2015

How can we add cutomer name to pos receipt in odoo? | OpenERP

For this we have to extend template of "PosTicket" like this :

<templates id="pos_custom_extended" inherit_id="point_of_sale.template" xml:space="preserve">

<t t-name="PosTicket">

....

<br />

<t t-esc="widget.pos.company.name"/><br />

Phone: <t t-esc="widget.pos.company.phone || ''"/><br />

User: <t t-esc="widget.pos.cashier ? widget.pos.cashier.name : widget.pos.user.name"/><br />

customer : <t t-esc="order.changed.client.name"/><br />

Shop: <t t-esc="widget.pos.shop.name"/><br />

<br />

....

</t>

</template>

How to inherit / modify point of sale pages & change Default Screen? | Odoo

Point of sale odoo have multiple screen and all screen set from screen.js in point_of_sale module. for inherit that file and change default screen you have to do like this :

  •  First you have to inherit widget and widget method in your module like this :
module.PosWidget.include{(
    build_widgets: function() {
       var self = this;
       this.screen_selector = new module.ScreenSelector({
            pos: this.pos,
            screen_set:{
                'products': this.product_screen,
                'payment' : this.payment_screen,
                'scale':    this.scale_screen,
                'receipt' : this.receipt_screen,
                'clientlist': this.clientlist_screen,
            },
            popup_set:{
                'error': this.error_popup,
                'error-barcode': this.error_barcode_popup,
                'error-traceback': this.error_traceback_popup,
                'confirm': this.confirm_popup,
                'unsent-orders': this.unsent_orders_popup,
            },
                default_screen: 'clientlist', #here you select your default screen 
                default_mode: 'cashier',
        });
    };
)};