Sylvain LE GAL
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 121 additions and 36 deletions
-
30pos_margin/README.rst
-
1pos_margin/__init__.py
-
6pos_margin/__openerp__.py
-
25pos_margin/hooks.py
-
16pos_margin/i18n/fr.po
-
16pos_margin/models/pos_order.py
-
43pos_margin/models/pos_order_line.py
-
BINpos_margin/static/description/pos_order_form.png
-
BINpos_margin/static/description/pos_order_form_view.png
-
BINpos_margin/static/description/pos_order_tree_view.png
-
20pos_margin/views/view_pos_order.xml
@ -1,2 +1,3 @@ |
|||
# -#- coding: utf-8 -#- |
|||
from . import models |
|||
from .hooks import pre_init_hook |
@ -0,0 +1,25 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# Copyright (C) 2017 - Today: GRAP (http://www.grap.coop) |
|||
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain) |
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|||
|
|||
import logging |
|||
|
|||
_logger = logging.getLogger(__name__) |
|||
|
|||
|
|||
def _create_column(cr, table_name, column_name, column_type): |
|||
_logger.info("Fast creation of the column %s.%s" % ( |
|||
table_name, column_name)) |
|||
|
|||
req = "ALTER TABLE %s ADD COLUMN %s %s" % ( |
|||
table_name, column_name, column_type) |
|||
cr.execute(req) |
|||
|
|||
|
|||
def pre_init_hook(cr): |
|||
_create_column(cr, 'pos_order_line', 'purchase_price', 'numeric') |
|||
_create_column(cr, 'pos_order_line', 'margin', 'numeric') |
|||
_create_column(cr, 'pos_order_line', 'margin_percent', 'numeric') |
|||
_create_column(cr, 'pos_order', 'margin', 'numeric') |
|||
_create_column(cr, 'pos_order', 'margin_percent', 'numeric') |
Before Width: 776 | Height: 419 | Size: 28 KiB |
After Width: 926 | Height: 537 | Size: 37 KiB |
After Width: 1139 | Height: 105 | Size: 19 KiB |
Write
Preview
Loading…
Cancel
Save
Reference in new issue