From 27455246629ce7c368f2d1975782f83280e56e56 Mon Sep 17 00:00:00 2001 From: lreficent Date: Fri, 26 May 2017 13:46:32 +0200 Subject: [PATCH] Several improvements --- quality_control_issue/README.rst | 4 +- quality_control_issue/__openerp__.py | 1 + quality_control_issue/models/__init__.py | 1 + quality_control_issue/models/qc_issue.py | 26 ++++- .../models/qc_problem_track.py | 18 ++++ .../static/description/icon.png | Bin 0 -> 7121 bytes .../static/description/icon.svg | 95 ++++++++++++++++++ quality_control_issue/views/qc_issue_view.xml | 21 ++-- .../views/qc_problem_track_view.xml | 53 ++++++++++ 9 files changed, 208 insertions(+), 11 deletions(-) create mode 100644 quality_control_issue/models/qc_problem_track.py create mode 100644 quality_control_issue/static/description/icon.png create mode 100644 quality_control_issue/static/description/icon.svg create mode 100644 quality_control_issue/views/qc_problem_track_view.xml diff --git a/quality_control_issue/README.rst b/quality_control_issue/README.rst index 8d851c7f0bd..64aa570ede9 100644 --- a/quality_control_issue/README.rst +++ b/quality_control_issue/README.rst @@ -6,6 +6,8 @@ Quality Control Issue ===================== +WIP + This module extends the functionality of Non-Conformance Material Report to allow you to report quality control issues. @@ -19,7 +21,7 @@ Usage To use this module, you need to: -#. Go to *Quality Control > NCMR > Non-Conforming Material Report*. +#. Go to *Quality Control > Issues > QC Issues*. .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas :alt: Try me on Runbot diff --git a/quality_control_issue/__openerp__.py b/quality_control_issue/__openerp__.py index db80635fbc0..456eea0c435 100644 --- a/quality_control_issue/__openerp__.py +++ b/quality_control_issue/__openerp__.py @@ -15,5 +15,6 @@ "data": [ "data/qc_issue_sequence.xml", "views/qc_issue_view.xml", + "views/qc_problem_track_view.xml", ], } diff --git a/quality_control_issue/models/__init__.py b/quality_control_issue/models/__init__.py index ec64d8695c5..2034bcb1627 100644 --- a/quality_control_issue/models/__init__.py +++ b/quality_control_issue/models/__init__.py @@ -3,3 +3,4 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from . import qc_issue +from . import qc_problem_track diff --git a/quality_control_issue/models/qc_issue.py b/quality_control_issue/models/qc_issue.py index d1bbb9ce892..d1b67095342 100644 --- a/quality_control_issue/models/qc_issue.py +++ b/quality_control_issue/models/qc_issue.py @@ -8,7 +8,7 @@ class QualityControlIssue(models.Model): _name = "qc.issue" - _description = "Nonconforming Material Report" + _description = "Quality Control Issue" _inherit = "mail.thread" @api.model @@ -18,10 +18,26 @@ def create(self, vals): return super(QualityControlIssue, self).create(vals) @api.one - @api.onchange("product_id") def _get_uom(self): self.product_uom = self.product_id.product_tmpl_id.uom_id + @api.one + @api.onchange('product_id') + def _set_lot_domain(self): + self.product_uom = self.product_id.product_tmpl_id.uom_id + if self.product_id: + return {'domain': { + 'lot_id': [('product_id', '=', self.product_id.id)]}} + return {} + + @api.one + @api.onchange("lot_id") + def _onchange_lot_id(self): + product = self.lot_id.product_id + if product: + self.product_id = product + self.product_uom = product.product_tmpl_id.uom_id + name = fields.Char(readonly=True) state = fields.Selection( selection=[("new", "New"), @@ -32,6 +48,7 @@ def _get_uom(self): comodel_name="product.product", string="Product", readonly=True, states={"new": [("readonly", False)]}, required=True) + product_tracking = fields.Selection(related="product_id.tracking") product_qty = fields.Float( string="Product Quantity", required=True, default=1.0, readonly=True, states={"new": [("readonly", False)]}, @@ -57,6 +74,11 @@ def _get_uom(self): states={"done": [("readonly", True)]},) description = fields.Text( states={"done": [("readonly", True)]},) + problem_track_ids = fields.Many2many( + comodel_name="qc.problem.track", string="Problems", + relation="qc_issue_problem_rel", column1="qc_issue_id", + column2="qc_problem_id", + states={"done": [("readonly", True)]},) @api.multi def action_confirm(self): diff --git a/quality_control_issue/models/qc_problem_track.py b/quality_control_issue/models/qc_problem_track.py new file mode 100644 index 00000000000..a608530e283 --- /dev/null +++ b/quality_control_issue/models/qc_problem_track.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- +# Copyright 2017 Eficent Business and IT Consulting Services S.L. +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from openerp import api, fields, models + + +class QcProblemTrack(models.Model): + _name = "qc.problem.track" + _description = "Quality Control Problem Tracking" + _inherit = "mail.thread" + + name = fields.Char() + notes = fields.Text() + issue_ids = fields.Many2many( + comodel_name="qc.issue", string="QC Issues", + relation="qc_issue_problem_rel", column1="qc_problem_id", + column2="qc_issue_id") diff --git a/quality_control_issue/static/description/icon.png b/quality_control_issue/static/description/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..e0aa80bcee2e5b2f7ef001921c947ec999f9578d GIT binary patch literal 7121 zcmV;?8!qIDP)gH?Arx10earlt+Dk!?GG zemCBsD`0rrV#8~Dw`A9e)s0C@^9*bhmJp+5AoRWd9s{auHh%K1tr^u0Q{DyKQU(w= zGcAY{Yy|*DN|&N5MC=Wo$LgJ%vT6We)~s2^W{dYi;_xRBhDg<9z+QvJ|IWO;kIlL( z?;>s)14v3rGFS{jIbfJ3vx*HsF@R=(Mgz=WUN!opAUAuFIxXD~-qi}|MZ~c2Z-F6A zK@|=_UjY39W|UuzjU6x~y0N0HbdN$6-I80u09bs=!sP%hb>cIp_Zu8_sIsi|loOxn z5Zt#5NKfYy3X1L(2zN1{7Z|(D7+ofTT_#Sr%n@v0Tp$rW1R&7`8d@1+|9~KT3UKEE zzy|cim zS1TaKl;j0-ZlRA40O7>ppGZ%4yT7;FDFgsu^pLAn&>I4cO4xN|l&kgVirX1LQc{wE zfxFAqdN>4uOLDaeU2!`D=;VXO0Tk$JJsbl~cC`jwaXSNG98z4ZgQFl|lB;#-iow+i z*h49LPfonOy)d9(1o}mWqhCZgLV^R~;o$)0BY-D>Dz%R54(hIlo15BE=Aktt(F1lUF>7J0_Ak3LL z4KtII&_6OP~{w&F-}saA0-JS_fyatG&-%MD;k>ikd!?k6C620(}! z83PAI;<1PC$DLE-z%j?a(wVYz_#$&Ha<=S%AP8#3)Pdo1FfOAYF17&a>8b^3!6gQe zn3^`oO13l(xR-#*P&pX&F?r)>iyp*+yYB+eJAYZDr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J__t*<56bSAI-~1jITHq5DIe8UXf7F!mM$E0!v2Bf;&KhTSnH@LD{5 z6M&rn%jba2BhS_^W2VoAmjoFx066@Khl|QiKdRPNUn=nw&M(dp(3}dIA%*Z zx?ak34NIV(5gX8-uWEnolu zQ2cW81r96;z#af~M^`3@A2_H1!Du^xt69JbJ-mf!MX$wQ?5WPpz%5|_0C05W)CP1I zW&`xDBesT>q)%%h(3`xqJ@s( + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/quality_control_issue/views/qc_issue_view.xml b/quality_control_issue/views/qc_issue_view.xml index a7820a2bbcb..3db8a7b8c8d 100644 --- a/quality_control_issue/views/qc_issue_view.xml +++ b/quality_control_issue/views/qc_issue_view.xml @@ -5,7 +5,7 @@ - My view description + qc.issue.tree qc.issue @@ -19,7 +19,7 @@ - My view description + qc.issue.form qc.issue
@@ -62,15 +62,20 @@ + groups="stock.group_production_lot" + attrs="{'required': [('product_tracking', 'in', ('serial', 'lot'))]}"/> - + + + groups="product.group_uom" + attrs="{'invisible': [('product_tracking', '=', 'serial')]}"/> + @@ -83,7 +88,7 @@ - Non-Conforming Material Reports + QC Issues ir.actions.act_window qc.issue form @@ -91,11 +96,11 @@ + sequence="50" name="Issues"/> + sequence="20" name="Issues"/> diff --git a/quality_control_issue/views/qc_problem_track_view.xml b/quality_control_issue/views/qc_problem_track_view.xml new file mode 100644 index 00000000000..8a5e9134925 --- /dev/null +++ b/quality_control_issue/views/qc_problem_track_view.xml @@ -0,0 +1,53 @@ + + + + + + + My view description + qc.problem.track + + + + + + + + + My view description + qc.problem.track + + + + + + + + + + + + + +
+ + +
+ +
+
+ + + Problem Tracking + ir.actions.act_window + qc.problem.track + form + + + + +
\ No newline at end of file