Browse Source

[ADD] beesdoo_product: push total_with_vat to POS model, such that it can be used with oca/pos_price_to_weight

pull/141/head
Manuel Claeys Bouuaert 5 years ago
parent
commit
9c686b4995
  1. 1
      beesdoo_product/__manifest__.py
  2. 22
      beesdoo_product/static/src/js/models.js
  3. 8
      beesdoo_product/views/assets.xml

1
beesdoo_product/__manifest__.py

@ -27,6 +27,7 @@
'data/barcode_rule.xml',
'data/product_sequence.xml',
'views/beesdoo_product.xml',
'views/assets.xml',
'wizard/views/label_printing_utils.xml',
'security/ir.model.access.csv',
],

22
beesdoo_product/static/src/js/models.js

@ -0,0 +1,22 @@
odoo.define('beesdoo_product.models', function (require) {
"use strict";
var models = require('point_of_sale.models');
var _super_PosModel = models.PosModel.prototype;
models.PosModel = models.PosModel.extend({
initialize: function (session, attributes) {
var product_model = _.find(this.models, function(model){
return model.model === 'product.product';
});
product_model.fields.push('total_with_vat');
// Inheritance
return _super_PosModel.initialize.call(this, session, attributes);
},
});
});

8
beesdoo_product/views/assets.xml

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="assets_frontend" inherit_id="point_of_sale.assets">
<xpath expr="." position="inside">
<script type="text/javascript" src="/beesdoo_product/static/src/js/models.js"/>
</xpath>
</template>
</odoo>
Loading…
Cancel
Save