From 256c6037961d70b6db087b44b795f79fb06fd812 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Fri, 9 Dec 2016 08:35:00 +0100 Subject: [PATCH] Add module pos_config_single_user Several usability enhancements in sale, purchase, product and account --- account_usability/account_view.xml | 14 +++++--- intrastat_product_type/__manifest__.py | 30 ++++-------------- .../intrastat_product_type.py | 20 +++++------- intrastat_product_type/post_install.py | 4 ++- intrastat_product_type/product_view.xml | 12 +++---- pos_config_single_user/__init__.py | 3 ++ pos_config_single_user/__manifest__.py | 24 ++++++++++++++ pos_config_single_user/pos.py | 27 ++++++++++++++++ pos_config_single_user/pos_view.xml | 21 ++++++++++++ .../static/description/icon.png | Bin 0 -> 6662 bytes pos_usability/pos_view.xml | 2 ++ product_usability/product.py | 7 ++++ purchase_usability/purchase_view.xml | 1 + sale_usability/sale_view.xml | 2 ++ 14 files changed, 118 insertions(+), 49 deletions(-) create mode 100644 pos_config_single_user/__init__.py create mode 100644 pos_config_single_user/__manifest__.py create mode 100644 pos_config_single_user/pos.py create mode 100644 pos_config_single_user/pos_view.xml create mode 100644 pos_config_single_user/static/description/icon.png diff --git a/account_usability/account_view.xml b/account_usability/account_view.xml index 75d8f6b..98b4d86 100644 --- a/account_usability/account_view.xml +++ b/account_usability/account_view.xml @@ -145,9 +145,14 @@ module --> {'journal_show_code_only': True} + + + + 200 + {} account.move.line - + + + Name or Reference diff --git a/intrastat_product_type/__manifest__.py b/intrastat_product_type/__manifest__.py index 3cdc2a6..ad10637 100644 --- a/intrastat_product_type/__manifest__.py +++ b/intrastat_product_type/__manifest__.py @@ -1,30 +1,12 @@ # -*- coding: utf-8 -*- -############################################################################## -# -# Intrastat Product Type module for Odoo -# Copyright (C) 2016 Akretion (http://www.akretion.com) -# @author Alexis de Lattre -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## - +# © 2016 Akretion (http://www.akretion.com) +# @author Alexis de Lattre +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { 'name': 'Intrastat Product Type', - 'version': '0.1', - 'category': 'Accounting & Finance', + 'version': '10.0.1.0.0', + 'category': 'Accounting', 'license': 'AGPL-3', 'summary': 'Adds a special field Intrastat Type on Products', 'description': """ @@ -42,5 +24,5 @@ This module has been written by Alexis de Lattre from Akretion -from openerp import models, fields, api, _ -from openerp.exceptions import ValidationError +from odoo import models, fields, api, _ +from odoo.exceptions import ValidationError class ProductTemplate(models.Model): @@ -34,16 +34,12 @@ class ProductTemplate(models.Model): "(but you can set Product Type to 'Consumable' or " "'Service').") % pt.name) - @api.multi - def onchange_type(self, type): - res = super(ProductTemplate, self).onchange_type(type) - if 'value' not in res: - res['value'] = {} - if type == 'product': - res['value']['intrastat_type'] = 'product' - elif type == 'service': - res['value']['intrastat_type'] = 'service' - return res + @api.onchange('type') + def intrastat_type_onchange(self): + if self.type in ('product', 'consu'): + self.intrastat_type = 'product' + elif self.type == 'service': + self.intrastat_type = 'service' class L10nFrIntrastatServiceDeclaration(models.Model): diff --git a/intrastat_product_type/post_install.py b/intrastat_product_type/post_install.py index 5366b28..47ca51c 100644 --- a/intrastat_product_type/post_install.py +++ b/intrastat_product_type/post_install.py @@ -1,7 +1,9 @@ # -*- coding: utf-8 -*- +# © 2016 Akretion (Alexis de Lattre ) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -def set_intrastat_type_on_products(cr, pool): +def set_intrastat_type_on_products(cr, registry): cr.execute( "UPDATE product_template SET intrastat_type='service' " "WHERE type='service'") diff --git a/intrastat_product_type/product_view.xml b/intrastat_product_type/product_view.xml index 38cb4e4..e6a926d 100644 --- a/intrastat_product_type/product_view.xml +++ b/intrastat_product_type/product_view.xml @@ -1,12 +1,11 @@ - - + @@ -21,5 +20,4 @@ - - + diff --git a/pos_config_single_user/__init__.py b/pos_config_single_user/__init__.py new file mode 100644 index 0000000..cc89676 --- /dev/null +++ b/pos_config_single_user/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +from . import pos diff --git a/pos_config_single_user/__manifest__.py b/pos_config_single_user/__manifest__.py new file mode 100644 index 0000000..7712ddb --- /dev/null +++ b/pos_config_single_user/__manifest__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +# © 2014-2016 Akretion (Alexis de Lattre ) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + 'name': 'POS Config Single User', + 'version': '10.0.1.0.0', + 'category': 'Point Of Sale', + 'license': 'AGPL-3', + 'summary': 'Configure on each pos.config a single user allowed to start it', + 'description': """ +POS Config Single User +====================== + +New parameter on pos.config: the (only) user allowed to start sessions of this pos.config. + +This module has been written by Alexis de Lattre from Akretion . + """, + 'author': 'Akretion', + 'website': 'http://www.akretion.com', + 'depends': ['point_of_sale'], + 'data': ['pos_view.xml'], + 'installable': True, +} diff --git a/pos_config_single_user/pos.py b/pos_config_single_user/pos.py new file mode 100644 index 0000000..173e618 --- /dev/null +++ b/pos_config_single_user/pos.py @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- +# © 2014-2016 Akretion (Alexis de Lattre ) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import models, fields, api, _ +from openerp.exceptions import UserError + + +class PosConfig(models.Model): + _inherit = 'pos.config' + + allowed_user_id = fields.Many2one( + 'res.users', string="Allowed User", + help="If you select a user, only this user will be allowed to start " + "sessions for this POS", ondelete='restrict') + + @api.multi + def open_session_cb(self): + self.ensure_one() + if ( + self.allowed_user_id and + self.allowed_user_id != self.env.user): + raise UserError(_( + "The POS '%s' can be used only by user '%s'.") % ( + self.name, + self.allowed_user_id.name)) + return super(PosConfig, self).open_session_cb() diff --git a/pos_config_single_user/pos_view.xml b/pos_config_single_user/pos_view.xml new file mode 100644 index 0000000..3cd2c43 --- /dev/null +++ b/pos_config_single_user/pos_view.xml @@ -0,0 +1,21 @@ + + + + + + + + pos_config_single_user.pos.config + pos.config + + + + + + + + + diff --git a/pos_config_single_user/static/description/icon.png b/pos_config_single_user/static/description/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..1a60d0ef970b6a9b19e742f3bb9f86cb17f52daa GIT binary patch literal 6662 zcmWkz1z3|^6rLy{-Ca^r(k(6BB_Jss(jZ-;2uKMyx>H(8Bt~}+ejHr`k?yYl`s`ag zd$w=)JNKNo7Nw=3h=WOq34uUxl$GRkz_SLpn`5AXM+N#LM(~7Ysj4UkdH8qBg_R_M zcb>W_z43%Vu!#QMA3@SH$-$fGUdrn7=qp(G1pH5(F}p(`5Q-#aIT=0QxxGL?H{H#q zivtP8MCLcOPJ_ul6i9iYROU}vq!>@S)Wu9|O}NtLxj#|4I2>pdUriRP7LP0lS)`Bc z6*^2ga5*FiePBuXTKnn6)eI3Pd20_xt<7xm3)N)i*;?y&65|(&fqHLvqf>s)2#=3Y z&}{wXJU9@)xe@0+6b;hInOaUW;X?cxw|Fq_cpB0DRi#K+LQ+8BGzPJ=NQ;fe97a!1 z8OuP8%SevRK#nbo{{$l}REdd?Ka`4+GEAqG`plRfKXmzE6CE8LzPvo{Bt#W(*oodP znd4dl&cMgR(}9DFJLcK4IMmiAd3t`HUsp%u-9q#D@ndpY+Rw`e=mat>NiyZrvegJi z2?^7QEw939$CBr65)u*vV`Fha&l#RVmYjt6diBb@W`1w( z{M@^~p`mlttz*lpYr~^+^F*5-Us{CPHiq}R9(!R?(K9J2I)wtbsh%G3$nbD?#hbcR z{c`5M8JSW&f8|oWV<)k{bXgk0e`=)ZwJd84*Wvc3(YO(eEk#A)DN0Ni;j(!fP$<;i z*;!sy6>Hb~Wvmk7yJo4L%GTBvr<7EVii%1;2?~V?aNWu!Q?SX!#Vl=ebG+!@u(2@>FC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&#rygfu=tL`9h^Cct{Sc6`JDwC^Kj_OufpvIC+pUDmk4CKBr{yCB1+BR$3 zI3I!m8JDqxm28k`>Se9(FEC z)Bg~XeD~6sEtr{-VY0EYvHg7RU9~8!|KDdi<E%WYavU#~S!^v-HT6yGsMHD+vL!`i)X(VEyiS+;n^B59HRYoSbrIW=kD_q7D80{0e{p*<4>2?>VUX! zNaOY1w!P0bG!it8$`X731z0P Total Transactions + monetary Total Balance Finale + monetary diff --git a/product_usability/product.py b/product_usability/product.py index fde3829..709fe01 100644 --- a/product_usability/product.py +++ b/product_usability/product.py @@ -21,3 +21,10 @@ class ProductProduct(models.Model): 'default_code_uniq', 'unique(default_code)', 'This internal reference already exists!')] + + +class ProductSupplierinfo(models.Model): + _inherit = 'product.supplierinfo' + + name = fields.Many2one( + domain=[('supplier', '=', True), ('parent_id', '=', False)]) diff --git a/purchase_usability/purchase_view.xml b/purchase_usability/purchase_view.xml index 5af068e..b5e5b43 100644 --- a/purchase_usability/purchase_view.xml +++ b/purchase_usability/purchase_view.xml @@ -43,6 +43,7 @@ + diff --git a/sale_usability/sale_view.xml b/sale_usability/sale_view.xml index 7509c3d..ee1e314 100644 --- a/sale_usability/sale_view.xml +++ b/sale_usability/sale_view.xml @@ -34,6 +34,7 @@ + @@ -45,6 +46,7 @@ + 1