Browse Source

[PORT] 10.0 pos_margin

pull/174/head
Sylvain LE GAL 8 years ago
parent
commit
a11d7052c1
  1. 2
      pos_margin/__manifest__.py
  2. 4
      pos_margin/models/pos_order.py
  3. 8
      pos_margin/models/pos_order_line.py
  4. 4
      pos_margin/views/view_pos_order.xml

2
pos_margin/__openerp__.py → pos_margin/__manifest__.py

@ -5,7 +5,7 @@
{ {
'name': 'POS Margin', 'name': 'POS Margin',
'version': '8.0.1.0.0',
'version': '10.0.1.0.0',
'category': 'Point Of Sale', 'category': 'Point Of Sale',
'sequence': 1, 'sequence': 1,
'author': "GRAP," 'author': "GRAP,"

4
pos_margin/models/pos_order.py

@ -3,7 +3,7 @@
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain) # @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import api, fields, models
from odoo import api, fields, models
import openerp.addons.decimal_precision as dp import openerp.addons.decimal_precision as dp
@ -13,7 +13,7 @@ class PosOrder(models.Model):
# Columns Section # Columns Section
margin = fields.Float( margin = fields.Float(
'Margin', compute='_compute_margin', store=True, 'Margin', compute='_compute_margin', store=True,
digits_compute=dp.get_precision('Product Price'),
digits=dp.get_precision('Product Price'),
help="It gives profitability by calculating the difference between" help="It gives profitability by calculating the difference between"
" the Unit Price and the cost price.") " the Unit Price and the cost price.")

8
pos_margin/models/pos_order_line.py

@ -3,7 +3,7 @@
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain) # @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import api, fields, models
from odoo import api, fields, models
import openerp.addons.decimal_precision as dp import openerp.addons.decimal_precision as dp
@ -13,13 +13,11 @@ class PosOrderLine(models.Model):
# Columns Section # Columns Section
margin = fields.Float( margin = fields.Float(
'Margin', compute='_compute_multi_margin', store=True, 'Margin', compute='_compute_multi_margin', store=True,
multi='multi_margin',
digits_compute=dp.get_precision('Product Price'))
multi='multi_margin', digits=dp.get_precision('Product Price'))
purchase_price = fields.Float( purchase_price = fields.Float(
'Cost Price', compute='_compute_multi_margin', store=True, 'Cost Price', compute='_compute_multi_margin', store=True,
multi='multi_margin',
digits_compute=dp.get_precision('Product Price'))
multi='multi_margin', digits=dp.get_precision('Product Price'))
# Compute Section # Compute Section
@api.multi @api.multi

4
pos_margin/views/view_pos_order.xml

@ -5,7 +5,7 @@ Copyright (C) 2017 - Today: GRAP (http://www.grap.coop)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
--> -->
<openerp><data>
<odoo>
<record id="view_pos_order_form" model="ir.ui.view"> <record id="view_pos_order_form" model="ir.ui.view">
<field name="model">pos.order</field> <field name="model">pos.order</field>
@ -22,4 +22,4 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
</field> </field>
</record> </record>
</data></openerp>
</odoo>
Loading…
Cancel
Save