Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added new module pos_fiscal_floor. Minor change in pos_fiscal_current. #31

Merged
merged 4 commits into from
Nov 27, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pos_fiscal_current/__openerp__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
'name' : 'POS fiscal current',
'version' : '1.0.0',
'author' : 'IT-Projects LLC,
'author' : 'IT-Projects LLC',
'license': 'LGPL-3',
'category' : 'Point Of Sale',
'website' : 'https://yelizariev.github.io',
Expand Down
4 changes: 3 additions & 1 deletion pos_fiscal_current/static/src/js/pos.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ odoo.define('pos_fiscal_current', function (require) {
this._super();
var order = this.pos.get_order();
if (order.fiscal_position != undefined) {
this.el.querySelector('.summary .total .fiscal .value').textContent = order.fiscal_position.name;
if (this.el.querySelector('.summary .total .fiscal .value') != null) {
this.el.querySelector('.summary .total .fiscal .value').textContent = order.fiscal_position.name;
}
}
}
})
Expand Down
2 changes: 1 addition & 1 deletion pos_fiscal_current/templates.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</xpath>
<xpath expr="//link[@id='pos-stylesheet']" position="after">
<link rel="stylesheet" href="/pos_fiscal_current/static/src/css/pos_fc.css"/>
</xpath>
</xpath>
</template>
</data>
</openerp>
2 changes: 2 additions & 0 deletions pos_fiscal_floor/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-
import model
14 changes: 14 additions & 0 deletions pos_fiscal_floor/__openerp__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# -*- coding: utf-8 -*-
{
'name' : 'POS fiscal floor',
'version' : '1.0.0',
'author' : 'IT-Projects LLC',
'license': 'LGPL-3',
'category' : 'Point Of Sale',
'website' : 'https://yelizariev.github.io',
'description': "Add Fiscal Position to POS floor model",
'data':['views.xml'],
'depends': ['base','point_of_sale','pos_restaurant'],
'installable': True,

}
1 change: 1 addition & 0 deletions pos_fiscal_floor/model/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import pos_fiscal_floor
8 changes: 8 additions & 0 deletions pos_fiscal_floor/model/pos_fiscal_floor.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# -*- coding: utf-8 -*-

from openerp.osv import fields, osv
from openerp import models

class restaurant_floor(osv.Model):
_inherit = 'restaurant.floor'
_columns = {'pos_default_fiscal': fields.many2one('account.fiscal.position','Fiscal Position')}
43 changes: 43 additions & 0 deletions pos_fiscal_floor/static/src/js/pos_fiscal_floor.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
odoo.define('pos_fiscal_floor', function (require) {

var screens = require('point_of_sale.screens');
require('pos_restaurant.floors');
var models = require('point_of_sale.models');

screens.OrderWidget.include({
update_summary: function () {
this._super();
var order = this.pos.get_order();
if (!order.fiscal_position) {
var f_id = posmodel.table.floor.pos_default_fiscal[0];
var f_name = posmodel.table.floor.pos_default_fiscal[1];
obj = _.find(this.pos.fiscal_positions, function(obj) { return obj.id == f_id })
order.fiscal_position = obj;
order.trigger('change');
}
}
})


models.load_models({
model: 'restaurant.floor',
fields: ['name','pos_default_fiscal','background_color','table_ids','sequence'],
domain: function(self){ return [['pos_config_id','=',self.config.id]]; },
loaded: function(self,floors){
self.floors = floors;
self.floors_by_id = {};
for (var i = 0; i < floors.length; i++) {
floors[i].tables = [];
self.floors_by_id[floors[i].id] = floors[i];
}

// Make sure they display in the correct order
self.floors = self.floors.sort(function(a,b){ return a.sequence - b.sequence; });

// Ignore floorplan features if no floor specified.
self.config.iface_floorplan = !!self.floors.length;
},
});


})
23 changes: 23 additions & 0 deletions pos_fiscal_floor/views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0"?>
<openerp>
<data>
<record model="ir.ui.view" id="view_restaurant_floor_form">
<field name="name">restaurant.floor.form.view.inherit</field>
<field name="model">restaurant.floor</field>
<field name="inherit_id" ref="pos_restaurant.view_restaurant_floor_form"></field>
<field name="arch" type="xml">
<xpath expr="//group[@col='4']" position="inside">
<field name="pos_default_fiscal"/>
</xpath>
</field>
</record>

<!-- POS -->
<template id="assets_backend" name="pos_fiscal_floor assets" inherit_id="point_of_sale.assets">
<xpath expr="." position="inside">
<script type="text/javascript" src="/pos_fiscal_floor/static/src/js/pos_fiscal_floor.js"></script>
</xpath>
</template>

</data>
</openerp>