Merge lp:asperience-openerp-addons/8.0 into lp:asperience-openerp-addons
- 8.0
- Merge into 6.1
Status: | Approved |
---|---|
Approved by: | hedererjs |
Approved revision: | 6 |
Proposed branch: | lp:asperience-openerp-addons/8.0 |
Merge into: | lp:asperience-openerp-addons |
Diff against target: |
63237 lines (has conflicts)
Conflict adding file .bzrignore. Moved existing file to .bzrignore.moved. Conflict adding file asperience_edi. Moved existing file to asperience_edi.moved. Conflict adding file asperience_sale_invoice_rate. Moved existing file to asperience_sale_invoice_rate.moved. |
To merge this branch: | bzr merge lp:asperience-openerp-addons/8.0 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
hedererjs | Approve | ||
Review via email: mp+239695@code.launchpad.net |
Commit message
Description of the change
- 13. By JS Hederer
-
Split, comments, images
- 14. By hedererjs
-
correction odoo v8.0 production
- 15. By hedererjs
-
logo + version update
- 16. By hedererjs
-
verification production 8.0
- 17. By hedererjs
-
sale_invoice_rate commit
- 18. By hedererjs
-
import account_
invoice_ sources - 19. By hedererjs
-
Production grade tag
- 20. By hedererjs
-
Production grade tag
- 21. By hedererjs
-
Production grade tag
- 22. By hedererjs
-
asperience_
account_ invoice_ sale_sources import production grade - 23. By hedererjs
-
form update
- 24. By hedererjs
-
view page groups=
"base.group_ extended" - 25. By hedererjs
-
correction groups view
- 26. By hedererjs
-
correction groups
- 27. By hedererjs
-
asperience_
sale_history import production grade - 28. By hedererjs
-
images
- 29. By hedererjs
-
asperience_
sale_picking_ history production_grade - 30. By hedererjs
-
__openerp__.py files reformat
- 31. By hedererjs
-
import asperience_
sale_base production_grade - 32. By hedererjs
-
asperience_
sale_invoice_ rate import production tag - 33. By hedererjs
-
category correction
- 34. By hedererjs
-
category correction
- 35. By hedererjs
-
category correction
- 36. By hedererjs
-
purge log instructions
- 37. By JS HEDERER
-
Review asperience_
product_ base module - 38. By JS HEDERER
-
Review asperience_
product_ base - 39. By JS HEDERER
-
Review asperience_
product_ date_touch - 40. By JS HEDERER
-
Review asperience_
product_ base - 41. By JS HEDERER
-
Import asperience_edi for V8 migration
- 42. By JS HEDERER
-
mail address incorrect
- 43. By JS HEDERER
-
incorrect mail address
- 44. By JS HEDERER
-
copyrights
- 45. By JS HEDERER
-
copyrights
Unmerged revisions
- 45. By JS HEDERER
-
copyrights
- 44. By JS HEDERER
-
copyrights
- 43. By JS HEDERER
-
incorrect mail address
- 42. By JS HEDERER
-
mail address incorrect
- 41. By JS HEDERER
-
Import asperience_edi for V8 migration
- 40. By JS HEDERER
-
Review asperience_
product_ base - 39. By JS HEDERER
-
Review asperience_
product_ date_touch - 38. By JS HEDERER
-
Review asperience_
product_ base - 37. By JS HEDERER
-
Review asperience_
product_ base module - 36. By hedererjs
-
purge log instructions
Preview Diff
1 | === added file '.bzrignore' | |||
2 | --- .bzrignore 1970-01-01 00:00:00 +0000 | |||
3 | +++ .bzrignore 2017-12-01 14:57:12 +0000 | |||
4 | @@ -0,0 +1,3 @@ | |||
5 | 1 | .project | ||
6 | 2 | .pydevproject | ||
7 | 3 | .settings | ||
8 | 0 | 4 | ||
9 | === renamed file '.bzrignore' => '.bzrignore.moved' | |||
10 | === added directory 'asperience_account_invoice_sale_sources' | |||
11 | === added file 'asperience_account_invoice_sale_sources/README' | |||
12 | --- asperience_account_invoice_sale_sources/README 1970-01-01 00:00:00 +0000 | |||
13 | +++ asperience_account_invoice_sale_sources/README 2017-12-01 14:57:12 +0000 | |||
14 | @@ -0,0 +1,2 @@ | |||
15 | 1 | This module is "production grade". | ||
16 | 2 | In case of problems, please contact maintenance_asperpgi@asperience.fr | ||
17 | 0 | \ No newline at end of file | 3 | \ No newline at end of file |
18 | 1 | 4 | ||
19 | === added file 'asperience_account_invoice_sale_sources/__init__.py' | |||
20 | --- asperience_account_invoice_sale_sources/__init__.py 1970-01-01 00:00:00 +0000 | |||
21 | +++ asperience_account_invoice_sale_sources/__init__.py 2017-12-01 14:57:12 +0000 | |||
22 | @@ -0,0 +1,24 @@ | |||
23 | 1 | # -*- encoding: utf-8 -*- | ||
24 | 2 | ############################################################################## | ||
25 | 3 | # | ||
26 | 4 | # OpenERP, Open Source Management Solution | ||
27 | 5 | # Copyright (C) 2007-TODAY ASPerience SARL (<https://www.asperience.fr>). | ||
28 | 6 | # All Rights Reserved | ||
29 | 7 | # | ||
30 | 8 | # This program is free software: you can redistribute it and/or modify | ||
31 | 9 | # it under the terms of the GNU General Public License as published by | ||
32 | 10 | # the Free Software Foundation, either version 3 of the License, or | ||
33 | 11 | # (at your option) any later version. | ||
34 | 12 | # | ||
35 | 13 | # This program is distributed in the hope that it will be useful, | ||
36 | 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
37 | 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
38 | 16 | # GNU General Public License for more details. | ||
39 | 17 | # | ||
40 | 18 | # You should have received a copy of the GNU General Public License | ||
41 | 19 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
42 | 20 | # | ||
43 | 21 | ############################################################################## | ||
44 | 22 | import account_invoice | ||
45 | 23 | |||
46 | 24 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | ||
47 | 0 | \ No newline at end of file | 25 | \ No newline at end of file |
48 | 1 | 26 | ||
49 | === added file 'asperience_account_invoice_sale_sources/__openerp__.py' | |||
50 | --- asperience_account_invoice_sale_sources/__openerp__.py 1970-01-01 00:00:00 +0000 | |||
51 | +++ asperience_account_invoice_sale_sources/__openerp__.py 2017-12-01 14:57:12 +0000 | |||
52 | @@ -0,0 +1,54 @@ | |||
53 | 1 | # -*- encoding: utf-8 -*- | ||
54 | 2 | ############################################################################## | ||
55 | 3 | # | ||
56 | 4 | # OpenERP, Open Source Management Solution | ||
57 | 5 | # Copyright (C) 2007-TODAY ASPerience SARL (<https://www.asperience.fr>). | ||
58 | 6 | # All Rights Reserved | ||
59 | 7 | # | ||
60 | 8 | # This program is free software: you can redistribute it and/or modify | ||
61 | 9 | # it under the terms of the GNU General Public License as published by | ||
62 | 10 | # the Free Software Foundation, either version 3 of the License, or | ||
63 | 11 | # (at your option) any later version. | ||
64 | 12 | # | ||
65 | 13 | # This program is distributed in the hope that it will be useful, | ||
66 | 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
67 | 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
68 | 16 | # GNU General Public License for more details. | ||
69 | 17 | # | ||
70 | 18 | # You should have received a copy of the GNU General Public License | ||
71 | 19 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
72 | 20 | # | ||
73 | 21 | ############################################################################## | ||
74 | 22 | { | ||
75 | 23 | "name": "ASPerience Invoice Sale sources", | ||
76 | 24 | "version": "8.0", | ||
77 | 25 | "author": "ASPerience", | ||
78 | 26 | "website": "https://www.asperience.fr", | ||
79 | 27 | "sequence": 0, | ||
80 | 28 | "certificate": "", | ||
81 | 29 | "license": "", | ||
82 | 30 | "depends": [ | ||
83 | 31 | "account","sale","asperience_account_invoice_sources" | ||
84 | 32 | ], | ||
85 | 33 | "category": "Accounting & Finance", | ||
86 | 34 | "complexity": "easy", | ||
87 | 35 | "description": """ | ||
88 | 36 | Links between invoices and sales | ||
89 | 37 | """, | ||
90 | 38 | "data": [ | ||
91 | 39 | "account_invoice_view.xml", | ||
92 | 40 | ], | ||
93 | 41 | "demo": [ | ||
94 | 42 | ], | ||
95 | 43 | "test": [ | ||
96 | 44 | ], | ||
97 | 45 | "images": [ | ||
98 | 46 | "images/asperience.png", | ||
99 | 47 | "images/grouped_invoice.png", | ||
100 | 48 | ], | ||
101 | 49 | "auto_install": False, | ||
102 | 50 | "installable": True, | ||
103 | 51 | "application": False, | ||
104 | 52 | |||
105 | 53 | } | ||
106 | 54 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | ||
107 | 0 | \ No newline at end of file | 55 | \ No newline at end of file |
108 | 1 | 56 | ||
109 | === added file 'asperience_account_invoice_sale_sources/account_invoice.py' | |||
110 | --- asperience_account_invoice_sale_sources/account_invoice.py 1970-01-01 00:00:00 +0000 | |||
111 | +++ asperience_account_invoice_sale_sources/account_invoice.py 2017-12-01 14:57:12 +0000 | |||
112 | @@ -0,0 +1,38 @@ | |||
113 | 1 | # -*- encoding: utf-8 -*- | ||
114 | 2 | ############################################################################## | ||
115 | 3 | # | ||
116 | 4 | # OpenERP, Open Source Management Solution | ||
117 | 5 | # Copyright (C) 2007-TODAY ASPerience SARL (<https://www.asperience.fr>). | ||
118 | 6 | # All Rights Reserved | ||
119 | 7 | # | ||
120 | 8 | # This program is free software: you can redistribute it and/or modify | ||
121 | 9 | # it under the terms of the GNU General Public License as published by | ||
122 | 10 | # the Free Software Foundation, either version 3 of the License, or | ||
123 | 11 | # (at your option) any later version. | ||
124 | 12 | # | ||
125 | 13 | # This program is distributed in the hope that it will be useful, | ||
126 | 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
127 | 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
128 | 16 | # GNU General Public License for more details. | ||
129 | 17 | # | ||
130 | 18 | # You should have received a copy of the GNU General Public License | ||
131 | 19 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
132 | 20 | # | ||
133 | 21 | ############################################################################## | ||
134 | 22 | from openerp.osv import fields, osv | ||
135 | 23 | |||
136 | 24 | class account_invoice(osv.osv): | ||
137 | 25 | _inherit = "account.invoice" | ||
138 | 26 | _columns = { | ||
139 | 27 | 'sale_ids': fields.many2many('sale.order', 'sale_order_invoice_rel', 'invoice_id', 'order_id', 'Sale orders'), | ||
140 | 28 | } | ||
141 | 29 | account_invoice() | ||
142 | 30 | |||
143 | 31 | class account_invoice_line(osv.osv): | ||
144 | 32 | _inherit = "account.invoice.line" | ||
145 | 33 | |||
146 | 34 | _columns = { | ||
147 | 35 | 'sale_line_ids': fields.many2many('sale.order.line', 'sale_order_line_invoice_rel', 'invoice_id', 'order_line_id', 'Sale Lines', readonly=True), | ||
148 | 36 | } | ||
149 | 37 | account_invoice_line() | ||
150 | 38 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | ||
151 | 0 | \ No newline at end of file | 39 | \ No newline at end of file |
152 | 1 | 40 | ||
153 | === added file 'asperience_account_invoice_sale_sources/account_invoice_view.xml' | |||
154 | --- asperience_account_invoice_sale_sources/account_invoice_view.xml 1970-01-01 00:00:00 +0000 | |||
155 | +++ asperience_account_invoice_sale_sources/account_invoice_view.xml 2017-12-01 14:57:12 +0000 | |||
156 | @@ -0,0 +1,32 @@ | |||
157 | 1 | <?xml version="1.0"?> | ||
158 | 2 | <openerp> | ||
159 | 3 | <data> | ||
160 | 4 | |||
161 | 5 | <record id="invoice_form_asperience_sources" model="ir.ui.view"> | ||
162 | 6 | <field name="name">account.invoice.form.asperience.sources</field> | ||
163 | 7 | <field name="model">account.invoice</field> | ||
164 | 8 | <field name="type">form</field> | ||
165 | 9 | <field name="priority">20</field> | ||
166 | 10 | <field name="inherit_id" ref="account.invoice_form"/> | ||
167 | 11 | <field name="arch" type="xml"> | ||
168 | 12 | <page string="Source" position="inside"> | ||
169 | 13 | <field colspan="4" name="sale_ids" nolabel="1"/> | ||
170 | 14 | </page> | ||
171 | 15 | </field> | ||
172 | 16 | </record> | ||
173 | 17 | <record id="invoice_line_form_asperience_sources" model="ir.ui.view"> | ||
174 | 18 | <field name="name">account.invoice.line.form.asperience.sources</field> | ||
175 | 19 | <field name="model">account.invoice.line</field> | ||
176 | 20 | <field name="type">form</field> | ||
177 | 21 | <field name="priority">20</field> | ||
178 | 22 | <field name="inherit_id" ref="account.view_invoice_line_form"/> | ||
179 | 23 | <field name="arch" type="xml"> | ||
180 | 24 | <field name="invoice_line_tax_id" position="after"> | ||
181 | 25 | <separator colspan="4" string="Source Order Lines"/> | ||
182 | 26 | <field colspan="4" name="sale_line_ids" nolabel="1"/> | ||
183 | 27 | </field> | ||
184 | 28 | </field> | ||
185 | 29 | </record> | ||
186 | 30 | |||
187 | 31 | </data> | ||
188 | 32 | </openerp> | ||
189 | 0 | \ No newline at end of file | 33 | \ No newline at end of file |
190 | 1 | 34 | ||
191 | === added directory 'asperience_account_invoice_sale_sources/i18n' | |||
192 | === added file 'asperience_account_invoice_sale_sources/i18n/fr.po' | |||
193 | --- asperience_account_invoice_sale_sources/i18n/fr.po 1970-01-01 00:00:00 +0000 | |||
194 | +++ asperience_account_invoice_sale_sources/i18n/fr.po 2017-12-01 14:57:12 +0000 | |||
195 | @@ -0,0 +1,51 @@ | |||
196 | 1 | # Translation of OpenERP Server. | ||
197 | 2 | # This file contains the translation of the following modules: | ||
198 | 3 | # * asperience_sale_invoice_sources | ||
199 | 4 | # | ||
200 | 5 | msgid "" | ||
201 | 6 | msgstr "" | ||
202 | 7 | "Project-Id-Version: OpenERP Server 6.1\n" | ||
203 | 8 | "Report-Msgid-Bugs-To: \n" | ||
204 | 9 | "POT-Creation-Date: 2013-11-06 21:04+0000\n" | ||
205 | 10 | "PO-Revision-Date: 2013-11-06 21:04+0000\n" | ||
206 | 11 | "Last-Translator: <>\n" | ||
207 | 12 | "Language-Team: \n" | ||
208 | 13 | "MIME-Version: 1.0\n" | ||
209 | 14 | "Content-Type: text/plain; charset=UTF-8\n" | ||
210 | 15 | "Content-Transfer-Encoding: \n" | ||
211 | 16 | "Plural-Forms: \n" | ||
212 | 17 | |||
213 | 18 | #. module: asperience_sale_invoice_sources | ||
214 | 19 | #: view:account.invoice.line:0 | ||
215 | 20 | msgid "Source Order Lines" | ||
216 | 21 | msgstr "Source lignes de commandes" | ||
217 | 22 | |||
218 | 23 | #. module: asperience_sale_invoice_sources | ||
219 | 24 | #: sql_constraint:account.invoice:0 | ||
220 | 25 | msgid "Invoice Number must be unique per Company!" | ||
221 | 26 | msgstr "Le numĆ©ro de facture doit ĆŖtre unique par sociĆ©tĆ© !" | ||
222 | 27 | |||
223 | 28 | #. module: asperience_sale_invoice_sources | ||
224 | 29 | #: view:account.invoice:0 | ||
225 | 30 | msgid "Source" | ||
226 | 31 | msgstr "Source" | ||
227 | 32 | |||
228 | 33 | #. module: asperience_sale_invoice_sources | ||
229 | 34 | #: model:ir.actions.act_window,name:asperience_sale_invoice_sources.action_invoice_open | ||
230 | 35 | msgid "Invoices" | ||
231 | 36 | msgstr "Factures" | ||
232 | 37 | |||
233 | 38 | #. module: asperience_sale_invoice_sources | ||
234 | 39 | #: model:ir.model,name:asperience_sale_invoice_sources.model_account_invoice_line | ||
235 | 40 | msgid "Invoice line" | ||
236 | 41 | msgstr "Ligne de facture" | ||
237 | 42 | |||
238 | 43 | #. module: asperience_sale_invoice_sources | ||
239 | 44 | #: constraint:account.invoice:0 | ||
240 | 45 | msgid "Error msg is in raise" | ||
241 | 46 | msgstr "Error msg is in raise" | ||
242 | 47 | |||
243 | 48 | #. module: asperience_sale_invoice_sources | ||
244 | 49 | #: model:ir.model,name:asperience_sale_invoice_sources.model_account_invoice | ||
245 | 50 | msgid "Invoice" | ||
246 | 51 | msgstr "Facture" | ||
247 | 0 | 52 | ||
248 | === added directory 'asperience_account_invoice_sale_sources/images' | |||
249 | === added file 'asperience_account_invoice_sale_sources/images/asperience.png' | |||
250 | 1 | Binary files asperience_account_invoice_sale_sources/images/asperience.png 1970-01-01 00:00:00 +0000 and asperience_account_invoice_sale_sources/images/asperience.png 2017-12-01 14:57:12 +0000 differ | 53 | Binary files asperience_account_invoice_sale_sources/images/asperience.png 1970-01-01 00:00:00 +0000 and asperience_account_invoice_sale_sources/images/asperience.png 2017-12-01 14:57:12 +0000 differ |
251 | === added file 'asperience_account_invoice_sale_sources/images/grouped_invoice.png' | |||
252 | 2 | Binary files asperience_account_invoice_sale_sources/images/grouped_invoice.png 1970-01-01 00:00:00 +0000 and asperience_account_invoice_sale_sources/images/grouped_invoice.png 2017-12-01 14:57:12 +0000 differ | 54 | Binary files asperience_account_invoice_sale_sources/images/grouped_invoice.png 1970-01-01 00:00:00 +0000 and asperience_account_invoice_sale_sources/images/grouped_invoice.png 2017-12-01 14:57:12 +0000 differ |
253 | === added directory 'asperience_account_invoice_sources' | |||
254 | === added file 'asperience_account_invoice_sources/README' | |||
255 | --- asperience_account_invoice_sources/README 1970-01-01 00:00:00 +0000 | |||
256 | +++ asperience_account_invoice_sources/README 2017-12-01 14:57:12 +0000 | |||
257 | @@ -0,0 +1,2 @@ | |||
258 | 1 | This module is "production grade". | ||
259 | 2 | In case of problems, please contact maintenance_asperpgi@asperience.fr | ||
260 | 0 | \ No newline at end of file | 3 | \ No newline at end of file |
261 | 1 | 4 | ||
262 | === added file 'asperience_account_invoice_sources/__init__.py' | |||
263 | --- asperience_account_invoice_sources/__init__.py 1970-01-01 00:00:00 +0000 | |||
264 | +++ asperience_account_invoice_sources/__init__.py 2017-12-01 14:57:12 +0000 | |||
265 | @@ -0,0 +1,24 @@ | |||
266 | 1 | # -*- encoding: utf-8 -*- | ||
267 | 2 | ############################################################################## | ||
268 | 3 | # | ||
269 | 4 | # OpenERP, Open Source Management Solution | ||
270 | 5 | # Copyright (C) 2007-TODAY ASPerience SARL (<https://www.asperience.fr>). | ||
271 | 6 | # All Rights Reserved | ||
272 | 7 | # | ||
273 | 8 | # This program is free software: you can redistribute it and/or modify | ||
274 | 9 | # it under the terms of the GNU Affero General Public License as published by | ||
275 | 10 | # the Free Software Foundation, either version 3 of the License, or | ||
276 | 11 | # (at your option) any later version. | ||
277 | 12 | # | ||
278 | 13 | # This program is distributed in the hope that it will be useful, | ||
279 | 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
280 | 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
281 | 16 | # GNU Affero General Public License for more details. | ||
282 | 17 | # | ||
283 | 18 | # You should have received a copy of the GNU Affero General Public License | ||
284 | 19 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
285 | 20 | # | ||
286 | 21 | ############################################################################## | ||
287 | 22 | |||
288 | 23 | |||
289 | 24 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | ||
290 | 0 | \ No newline at end of file | 25 | \ No newline at end of file |
291 | 1 | 26 | ||
292 | === added file 'asperience_account_invoice_sources/__openerp__.py' | |||
293 | --- asperience_account_invoice_sources/__openerp__.py 1970-01-01 00:00:00 +0000 | |||
294 | +++ asperience_account_invoice_sources/__openerp__.py 2017-12-01 14:57:12 +0000 | |||
295 | @@ -0,0 +1,54 @@ | |||
296 | 1 | # -*- encoding: utf-8 -*- | ||
297 | 2 | ############################################################################## | ||
298 | 3 | # | ||
299 | 4 | # OpenERP, Open Source Management Solution | ||
300 | 5 | # Copyright (C) 2007-TODAY ASPerience SARL (<https://www.asperience.fr>). | ||
301 | 6 | # All Rights Reserved | ||
302 | 7 | # | ||
303 | 8 | # This program is free software: you can redistribute it and/or modify | ||
304 | 9 | # it under the terms of the GNU Affero General Public License as published by | ||
305 | 10 | # the Free Software Foundation, either version 3 of the License, or | ||
306 | 11 | # (at your option) any later version. | ||
307 | 12 | # | ||
308 | 13 | # This program is distributed in the hope that it will be useful, | ||
309 | 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
310 | 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
311 | 16 | # GNU Affero General Public License for more details. | ||
312 | 17 | # | ||
313 | 18 | # You should have received a copy of the GNU Affero General Public License | ||
314 | 19 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
315 | 20 | # | ||
316 | 21 | ############################################################################## | ||
317 | 22 | { | ||
318 | 23 | "name": "ASPerience Account Invoice Sources", | ||
319 | 24 | "version": "8.0", | ||
320 | 25 | "author": "ASPerience", | ||
321 | 26 | "website": "https://www.asperience.fr", | ||
322 | 27 | "sequence": 0, | ||
323 | 28 | "certificate": "", | ||
324 | 29 | "license": "", | ||
325 | 30 | "depends": [ | ||
326 | 31 | "account" | ||
327 | 32 | ], | ||
328 | 33 | "category": "Accounting & Finance", | ||
329 | 34 | "complexity": "easy", | ||
330 | 35 | "description": """ | ||
331 | 36 | Adds view panel for displaying sources (sales, purchases, stocks) | ||
332 | 37 | """, | ||
333 | 38 | "data": [ | ||
334 | 39 | 'account_invoice_view.xml', | ||
335 | 40 | ], | ||
336 | 41 | "demo": [ | ||
337 | 42 | ], | ||
338 | 43 | "test": [ | ||
339 | 44 | ], | ||
340 | 45 | "images": [ | ||
341 | 46 | "images/asperience.png", | ||
342 | 47 | "images/group_invoice_view.png" | ||
343 | 48 | ], | ||
344 | 49 | "auto_install": False, | ||
345 | 50 | "installable": True, | ||
346 | 51 | "application": False, | ||
347 | 52 | |||
348 | 53 | } | ||
349 | 54 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | ||
350 | 0 | 55 | ||
351 | === added file 'asperience_account_invoice_sources/account_invoice_view.xml' | |||
352 | --- asperience_account_invoice_sources/account_invoice_view.xml 1970-01-01 00:00:00 +0000 | |||
353 | +++ asperience_account_invoice_sources/account_invoice_view.xml 2017-12-01 14:57:12 +0000 | |||
354 | @@ -0,0 +1,32 @@ | |||
355 | 1 | <?xml version="1.0" encoding="utf-8"?> | ||
356 | 2 | <openerp> | ||
357 | 3 | <data> | ||
358 | 4 | |||
359 | 5 | <record id="invoice_supplier_form_asperience_1" model="ir.ui.view"> | ||
360 | 6 | <field name="name">account.invoice.supplier.form.asperience.1</field> | ||
361 | 7 | <field name="model">account.invoice</field> | ||
362 | 8 | <field name="type">form</field> | ||
363 | 9 | <field name="inherit_id" ref="account.invoice_supplier_form"/> | ||
364 | 10 | <field name="arch" type="xml"> | ||
365 | 11 | <page string="Payments" position="after"> | ||
366 | 12 | <page string="Source" groups="base.group_user"> | ||
367 | 13 | </page> | ||
368 | 14 | </page> | ||
369 | 15 | </field> | ||
370 | 16 | </record> | ||
371 | 17 | |||
372 | 18 | <record id="invoice_form_asperience_1" model="ir.ui.view"> | ||
373 | 19 | <field name="name">account.invoice.form.asperience.1</field> | ||
374 | 20 | <field name="model">account.invoice</field> | ||
375 | 21 | <field name="type">form</field> | ||
376 | 22 | <field name="inherit_id" ref="account.invoice_form"/> | ||
377 | 23 | <field name="arch" type="xml"> | ||
378 | 24 | <page string="Payments" position="after"> | ||
379 | 25 | <page string="Source" groups="base.group_user"> | ||
380 | 26 | </page> | ||
381 | 27 | </page> | ||
382 | 28 | </field> | ||
383 | 29 | </record> | ||
384 | 30 | |||
385 | 31 | </data> | ||
386 | 32 | </openerp> | ||
387 | 0 | \ No newline at end of file | 33 | \ No newline at end of file |
388 | 1 | 34 | ||
389 | === added directory 'asperience_account_invoice_sources/i18n' | |||
390 | === added file 'asperience_account_invoice_sources/i18n/fr.po' | |||
391 | --- asperience_account_invoice_sources/i18n/fr.po 1970-01-01 00:00:00 +0000 | |||
392 | +++ asperience_account_invoice_sources/i18n/fr.po 2017-12-01 14:57:12 +0000 | |||
393 | @@ -0,0 +1,26 @@ | |||
394 | 1 | # Translation of OpenERP Server. | ||
395 | 2 | # This file contains the translation of the following modules: | ||
396 | 3 | # * asperience_account_invoice_sources | ||
397 | 4 | # | ||
398 | 5 | msgid "" | ||
399 | 6 | msgstr "" | ||
400 | 7 | "Project-Id-Version: OpenERP Server 6.1\n" | ||
401 | 8 | "Report-Msgid-Bugs-To: \n" | ||
402 | 9 | "POT-Creation-Date: 2013-05-26 19:23+0000\n" | ||
403 | 10 | "PO-Revision-Date: 2013-05-26 19:23+0000\n" | ||
404 | 11 | "Last-Translator: <>\n" | ||
405 | 12 | "Language-Team: \n" | ||
406 | 13 | "MIME-Version: 1.0\n" | ||
407 | 14 | "Content-Type: text/plain; charset=UTF-8\n" | ||
408 | 15 | "Content-Transfer-Encoding: \n" | ||
409 | 16 | "Plural-Forms: \n" | ||
410 | 17 | |||
411 | 18 | #. module: asperience_account_invoice_sources | ||
412 | 19 | #: view:account.invoice:0 | ||
413 | 20 | msgid "Source" | ||
414 | 21 | msgstr "Source" | ||
415 | 22 | |||
416 | 23 | #. module: asperience_account_invoice_sources | ||
417 | 24 | #: view:account.invoice:0 | ||
418 | 25 | msgid "Payments" | ||
419 | 26 | msgstr "RĆØglements" | ||
420 | 0 | 27 | ||
421 | === added directory 'asperience_account_invoice_sources/images' | |||
422 | === added file 'asperience_account_invoice_sources/images/asperience.png' | |||
423 | 1 | Binary files asperience_account_invoice_sources/images/asperience.png 1970-01-01 00:00:00 +0000 and asperience_account_invoice_sources/images/asperience.png 2017-12-01 14:57:12 +0000 differ | 28 | Binary files asperience_account_invoice_sources/images/asperience.png 1970-01-01 00:00:00 +0000 and asperience_account_invoice_sources/images/asperience.png 2017-12-01 14:57:12 +0000 differ |
424 | === added file 'asperience_account_invoice_sources/images/group_invoice_view.png' | |||
425 | 2 | Binary files asperience_account_invoice_sources/images/group_invoice_view.png 1970-01-01 00:00:00 +0000 and asperience_account_invoice_sources/images/group_invoice_view.png 2017-12-01 14:57:12 +0000 differ | 29 | Binary files asperience_account_invoice_sources/images/group_invoice_view.png 1970-01-01 00:00:00 +0000 and asperience_account_invoice_sources/images/group_invoice_view.png 2017-12-01 14:57:12 +0000 differ |
426 | === added directory 'asperience_configurator_mrp' | |||
427 | === added file 'asperience_configurator_mrp/Copy of mrp.py' | |||
428 | --- asperience_configurator_mrp/Copy of mrp.py 1970-01-01 00:00:00 +0000 | |||
429 | +++ asperience_configurator_mrp/Copy of mrp.py 2017-12-01 14:57:12 +0000 | |||
430 | @@ -0,0 +1,463 @@ | |||
431 | 1 | # -*- encoding: utf-8 -*- | ||
432 | 2 | ############################################################################## | ||
433 | 3 | # | ||
434 | 4 | # OpenERP, Open Source Management Solution | ||
435 | 5 | # Copyright (C) 2011 ASPerience SARL (<http://www.asperience.fr>). All Rights Reserved | ||
436 | 6 | # | ||
437 | 7 | # This program is free software: you can redistribute it and/or modify | ||
438 | 8 | # it under the terms of the GNU General Public License as published by | ||
439 | 9 | # the Free Software Foundation, either version 3 of the License, or | ||
440 | 10 | # (at your option) any later version. | ||
441 | 11 | # | ||
442 | 12 | # This program is distributed in the hope that it will be useful, | ||
443 | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
444 | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
445 | 15 | # GNU General Public License for more details. | ||
446 | 16 | # | ||
447 | 17 | # You should have received a copy of the GNU General Public License | ||
448 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
449 | 19 | # | ||
450 | 20 | ############################################################################## | ||
451 | 21 | |||
452 | 22 | from openerp.osv import fields,osv | ||
453 | 23 | import openerp.netsvc | ||
454 | 24 | |||
455 | 25 | import time | ||
456 | 26 | import datetime | ||
457 | 27 | from mx import DateTime | ||
458 | 28 | from openerp.tools.translate import _ | ||
459 | 29 | from tools import ustr | ||
460 | 30 | |||
461 | 31 | class mrp_workcenter_technology(osv.osv): | ||
462 | 32 | _name = 'mrp.workcenter.technology' | ||
463 | 33 | _columns = { | ||
464 | 34 | 'name': fields.char('Description', size=256, required=True), | ||
465 | 35 | } | ||
466 | 36 | _defaults = { | ||
467 | 37 | } | ||
468 | 38 | mrp_workcenter_technology() | ||
469 | 39 | |||
470 | 40 | class mrp_workcenter(osv.osv): | ||
471 | 41 | _inherit = 'mrp.workcenter' | ||
472 | 42 | |||
473 | 43 | def _get_type(self, cr, uid, ids, field_name, arg, context={}): | ||
474 | 44 | res = {} | ||
475 | 45 | for id in ids: | ||
476 | 46 | res[id] = {'type_re': '', 'type_pc': '', 'type_cc': ''} | ||
477 | 47 | for workcenter in self.browse(cr, uid, ids): | ||
478 | 48 | if workcenter.type_workcenter == 're': | ||
479 | 49 | res[id]['type_re'] = workcenter.type | ||
480 | 50 | elif workcenter.type_workcenter == 'pc': | ||
481 | 51 | res[id]['type_pc'] = workcenter.type | ||
482 | 52 | elif workcenter.type_workcenter == 'cc': | ||
483 | 53 | res[id]['type_cc'] = workcenter.type | ||
484 | 54 | return res | ||
485 | 55 | |||
486 | 56 | def _set_type(self, cr, uid, ids, name, value, arg, context): | ||
487 | 57 | if not value: | ||
488 | 58 | return False | ||
489 | 59 | if isinstance(ids, (int, long)): | ||
490 | 60 | ids = [ids] | ||
491 | 61 | for workcenter in self.browse(cr, uid, ids, context): | ||
492 | 62 | self.write(cr, uid, ids, {'type': value}) | ||
493 | 63 | return True | ||
494 | 64 | |||
495 | 65 | def onchange_type(self, cr, uid, id, type=''): | ||
496 | 66 | res = {'value':{'type': type}} | ||
497 | 67 | return res | ||
498 | 68 | |||
499 | 69 | def onchange_type_workcenter(self, cr, uid, id, type_workcenter): | ||
500 | 70 | res = {'value':{'type_re': '','type_pc': '', 'type_cc': '', 'type': ''}} | ||
501 | 71 | if type_workcenter == 're' or type_workcenter == 'pc': | ||
502 | 72 | res['value']['type_re'] = 'machine' | ||
503 | 73 | elif type_workcenter == 'cc': | ||
504 | 74 | res['value']['type_re'] = 'machine_hr' | ||
505 | 75 | res['value']['type'] = res['value']['type_re'] | ||
506 | 76 | return res | ||
507 | 77 | |||
508 | 78 | _columns = { | ||
509 | 79 | 'type': fields.selection([('machine','Machine'),('hr','Human Resource'),('tool','Tool'),('machine_hr','Machine and HR'),('line','Line'),('energy','Energy')], 'Type', required=True), | ||
510 | 80 | 'type_re': fields.function(_get_type, fnct_inv=_set_type, selection=[('machine',_('Machine')),('hr',_('Human Resource')),('tool',_('Tool')),('energy',_('Energy'))], | ||
511 | 81 | multi="type",method=True, store=False, type='selection', string='Type'), | ||
512 | 82 | 'type_pc': fields.function(_get_type, fnct_inv=_set_type, selection=[('machine',_('Machine')),('hr',_('Human Resource')),('machine_hr',_('Machine and HR')),('line',_('Line'))], | ||
513 | 83 | multi="type",method=True, store=False, type='selection', string='Type'), | ||
514 | 84 | 'type_cc': fields.function(_get_type, fnct_inv=_set_type, selection=[('machine_hr',_('Machine and HR')),('line',_('Line'))], | ||
515 | 85 | multi="type",method=True, store=False, type='selection', string='Type'), | ||
516 | 86 | 'type_workcenter': fields.selection([('re',_('Elementary resource')),('pc',_('Work center')),('cc',_('Work line'))], 'Type workcenter', required=True, size=2), | ||
517 | 87 | 'parent_id': fields.many2one('mrp.workcenter', "Parent"), | ||
518 | 88 | 'child_ids': fields.one2many('mrp.workcenter', 'parent_id','Childs'), | ||
519 | 89 | 'technology': fields.many2one('mrp.workcenter.technology', "Technology"), | ||
520 | 90 | 'external': fields.boolean('External workcenter'), | ||
521 | 91 | 'fixed_capacity': fields.boolean('Fixed capacity'), | ||
522 | 92 | 'capacity' : fields.float('Capacity'), | ||
523 | 93 | 'critical': fields.boolean('Critical'), | ||
524 | 94 | 'property_ids': fields.many2many('mrp.property', 'mrp_workcenter_property_rel','workcenter_id', 'property_id', 'Properties'), | ||
525 | 95 | 'warehouse_id': fields.many2one('stock.warehouse', 'Sector', required=True), | ||
526 | 96 | 'finite_capacity': fields.boolean('Finite Capacity'), | ||
527 | 97 | 'finite_capacity_qty' : fields.float('Finite Capacity Qty'), | ||
528 | 98 | 'scheduling': fields.selection([('machine','Machine'),('hr','Human Resource'),('machine_hr','Machine and HR'),('pg','the greatest')], 'Scheduling'), | ||
529 | 99 | } | ||
530 | 100 | _defaults = { | ||
531 | 101 | 'time_start': lambda *a: 0, | ||
532 | 102 | 'time_stop': lambda *a: 0, | ||
533 | 103 | 'time_cycle': lambda *a: 0, | ||
534 | 104 | 'type_workcenter': lambda *a: "pc", | ||
535 | 105 | } | ||
536 | 106 | |||
537 | 107 | def name_search(self, cr, uid, name, args=None, operator='ilike', context=None, limit=80): | ||
538 | 108 | if args: | ||
539 | 109 | if args[0][0] == 'type': | ||
540 | 110 | for val in args[0][2]: | ||
541 | 111 | if val: | ||
542 | 112 | if val in ['line', 'machine_hr']: | ||
543 | 113 | args = [('type', '=', 'line')] | ||
544 | 114 | break | ||
545 | 115 | elif val == 'machine': | ||
546 | 116 | args = [('type', 'in', ['line','machine_hr','machine'])] | ||
547 | 117 | break | ||
548 | 118 | elif val in ['energy', 'hr', 'tool']: | ||
549 | 119 | args = [('type', 'in', ['line','machine_hr','machine','hr'])] | ||
550 | 120 | break | ||
551 | 121 | |||
552 | 122 | return super(mrp_workcenter, self).name_search(cr, uid, name, args, operator, context, limit) | ||
553 | 123 | |||
554 | 124 | mrp_workcenter() | ||
555 | 125 | |||
556 | 126 | class mrp_bom_component_mode(osv.osv): | ||
557 | 127 | _name = 'mrp.bom.component.mode' | ||
558 | 128 | _description = 'mrp.bom.component.mode' | ||
559 | 129 | _columns = { | ||
560 | 130 | 'name': fields.char('Description', size=256, required=True), | ||
561 | 131 | 'dx': fields.text('Dx'), | ||
562 | 132 | 'dy': fields.text('Dy'), | ||
563 | 133 | 'dz': fields.text('Dz'), | ||
564 | 134 | 'dd': fields.text('Dd'), | ||
565 | 135 | } | ||
566 | 136 | _defaults = { | ||
567 | 137 | } | ||
568 | 138 | |||
569 | 139 | mrp_bom_component_mode() | ||
570 | 140 | |||
571 | 141 | class mrp_bom_component_rel(osv.osv): | ||
572 | 142 | _name = 'mrp.bom.component.rel' | ||
573 | 143 | _description = 'mrp.bom.component.rel' | ||
574 | 144 | _columns = { | ||
575 | 145 | 'bom_id': fields.many2one('mrp.bom', 'Bom', required=True, ondelete='cascade'), | ||
576 | 146 | 'component_id': fields.many2one('mrp.bom', 'Component', required=True, ondelete='cascade'), | ||
577 | 147 | # 'product_component_id': fields.related('component_id','product_id',type='many2one', relation="product.product", string="Product"), | ||
578 | 148 | 'qty': fields.float('Quantity', required=True), | ||
579 | 149 | 'mode': fields.many2one('mrp.bom.component.mode', 'Mode'), | ||
580 | 150 | } | ||
581 | 151 | |||
582 | 152 | def compute_size(self, cr, uid, ids, context={}): | ||
583 | 153 | logger = netsvc.Logger() | ||
584 | 154 | if not ids : | ||
585 | 155 | return False | ||
586 | 156 | result = {} | ||
587 | 157 | for i in self.browse(cr,uid,ids,context): | ||
588 | 158 | space = {} | ||
589 | 159 | space["x"] = context.get("size_x",0.0) | ||
590 | 160 | space["y"] = context.get("size_y",0.0) | ||
591 | 161 | space["z"] = context.get("size_z",0.0) | ||
592 | 162 | space["d"] = context.get("diameter",0.0) | ||
593 | 163 | space["Dx"] = context.get("size_x_specific_delta",0.0) | ||
594 | 164 | space["Dy"] = context.get("size_y_specific_delta",0.0) | ||
595 | 165 | space["Dz"] = context.get("size_z_specific_delta",0.0) | ||
596 | 166 | space["Dd"] = context.get("diameter_specific_delta",0.0) | ||
597 | 167 | |||
598 | 168 | |||
599 | 169 | result[i.id] = { | ||
600 | 170 | "size_x_specific_delta":0.0, | ||
601 | 171 | "size_y_specific_delta":0.0, | ||
602 | 172 | "size_z_specific_delta":0.0, | ||
603 | 173 | "diameter_specific_delta":0.0, | ||
604 | 174 | "size_x_specific":context.get("size_x",0.0), | ||
605 | 175 | "size_y_specific":context.get("size_y",0.0), | ||
606 | 176 | "size_z_specific":context.get("size_z",0.0), | ||
607 | 177 | "diameter_specific":context.get("diameter",0.0), | ||
608 | 178 | } | ||
609 | 179 | |||
610 | 180 | try: | ||
611 | 181 | result[i.id]["size_x_specific_delta"] = eval(i.mode.dx,space) | ||
612 | 182 | result[i.id]["size_x_specific"] = result[i.id]["size_x_specific"] - result[i.id]["size_x_specific_delta"] | ||
613 | 183 | except Exception, e: | ||
614 | 184 | logger.notifyChannel('eval size', netsvc.LOG_WARNING, e) | ||
615 | 185 | logger.notifyChannel('eval size', netsvc.LOG_WARNING, "transform x "+str(i.mode.dx)) | ||
616 | 186 | try: | ||
617 | 187 | result[i.id]["size_y_specific_delta"] = eval(i.mode.dy,space) | ||
618 | 188 | result[i.id]["size_y_specific"] = result[i.id]["size_y_specific"] - result[i.id]["size_y_specific_delta"] | ||
619 | 189 | except Exception, e: | ||
620 | 190 | logger.notifyChannel('eval size', netsvc.LOG_WARNING, e) | ||
621 | 191 | logger.notifyChannel('eval size', netsvc.LOG_WARNING, "transform y "+str(i.mode.dy)) | ||
622 | 192 | try: | ||
623 | 193 | result[i.id]["size_z_specific_delta"] = eval(i.mode.dz,space) | ||
624 | 194 | result[i.id]["size_z_specific"] = result[i.id]["size_z_specific"] - result[i.id]["size_z_specific_delta"] | ||
625 | 195 | except Exception, e: | ||
626 | 196 | logger.notifyChannel('eval size', netsvc.LOG_WARNING, e) | ||
627 | 197 | logger.notifyChannel('eval size', netsvc.LOG_WARNING, "transform z "+str(i.mode.dz)) | ||
628 | 198 | try: | ||
629 | 199 | result[i.id]["diameter_specific_delta"] = eval(i.mode.dd,space) | ||
630 | 200 | result[i.id]["diameter_specific"] = result[i.id]["diameter_specific"] - result[i.id]["diameter_specific_delta"] | ||
631 | 201 | except Exception, e: | ||
632 | 202 | logger.notifyChannel('eval size', netsvc.LOG_WARNING, e) | ||
633 | 203 | logger.notifyChannel('eval size', netsvc.LOG_WARNING, "transform d "+str(i.mode.dd)) | ||
634 | 204 | |||
635 | 205 | return result | ||
636 | 206 | |||
637 | 207 | _defaults = { | ||
638 | 208 | } | ||
639 | 209 | mrp_bom_component_rel() | ||
640 | 210 | |||
641 | 211 | def rounding(f, r): | ||
642 | 212 | if not r: | ||
643 | 213 | return f | ||
644 | 214 | return round(f / r) * r | ||
645 | 215 | |||
646 | 216 | class mrp_bom(osv.osv): | ||
647 | 217 | _inherit = 'mrp.bom' | ||
648 | 218 | |||
649 | 219 | # def __init__(self, pool, cr): | ||
650 | 220 | # super(mrp_bom,self).__init__(pool,cr) | ||
651 | 221 | # cr.execute('select count(*) from mrp_bom_childs_rel') | ||
652 | 222 | # nb1 = cr.dictfetchall()[0]['count'] | ||
653 | 223 | # cr.execute('select count(*) from mrp_bom_component_rel') | ||
654 | 224 | # nb2 = cr.dictfetchall()[0]['count'] | ||
655 | 225 | # if nb1 and not nb2 : | ||
656 | 226 | # cr.execute('insert into mrp_bom_component_rel\ | ||
657 | 227 | # (bom_id,component_id,qty)\ | ||
658 | 228 | # select a.bom_id, a.child_id, b.product_qty\ | ||
659 | 229 | # from mrp_bom_childs_rel a join mrp_bom b on a.bom_id = b.id') | ||
660 | 230 | # | ||
661 | 231 | # map_mode = { | ||
662 | 232 | # 'bottom':['.DES.'], | ||
663 | 233 | # 'top':['PLATEAU'], | ||
664 | 234 | # 'back':['.DER.'], | ||
665 | 235 | # 'front':['.FACE.'], | ||
666 | 236 | # 'side':['.COT.'], | ||
667 | 237 | # } | ||
668 | 238 | # for i in map_mode: | ||
669 | 239 | # for j in map_mode[i]: | ||
670 | 240 | # cr.execute("update mrp_bom_component_rel\ | ||
671 | 241 | # set mode = ( select id\ | ||
672 | 242 | # from mrp_bom_component_mode\ | ||
673 | 243 | # where name = '"+ustr(i)+"')\ | ||
674 | 244 | # where id in (\ | ||
675 | 245 | # select a.id\ | ||
676 | 246 | # from mrp_bom_component_rel a join mrp_bom b on a.component_id = b.id join product_product c on b.product_id = c.id join product_template d on c.product_tmpl_id = d.id\ | ||
677 | 247 | # where c.default_code like '%"+ustr(j)+"%');") | ||
678 | 248 | |||
679 | 249 | |||
680 | 250 | def _child_compute(self, cr, uid, ids, name, arg, context={}): | ||
681 | 251 | result = {} | ||
682 | 252 | for bom in self.browse(cr, uid, ids, context=context): | ||
683 | 253 | result[bom.id] = map(lambda x: x.component_id.id, bom.bom_components) | ||
684 | 254 | if bom.bom_components: | ||
685 | 255 | continue | ||
686 | 256 | ok = ((name=='child_complete_ids') and (bom.product_id.supply_method=='produce')) | ||
687 | 257 | if bom.type=='phantom' or ok: | ||
688 | 258 | sids = self.pool.get('mrp.bom').search(cr, uid, [('bom_id','=',False),('product_id','=',bom.product_id.id)]) | ||
689 | 259 | if sids: | ||
690 | 260 | bom2 = self.pool.get('mrp.bom').browse(cr, uid, sids[0], context=context) | ||
691 | 261 | result[bom.id] += map(lambda x: x.component_id.id, bom2.bom_components) | ||
692 | 262 | return result | ||
693 | 263 | |||
694 | 264 | def _compute_type(self, cr, uid, ids, field_name, arg, context): | ||
695 | 265 | res = dict(map(lambda x: (x,''), ids)) | ||
696 | 266 | for line in self.browse(cr, uid, ids): | ||
697 | 267 | if line.type=='phantom' and not line.bom_id: | ||
698 | 268 | res[line.id] = 'set' | ||
699 | 269 | continue | ||
700 | 270 | if line.bom_lines or line.bom_components or line.type=='phantom': | ||
701 | 271 | continue | ||
702 | 272 | if line.product_id.supply_method=='produce': | ||
703 | 273 | if line.product_id.procure_method=='make_to_stock': | ||
704 | 274 | res[line.id] = 'stock' | ||
705 | 275 | else: | ||
706 | 276 | res[line.id] = 'order' | ||
707 | 277 | return res | ||
708 | 278 | |||
709 | 279 | _columns = { | ||
710 | 280 | 'bom_type': fields.selection([('ass','Assemble'),('exp','Disassemble'),('cut','Cutting'),('cutinput','Cutting Input'),('picking','Picking'),('delay','Delay'),('control','Quality control')], 'BOM Type', required=True ), | ||
711 | 281 | 'bom_lines_multi': fields.many2many('mrp.bom', 'mrp_bom_childs_rel', 'bom_id', 'child_id', 'Child BoMs'), | ||
712 | 282 | 'bom_parent_multi': fields.many2many('mrp.bom', 'mrp_bom_childs_rel', 'child_id', 'bom_id', 'Parent BoMs'), | ||
713 | 283 | 'bom_components': fields.one2many('mrp.bom.component.rel', 'bom_id', 'Components'), | ||
714 | 284 | 'bom_components_parent': fields.one2many('mrp.bom.component.rel', 'component_id', 'Parent Components'), | ||
715 | 285 | 'method': fields.function(_compute_type, string='Method', method=True, type='selection', selection=[('',''),('stock','On Stock'),('order','On Order'),('set','Set / Pack')]), | ||
716 | 286 | 'type_group_ids': fields.many2many('product.type.property.option', 'mrp_bom_options_rel', 'bom_id', 'type_id', 'GOO',help="Used to map which property option is taken from previous product in assembly chain, or pushed to in dissambly chain"), | ||
717 | 287 | 'child_complete_ids': fields.function(_child_compute,relation='mrp.bom', method=True, string="BoM Hyerarchy", type='many2many'), | ||
718 | 288 | # 'group_property_ids': fields.many2many('mrp.property.group.option', 'mrp_bom_group_property_rel','bom_id', 'group_id', 'BOM Property Group Rel', help="Used to produce with properties not defined in sale order"), | ||
719 | 289 | 'sub_product_ids': fields.many2many('mrp.subproduct', 'mrp_bom_subproduct_rel','bom_id', 'sub_id', 'Sub products'), | ||
720 | 290 | } | ||
721 | 291 | _defaults = { | ||
722 | 292 | 'bom_type': lambda *a: 'ass' | ||
723 | 293 | } | ||
724 | 294 | |||
725 | 295 | mrp_bom() | ||
726 | 296 | |||
727 | 297 | class mrp_production(osv.osv): | ||
728 | 298 | _inherit = 'mrp.production' | ||
729 | 299 | |||
730 | 300 | def _size(self, cr, uid, ids, field_name, arg, context): | ||
731 | 301 | res = {} | ||
732 | 302 | for proc in self.browse(cr, uid, ids): | ||
733 | 303 | res[proc.id] = {'size_x': 0.0, 'size_y': 0.0, 'size_z': 0.0 , 'diameter': 0.0} | ||
734 | 304 | if proc.product_id: | ||
735 | 305 | res[proc.id]['size_x'] = proc.product_id.size_x or proc.product_id.product_tmpl_id.size_x_tmpl or 0.0 | ||
736 | 306 | res[proc.id]['size_y'] = proc.product_id.size_y or proc.product_id.product_tmpl_id.size_y_tmpl or 0.0 | ||
737 | 307 | res[proc.id]['size_z'] = proc.product_id.size_z or proc.product_id.product_tmpl_id.size_z_tmpl or 0.0 | ||
738 | 308 | res[proc.id]['diameter'] = proc.product_id.diameter or proc.product_id.product_tmpl_id.diameter_tmpl or 0.0 | ||
739 | 309 | return res | ||
740 | 310 | |||
741 | 311 | _columns = { | ||
742 | 312 | 'procurement_ids': fields.one2many('procurement.order', 'production_id', 'Procurements'), | ||
743 | 313 | 'specific_production':fields.boolean('Specific Production'), | ||
744 | 314 | 'note_production':fields.text('Production Note'), | ||
745 | 315 | 'size_x': fields.function(_size, multi="size", method=True, string='Width', digits=(16, 5), type='float'), | ||
746 | 316 | 'size_y': fields.function(_size, multi="size", method=True, string='Length', digits=(16, 5), type='float'), | ||
747 | 317 | 'size_z': fields.function(_size, multi="size", method=True, string='Thickness', digits=(16, 5), type='float'), | ||
748 | 318 | 'diameter': fields.function(_size, multi="size", method=True, string='Diameter', digits=(16, 5), type='float'), | ||
749 | 319 | 'size_x_specific': fields.float('Width specific', digits=(16, 5), readonly=True), | ||
750 | 320 | 'size_y_specific': fields.float('Length specific', digits=(16, 5), readonly=True), | ||
751 | 321 | 'size_z_specific': fields.float('Thickness specific', digits=(16, 5), readonly=True), | ||
752 | 322 | 'diameter_specific': fields.float('Diameter specific', digits=(16, 5), readonly=True), | ||
753 | 323 | 'size_x_specific_delta': fields.float('Width specific delta', digits=(16, 5), readonly=True), | ||
754 | 324 | 'size_y_specific_delta': fields.float('Length specific delta', digits=(16, 5), readonly=True), | ||
755 | 325 | 'size_z_specific_delta': fields.float('Thickness specific delta', digits=(16, 5), readonly=True), | ||
756 | 326 | 'diameter_specific_delta': fields.float('Diameter specific delta', digits=(16, 5), readonly=True), | ||
757 | 327 | 'uom_s_size_specific' : fields.many2one('product.uom', 'Size Uom', help="Default united of measure used for operations size"), | ||
758 | 328 | } | ||
759 | 329 | _order = 'id desc' | ||
760 | 330 | |||
761 | 331 | def action_production_end(self, cr, uid, ids): | ||
762 | 332 | # move_ids = [] | ||
763 | 333 | for production in self.browse(cr, uid, ids): | ||
764 | 334 | for res in production.move_lines: | ||
765 | 335 | for move in production.move_created_ids: | ||
766 | 336 | #XXX must use the orm | ||
767 | 337 | # cr.execute('INSERT INTO stock_move_history_ids \ | ||
768 | 338 | # (parent_id, child_id) VALUES (%s,%s)', | ||
769 | 339 | # (res.id, move.id)) | ||
770 | 340 | #ASPerience: test des valeurs pour Ʃviter les erreurs de rƩƩcriture | ||
771 | 341 | cr.execute('select parent_id,child_id from stock_move_history_ids where parent_id=%s and child_id=%s', (res.id, move.id)) | ||
772 | 342 | if len(cr.fetchall()) == 0: | ||
773 | 343 | cr.execute('insert into stock_move_history_ids (parent_id,child_id) values (%s,%s)', (res.id, move.id)) | ||
774 | 344 | else: | ||
775 | 345 | logger = netsvc.Logger() | ||
776 | 346 | logger.notifyChannel("warning", netsvc.LOG_WARNING," ERROR insert into stock_move_history_ids parent_id=%s and child_id=%s'." % (str(move.id), str(move.move_dest_id.id))) | ||
777 | 347 | #Fin ASPerience | ||
778 | 348 | # move_ids.append(res.id) | ||
779 | 349 | vals= {'state':'confirmed'} | ||
780 | 350 | new_moves = [x.id for x in production.move_created_ids] | ||
781 | 351 | self.pool.get('stock.move').write(cr, uid, new_moves, vals) | ||
782 | 352 | if not production.date_finnished: | ||
783 | 353 | self.write(cr, uid, [production.id], | ||
784 | 354 | {'date_finnished': time.strftime('%Y-%m-%d %H:%M:%S')}) | ||
785 | 355 | self.pool.get('stock.move').check_assign(cr, uid, new_moves) | ||
786 | 356 | self.pool.get('stock.move').action_done(cr, uid, new_moves) | ||
787 | 357 | self._costs_generate(cr, uid, production) | ||
788 | 358 | # self.pool.get('stock.move').action_done(cr, uid, move_ids) | ||
789 | 359 | self.write(cr, uid, ids, {'state': 'done'}) | ||
790 | 360 | return True | ||
791 | 361 | |||
792 | 362 | mrp_production() | ||
793 | 363 | |||
794 | 364 | class mrp_production_product_line(osv.osv): | ||
795 | 365 | _inherit = 'mrp.production.product.line' | ||
796 | 366 | |||
797 | 367 | _columns = { | ||
798 | 368 | 'property_ids': fields.many2many('mrp.property', 'mrp_production_product_line_property_rel', 'line_id','property_id', 'Properties'), | ||
799 | 369 | 'group_property_ids': fields.many2many('mrp.property.group.option', 'mrp_production_line_group_property_rel','production_line_id', 'group_id', 'Product Property Group Rel '), | ||
800 | 370 | 'procurement_id': fields.many2one('procurement.order', 'Procurement'), | ||
801 | 371 | 'option_ids': fields.many2many('product.links', 'mrp_production_product_line_options_rel','line_id', 'links_id', 'Option'), | ||
802 | 372 | 'bom_id': fields.many2one('mrp.bom', 'Bom'), | ||
803 | 373 | 'specific_production':fields.boolean('Specific Production'), | ||
804 | 374 | 'note_production':fields.text('Production Note'), | ||
805 | 375 | 'size_x_specific': fields.float('Width specific', digits=(16, 5), readonly=True ), | ||
806 | 376 | 'size_y_specific': fields.float('Length specific', digits=(16, 5), readonly=True), | ||
807 | 377 | 'size_z_specific': fields.float('Thickness specific', digits=(16, 5), readonly=True), | ||
808 | 378 | 'diameter_specific': fields.float('Diameter specific', digits=(16, 5), readonly=True), | ||
809 | 379 | 'size_x_specific_delta': fields.float('Width specific delta', digits=(16, 5), readonly=True), | ||
810 | 380 | 'size_y_specific_delta': fields.float('Length specific delta', digits=(16, 5), readonly=True), | ||
811 | 381 | 'size_z_specific_delta': fields.float('Thickness specific delta', digits=(16, 5), readonly=True), | ||
812 | 382 | 'diameter_specific_delta': fields.float('Diameter specific delta', digits=(16, 5), readonly=True), | ||
813 | 383 | 'uom_s_size_specific' : fields.many2one('product.uom', 'Size Uom', help="Default united of measure used for operations size"), | ||
814 | 384 | } | ||
815 | 385 | mrp_production_product_line() | ||
816 | 386 | |||
817 | 387 | class stock_production_lot(osv.osv): | ||
818 | 388 | _inherit = 'stock.production.lot' | ||
819 | 389 | |||
820 | 390 | def search_specific(self,cr,uid,vals,delay): | ||
821 | 391 | filter = [('product_id','=',vals['product_id'])] | ||
822 | 392 | filter_key = ['density','diameter','shape','size_x','size_y','size_z','weight'] | ||
823 | 393 | for key in filter_key: | ||
824 | 394 | if vals[key]: | ||
825 | 395 | filter.append((key,'=',vals[key])) | ||
826 | 396 | |||
827 | 397 | today=datetime.datetime.today() | ||
828 | 398 | if delay: | ||
829 | 399 | limit = (today-datetime.timedelta(days=delay)).strftime('%Y-%m-%d %H:%M:%S') | ||
830 | 400 | filter.append(('date','>',limit)) | ||
831 | 401 | |||
832 | 402 | result = self.search(cr,uid,filter) | ||
833 | 403 | set_property_ids = set(vals['property_ids'][0][2]) | ||
834 | 404 | set_group_property_ids = set(vals['group_property_ids'][0][2]) | ||
835 | 405 | set_option_ids = set(vals['option_ids'][0][2]) | ||
836 | 406 | for lot_id in result: | ||
837 | 407 | lot = self.browse(cr,uid,lot_id) | ||
838 | 408 | lot_property_ids = set([i.id for i in lot.property_ids]) | ||
839 | 409 | lot_group_property_ids = set([i.id for i in lot.group_property_ids]) | ||
840 | 410 | lot_option_ids = set([i.id for i in lot.option_ids]) | ||
841 | 411 | if lot_property_ids == set_property_ids and lot_group_property_ids == set_group_property_ids and lot_option_ids == set_option_ids : | ||
842 | 412 | return lot.id | ||
843 | 413 | return False | ||
844 | 414 | |||
845 | 415 | _columns = { | ||
846 | 416 | 'property_ids': fields.many2many('mrp.property', 'mrp_production_lot_property_rel', 'lot_id','property_id', 'Properties'), | ||
847 | 417 | 'group_property_ids': fields.many2many('mrp.property.group.option', 'mrp_production_lot_group_property_rel','production_lot_id', 'group_id', 'Product Property Group Rel '), | ||
848 | 418 | 'option_ids': fields.many2many('product.links', 'mrp_production_lot_options_rel','production_lot_id', 'links_id', 'Options'), | ||
849 | 419 | } | ||
850 | 420 | |||
851 | 421 | _defaults = { | ||
852 | 422 | } | ||
853 | 423 | stock_production_lot() | ||
854 | 424 | |||
855 | 425 | class mrp_routing(osv.osv): | ||
856 | 426 | _inherit = 'mrp.routing' | ||
857 | 427 | _columns = { | ||
858 | 428 | 'technical_data': fields.char('Technical Data', size=128), | ||
859 | 429 | } | ||
860 | 430 | _defaults = { | ||
861 | 431 | 'active': lambda *a: 1, | ||
862 | 432 | } | ||
863 | 433 | mrp_routing() | ||
864 | 434 | |||
865 | 435 | class mrp_routing_workcenter_subproduct(osv.osv): | ||
866 | 436 | _name = 'mrp.routing.workcenter.subproduct' | ||
867 | 437 | _description = 'mrp.routing.workcenter.subproduct' | ||
868 | 438 | _columns = { | ||
869 | 439 | 'name': fields.float('Percent', required=True), | ||
870 | 440 | 'subproduct_id': fields.many2one('mrp.subproduct', 'Subproduct', required=True), | ||
871 | 441 | 'workcenter_line_id': fields.many2one('mrp.routing.workcenter', 'Routing Workcenter', required=True), | ||
872 | 442 | } | ||
873 | 443 | mrp_routing_workcenter_subproduct() | ||
874 | 444 | |||
875 | 445 | class mrp_routing_workcenter(osv.osv): | ||
876 | 446 | _inherit = 'mrp.routing.workcenter' | ||
877 | 447 | _columns = { | ||
878 | 448 | 'sub_ids': fields.one2many('mrp.routing.workcenter.subproduct', 'workcenter_line_id', 'Sub Product'), | ||
879 | 449 | 'bom_ids': fields.many2many('mrp.bom', 'routing_workcenter_mrp_bom_rel', 'workcenter_line_id', 'bom_id', 'Components'), | ||
880 | 450 | } | ||
881 | 451 | _defaults = { | ||
882 | 452 | } | ||
883 | 453 | mrp_routing_workcenter() | ||
884 | 454 | |||
885 | 455 | class mrp_production_workcenter_line(osv.osv): | ||
886 | 456 | _inherit = 'mrp.production.workcenter.line' | ||
887 | 457 | _columns = { | ||
888 | 458 | 'move_ids' : fields.many2many('stock.move', 'mrp_production_workcenter_line_stock_move_rel', 'line_id', 'move_id', 'Moves'), | ||
889 | 459 | } | ||
890 | 460 | _defaults = { | ||
891 | 461 | } | ||
892 | 462 | mrp_production_workcenter_line() | ||
893 | 463 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | ||
894 | 0 | \ No newline at end of file | 464 | \ No newline at end of file |
895 | 1 | 465 | ||
896 | === added file 'asperience_configurator_mrp/__init__.py' | |||
897 | --- asperience_configurator_mrp/__init__.py 1970-01-01 00:00:00 +0000 | |||
898 | +++ asperience_configurator_mrp/__init__.py 2017-12-01 14:57:12 +0000 | |||
899 | @@ -0,0 +1,34 @@ | |||
900 | 1 | # -*- encoding: utf-8 -*- | ||
901 | 2 | ############################################################################## | ||
902 | 3 | # | ||
903 | 4 | # OpenERP, Open Source Management Solution | ||
904 | 5 | # Copyright (C) 2007-2014 ASPerience SARL (<http://www.asperience.fr>). | ||
905 | 6 | # All Rights Reserved | ||
906 | 7 | # | ||
907 | 8 | # This program is free software: you can redistribute it and/or modify | ||
908 | 9 | # it under the terms of the GNU General Public License as published by | ||
909 | 10 | # the Free Software Foundation, either version 3 of the License, or | ||
910 | 11 | # (at your option) any later version. | ||
911 | 12 | # | ||
912 | 13 | # This program is distributed in the hope that it will be useful, | ||
913 | 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
914 | 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
915 | 16 | # GNU General Public License for more details. | ||
916 | 17 | # | ||
917 | 18 | # You should have received a copy of the GNU General Public License | ||
918 | 19 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
919 | 20 | # | ||
920 | 21 | ############################################################################## | ||
921 | 22 | import company | ||
922 | 23 | import product | ||
923 | 24 | import stock | ||
924 | 25 | import stock_production | ||
925 | 26 | import procurement | ||
926 | 27 | import mrp_property | ||
927 | 28 | import mrp_bom | ||
928 | 29 | import mrp_subproduct | ||
929 | 30 | import mrp_workcenter | ||
930 | 31 | import mrp_routing | ||
931 | 32 | import mrp_production | ||
932 | 33 | #import report | ||
933 | 34 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | ||
934 | 0 | \ No newline at end of file | 35 | \ No newline at end of file |
935 | 1 | 36 | ||
936 | === added file 'asperience_configurator_mrp/__openerp__.py' | |||
937 | --- asperience_configurator_mrp/__openerp__.py 1970-01-01 00:00:00 +0000 | |||
938 | +++ asperience_configurator_mrp/__openerp__.py 2017-12-01 14:57:12 +0000 | |||
939 | @@ -0,0 +1,76 @@ | |||
940 | 1 | # -*- encoding: utf-8 -*- | ||
941 | 2 | ############################################################################## | ||
942 | 3 | # | ||
943 | 4 | # OpenERP, Open Source Management Solution | ||
944 | 5 | # Copyright (C) 2007-2014 ASPerience SARL (<http://www.asperience.fr>). | ||
945 | 6 | # All Rights Reserved | ||
946 | 7 | # | ||
947 | 8 | # This program is free software: you can redistribute it and/or modify | ||
948 | 9 | # it under the terms of the GNU General Public License as published by | ||
949 | 10 | # the Free Software Foundation, either version 3 of the License, or | ||
950 | 11 | # (at your option) any later version. | ||
951 | 12 | # | ||
952 | 13 | # This program is distributed in the hope that it will be useful, | ||
953 | 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
954 | 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
955 | 16 | # GNU General Public License for more details. | ||
956 | 17 | # | ||
957 | 18 | # You should have received a copy of the GNU General Public License | ||
958 | 19 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
959 | 20 | # | ||
960 | 21 | ############################################################################## | ||
961 | 22 | { | ||
962 | 23 | "name": "ASPerience - MRP", | ||
963 | 24 | "version": "8.0", | ||
964 | 25 | "author": "ASPerience", | ||
965 | 26 | "website": "http://www.asperience.fr", | ||
966 | 27 | "sequence": 0, | ||
967 | 28 | "certificate": "", | ||
968 | 29 | "license": "", | ||
969 | 30 | "depends": [ | ||
970 | 31 | "mrp", | ||
971 | 32 | "mrp_byproduct", | ||
972 | 33 | "mrp_operations", | ||
973 | 34 | "product", | ||
974 | 35 | "stock", | ||
975 | 36 | "asperience_product_attributes", | ||
976 | 37 | ], | ||
977 | 38 | "category": "Generic Modules/ASPerience", | ||
978 | 39 | "complexity": "easy", | ||
979 | 40 | "description": """ | ||
980 | 41 | BOM tree management, trees of supplies from the configurator and trees production. | ||
981 | 42 | Filtering system of nomenclature by properties, from supplies. | ||
982 | 43 | Management of product properties. | ||
983 | 44 | """, | ||
984 | 45 | "data": [ | ||
985 | 46 | "security/ir.model.access.csv", | ||
986 | 47 | "company_view.xml", | ||
987 | 48 | "product_view.xml", | ||
988 | 49 | "procurement_view.xml", | ||
989 | 50 | "mrp_view.xml", | ||
990 | 51 | "stock_production_view.xml", | ||
991 | 52 | "mrp_workflow.xml", | ||
992 | 53 | "mrp_report.xml", | ||
993 | 54 | "mrp_subproduct_view.xml", | ||
994 | 55 | "mrp_data.xml", | ||
995 | 56 | ], | ||
996 | 57 | "demo": [ | ||
997 | 58 | ], | ||
998 | 59 | "test": [ | ||
999 | 60 | ], | ||
1000 | 61 | "js": [ | ||
1001 | 62 | ], | ||
1002 | 63 | "css": [ | ||
1003 | 64 | ], | ||
1004 | 65 | "qweb": [ | ||
1005 | 66 | ], | ||
1006 | 67 | "demo_xml": [ | ||
1007 | 68 | ], | ||
1008 | 69 | "images": [ | ||
1009 | 70 | ], | ||
1010 | 71 | "auto_install": False, | ||
1011 | 72 | "installable": True, | ||
1012 | 73 | "application": False, | ||
1013 | 74 | |||
1014 | 75 | } | ||
1015 | 76 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | ||
1016 | 0 | \ No newline at end of file | 77 | \ No newline at end of file |
1017 | 1 | 78 | ||
1018 | === added file 'asperience_configurator_mrp/bom_graph.pyc' | |||
1019 | 2 | Binary files asperience_configurator_mrp/bom_graph.pyc 1970-01-01 00:00:00 +0000 and asperience_configurator_mrp/bom_graph.pyc 2017-12-01 14:57:12 +0000 differ | 79 | Binary files asperience_configurator_mrp/bom_graph.pyc 1970-01-01 00:00:00 +0000 and asperience_configurator_mrp/bom_graph.pyc 2017-12-01 14:57:12 +0000 differ |
1020 | === added file 'asperience_configurator_mrp/company.py' | |||
1021 | --- asperience_configurator_mrp/company.py 1970-01-01 00:00:00 +0000 | |||
1022 | +++ asperience_configurator_mrp/company.py 2017-12-01 14:57:12 +0000 | |||
1023 | @@ -0,0 +1,32 @@ | |||
1024 | 1 | # -*- encoding: utf-8 -*- | ||
1025 | 2 | ############################################################################## | ||
1026 | 3 | # | ||
1027 | 4 | # OpenERP, Open Source Management Solution | ||
1028 | 5 | # Copyright (C) 2007-2014 ASPerience SARL (<http://www.asperience.fr>). | ||
1029 | 6 | # All Rights Reserved | ||
1030 | 7 | # | ||
1031 | 8 | # This program is free software: you can redistribute it and/or modify | ||
1032 | 9 | # it under the terms of the GNU General Public License as published by | ||
1033 | 10 | # the Free Software Foundation, either version 3 of the License, or | ||
1034 | 11 | # (at your option) any later version. | ||
1035 | 12 | # | ||
1036 | 13 | # This program is distributed in the hope that it will be useful, | ||
1037 | 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1038 | 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1039 | 16 | # GNU General Public License for more details. | ||
1040 | 17 | # | ||
1041 | 18 | # You should have received a copy of the GNU General Public License | ||
1042 | 19 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1043 | 20 | # | ||
1044 | 21 | ############################################################################## | ||
1045 | 22 | from openerp.osv import osv, fields | ||
1046 | 23 | |||
1047 | 24 | class res_company(osv.osv): | ||
1048 | 25 | _inherit = 'res.company' | ||
1049 | 26 | |||
1050 | 27 | _columns = { | ||
1051 | 28 | 'tracking_production_delay':fields.integer('Tracking production delay'), | ||
1052 | 29 | } | ||
1053 | 30 | |||
1054 | 31 | res_company() | ||
1055 | 32 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | ||
1056 | 0 | \ No newline at end of file | 33 | \ No newline at end of file |
1057 | 1 | 34 | ||
1058 | === added file 'asperience_configurator_mrp/company_view.xml' | |||
1059 | --- asperience_configurator_mrp/company_view.xml 1970-01-01 00:00:00 +0000 | |||
1060 | +++ asperience_configurator_mrp/company_view.xml 2017-12-01 14:57:12 +0000 | |||
1061 | @@ -0,0 +1,16 @@ | |||
1062 | 1 | <?xml version="1.0" encoding="utf-8"?> | ||
1063 | 2 | <openerp> | ||
1064 | 3 | <data> | ||
1065 | 4 | <record id="view_company_form_asperience_mrp" model="ir.ui.view"> | ||
1066 | 5 | <field name="name">res.company.form.asperience.mrp</field> | ||
1067 | 6 | <field name="model">res.company</field> | ||
1068 | 7 | <field name="priority">25</field> | ||
1069 | 8 | <field name="inherit_id" ref="base.view_company_form"/> | ||
1070 | 9 | <field name="arch" type="xml"> | ||
1071 | 10 | <field name="manufacturing_lead" position="after"> | ||
1072 | 11 | <field name="tracking_production_delay"/> | ||
1073 | 12 | </field> | ||
1074 | 13 | </field> | ||
1075 | 14 | </record> | ||
1076 | 15 | </data> | ||
1077 | 16 | </openerp> | ||
1078 | 0 | 17 | ||
1079 | === added directory 'asperience_configurator_mrp/i18n' | |||
1080 | === added file 'asperience_configurator_mrp/i18n/fr_FR.po' | |||
1081 | --- asperience_configurator_mrp/i18n/fr_FR.po 1970-01-01 00:00:00 +0000 | |||
1082 | +++ asperience_configurator_mrp/i18n/fr_FR.po 2017-12-01 14:57:12 +0000 | |||
1083 | @@ -0,0 +1,274 @@ | |||
1084 | 1 | # Translation of ASPerPGI. | ||
1085 | 2 | # This file contains the translation of the following modules: | ||
1086 | 3 | # * asperience_mrp | ||
1087 | 4 | # * report_mrp | ||
1088 | 5 | # * mrp | ||
1089 | 6 | # | ||
1090 | 7 | msgid "" | ||
1091 | 8 | msgstr "" | ||
1092 | 9 | "Project-Id-Version: ASPerPGI 5.0.10\n" | ||
1093 | 10 | "Report-Msgid-Bugs-To: support@openerp.com\n" | ||
1094 | 11 | "POT-Creation-Date: 2010-11-10 08:50:02+0000\n" | ||
1095 | 12 | "PO-Revision-Date: 2010-11-10 08:50:02+0000\n" | ||
1096 | 13 | "Last-Translator: <>\n" | ||
1097 | 14 | "Language-Team: \n" | ||
1098 | 15 | "MIME-Version: 1.0\n" | ||
1099 | 16 | "Content-Type: text/plain; charset=UTF-8\n" | ||
1100 | 17 | "Content-Transfer-Encoding: \n" | ||
1101 | 18 | "Plural-Forms: \n" | ||
1102 | 19 | |||
1103 | 20 | #. module: mrp | ||
1104 | 21 | #: view:mrp.production:0 | ||
1105 | 22 | msgid "Consumed Products" | ||
1106 | 23 | msgstr "Produits ConsommƩs" | ||
1107 | 24 | |||
1108 | 25 | #. module: asperience_mrp | ||
1109 | 26 | #: field:procurement.order,specific_production:0 | ||
1110 | 27 | #: field:mrp.production,specific_production:0 | ||
1111 | 28 | msgid "Specific Production" | ||
1112 | 29 | msgstr "Production spƩcifique" | ||
1113 | 30 | |||
1114 | 31 | #. module: mrp | ||
1115 | 32 | #: model:ir.actions.wizard,name:mrp.product_procurement_wizard | ||
1116 | 33 | msgid "Procurement Request" | ||
1117 | 34 | msgstr "Demande d'approvisionnement" | ||
1118 | 35 | |||
1119 | 36 | #. module: asperience_mrp | ||
1120 | 37 | #: field:product.category.property,categ_id:0 | ||
1121 | 38 | msgid "Category" | ||
1122 | 39 | msgstr "Categorie" | ||
1123 | 40 | |||
1124 | 41 | #. module: asperience_mrp | ||
1125 | 42 | #: model:ir.module.module,shortdesc:asperience_mrp.module_meta_information | ||
1126 | 43 | msgid "ASPerience - MRP" | ||
1127 | 44 | msgstr "" | ||
1128 | 45 | |||
1129 | 46 | #. module: asperience_mrp | ||
1130 | 47 | #: field:mrp.property,size_y_tmpl:0 | ||
1131 | 48 | msgid "Length" | ||
1132 | 49 | msgstr "Largeur" | ||
1133 | 50 | |||
1134 | 51 | #. module: asperience_mrp | ||
1135 | 52 | #: field:mrp.workcenter,capacity:0 | ||
1136 | 53 | msgid "Capacity" | ||
1137 | 54 | msgstr "CapacitƩ" | ||
1138 | 55 | |||
1139 | 56 | #. module: asperience_mrp | ||
1140 | 57 | #: code:addons/asperience_mrp/mrp.py:0 | ||
1141 | 58 | #: selection:mrp.workcenter,type_workcenter:0 | ||
1142 | 59 | #, python-format | ||
1143 | 60 | msgid "Work line" | ||
1144 | 61 | msgstr "Ligne de production" | ||
1145 | 62 | |||
1146 | 63 | #. module: asperience_mrp | ||
1147 | 64 | #: field:mrp.property,size_z_tmpl:0 | ||
1148 | 65 | msgid "Thickness" | ||
1149 | 66 | msgstr "Hauteur" | ||
1150 | 67 | |||
1151 | 68 | #. module: asperience_mrp | ||
1152 | 69 | #: field:mrp.property.group.option,type_group_id:0 | ||
1153 | 70 | #: field:product.category.property,type_group:0 | ||
1154 | 71 | #: field:product.property,type_group:0 | ||
1155 | 72 | msgid "Group By" | ||
1156 | 73 | msgstr "Grouper par" | ||
1157 | 74 | |||
1158 | 75 | #. module: asperience_mrp | ||
1159 | 76 | #: view:product.product:0 | ||
1160 | 77 | msgid "Generate BoM" | ||
1161 | 78 | msgstr "GƩnƩrer le BoM" | ||
1162 | 79 | |||
1163 | 80 | |||
1164 | 81 | #. module: asperience_mrp | ||
1165 | 82 | #: field:product.product,bom:0 | ||
1166 | 83 | msgid "BoM Generated" | ||
1167 | 84 | msgstr "BoM gƩnƩrƩ" | ||
1168 | 85 | |||
1169 | 86 | #. module: asperience_mrp | ||
1170 | 87 | #: view:product.product:0 | ||
1171 | 88 | msgid "Generate" | ||
1172 | 89 | msgstr "GƩnƩrer" | ||
1173 | 90 | |||
1174 | 91 | #. module: asperience_mrp | ||
1175 | 92 | #: field:mrp.property,uom_s_size_tmpl:0 | ||
1176 | 93 | msgid "Size Uom" | ||
1177 | 94 | msgstr "Udm taille" | ||
1178 | 95 | |||
1179 | 96 | #. module: asperience_mrp | ||
1180 | 97 | #: field:mrp.property,price:0 | ||
1181 | 98 | msgid "Price" | ||
1182 | 99 | msgstr "Prix" | ||
1183 | 100 | |||
1184 | 101 | #. module: asperience_mrp | ||
1185 | 102 | #: field:mrp.production.product.line,property_ids:0 | ||
1186 | 103 | #: field:mrp.property.group,property_ids:0 | ||
1187 | 104 | #: field:mrp.property.group.option,property_id:0 | ||
1188 | 105 | #: field:mrp.workcenter,property_ids:0 | ||
1189 | 106 | msgid "Properties" | ||
1190 | 107 | msgstr "PropriƩtƩs" | ||
1191 | 108 | |||
1192 | 109 | #. module: asperience_mrp | ||
1193 | 110 | #: field:mrp.property,size_x_tmpl:0 | ||
1194 | 111 | msgid "Width" | ||
1195 | 112 | msgstr "Profondeur" | ||
1196 | 113 | |||
1197 | 114 | #. module: asperience_mrp | ||
1198 | 115 | #: field:mrp.workcenter,external:0 | ||
1199 | 116 | msgid "External workcenter" | ||
1200 | 117 | msgstr "" | ||
1201 | 118 | |||
1202 | 119 | #. module: asperience_mrp | ||
1203 | 120 | #: field:mrp.workcenter,critical:0 | ||
1204 | 121 | msgid "Critical" | ||
1205 | 122 | msgstr "" | ||
1206 | 123 | |||
1207 | 124 | #. module: asperience_mrp | ||
1208 | 125 | #: selection:product.category.property,type:0 | ||
1209 | 126 | msgid "Template" | ||
1210 | 127 | msgstr "ModĆØle" | ||
1211 | 128 | |||
1212 | 129 | #. module: asperience_mrp | ||
1213 | 130 | #: constraint:ir.model:0 | ||
1214 | 131 | msgid "The Object name must start with x_ and not contain any special character !" | ||
1215 | 132 | msgstr "Le nom de l'objet doit commencer avec x_ et ne pas contenir de charactĆØres spĆ©ciaux !" | ||
1216 | 133 | |||
1217 | 134 | #. module: asperience_mrp | ||
1218 | 135 | #: view:product.property:0 | ||
1219 | 136 | msgid "Product Properties Product" | ||
1220 | 137 | msgstr "Options de Configuration PropriƩtƩs du Produit" | ||
1221 | 138 | |||
1222 | 139 | #. module: asperience_mrp | ||
1223 | 140 | #: field:product.category.property,type:0 | ||
1224 | 141 | msgid "Type" | ||
1225 | 142 | msgstr "" | ||
1226 | 143 | |||
1227 | 144 | #. module: asperience_mrp | ||
1228 | 145 | #: model:ir.model,name:asperience_mrp.model_mrp_workcenter_technology | ||
1229 | 146 | msgid "mrp.workcenter.technology" | ||
1230 | 147 | msgstr "Famille technologique" | ||
1231 | 148 | |||
1232 | 149 | #. module: asperience_mrp | ||
1233 | 150 | #: selection:product.category.property,type:0 | ||
1234 | 151 | #: field:product.property,product_id:0 | ||
1235 | 152 | #: field:product.property,template_id:0 | ||
1236 | 153 | msgid "Product" | ||
1237 | 154 | msgstr "Produit" | ||
1238 | 155 | |||
1239 | 156 | #. module: asperience_mrp | ||
1240 | 157 | #: field:product.property,used:0 | ||
1241 | 158 | msgid "Used" | ||
1242 | 159 | msgstr "Actif" | ||
1243 | 160 | |||
1244 | 161 | #. module: asperience_mrp | ||
1245 | 162 | #: field:mrp.workcenter.technology,name:0 | ||
1246 | 163 | #: view:product.category:0 | ||
1247 | 164 | #: field:product.category,description:0 | ||
1248 | 165 | #: field:product.category.property,name:0 | ||
1249 | 166 | #: field:product.property,name:0 | ||
1250 | 167 | msgid "Description" | ||
1251 | 168 | msgstr "" | ||
1252 | 169 | |||
1253 | 170 | #. module: asperience_mrp | ||
1254 | 171 | #: field:product.category,linked_product_ids:0 | ||
1255 | 172 | msgid "Linked products" | ||
1256 | 173 | msgstr "" | ||
1257 | 174 | |||
1258 | 175 | #. module: asperience_mrp | ||
1259 | 176 | #: code:addons/asperience_mrp/mrp.py:0 | ||
1260 | 177 | #: selection:mrp.workcenter,type_workcenter:0 | ||
1261 | 178 | #, python-format | ||
1262 | 179 | msgid "Elementary resource" | ||
1263 | 180 | msgstr "Ressource ƩlƩmentaire" | ||
1264 | 181 | |||
1265 | 182 | #. module: asperience_mrp | ||
1266 | 183 | #: model:ir.model,name:asperience_mrp.model_product_property | ||
1267 | 184 | msgid "product.property" | ||
1268 | 185 | msgstr "PropriƩtƩs" | ||
1269 | 186 | |||
1270 | 187 | #. module: asperience_mrp | ||
1271 | 188 | #: field:mrp.workcenter,type_workcenter:0 | ||
1272 | 189 | msgid "Type workcenter" | ||
1273 | 190 | msgstr "Type de centre de travail" | ||
1274 | 191 | |||
1275 | 192 | #. module: asperience_mrp | ||
1276 | 193 | #: view:product.product.property:0 | ||
1277 | 194 | msgid "Properties" | ||
1278 | 195 | msgstr "PropriƩtƩs" | ||
1279 | 196 | |||
1280 | 197 | #. module: asperience_mrp | ||
1281 | 198 | #: code:addons/asperience_mrp/mrp.py:0 | ||
1282 | 199 | #: selection:mrp.workcenter,type_workcenter:0 | ||
1283 | 200 | #, python-format | ||
1284 | 201 | msgid "Work center" | ||
1285 | 202 | msgstr "Machine" | ||
1286 | 203 | |||
1287 | 204 | #. module: asperience_mrp | ||
1288 | 205 | #: constraint:ir.ui.view:0 | ||
1289 | 206 | msgid "Invalid XML for View Architecture!" | ||
1290 | 207 | msgstr "XML non valide pour l'architecture de la vue" | ||
1291 | 208 | |||
1292 | 209 | #. module: asperience_mrp | ||
1293 | 210 | #: field:mrp.workcenter,fixed_capacity:0 | ||
1294 | 211 | msgid "Fixed capacity" | ||
1295 | 212 | msgstr "" | ||
1296 | 213 | |||
1297 | 214 | #. module: asperience_mrp | ||
1298 | 215 | #: field:mrp.property.group,required:0 | ||
1299 | 216 | msgid "Required" | ||
1300 | 217 | msgstr "Requis" | ||
1301 | 218 | |||
1302 | 219 | #. module: asperience_mrp | ||
1303 | 220 | #: view:product.category.property:0 | ||
1304 | 221 | msgid "Product Property" | ||
1305 | 222 | msgstr "PropriƩtƩs" | ||
1306 | 223 | |||
1307 | 224 | #. module: asperience_mrp | ||
1308 | 225 | #: field:mrp.property,code:0 | ||
1309 | 226 | msgid "Code" | ||
1310 | 227 | msgstr "" | ||
1311 | 228 | |||
1312 | 229 | #. module: asperience_mrp | ||
1313 | 230 | #: field:product.category,property_ids:0 | ||
1314 | 231 | #: field:product.category.property,property_id:0 | ||
1315 | 232 | #: field:product.property,property_id:0 | ||
1316 | 233 | msgid "Property" | ||
1317 | 234 | msgstr "PropriƩtƩ" | ||
1318 | 235 | |||
1319 | 236 | #. module: asperience_mrp | ||
1320 | 237 | #: field:mrp.workcenter,child_ids:0 | ||
1321 | 238 | msgid "Childs" | ||
1322 | 239 | msgstr "Enfants" | ||
1323 | 240 | |||
1324 | 241 | #. module: asperience_mrp | ||
1325 | 242 | #: field:mrp.workcenter,parent_id:0 | ||
1326 | 243 | msgid "Parent" | ||
1327 | 244 | msgstr "" | ||
1328 | 245 | |||
1329 | 246 | #. module: asperience_mrp | ||
1330 | 247 | #: field:product.template,property_tmpl_ids:0 | ||
1331 | 248 | msgid "Property Template" | ||
1332 | 249 | msgstr "" | ||
1333 | 250 | |||
1334 | 251 | #. module: asperience_mrp | ||
1335 | 252 | #: field:product.template,linked_product_tmpl_ids:0 | ||
1336 | 253 | msgid "Linked products template" | ||
1337 | 254 | msgstr "Options de Configuration Option du ModĆØle" | ||
1338 | 255 | |||
1339 | 256 | #. module: asperience_mrp | ||
1340 | 257 | #: view:product.property:0 | ||
1341 | 258 | msgid "Product Properties Template" | ||
1342 | 259 | msgstr "Options de Configuration PropriĆ©tĆ©s du ModĆØle" | ||
1343 | 260 | |||
1344 | 261 | #. module: asperience_mrp | ||
1345 | 262 | #: model:ir.model,name:asperience_mrp.model_product_category_property | ||
1346 | 263 | msgid "product.category.property" | ||
1347 | 264 | msgstr "" | ||
1348 | 265 | |||
1349 | 266 | #. module: asperience_mrp | ||
1350 | 267 | #: field:mrp.workcenter,technology:0 | ||
1351 | 268 | msgid "Technology" | ||
1352 | 269 | msgstr "Famille technologique" | ||
1353 | 270 | |||
1354 | 271 | #. module: report_mrp | ||
1355 | 272 | #: field:report.mrp.inout,value:0 | ||
1356 | 273 | msgid "Stock value" | ||
1357 | 274 | msgstr "Valeur de stock" | ||
1358 | 0 | 275 | ||
1359 | === added file 'asperience_configurator_mrp/mrp.pyc' | |||
1360 | 1 | Binary files asperience_configurator_mrp/mrp.pyc 1970-01-01 00:00:00 +0000 and asperience_configurator_mrp/mrp.pyc 2017-12-01 14:57:12 +0000 differ | 276 | Binary files asperience_configurator_mrp/mrp.pyc 1970-01-01 00:00:00 +0000 and asperience_configurator_mrp/mrp.pyc 2017-12-01 14:57:12 +0000 differ |
1361 | === added file 'asperience_configurator_mrp/mrp_bom.py' | |||
1362 | --- asperience_configurator_mrp/mrp_bom.py 1970-01-01 00:00:00 +0000 | |||
1363 | +++ asperience_configurator_mrp/mrp_bom.py 2017-12-01 14:57:12 +0000 | |||
1364 | @@ -0,0 +1,843 @@ | |||
1365 | 1 | # -*- encoding: utf-8 -*- | ||
1366 | 2 | ############################################################################## | ||
1367 | 3 | # | ||
1368 | 4 | # OpenERP, Open Source Management Solution | ||
1369 | 5 | # Copyright (C) 2007-2014 ASPerience SARL (<http://www.asperience.fr>). | ||
1370 | 6 | # All Rights Reserved | ||
1371 | 7 | # | ||
1372 | 8 | # This program is free software: you can redistribute it and/or modify | ||
1373 | 9 | # it under the terms of the GNU General Public License as published by | ||
1374 | 10 | # the Free Software Foundation, either version 3 of the License, or | ||
1375 | 11 | # (at your option) any later version. | ||
1376 | 12 | # | ||
1377 | 13 | # This program is distributed in the hope that it will be useful, | ||
1378 | 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1379 | 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1380 | 16 | # GNU General Public License for more details. | ||
1381 | 17 | # | ||
1382 | 18 | # You should have received a copy of the GNU General Public License | ||
1383 | 19 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1384 | 20 | # | ||
1385 | 21 | ############################################################################## | ||
1386 | 22 | from openerp.osv import fields,osv | ||
1387 | 23 | #import openerp.netsvc | ||
1388 | 24 | #from openerp.tools.translate import _ | ||
1389 | 25 | #from openerp.tools import ustr | ||
1390 | 26 | import logging | ||
1391 | 27 | _logger = logging.getLogger(__name__) | ||
1392 | 28 | |||
1393 | 29 | class mrp_bom_component_mode(osv.osv): | ||
1394 | 30 | _name = 'mrp.bom.component.mode' | ||
1395 | 31 | _description = 'mrp.bom.component.mode' | ||
1396 | 32 | _columns = { | ||
1397 | 33 | 'name': fields.char('Description', size=256, required=True), | ||
1398 | 34 | 'dx': fields.text('Dx'), | ||
1399 | 35 | 'dy': fields.text('Dy'), | ||
1400 | 36 | 'dz': fields.text('Dz'), | ||
1401 | 37 | 'dd': fields.text('Dd'), | ||
1402 | 38 | } | ||
1403 | 39 | _defaults = { | ||
1404 | 40 | } | ||
1405 | 41 | |||
1406 | 42 | mrp_bom_component_mode() | ||
1407 | 43 | |||
1408 | 44 | class mrp_bom_component_rel(osv.osv): | ||
1409 | 45 | _name = 'mrp.bom.component.rel' | ||
1410 | 46 | _description = 'mrp.bom.component.rel' | ||
1411 | 47 | _columns = { | ||
1412 | 48 | 'bom_id': fields.many2one('mrp.bom', 'Bom', required=True, ondelete='cascade'), | ||
1413 | 49 | 'component_id': fields.many2one('mrp.bom', 'Component', required=True, ondelete='cascade'), | ||
1414 | 50 | # 'product_component_id': fields.related('component_id','product_id',type='many2one', relation="product.product", string="Product"), | ||
1415 | 51 | 'qty': fields.float('Quantity', required=True), | ||
1416 | 52 | 'mode': fields.many2one('mrp.bom.component.mode', 'Mode'), | ||
1417 | 53 | } | ||
1418 | 54 | |||
1419 | 55 | def compute_size(self, cr, uid, ids, context={}): | ||
1420 | 56 | logger = netsvc.Logger() | ||
1421 | 57 | if not ids : | ||
1422 | 58 | return False | ||
1423 | 59 | result = {} | ||
1424 | 60 | for i in self.browse(cr,uid,ids,context): | ||
1425 | 61 | space = {} | ||
1426 | 62 | space["x"] = context.get("size_x",0.0) | ||
1427 | 63 | space["y"] = context.get("size_y",0.0) | ||
1428 | 64 | space["z"] = context.get("size_z",0.0) | ||
1429 | 65 | space["d"] = context.get("diameter",0.0) | ||
1430 | 66 | space["Dx"] = context.get("size_x_specific_delta",0.0) | ||
1431 | 67 | space["Dy"] = context.get("size_y_specific_delta",0.0) | ||
1432 | 68 | space["Dz"] = context.get("size_z_specific_delta",0.0) | ||
1433 | 69 | space["Dd"] = context.get("diameter_specific_delta",0.0) | ||
1434 | 70 | |||
1435 | 71 | |||
1436 | 72 | result[i.id] = { | ||
1437 | 73 | "size_x_specific_delta":0.0, | ||
1438 | 74 | "size_y_specific_delta":0.0, | ||
1439 | 75 | "size_z_specific_delta":0.0, | ||
1440 | 76 | "diameter_specific_delta":0.0, | ||
1441 | 77 | "size_x_specific":context.get("size_x",0.0), | ||
1442 | 78 | "size_y_specific":context.get("size_y",0.0), | ||
1443 | 79 | "size_z_specific":context.get("size_z",0.0), | ||
1444 | 80 | "diameter_specific":context.get("diameter",0.0), | ||
1445 | 81 | } | ||
1446 | 82 | |||
1447 | 83 | try: | ||
1448 | 84 | result[i.id]["size_x_specific_delta"] = eval(i.mode.dx,space) | ||
1449 | 85 | result[i.id]["size_x_specific"] = result[i.id]["size_x_specific"] - result[i.id]["size_x_specific_delta"] | ||
1450 | 86 | except Exception, e: | ||
1451 | 87 | logger.notifyChannel('eval size', netsvc.LOG_WARNING, e) | ||
1452 | 88 | logger.notifyChannel('eval size', netsvc.LOG_WARNING, "transform x "+str(i.mode.dx)) | ||
1453 | 89 | try: | ||
1454 | 90 | result[i.id]["size_y_specific_delta"] = eval(i.mode.dy,space) | ||
1455 | 91 | result[i.id]["size_y_specific"] = result[i.id]["size_y_specific"] - result[i.id]["size_y_specific_delta"] | ||
1456 | 92 | except Exception, e: | ||
1457 | 93 | logger.notifyChannel('eval size', netsvc.LOG_WARNING, e) | ||
1458 | 94 | logger.notifyChannel('eval size', netsvc.LOG_WARNING, "transform y "+str(i.mode.dy)) | ||
1459 | 95 | try: | ||
1460 | 96 | result[i.id]["size_z_specific_delta"] = eval(i.mode.dz,space) | ||
1461 | 97 | result[i.id]["size_z_specific"] = result[i.id]["size_z_specific"] - result[i.id]["size_z_specific_delta"] | ||
1462 | 98 | except Exception, e: | ||
1463 | 99 | logger.notifyChannel('eval size', netsvc.LOG_WARNING, e) | ||
1464 | 100 | logger.notifyChannel('eval size', netsvc.LOG_WARNING, "transform z "+str(i.mode.dz)) | ||
1465 | 101 | try: | ||
1466 | 102 | result[i.id]["diameter_specific_delta"] = eval(i.mode.dd,space) | ||
1467 | 103 | result[i.id]["diameter_specific"] = result[i.id]["diameter_specific"] - result[i.id]["diameter_specific_delta"] | ||
1468 | 104 | except Exception, e: | ||
1469 | 105 | logger.notifyChannel('eval size', netsvc.LOG_WARNING, e) | ||
1470 | 106 | logger.notifyChannel('eval size', netsvc.LOG_WARNING, "transform d "+str(i.mode.dd)) | ||
1471 | 107 | |||
1472 | 108 | return result | ||
1473 | 109 | |||
1474 | 110 | _defaults = { | ||
1475 | 111 | } | ||
1476 | 112 | mrp_bom_component_rel() | ||
1477 | 113 | |||
1478 | 114 | def rounding(f, r): | ||
1479 | 115 | if not r: | ||
1480 | 116 | return f | ||
1481 | 117 | return round(f / r) * r | ||
1482 | 118 | |||
1483 | 119 | class mrp_bom(osv.osv): | ||
1484 | 120 | _inherit = 'mrp.bom' | ||
1485 | 121 | |||
1486 | 122 | # def __init__(self, pool, cr): | ||
1487 | 123 | # super(mrp_bom,self).__init__(pool,cr) | ||
1488 | 124 | # cr.execute('select count(*) from mrp_bom_childs_rel') | ||
1489 | 125 | # nb1 = cr.dictfetchall()[0]['count'] | ||
1490 | 126 | # cr.execute('select count(*) from mrp_bom_component_rel') | ||
1491 | 127 | # nb2 = cr.dictfetchall()[0]['count'] | ||
1492 | 128 | # if nb1 and not nb2 : | ||
1493 | 129 | # cr.execute('insert into mrp_bom_component_rel\ | ||
1494 | 130 | # (bom_id,component_id,qty)\ | ||
1495 | 131 | # select a.bom_id, a.child_id, b.product_qty\ | ||
1496 | 132 | # from mrp_bom_childs_rel a join mrp_bom b on a.bom_id = b.id') | ||
1497 | 133 | # | ||
1498 | 134 | # map_mode = { | ||
1499 | 135 | # 'bottom':['.DES.'], | ||
1500 | 136 | # 'top':['PLATEAU'], | ||
1501 | 137 | # 'back':['.DER.'], | ||
1502 | 138 | # 'front':['.FACE.'], | ||
1503 | 139 | # 'side':['.COT.'], | ||
1504 | 140 | # } | ||
1505 | 141 | # for i in map_mode: | ||
1506 | 142 | # for j in map_mode[i]: | ||
1507 | 143 | # cr.execute("update mrp_bom_component_rel\ | ||
1508 | 144 | # set mode = ( select id\ | ||
1509 | 145 | # from mrp_bom_component_mode\ | ||
1510 | 146 | # where name = '"+ustr(i)+"')\ | ||
1511 | 147 | # where id in (\ | ||
1512 | 148 | # select a.id\ | ||
1513 | 149 | # from mrp_bom_component_rel a join mrp_bom b on a.component_id = b.id join product_product c on b.product_id = c.id join product_template d on c.product_tmpl_id = d.id\ | ||
1514 | 150 | # where c.default_code like '%"+ustr(j)+"%');") | ||
1515 | 151 | |||
1516 | 152 | |||
1517 | 153 | def _child_compute(self, cr, uid, ids, name, arg, context={}): | ||
1518 | 154 | result = {} | ||
1519 | 155 | for bom in self.browse(cr, uid, ids, context=context): | ||
1520 | 156 | result[bom.id] = map(lambda x: x.component_id.id, bom.bom_components) | ||
1521 | 157 | if bom.bom_components: | ||
1522 | 158 | continue | ||
1523 | 159 | ok = ((name=='child_complete_ids') and (bom.product_id.supply_method=='produce')) | ||
1524 | 160 | if bom.type=='phantom' or ok: | ||
1525 | 161 | sids = self.pool.get('mrp.bom').search(cr, uid, [('bom_id','=',False),('product_id','=',bom.product_id.id)]) | ||
1526 | 162 | if sids: | ||
1527 | 163 | bom2 = self.pool.get('mrp.bom').browse(cr, uid, sids[0], context=context) | ||
1528 | 164 | result[bom.id] += map(lambda x: x.component_id.id, bom2.bom_components) | ||
1529 | 165 | return result | ||
1530 | 166 | |||
1531 | 167 | def _compute_type(self, cr, uid, ids, field_name, arg, context): | ||
1532 | 168 | res = dict(map(lambda x: (x,''), ids)) | ||
1533 | 169 | for line in self.browse(cr, uid, ids): | ||
1534 | 170 | if line.type=='phantom' and not line.bom_id: | ||
1535 | 171 | res[line.id] = 'set' | ||
1536 | 172 | continue | ||
1537 | 173 | if line.bom_lines or line.bom_components or line.type=='phantom': | ||
1538 | 174 | continue | ||
1539 | 175 | if line.product_id.supply_method=='produce': | ||
1540 | 176 | if line.product_id.procure_method=='make_to_stock': | ||
1541 | 177 | res[line.id] = 'stock' | ||
1542 | 178 | else: | ||
1543 | 179 | res[line.id] = 'order' | ||
1544 | 180 | return res | ||
1545 | 181 | |||
1546 | 182 | _columns = { | ||
1547 | 183 | #Dimensions | ||
1548 | 184 | 'size_x': fields.float('Width', digits=(16, 5)), | ||
1549 | 185 | 'size_y': fields.float('Length', digits=(16, 5)), | ||
1550 | 186 | 'size_z': fields.float('Thickness', digits=(16, 5)), | ||
1551 | 187 | 'density': fields.float('Density', digits=(16, 5)), | ||
1552 | 188 | 'shape' : fields.selection([('quadrangular', 'Quadrangular'), ('cylindrical', 'Cylindrical'), ('other', 'Other')], 'Shape', required=True), | ||
1553 | 189 | 'diameter' : fields.float('Diameter', digits=(16, 5)), | ||
1554 | 190 | 'weight': fields.float('Weight', digits=(16, 5)), | ||
1555 | 191 | #Production | ||
1556 | 192 | 'bom_type': fields.selection([('ass','Assemble'),('exp','Disassemble'),('cut','Cutting'),('cutinput','Cutting Input'),('picking','Picking'),('delay','Delay'),('control','Quality control')], 'BOM Type', required=True ), | ||
1557 | 193 | 'bom_lines_multi': fields.many2many('mrp.bom', 'mrp_bom_childs_rel', 'bom_id', 'child_id', 'Child BoMs'), | ||
1558 | 194 | 'bom_parent_multi': fields.many2many('mrp.bom', 'mrp_bom_childs_rel', 'child_id', 'bom_id', 'Parent BoMs'), | ||
1559 | 195 | 'bom_components': fields.one2many('mrp.bom.component.rel', 'bom_id', 'Components'), | ||
1560 | 196 | 'bom_components_parent': fields.one2many('mrp.bom.component.rel', 'component_id', 'Parent Components'), | ||
1561 | 197 | 'method': fields.function(_compute_type, string='Method', method=True, type='selection', selection=[('',''),('stock','On Stock'),('order','On Order'),('set','Set / Pack')]), | ||
1562 | 198 | 'type_group_ids': fields.many2many('product.type.property.option', 'mrp_bom_options_rel', 'bom_id', 'type_id', 'GOO',help="Used to map which property option is taken from previous product in assembly chain, or pushed to in dissambly chain"), | ||
1563 | 199 | 'child_complete_ids': fields.function(_child_compute,relation='mrp.bom', method=True, string="BoM Hyerarchy", type='many2many'), | ||
1564 | 200 | # 'group_property_ids': fields.many2many('mrp.property.group.option', 'mrp_bom_group_property_rel','bom_id', 'group_id', 'BOM Property Group Rel', help="Used to produce with properties not defined in sale order"), | ||
1565 | 201 | 'sub_product_ids': fields.many2many('mrp.subproduct', 'mrp_bom_subproduct_rel','bom_id', 'sub_id', 'Sub products'), | ||
1566 | 202 | } | ||
1567 | 203 | _defaults = { | ||
1568 | 204 | 'bom_type': lambda *a: 'ass' | ||
1569 | 205 | } | ||
1570 | 206 | |||
1571 | 207 | def compute_weight(self, cr, uid, id, product_id, size_x, size_y, size_z, shape, density, diameter): | ||
1572 | 208 | if product_id: | ||
1573 | 209 | product = self.pool.get('product.product').browse(cr, uid, product_id, context='') | ||
1574 | 210 | factor1 = product.uom_d_weight.factor | ||
1575 | 211 | factor2 = product.uom_id.factor | ||
1576 | 212 | factor3 = product.uom_d_size.factor | ||
1577 | 213 | factor4 = product.uom_s_size.factor | ||
1578 | 214 | return {'value': compute_w(cr, uid, factor1, factor2, factor3, factor4, size_x, size_y, size_z, shape, density, diameter)} | ||
1579 | 215 | |||
1580 | 216 | def onchange_product_id(self, cr, uid, ids, product_id, name, id, context={}): | ||
1581 | 217 | if product_id: | ||
1582 | 218 | w = self.pool.get('product.product').browse(cr, uid, [product_id], context)[0] | ||
1583 | 219 | factor1 = w.uom_d_weight.factor | ||
1584 | 220 | factor2 = w.uom_id.factor | ||
1585 | 221 | factor3 = w.uom_d_size.factor | ||
1586 | 222 | factor4 = w.uom_s_size.factor | ||
1587 | 223 | v = { | ||
1588 | 224 | 'product_uom':w.uom_id.id, | ||
1589 | 225 | 'product_uos':w.uos_id and w.uos_id.id or w.uom_id.id, | ||
1590 | 226 | 'size_x':w.size_x or w.size_x_tmpl, | ||
1591 | 227 | 'size_y':w.size_y or w.size_y_tmpl, | ||
1592 | 228 | 'size_z':w.size_z or w.size_z_tmpl, | ||
1593 | 229 | 'density':w.density or w.density_tmpl, | ||
1594 | 230 | 'shape':w.shape, | ||
1595 | 231 | 'diameter':w.diameter or w.diameter_tmpl, | ||
1596 | 232 | 'weight': compute_w(cr, uid, factor1, factor2, factor3, factor4, w.size_x or w.size_x_tmpl, w.size_y or w.size_y_tmpl, w.size_z or w.size_z_tmpl, w.shape, w.density or w.density_tmpl, w.diameter or w.diameter_tmpl)['weight'], | ||
1597 | 233 | 'name' : w.name, | ||
1598 | 234 | } | ||
1599 | 235 | if id : | ||
1600 | 236 | v['bom_id'] = id | ||
1601 | 237 | return {'value': v} | ||
1602 | 238 | return {} | ||
1603 | 239 | |||
1604 | 240 | def button_quality_control(self,cr,uid,ids,context={}): | ||
1605 | 241 | revision_obj = self.pool.get('stock.production.lot.revision') | ||
1606 | 242 | attachment_obj = self.pool.get('ir.attachment') | ||
1607 | 243 | for i in ids: | ||
1608 | 244 | lot = self.browse(cr,uid,i) | ||
1609 | 245 | if not lot.production_date: | ||
1610 | 246 | raise osv.except_osv(_('Error :"'),_("Missing production date")) | ||
1611 | 247 | |||
1612 | 248 | if lot.revisions: | ||
1613 | 249 | indice = (max([eval(revision.indice) for revision in lot.revisions]) or 0) + 1 | ||
1614 | 250 | else: | ||
1615 | 251 | indice = 1 | ||
1616 | 252 | vals = { | ||
1617 | 253 | 'name': _("certificate"), | ||
1618 | 254 | 'description': _("Conformity certificate generation"), | ||
1619 | 255 | 'indice': str(indice), | ||
1620 | 256 | 'date': datetime.datetime.now(), | ||
1621 | 257 | 'author_id': uid, | ||
1622 | 258 | 'lot_id': i, | ||
1623 | 259 | } | ||
1624 | 260 | revision_obj.create(cr,uid,vals) | ||
1625 | 261 | report = "stock.production.lot.conformity.certificate" | ||
1626 | 262 | ir_obj = self.pool.get('ir.actions.report.xml') | ||
1627 | 263 | report_xml_ids = ir_obj.search(cr, uid,[('report_name', '=', report)]) | ||
1628 | 264 | if report_xml_ids: | ||
1629 | 265 | report_xml = ir_obj.browse(cr, uid, report_xml_ids[0]) | ||
1630 | 266 | service = netsvc.LocalService("report."+report) | ||
1631 | 267 | (r, format) = service.create(cr, uid, [i], {}, {}) | ||
1632 | 268 | report_file = report_xml.name+'.'+format | ||
1633 | 269 | report_datas = base64.encodestring(r) | ||
1634 | 270 | data_attach = { | ||
1635 | 271 | 'name': _('Conformity_certificate_')+(lot.name or '')+"_V"+str(indice), | ||
1636 | 272 | 'datas':report_datas, | ||
1637 | 273 | 'datas_fname': _('Conformity_certificate_')+(lot.name or '')+"_V"+str(indice)+".pdf", | ||
1638 | 274 | 'description': _('Conformity_certificate_')+(lot.name or '')+"_V"+str(indice)+".pdf", | ||
1639 | 275 | 'res_model': 'stock.production.lot', | ||
1640 | 276 | 'res_id': i | ||
1641 | 277 | } | ||
1642 | 278 | attachment_obj.create(cr,uid, data_attach) | ||
1643 | 279 | self.write(cr,uid,ids,{'quality_control':True}) | ||
1644 | 280 | |||
1645 | 281 | return True | ||
1646 | 282 | |||
1647 | 283 | def _bom_find(self, cr, uid, product_id, product_uom, properties=[], group_properties_filter=[], bom_type='ass', level=0): | ||
1648 | 284 | level_str = "-"*level | ||
1649 | 285 | print_tab(level,"*"*50) | ||
1650 | 286 | print_tab(level,"_bom_find",product_id) | ||
1651 | 287 | print_tab(level,"_bom_find properties",properties) | ||
1652 | 288 | print_tab(level,"_bom_find group_properties_filter",group_properties_filter) | ||
1653 | 289 | pre = level_str+"_bom_find " | ||
1654 | 290 | print_tab(level,"_"*50) | ||
1655 | 291 | bom_result = False | ||
1656 | 292 | # Why searching on BoM without parent ? | ||
1657 | 293 | cr.execute('select id from mrp_bom where product_id=%s and bom_id is null and bom_type = %s order by sequence', (product_id,bom_type)) | ||
1658 | 294 | ids = map(lambda x: x[0], cr.fetchall()) | ||
1659 | 295 | |||
1660 | 296 | if not ids : | ||
1661 | 297 | print_tab(pre+"generate all") | ||
1662 | 298 | self.pool.get('product.product').generate_bom(cr,uid,[product_id]) | ||
1663 | 299 | print_tab(pre+"return bom_find after generate") | ||
1664 | 300 | print_tab("9"*50) | ||
1665 | 301 | return self._bom_find(cr, uid, product_id, product_uom, properties, group_properties_filter,level=level+1) | ||
1666 | 302 | |||
1667 | 303 | max_prop = 0 | ||
1668 | 304 | result = False | ||
1669 | 305 | |||
1670 | 306 | if not properties and not group_properties_filter: | ||
1671 | 307 | #Produit configurable: recherche du BOM principal | ||
1672 | 308 | print_tab(pre+"Produit configurable: recherche du BOM principal",product_id) | ||
1673 | 309 | for bom in self.pool.get('mrp.bom').browse(cr, uid, ids): | ||
1674 | 310 | not_filter = True | ||
1675 | 311 | for group_id in bom.type_group_ids: | ||
1676 | 312 | # print pre+"group_id ",group_id.id | ||
1677 | 313 | if group_id.execution_filter : | ||
1678 | 314 | # print pre+"group_id filter " | ||
1679 | 315 | not_filter = False | ||
1680 | 316 | if not_filter: | ||
1681 | 317 | result = bom.id | ||
1682 | 318 | break | ||
1683 | 319 | if not result : | ||
1684 | 320 | self.pool.get('product.product').generate_bom(cr,uid,[product_id]) | ||
1685 | 321 | return self._bom_find(cr, uid, product_id, product_uom, [], [],level=level+1) | ||
1686 | 322 | elif group_properties_filter : | ||
1687 | 323 | #Produit configurable: recherche du BOM liƩ au groupe de propriƩtƩ | ||
1688 | 324 | print_tab(pre+"Produit configurable: recherche du BOM liƩ au groupe de propriƩtƩ",product_id) | ||
1689 | 325 | # group_properties_filter = [i.type_group_id.id for i in self.pool.get('mrp.property.group.option').browse(cr, uid, group_properties_filter)] | ||
1690 | 326 | for bom in self.pool.get('mrp.bom').browse(cr, uid, ids): | ||
1691 | 327 | for group_id in bom.type_group_ids: | ||
1692 | 328 | print_tab(pre+"group_id ",group_id.id,group_id.name,group_id.execution_filter) | ||
1693 | 329 | print_tab(group_properties_filter) | ||
1694 | 330 | if group_id.execution_filter and group_id.id in group_properties_filter: | ||
1695 | 331 | result = bom.id | ||
1696 | 332 | break | ||
1697 | 333 | if not result : | ||
1698 | 334 | parent = self._bom_find(cr, uid, product_id, product_uom,level=level+1) | ||
1699 | 335 | self.pool.get('product.product').generate_bom(cr,uid,[product_id],{"rec":1,"product_qty":1,"options":group_properties_filter, 'bom_parent':parent})[product_id] | ||
1700 | 336 | print_tab(pre+"return bom_find") | ||
1701 | 337 | # # CA NE FONCTIONNE PAS AVEC CA MAIS CE N4EST PAS NORMAL | ||
1702 | 338 | print_tab("8"*50) | ||
1703 | 339 | return self._bom_find(cr, uid, product_id, product_uom, properties, group_properties_filter,level=level+1) | ||
1704 | 340 | else: | ||
1705 | 341 | #Produit avec configuration mrp originale | ||
1706 | 342 | print pre+"Produit avec configuration mrp originale" | ||
1707 | 343 | for bom in self.pool.get('mrp.bom').browse(cr, uid, ids): | ||
1708 | 344 | prop = 0 | ||
1709 | 345 | for prop_id in bom.property_ids: | ||
1710 | 346 | if prop_id.id in properties: | ||
1711 | 347 | prop+=1 | ||
1712 | 348 | if (prop>max_prop) or ((max_prop==0) and not result): | ||
1713 | 349 | result = bom.id | ||
1714 | 350 | max_prop = prop | ||
1715 | 351 | |||
1716 | 352 | print_tab(pre+"return result",result) | ||
1717 | 353 | print_tab("-"*50) | ||
1718 | 354 | return result | ||
1719 | 355 | |||
1720 | 356 | def _bom_explode(self, cr, uid, bom, factor, properties, addthis=False, level=1, group_properties=[], procurement_id=False, context={}): | ||
1721 | 357 | level_str = "-"*level | ||
1722 | 358 | print_tab(level,"_bom_explode") | ||
1723 | 359 | print_tab(level,"procurement_id",procurement_id) | ||
1724 | 360 | print_tab(level,"bom.id",bom.id) | ||
1725 | 361 | factor = factor / (bom.product_efficiency or 1.0) | ||
1726 | 362 | factor = rounding(factor, bom.product_rounding) | ||
1727 | 363 | if factor<bom.product_rounding: | ||
1728 | 364 | factor = bom.product_rounding | ||
1729 | 365 | result = [] | ||
1730 | 366 | result2 = [] | ||
1731 | 367 | phantom=False | ||
1732 | 368 | if "bom_tree" not in context: | ||
1733 | 369 | context["bom_tree"] = [] | ||
1734 | 370 | proc_obj = self.pool.get('procurement.order') | ||
1735 | 371 | bom_obj = self.pool.get('mrp.bom') | ||
1736 | 372 | proc_ptr = False | ||
1737 | 373 | if procurement_id: | ||
1738 | 374 | proc_ptr = proc_obj.browse(cr,uid,procurement_id) | ||
1739 | 375 | #======================================================================= | ||
1740 | 376 | # Filtres | ||
1741 | 377 | #======================================================================= | ||
1742 | 378 | filter = [] | ||
1743 | 379 | no_filter = [] | ||
1744 | 380 | property_group = [] | ||
1745 | 381 | for i in bom.type_group_ids : | ||
1746 | 382 | if i.execution_filter : | ||
1747 | 383 | filter.append(i.id) | ||
1748 | 384 | else: | ||
1749 | 385 | no_filter.append(i.id) | ||
1750 | 386 | |||
1751 | 387 | #======================================================================= | ||
1752 | 388 | # Phantom | ||
1753 | 389 | #======================================================================= | ||
1754 | 390 | if bom.type=='phantom' :#and not bom.bom_lines and not bom.bom_components: | ||
1755 | 391 | # print_tab(level,"phantom : product search :",bom.product_id.default_code,bom.product_id.name) | ||
1756 | 392 | # newbom = self._bom_find(cr, uid, bom.product_id.id, bom.product_uom.id, properties) | ||
1757 | 393 | # print_tab(level,"phantom : product ok:",self.browse(cr, uid, [newbom])[0].product_id.default_code,self.browse(cr, uid, [newbom])[0].product_id.name) | ||
1758 | 394 | # if newbom: | ||
1759 | 395 | # if bom.id not in context["bom_tree"]: | ||
1760 | 396 | # context["bom_tree"].append(bom.id) | ||
1761 | 397 | # | ||
1762 | 398 | # res = self._bom_explode(cr, uid, self.browse(cr, uid, [newbom])[0], factor*bom.product_qty, properties, addthis=True, level=level+10, group_properties=group_properties, procurement_id=procurement_id, context=context) | ||
1763 | 399 | # result = result + res[0] | ||
1764 | 400 | # result2 = result2 + res[1] | ||
1765 | 401 | # phantom=True | ||
1766 | 402 | # else: | ||
1767 | 403 | phantom=False | ||
1768 | 404 | #======================================================================= | ||
1769 | 405 | # Not phantom | ||
1770 | 406 | #======================================================================= | ||
1771 | 407 | if not phantom: | ||
1772 | 408 | print_tab(level,"not phantom : product :",bom.product_id.name) | ||
1773 | 409 | #=================================================================== | ||
1774 | 410 | # Bom without filter | ||
1775 | 411 | #=================================================================== | ||
1776 | 412 | if not filter : | ||
1777 | 413 | print_tab(level,"nomenclature sans filtre",context) | ||
1778 | 414 | print_tab(level,"addthis and ((not bom.bom_lines and not bom.bom_components) or bom.bom_type in ('cutinput'))", addthis,not bom.bom_lines,not bom.bom_components,bom.bom_type) | ||
1779 | 415 | print addthis,bom.bom_lines,bom.bom_components,bom.bom_type | ||
1780 | 416 | if addthis and ((not bom.bom_lines and not bom.bom_components) or bom.bom_type in ('cutinput')): | ||
1781 | 417 | print_tab(level,"*****ajout",bom.product_id.name) | ||
1782 | 418 | proc_property_group = proc_ptr and [i.type_group_id.id for i in proc_ptr.group_property_ids] or [] | ||
1783 | 419 | property_group = list(set(proc_property_group) & set(no_filter)) | ||
1784 | 420 | bom_property_ids = [] | ||
1785 | 421 | for bom_ptr in bom_obj.browse(cr,uid,context["bom_tree"]+[bom.id]): | ||
1786 | 422 | bom_property_ids.extend([i.id for i in bom_ptr.property_ids]) | ||
1787 | 423 | proc_property_ids = proc_ptr and [i.property_id.id for i in proc_ptr.group_property_ids if i.type_group_id.id in property_group] or [] | ||
1788 | 424 | property_ids = proc_ptr and [i.id for i in proc_ptr.property_ids] or [] | ||
1789 | 425 | property_ids = list(set(proc_property_ids) & set(property_ids)) | ||
1790 | 426 | property_ids += bom_property_ids | ||
1791 | 427 | property_ids = list(set(property_ids)) | ||
1792 | 428 | group_property_ids = proc_ptr and [i.id for i in proc_ptr.group_property_ids if i.type_group_id.id in property_group ] or [] | ||
1793 | 429 | vals = { | ||
1794 | 430 | 'name': bom.product_id.name, | ||
1795 | 431 | 'product_id': bom.product_id.id, | ||
1796 | 432 | 'product_qty': bom.product_qty * factor, | ||
1797 | 433 | 'product_uom': bom.product_uom.id, | ||
1798 | 434 | 'product_uos_qty': bom.product_uos and bom.product_uos_qty * factor or False, | ||
1799 | 435 | 'product_uos': bom.product_uos and bom.product_uos.id or False, | ||
1800 | 436 | 'property_ids': [(6,0,property_ids)], | ||
1801 | 437 | 'group_property_ids': [(6,0,group_property_ids)], | ||
1802 | 438 | 'density':bom.density, | ||
1803 | 439 | 'diameter':bom.diameter, | ||
1804 | 440 | 'shape':bom.shape, | ||
1805 | 441 | 'size_x':bom.size_x, | ||
1806 | 442 | 'size_y':bom.size_y, | ||
1807 | 443 | 'size_z':bom.size_z, | ||
1808 | 444 | 'diameter':bom.diameter, | ||
1809 | 445 | 'weight':bom.weight, | ||
1810 | 446 | 'bom_id':bom.id, | ||
1811 | 447 | } | ||
1812 | 448 | |||
1813 | 449 | print_tab(level,"++++++++++++++++++++++",) | ||
1814 | 450 | if "bom_line" in context : | ||
1815 | 451 | print_tab(level,"bom_line",context["bom_line"].bom_id.bom_type,context["bom_line"].bom_id.name) | ||
1816 | 452 | if context["bom_line"].bom_id.bom_type not in ('cutinput') : | ||
1817 | 453 | value_size = { | ||
1818 | 454 | 'size_x':bom.size_x, | ||
1819 | 455 | 'size_y':bom.size_y, | ||
1820 | 456 | 'size_z':bom.size_z, | ||
1821 | 457 | 'diameter':bom.diameter, | ||
1822 | 458 | 'specific_production': proc_ptr and proc_ptr.specific_production, | ||
1823 | 459 | 'note_production': proc_ptr and proc_ptr.note_production, | ||
1824 | 460 | 'size_x_specific': proc_ptr and proc_ptr.size_x_specific, | ||
1825 | 461 | 'size_y_specific': proc_ptr and proc_ptr.size_y_specific, | ||
1826 | 462 | 'size_z_specific': proc_ptr and proc_ptr.size_z_specific, | ||
1827 | 463 | 'diameter_specific': proc_ptr and proc_ptr.diameter_specific, | ||
1828 | 464 | 'size_x_specific_delta': proc_ptr and proc_ptr.size_x_specific_delta, | ||
1829 | 465 | 'size_y_specific_delta': proc_ptr and proc_ptr.size_y_specific_delta, | ||
1830 | 466 | 'size_z_specific_delta': proc_ptr and proc_ptr.size_z_specific_delta, | ||
1831 | 467 | 'diameter_specific_delta': proc_ptr and proc_ptr.diameter_specific_delta, | ||
1832 | 468 | } | ||
1833 | 469 | vals.update(context["bom_line"].compute_size(value_size)[context["bom_line"].id]) | ||
1834 | 470 | vals.update({ | ||
1835 | 471 | 'shape':bom.shape, | ||
1836 | 472 | 'specific_production': proc_ptr and proc_ptr.specific_production, | ||
1837 | 473 | 'note_production': proc_ptr and proc_ptr.note_production, | ||
1838 | 474 | }) | ||
1839 | 475 | else: | ||
1840 | 476 | if proc_ptr: | ||
1841 | 477 | value_size = { | ||
1842 | 478 | 'size_x':proc_ptr.size_x, | ||
1843 | 479 | 'size_y':proc_ptr.size_y, | ||
1844 | 480 | 'size_z':proc_ptr.size_z, | ||
1845 | 481 | 'diameter':proc_ptr.diameter, | ||
1846 | 482 | 'specific_production': proc_ptr.specific_production, | ||
1847 | 483 | 'note_production': proc_ptr.note_production, | ||
1848 | 484 | 'size_x_specific': proc_ptr.size_x_specific, | ||
1849 | 485 | 'size_y_specific': proc_ptr.size_y_specific, | ||
1850 | 486 | 'size_z_specific': proc_ptr.size_z_specific, | ||
1851 | 487 | 'diameter_specific': proc_ptr.diameter_specific, | ||
1852 | 488 | 'size_x_specific_delta': proc_ptr.size_x_specific_delta, | ||
1853 | 489 | 'size_y_specific_delta': proc_ptr.size_y_specific_delta, | ||
1854 | 490 | 'size_z_specific_delta': proc_ptr.size_z_specific_delta, | ||
1855 | 491 | 'diameter_specific_delta': proc_ptr.diameter_specific_delta, | ||
1856 | 492 | } | ||
1857 | 493 | vals.update(value_size) | ||
1858 | 494 | |||
1859 | 495 | result.append(vals) | ||
1860 | 496 | else: | ||
1861 | 497 | print_tab(level,"*****rec") | ||
1862 | 498 | if bom.id not in context["bom_tree"]: | ||
1863 | 499 | context["bom_tree"].append(bom.id) | ||
1864 | 500 | for bom2 in bom.bom_lines: | ||
1865 | 501 | print_tab(level,"\\"*50) | ||
1866 | 502 | res = self._bom_explode(cr, uid, bom2, factor, properties, addthis=True, level=level+10, group_properties=group_properties, procurement_id=procurement_id, context=context) | ||
1867 | 503 | print_tab(level,"/"*50) | ||
1868 | 504 | result = result + res[0] | ||
1869 | 505 | result2 = result2 + res[1] | ||
1870 | 506 | for bom2 in bom.bom_components: | ||
1871 | 507 | print_tab(level,"\\"*50) | ||
1872 | 508 | context_child = context.copy() | ||
1873 | 509 | context_child.update({'bom_line':bom2}) | ||
1874 | 510 | if bom2.component_id.id not in context["bom_tree"]: | ||
1875 | 511 | print_tab(level,"explode") | ||
1876 | 512 | res = self._bom_explode(cr, uid, bom2.component_id, factor, properties, addthis=True, level=level+10, group_properties=group_properties, procurement_id=procurement_id, context=context_child) | ||
1877 | 513 | result = result + res[0] | ||
1878 | 514 | result2 = result2 + res[1] | ||
1879 | 515 | print_tab(level,"/"*50) | ||
1880 | 516 | #=================================================================== | ||
1881 | 517 | # Bom with filter | ||
1882 | 518 | #=================================================================== | ||
1883 | 519 | if filter : | ||
1884 | 520 | print_tab(level,"nomenclature avec filtre") | ||
1885 | 521 | match = False | ||
1886 | 522 | table_match = {} | ||
1887 | 523 | for child in proc_ptr.procurement_line: | ||
1888 | 524 | print_tab(level,"check procuremnt") | ||
1889 | 525 | print_tab(level,"filter",filter) | ||
1890 | 526 | print_tab(level,"child.parent_option_id.type_group.id",child.parent_option_id.type_group.id) | ||
1891 | 527 | print_tab(level,"child.parent_option_id.product_id",child.parent_option_id.product_id.id,child.parent_option_id.product_id.name) | ||
1892 | 528 | print_tab(level,"bom.product_id",bom.product_id.id,bom.product_id.name) | ||
1893 | 529 | |||
1894 | 530 | |||
1895 | 531 | if child.parent_option_id.type_group.id in filter and child.parent_option_id.product_id == bom.product_id: | ||
1896 | 532 | print_tab(level,"ok") | ||
1897 | 533 | if addthis or(not bom.bom_lines and not bom.bom_components): | ||
1898 | 534 | print_tab(level,"*****ajout avec proc",bom.product_id.name) | ||
1899 | 535 | bom_property_ids = [] | ||
1900 | 536 | for bom_ptr in bom_obj.browse(cr,uid,context["bom_tree"]+[bom.id]): | ||
1901 | 537 | bom_property_ids.extend([i.id for i in bom_ptr.property_ids]) | ||
1902 | 538 | proc_property_ids = child and [i.property_id.id for i in child.group_property_ids if i.type_group_id.id in property_group] or [] | ||
1903 | 539 | property_ids = child and [i.id for i in child.property_ids] or [] | ||
1904 | 540 | property_ids = list(set(proc_property_ids) & set(property_ids)) | ||
1905 | 541 | property_ids += bom_property_ids | ||
1906 | 542 | property_ids = list(set(property_ids)) | ||
1907 | 543 | result.append( | ||
1908 | 544 | { | ||
1909 | 545 | 'name': bom.product_id.name, | ||
1910 | 546 | 'product_id': bom.product_id.id, | ||
1911 | 547 | 'product_qty': bom.product_qty * factor, | ||
1912 | 548 | 'product_uom': bom.product_uom.id, | ||
1913 | 549 | 'product_uos_qty': bom.product_uos and bom.product_uos_qty * factor or False, | ||
1914 | 550 | 'product_uos': bom.product_uos and bom.product_uos.id or False, | ||
1915 | 551 | 'property_ids': property_ids, | ||
1916 | 552 | 'group_property_ids': proc_property_ids, | ||
1917 | 553 | 'option_ids': [(6,0,[child.parent_option_id.id])], | ||
1918 | 554 | 'procurement_id': child.id, | ||
1919 | 555 | 'density':bom.density, | ||
1920 | 556 | 'shape':bom.shape, | ||
1921 | 557 | 'size_x':child.size_x_specific or bom.size_x, | ||
1922 | 558 | 'size_y':child.size_y_specific or bom.size_y, | ||
1923 | 559 | 'size_z':child.size_z_specific or bom.size_z, | ||
1924 | 560 | 'diameter':child.diameter_specific or bom.diameter, | ||
1925 | 561 | 'weight':bom.weight, | ||
1926 | 562 | }) | ||
1927 | 563 | else: | ||
1928 | 564 | print_tab(level,"*****rec", "addthis or(not bom.bom_lines and not bom.bom_components)",addthis,not bom.bom_lines,not bom.bom_components) | ||
1929 | 565 | for bom2 in bom.bom_lines: | ||
1930 | 566 | res = self._bom_explode(cr, uid, bom2, factor, properties, addthis=True, level=level+10, group_properties=group_properties, procurement_id=child.id, context=context) | ||
1931 | 567 | result = result + res[0] | ||
1932 | 568 | result2 = result2 + res[1] | ||
1933 | 569 | for bom2 in bom.bom_components: | ||
1934 | 570 | context_child = context.copy() | ||
1935 | 571 | context_child.update({'bom_line':bom2}) | ||
1936 | 572 | res = self._bom_explode(cr, uid, bom2.component_id, factor, properties, addthis=True, level=level+10, group_properties=group_properties, procurement_id=child.id, context=context_child) | ||
1937 | 573 | result = result + res[0] | ||
1938 | 574 | result2 = result2 + res[1] | ||
1939 | 575 | else: | ||
1940 | 576 | print_tab(level,"!ok",child.parent_option_id.type_group.id , filter,child.parent_option_id.product_id,bom.product_id) | ||
1941 | 577 | else: | ||
1942 | 578 | #=================================================================== | ||
1943 | 579 | # Add routing of bom phantom | ||
1944 | 580 | #=================================================================== | ||
1945 | 581 | if bom.routing_id: | ||
1946 | 582 | for wc_use in bom.routing_id.workcenter_lines: | ||
1947 | 583 | wc = wc_use.workcenter_id | ||
1948 | 584 | d, m = divmod(factor, wc_use.workcenter_id.capacity_per_cycle) | ||
1949 | 585 | mult = (d + (m and 1.0 or 0.0)) | ||
1950 | 586 | cycle = mult * wc_use.cycle_nbr | ||
1951 | 587 | result2.append({ | ||
1952 | 588 | 'name': bom.routing_id.name, | ||
1953 | 589 | 'workcenter_id': wc.id, | ||
1954 | 590 | 'sequence': level+(wc_use.sequence or 0), | ||
1955 | 591 | 'cycle': cycle, | ||
1956 | 592 | 'hour': float(wc_use.hour_nbr*mult + (wc.time_start+wc.time_stop+cycle*wc.time_cycle) * (wc.time_efficiency or 1.0)), | ||
1957 | 593 | }) | ||
1958 | 594 | return result, result2 | ||
1959 | 595 | |||
1960 | 596 | # level_ = "-----------"+("-"*level) | ||
1961 | 597 | # if level == 50 : raise | ||
1962 | 598 | # print "*"*50 | ||
1963 | 599 | # print level_+"***_bom_explode",level,bom.name,[ i.id for i in bom.bom_lines],[ i.component_id.id for i in bom.bom_components],addthis | ||
1964 | 600 | # production_obj = self.pool.get('mrp.production') | ||
1965 | 601 | # procurement_obj = self.pool.get('procurement.order') | ||
1966 | 602 | # | ||
1967 | 603 | # procurement = False | ||
1968 | 604 | # production = False | ||
1969 | 605 | # if procurement_id: | ||
1970 | 606 | # procurement = procurement_obj.browse(cr,uid,procurement_id) | ||
1971 | 607 | # if procurement.production_id: | ||
1972 | 608 | # production = procurement.production_id | ||
1973 | 609 | # | ||
1974 | 610 | # factor = factor / (bom.product_efficiency or 1.0) | ||
1975 | 611 | # factor = rounding(factor, bom.product_rounding) | ||
1976 | 612 | # if factor<bom.product_rounding: | ||
1977 | 613 | # factor = bom.product_rounding | ||
1978 | 614 | # result = [] | ||
1979 | 615 | # result2 = [] | ||
1980 | 616 | # result3 = [] | ||
1981 | 617 | # phantom=False | ||
1982 | 618 | # match = False | ||
1983 | 619 | # no_rec = False | ||
1984 | 620 | # if bom.type=='phantom': | ||
1985 | 621 | # print level_+"phantom" | ||
1986 | 622 | # for bom2 in bom.bom_lines: | ||
1987 | 623 | # res = self._bom_explode(cr, uid, bom2, factor, properties, addthis=True, level=level+10, group_properties=group_properties, procurement_id=procurement_id) | ||
1988 | 624 | # result = result + res[0] | ||
1989 | 625 | # result2 = result2 + res[1] | ||
1990 | 626 | # for bom2 in bom.bom_components: | ||
1991 | 627 | # res = self._bom_explode(cr, uid, bom2.component_id, factor, properties, addthis=True, level=level+10, group_properties=group_properties, procurement_id=procurement_id) | ||
1992 | 628 | # result = result + res[0] | ||
1993 | 629 | # result2 = result2 + res[1] | ||
1994 | 630 | # else: | ||
1995 | 631 | # print level_+"not phantom",procurement,bom,bom.type_group_ids | ||
1996 | 632 | # filter = [] | ||
1997 | 633 | # for i in bom.type_group_ids : | ||
1998 | 634 | # print i,i.name,i.execution_filter | ||
1999 | 635 | # if i.execution_filter : | ||
2000 | 636 | # filter.append(i.id) | ||
2001 | 637 | # if filter : | ||
2002 | 638 | # if procurement and procurement.parent_option_id and procurement.parent_option_id.type_group : | ||
2003 | 639 | # print level_+"proc group ",procurement.parent_option_id.type_group.id | ||
2004 | 640 | # print level_+"filter ",filter | ||
2005 | 641 | # if procurement and procurement.parent_option_id and procurement.parent_option_id.type_group and procurement.parent_option_id.type_group.id in filter: | ||
2006 | 642 | # result.append( | ||
2007 | 643 | # { | ||
2008 | 644 | # 'name': bom.product_id.name, | ||
2009 | 645 | # 'product_id': bom.product_id.id, | ||
2010 | 646 | # 'product_qty': bom.product_qty * factor, | ||
2011 | 647 | # 'product_uom': bom.product_uom.id, | ||
2012 | 648 | # 'product_uos_qty': bom.product_uos and bom.product_uos_qty * factor or False, | ||
2013 | 649 | # 'product_uos': bom.product_uos and bom.product_uos.id or False, | ||
2014 | 650 | # 'property_ids': [(6,0,[i.id for i in procurement.property_ids])], | ||
2015 | 651 | # 'group_property_ids': [(6,0,[i.id for i in procurement.group_property_ids])], | ||
2016 | 652 | # 'procurement_ids': [(4,procurement_id)], | ||
2017 | 653 | # }) | ||
2018 | 654 | # no_rec = True | ||
2019 | 655 | # else: | ||
2020 | 656 | # if procurement : | ||
2021 | 657 | # result.append( | ||
2022 | 658 | # { | ||
2023 | 659 | # 'name': bom.product_id.name, | ||
2024 | 660 | # 'product_id': bom.product_id.id, | ||
2025 | 661 | # 'product_qty': bom.product_qty * factor, | ||
2026 | 662 | # 'product_uom': bom.product_uom.id, | ||
2027 | 663 | # 'product_uos_qty': bom.product_uos and bom.product_uos_qty * factor or False, | ||
2028 | 664 | # 'product_uos': bom.product_uos and bom.product_uos.id or False, | ||
2029 | 665 | # 'property_ids': [(6,0,[i.id for i in procurement.property_ids])], | ||
2030 | 666 | # 'group_property_ids': [(6,0,[i.id for i in procurement.group_property_ids])], | ||
2031 | 667 | # 'procurement_ids': [(4,procurement_id)], | ||
2032 | 668 | # }) | ||
2033 | 669 | # no_rec = True | ||
2034 | 670 | ## for bom2 in bom.bom_lines: | ||
2035 | 671 | ## if bom2.product_id.supply_method in ('produce'): | ||
2036 | 672 | ## if production: | ||
2037 | 673 | ## vals = { | ||
2038 | 674 | ## 'name':'PROD2:'+production.name, | ||
2039 | 675 | ## 'date_planned': production.date_planned, | ||
2040 | 676 | ## 'product_id': bom2.product_id.id, | ||
2041 | 677 | ## 'product_qty': bom2.product_qty, | ||
2042 | 678 | ## 'product_uom': bom2.product_uom.id, | ||
2043 | 679 | ## 'product_uos_qty': bom2.product_uos and line.product_uos_qty or False, | ||
2044 | 680 | ## 'product_uos': bom2.product_uos and line.product_uos.id or False, | ||
2045 | 681 | ## 'location_id': production.location_src_id.id, | ||
2046 | 682 | ## 'location_dest_id': bom2.product_id.product_tmpl_id.property_stock_production.id, | ||
2047 | 683 | ### 'move_dest_id': res_final_id, | ||
2048 | 684 | ## 'state': 'waiting', | ||
2049 | 685 | ### 'prodlot_id': line_prodlot_id, | ||
2050 | 686 | ## } | ||
2051 | 687 | ## result3.append(vals) | ||
2052 | 688 | ## for bom2 in bom.bom_components: | ||
2053 | 689 | ## bom2=bom2.component_id | ||
2054 | 690 | ## if bom2.product_id.supply_method in ('produce'): | ||
2055 | 691 | ## if production: | ||
2056 | 692 | ## vals = { | ||
2057 | 693 | ## 'name':'PROD2:'+production.name, | ||
2058 | 694 | ## 'date_planned': production.date_planned, | ||
2059 | 695 | ## 'product_id': bom2.product_id.id, | ||
2060 | 696 | ## 'product_qty': bom2.product_qty, | ||
2061 | 697 | ## 'product_uom': bom2.product_uom.id, | ||
2062 | 698 | ## 'product_uos_qty': bom2.product_uos and line.product_uos_qty or False, | ||
2063 | 699 | ## 'product_uos': bom2.product_uos and line.product_uos.id or False, | ||
2064 | 700 | ## 'location_id': production.location_src_id.id, | ||
2065 | 701 | ## 'location_dest_id': bom2.product_id.product_tmpl_id.property_stock_production.id, | ||
2066 | 702 | ### 'move_dest_id': res_final_id, | ||
2067 | 703 | ## 'state': 'waiting', | ||
2068 | 704 | ### 'prodlot_id': line_prodlot_id, | ||
2069 | 705 | ## } | ||
2070 | 706 | ## result3.append(vals) | ||
2071 | 707 | # if not no_rec: | ||
2072 | 708 | # for bom2 in bom.bom_lines: | ||
2073 | 709 | # res = self._bom_explode(cr, uid, bom2, factor, properties, addthis=True, level=level+10) | ||
2074 | 710 | # result = result + res[0] | ||
2075 | 711 | # result2 = result2 + res[1] | ||
2076 | 712 | # for bom2 in bom.bom_components: | ||
2077 | 713 | # res = self._bom_explode(cr, uid, bom2.component_id, factor, properties, addthis=True, level=level+10, group_properties=group_properties, procurement_id=procurement_id) | ||
2078 | 714 | # result = result + res[0] | ||
2079 | 715 | # result2 = result2 + res[1] | ||
2080 | 716 | # print level_+"result ---------> ",result | ||
2081 | 717 | # | ||
2082 | 718 | # return result, result2, [] | ||
2083 | 719 | |||
2084 | 720 | def gen_graph(self,cr,uid,ids,context): | ||
2085 | 721 | bom_node = [] | ||
2086 | 722 | bom_link = [] | ||
2087 | 723 | gen_graph_tab = [] | ||
2088 | 724 | gen_graph_desc_tab = [] | ||
2089 | 725 | gen_graph_asc_tab = [] | ||
2090 | 726 | def gen_graph(bom): | ||
2091 | 727 | # print "gen_graph" | ||
2092 | 728 | result = "" | ||
2093 | 729 | if bom.id not in gen_graph_tab: | ||
2094 | 730 | gen_graph_tab.append(bom.id) | ||
2095 | 731 | result+=rec_gen_graph_desc(bom) | ||
2096 | 732 | result+=rec_gen_graph_asc(bom) | ||
2097 | 733 | return result | ||
2098 | 734 | |||
2099 | 735 | def rec_gen_graph_desc(bom): | ||
2100 | 736 | # print "rec_gen_graph_desc" | ||
2101 | 737 | result = "" | ||
2102 | 738 | if bom.id not in bom_node: | ||
2103 | 739 | bom_node.append(bom.id) | ||
2104 | 740 | result += str(bom.id)+" [label=\""+bom.name+"\"] "+";\n" | ||
2105 | 741 | for line in bom.bom_components: | ||
2106 | 742 | if str(bom.id)+"_"+str(line.component_id.id) not in bom_link: | ||
2107 | 743 | bom_link.append(str(bom.id)+"_"+str(line.component_id.id)) | ||
2108 | 744 | result += str(bom.id)+" -> "+str(line.component_id.id)+";\n" | ||
2109 | 745 | result += rec_gen_graph_desc(line.component_id) | ||
2110 | 746 | result += gen_graph(line.component_id) | ||
2111 | 747 | return result | ||
2112 | 748 | |||
2113 | 749 | def rec_gen_graph_asc(bom): | ||
2114 | 750 | # print "rec_gen_graph_asc" | ||
2115 | 751 | result = "" | ||
2116 | 752 | if bom.id not in bom_node: | ||
2117 | 753 | bom_node.append(bom.id) | ||
2118 | 754 | result += str(bom.id)+" [label=\""+bom.name+"\"] "+";\n" | ||
2119 | 755 | for line in bom.bom_components_parent: | ||
2120 | 756 | if str(line.bom_id.id)+"_"+str(bom.id) not in bom_link: | ||
2121 | 757 | bom_link.append(str(line.id)+"_"+str(bom.id)) | ||
2122 | 758 | result += str(line.bom_id.id)+" -> "+str(bom.id)+";\n" | ||
2123 | 759 | result += rec_gen_graph_asc(line.bom_id) | ||
2124 | 760 | result += gen_graph(line.bom_id) | ||
2125 | 761 | return result | ||
2126 | 762 | |||
2127 | 763 | #print "digraph G {" | ||
2128 | 764 | #for bom in self.browse(cr,uid,ids,context): | ||
2129 | 765 | # print gen_graph(bom) | ||
2130 | 766 | #print "}" | ||
2131 | 767 | return True | ||
2132 | 768 | |||
2133 | 769 | def gen_graph_dot(self,cr,uid,ids,context={}): | ||
2134 | 770 | |||
2135 | 771 | try: | ||
2136 | 772 | import pydot | ||
2137 | 773 | except Exception,e: | ||
2138 | 774 | _logger.notifyChannel('workflow', netsvc.LOG_WARNING, | ||
2139 | 775 | 'Import Error for pydot, you will not be able to render workflows\n' | ||
2140 | 776 | 'Consider Installing PyDot or dependencies: http://dkbza.org/pydot.html') | ||
2141 | 777 | raise e | ||
2142 | 778 | |||
2143 | 779 | self.done = False | ||
2144 | 780 | |||
2145 | 781 | graph = pydot.Dot(fontsize='16', label="""\\\n\\nBOM: """, | ||
2146 | 782 | size='10.7, 7.3', center='1', ratio='auto', rotate='90', rankdir='LR' | ||
2147 | 783 | ) | ||
2148 | 784 | |||
2149 | 785 | bom_node = [] | ||
2150 | 786 | bom_link = [] | ||
2151 | 787 | gen_graph_tab = [] | ||
2152 | 788 | gen_graph_desc_tab = [] | ||
2153 | 789 | gen_graph_asc_tab = [] | ||
2154 | 790 | def gen_graph(bom): | ||
2155 | 791 | result = "" | ||
2156 | 792 | if bom.id not in gen_graph_tab: | ||
2157 | 793 | gen_graph_tab.append(bom.id) | ||
2158 | 794 | result+=rec_gen_graph_desc(bom) | ||
2159 | 795 | # result+=rec_gen_graph_asc(bom) | ||
2160 | 796 | return result | ||
2161 | 797 | |||
2162 | 798 | def rec_gen_graph_desc(bom): | ||
2163 | 799 | result = "" | ||
2164 | 800 | if bom.id not in bom_node: | ||
2165 | 801 | bom_node.append(bom.id) | ||
2166 | 802 | args = {'label':bom.product_id and bom.product_id.default_code or "E"} | ||
2167 | 803 | graph.add_node(pydot.Node(str(bom.id), **args)) | ||
2168 | 804 | for line in bom.bom_components: | ||
2169 | 805 | if str(bom.id)+"_"+str(line.component_id.id) not in bom_link: | ||
2170 | 806 | bom_link.append(str(bom.id)+"_"+str(line.component_id.id)) | ||
2171 | 807 | label = "|" | ||
2172 | 808 | for i in bom.type_group_ids : | ||
2173 | 809 | if i.execution_filter: | ||
2174 | 810 | if label : | ||
2175 | 811 | label+= "|" | ||
2176 | 812 | label+= i.name | ||
2177 | 813 | args = {'label':label} | ||
2178 | 814 | graph.add_edge(pydot.Edge( str(bom.id) ,str(line.component_id.id), fontsize='10', **args)) | ||
2179 | 815 | result += rec_gen_graph_desc(line.component_id) | ||
2180 | 816 | # result += gen_graph(line) | ||
2181 | 817 | return result | ||
2182 | 818 | |||
2183 | 819 | def rec_gen_graph_asc(bom): | ||
2184 | 820 | result = "" | ||
2185 | 821 | if bom.id not in bom_node: | ||
2186 | 822 | bom_node.append(bom.id) | ||
2187 | 823 | args = {'label':bom.product_id and bom.product_id.default_code or "E"} | ||
2188 | 824 | graph.add_node(pydot.Node(str(bom.id), **args)) | ||
2189 | 825 | for line in bom.bom_components_parent: | ||
2190 | 826 | if str(line.bom_id.id)+"_"+str(bom.id) not in bom_link: | ||
2191 | 827 | bom_link.append(str(line.bom_id.id)+"_"+str(bom.id)) | ||
2192 | 828 | args = {'label':''} | ||
2193 | 829 | graph.add_edge(pydot.Edge( str(line.bom_id.id) ,str(bom.id), fontsize='10', **args)) | ||
2194 | 830 | result += rec_gen_graph_asc(line.bom_id) | ||
2195 | 831 | # result += gen_graph(line) | ||
2196 | 832 | return result | ||
2197 | 833 | |||
2198 | 834 | |||
2199 | 835 | for bom in self.browse(cr,uid,ids,context): | ||
2200 | 836 | gen_graph(bom) | ||
2201 | 837 | |||
2202 | 838 | return graph | ||
2203 | 839 | |||
2204 | 840 | |||
2205 | 841 | |||
2206 | 842 | mrp_bom() | ||
2207 | 843 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | ||
2208 | 0 | \ No newline at end of file | 844 | \ No newline at end of file |
2209 | 1 | 845 | ||
2210 | === added file 'asperience_configurator_mrp/mrp_data.xml' | |||
2211 | --- asperience_configurator_mrp/mrp_data.xml 1970-01-01 00:00:00 +0000 | |||
2212 | +++ asperience_configurator_mrp/mrp_data.xml 2017-12-01 14:57:12 +0000 | |||
2213 | @@ -0,0 +1,85 @@ | |||
2214 | 1 | <?xml version="1.0" encoding="utf-8"?> | ||
2215 | 2 | <openerp> | ||
2216 | 3 | <data noupdate="0"> | ||
2217 | 4 | |||
2218 | 5 | <!-- | ||
2219 | 6 | Description Dx Dy Dz Dd | ||
2220 | 7 | [Modifier] side Dz Dx [Supprimer] | ||
2221 | 8 | [Modifier] top Dy Dx [Supprimer] | ||
2222 | 9 | [Modifier] bottom Dy Dx [Supprimer] | ||
2223 | 10 | [Modifier] back Dy Dz [Supprimer] | ||
2224 | 11 | [Modifier] front Dy Dz--> | ||
2225 | 12 | <record id="mode_side" model="mrp.bom.component.mode"> | ||
2226 | 13 | <field name="name" >side</field> | ||
2227 | 14 | <field name="dx" eval="'Dy'" /> | ||
2228 | 15 | <field name="dy" eval="'Dz'" /> | ||
2229 | 16 | <field name="dz" eval="''" /> | ||
2230 | 17 | <field name="dd" eval="''" /> | ||
2231 | 18 | </record> | ||
2232 | 19 | <record id="mode_top" model="mrp.bom.component.mode"> | ||
2233 | 20 | <field name="name">top</field> | ||
2234 | 21 | <field name="dx" eval="'Dx'" /> | ||
2235 | 22 | <field name="dy" eval="'Dy'" /> | ||
2236 | 23 | <field name="dz" eval="''" /> | ||
2237 | 24 | <field name="dd" eval="''" /> | ||
2238 | 25 | </record> | ||
2239 | 26 | <record id="mode_bottom" model="mrp.bom.component.mode"> | ||
2240 | 27 | <field name="name" >bottom</field> | ||
2241 | 28 | <field name="dx" eval="'Dx'" /> | ||
2242 | 29 | <field name="dy" eval="'Dy'" /> | ||
2243 | 30 | <field name="dz" eval="''" /> | ||
2244 | 31 | <field name="dd" eval="''" /> | ||
2245 | 32 | </record> | ||
2246 | 33 | <record id="mode_back" model="mrp.bom.component.mode"> | ||
2247 | 34 | <field name="name" >back</field> | ||
2248 | 35 | <field name="dx" eval="'Dx'" /> | ||
2249 | 36 | <field name="dy" eval="'Dz'" /> | ||
2250 | 37 | <field name="dz" eval="''" /> | ||
2251 | 38 | <field name="dd" eval="''" /> | ||
2252 | 39 | </record> | ||
2253 | 40 | <record id="mode_front" model="mrp.bom.component.mode"> | ||
2254 | 41 | <field name="name" >front</field> | ||
2255 | 42 | <field name="dx" eval="'Dx'" /> | ||
2256 | 43 | <field name="dy" eval="'Dz'" /> | ||
2257 | 44 | <field name="dz" eval="''" /> | ||
2258 | 45 | <field name="dd" eval="''" /> | ||
2259 | 46 | </record> | ||
2260 | 47 | <!-- | ||
2261 | 48 | <record id="mode_side" model="mrp.bom.component.mode"> | ||
2262 | 49 | <field name="name" >side</field> | ||
2263 | 50 | <field name="dx" eval="'Dy'" /> | ||
2264 | 51 | <field name="dy" eval="''" /> | ||
2265 | 52 | <field name="dz" eval="''" /> | ||
2266 | 53 | <field name="dd" eval="''" /> | ||
2267 | 54 | </record> | ||
2268 | 55 | <record id="mode_top" model="mrp.bom.component.mode"> | ||
2269 | 56 | <field name="name">top</field> | ||
2270 | 57 | <field name="dx" eval="'Dx'" /> | ||
2271 | 58 | <field name="dy" eval="'Dy'" /> | ||
2272 | 59 | <field name="dz" eval="'Dz'" /> | ||
2273 | 60 | <field name="dd" eval="''" /> | ||
2274 | 61 | </record> | ||
2275 | 62 | <record id="mode_bottom" model="mrp.bom.component.mode"> | ||
2276 | 63 | <field name="name" >bottom</field> | ||
2277 | 64 | <field name="dx" eval="'Dx'" /> | ||
2278 | 65 | <field name="dy" eval="'Dy'" /> | ||
2279 | 66 | <field name="dz" eval="'Dz'" /> | ||
2280 | 67 | <field name="dd" eval="''" /> | ||
2281 | 68 | </record> | ||
2282 | 69 | <record id="mode_back" model="mrp.bom.component.mode"> | ||
2283 | 70 | <field name="name" >back</field> | ||
2284 | 71 | <field name="dx" eval="''" /> | ||
2285 | 72 | <field name="dy" eval="'Dx'" /> | ||
2286 | 73 | <field name="dz" eval="''" /> | ||
2287 | 74 | <field name="dd" eval="''" /> | ||
2288 | 75 | </record> | ||
2289 | 76 | <record id="mode_front" model="mrp.bom.component.mode"> | ||
2290 | 77 | <field name="name" >front</field> | ||
2291 | 78 | <field name="dx" eval="''" /> | ||
2292 | 79 | <field name="dy" eval="'Dx'" /> | ||
2293 | 80 | <field name="dz" eval="''" /> | ||
2294 | 81 | <field name="dd" eval="''" /> | ||
2295 | 82 | </record> | ||
2296 | 83 | --> | ||
2297 | 84 | </data> | ||
2298 | 85 | </openerp> | ||
2299 | 0 | 86 | ||
2300 | === added file 'asperience_configurator_mrp/mrp_procurement.pyc' | |||
2301 | 1 | Binary files asperience_configurator_mrp/mrp_procurement.pyc 1970-01-01 00:00:00 +0000 and asperience_configurator_mrp/mrp_procurement.pyc 2017-12-01 14:57:12 +0000 differ | 87 | Binary files asperience_configurator_mrp/mrp_procurement.pyc 1970-01-01 00:00:00 +0000 and asperience_configurator_mrp/mrp_procurement.pyc 2017-12-01 14:57:12 +0000 differ |
2302 | === added file 'asperience_configurator_mrp/mrp_production.py' | |||
2303 | --- asperience_configurator_mrp/mrp_production.py 1970-01-01 00:00:00 +0000 | |||
2304 | +++ asperience_configurator_mrp/mrp_production.py 2017-12-01 14:57:12 +0000 | |||
2305 | @@ -0,0 +1,593 @@ | |||
2306 | 1 | # -*- encoding: utf-8 -*- | ||
2307 | 2 | ############################################################################## | ||
2308 | 3 | # | ||
2309 | 4 | # OpenERP, Open Source Management Solution | ||
2310 | 5 | # Copyright (C) 2007-2014 ASPerience SARL (<http://www.asperience.fr>). | ||
2311 | 6 | # All Rights Reserved | ||
2312 | 7 | # | ||
2313 | 8 | # This program is free software: you can redistribute it and/or modify | ||
2314 | 9 | # it under the terms of the GNU General Public License as published by | ||
2315 | 10 | # the Free Software Foundation, either version 3 of the License, or | ||
2316 | 11 | # (at your option) any later version. | ||
2317 | 12 | # | ||
2318 | 13 | # This program is distributed in the hope that it will be useful, | ||
2319 | 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2320 | 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2321 | 16 | # GNU General Public License for more details. | ||
2322 | 17 | # | ||
2323 | 18 | # You should have received a copy of the GNU General Public License | ||
2324 | 19 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
2325 | 20 | # | ||
2326 | 21 | ############################################################################## | ||
2327 | 22 | from openerp.osv import fields,osv | ||
2328 | 23 | import inspect | ||
2329 | 24 | |||
2330 | 25 | class mrp_production(osv.osv): | ||
2331 | 26 | _inherit = 'mrp.production' | ||
2332 | 27 | |||
2333 | 28 | def _size(self, cr, uid, ids, field_name, arg, context): | ||
2334 | 29 | res = {} | ||
2335 | 30 | for proc in self.browse(cr, uid, ids): | ||
2336 | 31 | res[proc.id] = {'size_x': 0.0, 'size_y': 0.0, 'size_z': 0.0 , 'diameter': 0.0} | ||
2337 | 32 | if proc.product_id: | ||
2338 | 33 | res[proc.id]['size_x'] = proc.product_id.size_x or proc.product_id.product_tmpl_id.size_x_tmpl or 0.0 | ||
2339 | 34 | res[proc.id]['size_y'] = proc.product_id.size_y or proc.product_id.product_tmpl_id.size_y_tmpl or 0.0 | ||
2340 | 35 | res[proc.id]['size_z'] = proc.product_id.size_z or proc.product_id.product_tmpl_id.size_z_tmpl or 0.0 | ||
2341 | 36 | res[proc.id]['diameter'] = proc.product_id.diameter or proc.product_id.product_tmpl_id.diameter_tmpl or 0.0 | ||
2342 | 37 | return res | ||
2343 | 38 | |||
2344 | 39 | def action_compute(self, cr, uid, ids, context={}): | ||
2345 | 40 | print "action_compute",ids,context | ||
2346 | 41 | results = [] | ||
2347 | 42 | for production in self.browse(cr, uid, ids): | ||
2348 | 43 | cr.execute('delete from mrp_production_product_line where production_id=%s', (production.id,)) | ||
2349 | 44 | cr.execute('delete from mrp_production_workcenter_line where production_id=%s', (production.id,)) | ||
2350 | 45 | bom_point = production.bom_id | ||
2351 | 46 | bom_id = production.bom_id.id | ||
2352 | 47 | filter = [] | ||
2353 | 48 | properties = [] | ||
2354 | 49 | group_properties = [] | ||
2355 | 50 | |||
2356 | 51 | #Lors de la crƩation du mrp.production, il faut s'assurer que tous les procurements sommƩs sur la production | ||
2357 | 52 | #ont les mĆŖmes propriĆ©tĆ©s et les mĆŖmes groupes de propriĆ©tĆ©s | ||
2358 | 53 | if production and production.procurement_ids and production.procurement_ids[0].parent_option_id and production.procurement_ids[0].parent_option_id.type_group : | ||
2359 | 54 | filter.append(production.procurement_ids[0].parent_option_id.type_group.id) | ||
2360 | 55 | group_properties = [i.id for i in production.procurement_ids[0].group_property_ids] | ||
2361 | 56 | # #=============================================================== | ||
2362 | 57 | # # CrƩation des lignes de production | ||
2363 | 58 | # #=============================================================== | ||
2364 | 59 | # for procurement in production.procurement_ids: | ||
2365 | 60 | # if procurement.bom_id and procurement.bom_id.bom_type in ('cut'): | ||
2366 | 61 | # vals = { | ||
2367 | 62 | # 'production_id': production.id, | ||
2368 | 63 | # 'procurement_id': procurement.id, | ||
2369 | 64 | # 'bom_id':procurement.move_id.prodlot_id.mrp_production_id.bom_id.id, | ||
2370 | 65 | # | ||
2371 | 66 | # 'name': procurement.move_id.prodlot_id.mrp_production_id.bom_id.product_id.name, | ||
2372 | 67 | # 'product_id': procurement.move_id.prodlot_id.mrp_production_id.bom_id.product_id.id, | ||
2373 | 68 | # 'product_qty': procurement.move_id.prodlot_id.mrp_production_id.bom_id.product_qty, | ||
2374 | 69 | # 'product_uom': procurement.move_id.prodlot_id.mrp_production_id.bom_id.product_uom.id, | ||
2375 | 70 | # 'product_uos_qty': procurement.move_id.prodlot_id.mrp_production_id.bom_id.product_uos and bom.product_uos_qty * factor or False, | ||
2376 | 71 | # 'product_uos': procurement.move_id.prodlot_id.mrp_production_id.bom_id.product_uos and bom.product_uos.id or False, | ||
2377 | 72 | # 'property_ids': [i.id for i in procurement.property_ids], | ||
2378 | 73 | # 'group_property_ids': [i.id for i in procurement.group_property_ids], | ||
2379 | 74 | # 'density':procurement.move_id.prodlot_id.mrp_production_id.bom_id.density, | ||
2380 | 75 | # 'diameter':procurement.move_id.prodlot_id.mrp_production_id.bom_id.diameter, | ||
2381 | 76 | # 'shape':procurement.move_id.prodlot_id.mrp_production_id.bom_id.shape, | ||
2382 | 77 | # 'weight':procurement.move_id.prodlot_id.mrp_production_id.bom_id.weight, | ||
2383 | 78 | # 'size_x':procurement.size_x, | ||
2384 | 79 | # 'size_y':procurement.size_y, | ||
2385 | 80 | # 'size_z':procurement.size_z, | ||
2386 | 81 | # 'diameter':procurement.diameter, | ||
2387 | 82 | # 'specific_production': procurement.specific_production, | ||
2388 | 83 | # 'note_production': procurement.note_production, | ||
2389 | 84 | # 'size_x_specific': procurement.size_x_specific, | ||
2390 | 85 | # 'size_y_specific': procurement.size_y_specific, | ||
2391 | 86 | # 'size_z_specific': procurement.size_z_specific, | ||
2392 | 87 | # 'diameter_specific': procurement.diameter_specific, | ||
2393 | 88 | # 'size_x_specific_delta': procurement.size_x_specific_delta, | ||
2394 | 89 | # 'size_y_specific_delta': procurement.size_y_specific_delta, | ||
2395 | 90 | # 'size_z_specific_delta': procurement.size_z_specific_delta, | ||
2396 | 91 | # 'diameter_specific_delta': procurement.diameter_specific_delta, | ||
2397 | 92 | # } | ||
2398 | 93 | # self.pool.get('mrp.production.product.line').create(cr,uid,vals) | ||
2399 | 94 | # procurement.move_id.write({'production_id':production.id}) | ||
2400 | 95 | |||
2401 | 96 | if not bom_point: | ||
2402 | 97 | bom_id = self.pool.get('mrp.bom')._bom_find(cr, uid, production.product_id.id, production.product_uom.id, properties, filter) | ||
2403 | 98 | if bom_id: | ||
2404 | 99 | bom_point = self.pool.get('mrp.bom').browse(cr, uid, bom_id) | ||
2405 | 100 | routing_id = bom_point.routing_id.id or False | ||
2406 | 101 | self.write(cr, uid, [production.id], {'bom_id': bom_id, 'routing_id': routing_id}) | ||
2407 | 102 | |||
2408 | 103 | if not bom_id: | ||
2409 | 104 | raise osv.except_osv(_('Error'), _("Couldn't find bill of material for product %s,%s: production %s,%s" % (production.product_id.name,str(production.product_id.id),production.name,str(production.id)) ) ) | ||
2410 | 105 | |||
2411 | 106 | #if bom_point.routing_id and bom_point.routing_id.location_id: | ||
2412 | 107 | # self.write(cr, uid, [production.id], {'location_src_id': bom_point.routing_id.location_id.id}) | ||
2413 | 108 | |||
2414 | 109 | factor = production.product_qty * production.product_uom.factor / bom_point.product_uom.factor | ||
2415 | 110 | print "production.procurement_ids[0]",production.procurement_ids[0] | ||
2416 | 111 | res = self.pool.get('mrp.bom')._bom_explode(cr, uid, bom_point, factor / bom_point.product_qty, properties, group_properties=group_properties, procurement_id=production.procurement_ids[0].id or False) | ||
2417 | 112 | results = res[0] | ||
2418 | 113 | results2 = res[1] | ||
2419 | 114 | print "1111111111" | ||
2420 | 115 | for line in results: | ||
2421 | 116 | print line | ||
2422 | 117 | line['production_id'] = production.id | ||
2423 | 118 | self.pool.get('mrp.production.product.line').create(cr, uid, line) | ||
2424 | 119 | print "2222222222" | ||
2425 | 120 | for line in results2: | ||
2426 | 121 | print line | ||
2427 | 122 | line['production_id'] = production.id | ||
2428 | 123 | self.pool.get('mrp.production.workcenter.line').create(cr, uid, line) | ||
2429 | 124 | return len(results) | ||
2430 | 125 | |||
2431 | 126 | def action_confirm(self, cr, uid, ids): | ||
2432 | 127 | # print "action_confirm stock.production" | ||
2433 | 128 | lot_obj = self.pool.get('stock.production.lot') | ||
2434 | 129 | picking_obj = self.pool.get('stock.picking') | ||
2435 | 130 | move_obj = self.pool.get('stock.move') | ||
2436 | 131 | |||
2437 | 132 | picking_id=False | ||
2438 | 133 | proc_ids = [] | ||
2439 | 134 | for production in self.browse(cr, uid, ids): | ||
2440 | 135 | #=================================================================== | ||
2441 | 136 | # Test production dĆ©jĆ confirmĆ© | ||
2442 | 137 | #=================================================================== | ||
2443 | 138 | if production.state in ('confirmed'): | ||
2444 | 139 | picking_id = production.picking_id.id | ||
2445 | 140 | continue | ||
2446 | 141 | #=================================================================== | ||
2447 | 142 | # Compute si pas dĆ©jĆ fait | ||
2448 | 143 | #=================================================================== | ||
2449 | 144 | if not production.product_lines: | ||
2450 | 145 | self.action_compute(cr, uid, [production.id]) | ||
2451 | 146 | production = self.browse(cr, uid, [production.id])[0] | ||
2452 | 147 | #=================================================================== | ||
2453 | 148 | # Init des variables | ||
2454 | 149 | #=================================================================== | ||
2455 | 150 | moves = [] | ||
2456 | 151 | routing_loc = None | ||
2457 | 152 | pick_type = 'internal' | ||
2458 | 153 | address_id = False | ||
2459 | 154 | company = self.pool.get('res.users').browse(cr, uid, uid).company_id | ||
2460 | 155 | source = production.product_id.product_tmpl_id.property_stock_production.id | ||
2461 | 156 | if production.bom_id.routing_id and production.bom_id.routing_id.location_id: | ||
2462 | 157 | routing_loc = production.bom_id.routing_id.location_id | ||
2463 | 158 | if routing_loc.usage<>'internal': | ||
2464 | 159 | pick_type = 'out' | ||
2465 | 160 | address_id = routing_loc.address_id and routing_loc.address_id.id or False | ||
2466 | 161 | routing_loc = routing_loc.id | ||
2467 | 162 | |||
2468 | 163 | #=================================================================== | ||
2469 | 164 | # Creation du picking de sortie | ||
2470 | 165 | #=================================================================== | ||
2471 | 166 | vals = { | ||
2472 | 167 | 'origin': (production.origin or '').split(':')[0] +':'+production.name, | ||
2473 | 168 | 'type': pick_type, | ||
2474 | 169 | 'move_type': 'one', | ||
2475 | 170 | 'state': 'auto', | ||
2476 | 171 | 'address_id': address_id, | ||
2477 | 172 | 'partner_shipping_id':address_id, | ||
2478 | 173 | 'auto_picking': self._get_auto_picking(cr, uid, production), | ||
2479 | 174 | } | ||
2480 | 175 | picking_id = picking_obj.create(cr, uid, vals) | ||
2481 | 176 | print_tab("*"*50) | ||
2482 | 177 | print_tab("Creation du picking de sortie") | ||
2483 | 178 | print_tab(vals) | ||
2484 | 179 | #=================================================================== | ||
2485 | 180 | # Rehcherche du lot + Creation du lot s'il n'Ć©xiste pas | ||
2486 | 181 | #=================================================================== | ||
2487 | 182 | vals = { | ||
2488 | 183 | 'product_id': production.product_id.id, | ||
2489 | 184 | 'date': datetime.datetime.now(), | ||
2490 | 185 | 'mrp_production_id': production.id, | ||
2491 | 186 | 'property_ids': production.procurement_ids and [(6,0,[i.id for i in production.procurement_ids[0].property_ids])] or [(6,0,[])], | ||
2492 | 187 | 'group_property_ids': production.procurement_ids and [(6,0,[i.id for i in production.procurement_ids[0].group_property_ids])] or [(6,0,[])], | ||
2493 | 188 | 'option_ids': production.procurement_ids and production.procurement_ids[0].parent_option_id and [(6,0,[ production.procurement_ids[0].parent_option_id.id ])] or [(6,0,[])], | ||
2494 | 189 | 'density': production.bom_id.density, | ||
2495 | 190 | 'diameter': production.bom_id.diameter, | ||
2496 | 191 | 'shape': production.bom_id.shape, | ||
2497 | 192 | 'size_x': production.procurement_ids[0].size_x_specific or production.bom_id.size_x, | ||
2498 | 193 | 'size_y': production.procurement_ids[0].size_y_specific or production.bom_id.size_y, | ||
2499 | 194 | 'size_z': production.procurement_ids[0].size_z_specific or production.bom_id.size_z, | ||
2500 | 195 | 'weight': production.bom_id.weight, | ||
2501 | 196 | } | ||
2502 | 197 | prodlot_id = lot_obj.search_specific(cr,uid,vals,company.tracking_production_delay) | ||
2503 | 198 | if not prodlot_id: | ||
2504 | 199 | vals['name'] = self.pool.get('ir.sequence').get(cr, uid, 'stock.lot.serial') | ||
2505 | 200 | prodlot_id = lot_obj.create(cr, uid, vals) | ||
2506 | 201 | revision_id = self.pool.get('stock.production.lot.revision').create(cr, uid, { | ||
2507 | 202 | 'name': (production.origin or '').split(':')[0] +':'+production.name, | ||
2508 | 203 | 'description': (production.origin or '').split(':')[0] +':'+production.name, | ||
2509 | 204 | 'date': datetime.datetime.now(), | ||
2510 | 205 | 'author_id': uid, | ||
2511 | 206 | 'lot_id': prodlot_id, | ||
2512 | 207 | }) | ||
2513 | 208 | #=================================================================== | ||
2514 | 209 | # Update des moves | ||
2515 | 210 | #=================================================================== | ||
2516 | 211 | self.pool.get('stock.move').write(cr, uid, [i.move_id.id for i in production.procurement_ids if not i.move_id.prodlot_id], { | ||
2517 | 212 | 'prodlot_id': prodlot_id, | ||
2518 | 213 | }) | ||
2519 | 214 | |||
2520 | 215 | |||
2521 | 216 | print_tab("*"*50) | ||
2522 | 217 | print_tab("production",production) | ||
2523 | 218 | print_tab("production",production.procurement_ids) | ||
2524 | 219 | print_tab("*"*50) | ||
2525 | 220 | # raise | ||
2526 | 221 | |||
2527 | 222 | #=================================================================== | ||
2528 | 223 | # Creation des lignes de workcenter | ||
2529 | 224 | #=================================================================== | ||
2530 | 225 | if production.bom_id and production.bom_id.routing_id: | ||
2531 | 226 | print production.bom_id | ||
2532 | 227 | for wc_use in production.bom_id.routing_id.workcenter_lines: | ||
2533 | 228 | wc = wc_use.workcenter_id | ||
2534 | 229 | factor = production.product_qty * production.product_uom.factor / production.bom_id.product_uom.factor | ||
2535 | 230 | d, m = divmod(factor, wc_use.workcenter_id.capacity_per_cycle) | ||
2536 | 231 | mult = (d + (m and 1.0 or 0.0)) | ||
2537 | 232 | cycle = mult * wc_use.cycle_nbr | ||
2538 | 233 | move_ids = [] | ||
2539 | 234 | |||
2540 | 235 | self.pool.get('mrp.production.workcenter.line').create(cr,uid,{ | ||
2541 | 236 | 'production_id': production.id, | ||
2542 | 237 | 'name': production.bom_id.routing_id.name, | ||
2543 | 238 | 'workcenter_id': wc.id, | ||
2544 | 239 | 'sequence': wc_use.sequence or 0, | ||
2545 | 240 | 'cycle': cycle, | ||
2546 | 241 | 'hour': float(wc_use.hour_nbr*mult + (wc.time_start+wc.time_stop+cycle*wc.time_cycle) * (wc.time_efficiency or 1.0)), | ||
2547 | 242 | 'move_ids': [(6,0,move_ids)], | ||
2548 | 243 | }) | ||
2549 | 244 | |||
2550 | 245 | #=================================================================== | ||
2551 | 246 | # Creation du mouvement de sortie | ||
2552 | 247 | #=================================================================== | ||
2553 | 248 | # TODO : voir pourquoi le picking il n'est pas reliƩ au picking de sortie crƩƩ plus haut | ||
2554 | 249 | |||
2555 | 250 | res_final_id = False | ||
2556 | 251 | if production.bom_id.bom_type in ('cut'): | ||
2557 | 252 | for proc in production.procurement_ids: | ||
2558 | 253 | if proc.move_id.id: | ||
2559 | 254 | res_final_id = proc.move_id.id | ||
2560 | 255 | vals = { | ||
2561 | 256 | 'production_id':production.id, | ||
2562 | 257 | } | ||
2563 | 258 | move_obj.write(cr, uid, res_final_id, vals) | ||
2564 | 259 | else: | ||
2565 | 260 | vals = { | ||
2566 | 261 | 'name':'PROD1:'+production.name, | ||
2567 | 262 | 'date_planned': production.date_planned, | ||
2568 | 263 | 'product_id': production.product_id.id, | ||
2569 | 264 | 'product_qty': production.product_qty, | ||
2570 | 265 | 'product_uom': production.product_uom.id, | ||
2571 | 266 | 'product_uos_qty': production.product_uos and production.product_uos_qty or False, | ||
2572 | 267 | 'product_uos': production.product_uos and production.product_uos.id or False, | ||
2573 | 268 | 'location_id': source, | ||
2574 | 269 | 'location_dest_id': production.location_dest_id.id, | ||
2575 | 270 | 'move_dest_id': production.move_prod_id.id, | ||
2576 | 271 | 'state': 'waiting', | ||
2577 | 272 | 'prodlot_id': prodlot_id, | ||
2578 | 273 | 'production_id':production.id, | ||
2579 | 274 | } | ||
2580 | 275 | res_final_id = move_obj.create(cr, uid, vals) | ||
2581 | 276 | print_tab("*"*50) | ||
2582 | 277 | print_tab("Creation du mouvement de sortie") | ||
2583 | 278 | print_tab(vals) | ||
2584 | 279 | |||
2585 | 280 | # self.write(cr, uid, [production.id], {'move_created_ids': [(6, 0, [res_final_id])]}) | ||
2586 | 281 | |||
2587 | 282 | #=================================================================== | ||
2588 | 283 | # Parcours des ligne de production | ||
2589 | 284 | #=================================================================== | ||
2590 | 285 | for line in production.product_lines: | ||
2591 | 286 | move_id = False | ||
2592 | 287 | line_prodlot_id = False | ||
2593 | 288 | # production_id = False | ||
2594 | 289 | #=============================================================== | ||
2595 | 290 | # Test if bom is assemble or disassemble | ||
2596 | 291 | #=============================================================== | ||
2597 | 292 | print "--------------",line.bom_id.bom_type | ||
2598 | 293 | if production.bom_id.bom_type in ('cutinput'): | ||
2599 | 294 | product_id = production.product_id.id | ||
2600 | 295 | else: | ||
2601 | 296 | product_id = line.product_id.id | ||
2602 | 297 | |||
2603 | 298 | if line.product_id.type in ('product', 'consu'): | ||
2604 | 299 | #=========================================================== | ||
2605 | 300 | # Recherche du lot, crƩation d'il n'Ʃxiste pas | ||
2606 | 301 | #=========================================================== | ||
2607 | 302 | vals = { | ||
2608 | 303 | 'product_id': product_id, | ||
2609 | 304 | 'date': datetime.datetime.now(), | ||
2610 | 305 | 'mrp_production_id': production.id, | ||
2611 | 306 | 'property_ids': [(6,0,[i.id for i in line.property_ids])] or [(6,0,[])], | ||
2612 | 307 | 'group_property_ids': [(6,0,[i.id for i in line.group_property_ids])] or [(6,0,[])], | ||
2613 | 308 | 'option_ids': [(6,0,[i.id for i in line.option_ids])] or [(6,0,[])], | ||
2614 | 309 | 'density':line.density, | ||
2615 | 310 | 'diameter':line.specific_production and line.diameter_specific or line.diameter, | ||
2616 | 311 | 'shape':line.shape, | ||
2617 | 312 | 'size_x': line.specific_production and line.size_x_specific or line.size_x, | ||
2618 | 313 | 'size_y': line.specific_production and line.size_y_specific or line.size_y, | ||
2619 | 314 | 'size_z': line.specific_production and line.size_z_specific or line.size_z, | ||
2620 | 315 | 'weight':line.weight, | ||
2621 | 316 | } | ||
2622 | 317 | if line.procurement_id : | ||
2623 | 318 | line_prodlot_id = line.procurement_id.move_id.prodlot_id.id | ||
2624 | 319 | if not line_prodlot_id: | ||
2625 | 320 | vals['name'] = self.pool.get('ir.sequence').get(cr, uid, 'stock.lot.serial') | ||
2626 | 321 | line_prodlot_id = lot_obj.search_specific(cr,uid,vals,company.tracking_production_delay) | ||
2627 | 322 | if not line_prodlot_id: | ||
2628 | 323 | line_prodlot_id = lot_obj.create(cr, uid, vals) | ||
2629 | 324 | revision_id = self.pool.get('stock.production.lot.revision').create(cr, uid, { | ||
2630 | 325 | 'name': (production.origin or '').split(':')[0] +':'+production.name, | ||
2631 | 326 | 'description': (production.origin or '').split(':')[0] +':'+production.name, | ||
2632 | 327 | 'date': datetime.datetime.now(), | ||
2633 | 328 | 'author_id': uid, | ||
2634 | 329 | 'lot_id': line_prodlot_id, | ||
2635 | 330 | }) | ||
2636 | 331 | |||
2637 | 332 | # #=========================================================== | ||
2638 | 333 | # # Recuperation de la production en cours associƩ au lot | ||
2639 | 334 | # #=========================================================== | ||
2640 | 335 | # if line_prodlot_id and line.bom_id.bom_type in ('cut'): | ||
2641 | 336 | # move_ids = move_obj.search(cr,uid,[('prodlot_id','=',line_prodlot_id),('production_id','!=',False),('production_id.state','=','confirmed')]) | ||
2642 | 337 | # if move_ids: | ||
2643 | 338 | # production_id = move_obj.read(cr,uid,move_ids)[0]['production_id'][0] | ||
2644 | 339 | #=========================================================== | ||
2645 | 340 | # Recherche ou creation du move de sortie + enregistrement sur la production en entrƩe | ||
2646 | 341 | #=========================================================== | ||
2647 | 342 | if not line.procurement_id : | ||
2648 | 343 | vals = { | ||
2649 | 344 | 'name':'PROD22:'+production.name, | ||
2650 | 345 | 'date_planned': production.date_planned, | ||
2651 | 346 | 'product_id': product_id, | ||
2652 | 347 | 'product_qty': line.product_qty, | ||
2653 | 348 | 'product_uom': line.product_uom.id, | ||
2654 | 349 | 'product_uos_qty': line.product_uos and line.product_uos_qty or False, | ||
2655 | 350 | 'product_uos': line.product_uos and line.product_uos.id or False, | ||
2656 | 351 | 'location_id': routing_loc or production.location_src_id.id, | ||
2657 | 352 | 'location_dest_id': source, | ||
2658 | 353 | 'move_dest_id': res_final_id, | ||
2659 | 354 | 'state': 'waiting', | ||
2660 | 355 | 'prodlot_id': line_prodlot_id, | ||
2661 | 356 | } | ||
2662 | 357 | res_dest_id = self.pool.get('stock.move').create(cr, uid, vals) | ||
2663 | 358 | moves.append(res_dest_id) | ||
2664 | 359 | print_tab("/"*50) | ||
2665 | 360 | print_tab("creation du move de sortie de ligne") | ||
2666 | 361 | print_tab(vals) | ||
2667 | 362 | else: | ||
2668 | 363 | res_dest_id = line.procurement_id.move_id.id | ||
2669 | 364 | self.write(cr, uid, [production.id], {'move_lines': [(4,res_dest_id)]}) | ||
2670 | 365 | #=========================================================== | ||
2671 | 366 | # CrƩation du move suivant le move de production | ||
2672 | 367 | #=========================================================== | ||
2673 | 368 | vals = { | ||
2674 | 369 | 'name':'PROD3:'+production.name, | ||
2675 | 370 | 'picking_id':picking_id, | ||
2676 | 371 | 'product_id': product_id, | ||
2677 | 372 | 'product_qty': line.product_qty, | ||
2678 | 373 | 'product_uom': line.product_uom.id, | ||
2679 | 374 | 'product_uos_qty': line.product_uos and line.product_uos_qty or False, | ||
2680 | 375 | 'product_uos': line.product_uos and line.product_uos.id or False, | ||
2681 | 376 | 'date_planned': production.date_planned, | ||
2682 | 377 | 'move_dest_id': res_dest_id, | ||
2683 | 378 | 'location_id': production.location_src_id.id, | ||
2684 | 379 | 'location_dest_id': routing_loc or production.location_src_id.id, | ||
2685 | 380 | 'state': 'waiting', | ||
2686 | 381 | 'prodlot_id': line_prodlot_id, | ||
2687 | 382 | # 'production_id': production_id, | ||
2688 | 383 | } | ||
2689 | 384 | print_tab("CrƩation du move suivant le move de sortie") | ||
2690 | 385 | print_tab(vals) | ||
2691 | 386 | move_id = self.pool.get('stock.move').create(cr, uid, vals) | ||
2692 | 387 | #=============================================================== | ||
2693 | 388 | # CrƩation du procurement pour la ligne s'il n'Ʃxiste pas + update de la ligne | ||
2694 | 389 | #=============================================================== | ||
2695 | 390 | if not line.procurement_id : | ||
2696 | 391 | # production_id = False | ||
2697 | 392 | vals = { | ||
2698 | 393 | 'name': (production.origin or '').split(':')[0] + ':' + production.name, | ||
2699 | 394 | 'origin': (production.origin or '').split(':')[0] + ':' + production.name, | ||
2700 | 395 | 'date_planned': production.date_planned, | ||
2701 | 396 | 'product_id': line.product_id.id, | ||
2702 | 397 | 'product_qty': line.product_qty, | ||
2703 | 398 | 'product_uom': line.product_uom.id, | ||
2704 | 399 | 'product_uos_qty': line.product_uos and line.product_qty or False, | ||
2705 | 400 | 'product_uos': line.product_uos and line.product_uos.id or False, | ||
2706 | 401 | 'property_ids': [(6,0,[i.id for i in line.property_ids])], | ||
2707 | 402 | 'group_property_ids': [(6,0,[i.id for i in line.group_property_ids])], | ||
2708 | 403 | 'option_ids': [(6,0,[i.id for i in line.option_ids])], | ||
2709 | 404 | 'size_x':line.size_x, | ||
2710 | 405 | 'size_y':line.size_y, | ||
2711 | 406 | 'size_z':line.size_z, | ||
2712 | 407 | 'diameter':line.diameter, | ||
2713 | 408 | 'specific_production': line.specific_production, | ||
2714 | 409 | 'note_production': line.note_production, | ||
2715 | 410 | 'size_x_specific': line.size_x_specific, | ||
2716 | 411 | 'size_y_specific': line.size_y_specific, | ||
2717 | 412 | 'size_z_specific': line.size_z_specific, | ||
2718 | 413 | 'diameter_specific': line.diameter_specific, | ||
2719 | 414 | 'size_x_specific_delta': line.size_x_specific_delta, | ||
2720 | 415 | 'size_y_specific_delta': line.size_y_specific_delta, | ||
2721 | 416 | 'size_z_specific_delta': line.size_z_specific_delta, | ||
2722 | 417 | 'diameter_specific_delta': line.diameter_specific_delta, | ||
2723 | 418 | 'location_id': production.location_src_id.id, | ||
2724 | 419 | 'procure_method': line.product_id.procure_method, | ||
2725 | 420 | 'move_id': move_id, | ||
2726 | 421 | 'bom_id': line.bom_id and line.bom_id.id or False, | ||
2727 | 422 | # 'production_id':production_id, | ||
2728 | 423 | } | ||
2729 | 424 | proc_id = self.pool.get('procurement.order').create(cr, uid, vals) | ||
2730 | 425 | print_tab("CrƩation du procurement") | ||
2731 | 426 | print_tab(vals) | ||
2732 | 427 | self.pool.get('mrp.production.product.line').write(cr, uid, line.id, {'procurement_id':proc_id}) | ||
2733 | 428 | #=========================================================== | ||
2734 | 429 | # Validation du procurement | ||
2735 | 430 | #=========================================================== | ||
2736 | 431 | wf_service = netsvc.LocalService("workflow") | ||
2737 | 432 | wf_service.trg_validate(uid, 'procurement.order', proc_id, 'button_confirm', cr) | ||
2738 | 433 | proc_ids.append(proc_id) | ||
2739 | 434 | #=================================================================== | ||
2740 | 435 | # Validation du picking de sortie | ||
2741 | 436 | #=================================================================== | ||
2742 | 437 | wf_service = netsvc.LocalService("workflow") | ||
2743 | 438 | wf_service.trg_validate(uid, 'stock.picking', picking_id, 'button_confirm', cr) | ||
2744 | 439 | self.write(cr, uid, [production.id], {'picking_id':picking_id, 'state':'confirmed'}) | ||
2745 | 440 | # raise | ||
2746 | 441 | return picking_id | ||
2747 | 442 | |||
2748 | 443 | _columns = { | ||
2749 | 444 | 'procurement_ids': fields.one2many('procurement.order', 'production_id', 'Procurements'), | ||
2750 | 445 | 'specific_production':fields.boolean('Specific Production'), | ||
2751 | 446 | 'note_production':fields.text('Production Note'), | ||
2752 | 447 | 'size_x': fields.function(_size, multi="size", method=True, string='Width', digits=(16, 5), type='float'), | ||
2753 | 448 | 'size_y': fields.function(_size, multi="size", method=True, string='Length', digits=(16, 5), type='float'), | ||
2754 | 449 | 'size_z': fields.function(_size, multi="size", method=True, string='Thickness', digits=(16, 5), type='float'), | ||
2755 | 450 | 'diameter': fields.function(_size, multi="size", method=True, string='Diameter', digits=(16, 5), type='float'), | ||
2756 | 451 | 'size_x_specific': fields.float('Width specific', digits=(16, 5), readonly=True), | ||
2757 | 452 | 'size_y_specific': fields.float('Length specific', digits=(16, 5), readonly=True), | ||
2758 | 453 | 'size_z_specific': fields.float('Thickness specific', digits=(16, 5), readonly=True), | ||
2759 | 454 | 'diameter_specific': fields.float('Diameter specific', digits=(16, 5), readonly=True), | ||
2760 | 455 | 'size_x_specific_delta': fields.float('Width specific delta', digits=(16, 5), readonly=True), | ||
2761 | 456 | 'size_y_specific_delta': fields.float('Length specific delta', digits=(16, 5), readonly=True), | ||
2762 | 457 | 'size_z_specific_delta': fields.float('Thickness specific delta', digits=(16, 5), readonly=True), | ||
2763 | 458 | 'diameter_specific_delta': fields.float('Diameter specific delta', digits=(16, 5), readonly=True), | ||
2764 | 459 | } | ||
2765 | 460 | _order = 'id desc' | ||
2766 | 461 | |||
2767 | 462 | def action_production_end(self, cr, uid, ids): | ||
2768 | 463 | # move_ids = [] | ||
2769 | 464 | for production in self.browse(cr, uid, ids): | ||
2770 | 465 | for res in production.move_lines: | ||
2771 | 466 | for move in production.move_created_ids: | ||
2772 | 467 | #XXX must use the orm | ||
2773 | 468 | # cr.execute('INSERT INTO stock_move_history_ids \ | ||
2774 | 469 | # (parent_id, child_id) VALUES (%s,%s)', | ||
2775 | 470 | # (res.id, move.id)) | ||
2776 | 471 | #ASPerience: test des valeurs pour Ʃviter les erreurs de rƩƩcriture | ||
2777 | 472 | cr.execute('select parent_id,child_id from stock_move_history_ids where parent_id=%s and child_id=%s', (res.id, move.id)) | ||
2778 | 473 | if len(cr.fetchall()) == 0: | ||
2779 | 474 | cr.execute('insert into stock_move_history_ids (parent_id,child_id) values (%s,%s)', (res.id, move.id)) | ||
2780 | 475 | else: | ||
2781 | 476 | logger = netsvc.Logger() | ||
2782 | 477 | logger.notifyChannel("warning", netsvc.LOG_WARNING," ERROR insert into stock_move_history_ids parent_id=%s and child_id=%s'." % (str(move.id), str(move.move_dest_id.id))) | ||
2783 | 478 | #Fin ASPerience | ||
2784 | 479 | # move_ids.append(res.id) | ||
2785 | 480 | vals= {'state':'confirmed'} | ||
2786 | 481 | new_moves = [x.id for x in production.move_created_ids] | ||
2787 | 482 | self.pool.get('stock.move').write(cr, uid, new_moves, vals) | ||
2788 | 483 | if not production.date_finnished: | ||
2789 | 484 | self.write(cr, uid, [production.id], | ||
2790 | 485 | {'date_finnished': time.strftime('%Y-%m-%d %H:%M:%S')}) | ||
2791 | 486 | self.pool.get('stock.move').check_assign(cr, uid, new_moves) | ||
2792 | 487 | self.pool.get('stock.move').action_done(cr, uid, new_moves) | ||
2793 | 488 | self._costs_generate(cr, uid, production) | ||
2794 | 489 | # self.pool.get('stock.move').action_done(cr, uid, move_ids) | ||
2795 | 490 | self.write(cr, uid, ids, {'state': 'done'}) | ||
2796 | 491 | return True | ||
2797 | 492 | |||
2798 | 493 | mrp_production() | ||
2799 | 494 | |||
2800 | 495 | class mrp_production_product_line(osv.osv): | ||
2801 | 496 | _inherit = 'mrp.production.product.line' | ||
2802 | 497 | |||
2803 | 498 | _columns = { | ||
2804 | 499 | #Properties | ||
2805 | 500 | 'property_ids': fields.many2many('mrp.property', 'mrp_production_product_line_property_rel', 'line_id','property_id', 'Properties'), | ||
2806 | 501 | 'group_property_ids': fields.many2many('mrp.property.group.option', 'mrp_production_line_group_property_rel','production_line_id', 'group_id', 'Product Property Group Rel '), | ||
2807 | 502 | 'procurement_id': fields.many2one('procurement.order', 'Procurement'), | ||
2808 | 503 | 'option_ids': fields.many2many('product.links', 'mrp_production_product_line_options_rel','line_id', 'links_id', 'Option'), | ||
2809 | 504 | 'bom_id': fields.many2one('mrp.bom', 'Bom'), | ||
2810 | 505 | #Dimensions | ||
2811 | 506 | 'size_x': fields.float('Width', digits=(16, 5)), | ||
2812 | 507 | 'size_y': fields.float('Lenght', digits=(16, 5)), | ||
2813 | 508 | 'size_z': fields.float('Thickness', digits=(16, 5)), | ||
2814 | 509 | 'density': fields.float('Density', digits=(16, 5)), | ||
2815 | 510 | 'shape' : fields.selection([('quadrangular', 'Quadrangular'), ('cylindrical', 'Cylindrical'), ('other', 'Other')], 'Shape', required=True), | ||
2816 | 511 | 'diameter' : fields.float('Diameter', digits=(16, 5)), | ||
2817 | 512 | 'weight': fields.float('Weight', digits=(16, 5)), | ||
2818 | 513 | 'specific_production':fields.boolean('Specific Production'), | ||
2819 | 514 | 'note_production':fields.text('Production Note'), | ||
2820 | 515 | 'size_x_specific': fields.float('Width specific', digits=(16, 5), readonly=True ), | ||
2821 | 516 | 'size_y_specific': fields.float('Length specific', digits=(16, 5), readonly=True), | ||
2822 | 517 | 'size_z_specific': fields.float('Thickness specific', digits=(16, 5), readonly=True), | ||
2823 | 518 | 'diameter_specific': fields.float('Diameter specific', digits=(16, 5), readonly=True), | ||
2824 | 519 | 'size_x_specific_delta': fields.float('Width specific delta', digits=(16, 5), readonly=True), | ||
2825 | 520 | 'size_y_specific_delta': fields.float('Length specific delta', digits=(16, 5), readonly=True), | ||
2826 | 521 | 'size_z_specific_delta': fields.float('Thickness specific delta', digits=(16, 5), readonly=True), | ||
2827 | 522 | 'diameter_specific_delta': fields.float('Diameter specific delta', digits=(16, 5), readonly=True), | ||
2828 | 523 | |||
2829 | 524 | 'uom_d_size' : fields.related('product_id', 'uom_d_size', help="Default united of measure density used for operations size to cube"), | ||
2830 | 525 | 'uom_d_weight': fields.related('product_id', 'uom_d_weight', help="Default united of measure density used for operations weight"), | ||
2831 | 526 | 'uom_s_size' : fields.related('product_id', 'uom_s_size', help="Default united of measure used for operations size"), | ||
2832 | 527 | } | ||
2833 | 528 | _defaults = { | ||
2834 | 529 | 'shape': lambda * a: 'other', | ||
2835 | 530 | } | ||
2836 | 531 | |||
2837 | 532 | def onchange_product_id(self, cr, uid, ids, product_id, context={}): | ||
2838 | 533 | if product_id: | ||
2839 | 534 | w = self.pool.get('product.product').browse(cr, uid, product_id, context) | ||
2840 | 535 | factor1 = w.uom_d_weight.factor | ||
2841 | 536 | factor2 = w.uom_id.factor | ||
2842 | 537 | factor3 = w.uom_d_size.factor | ||
2843 | 538 | factor4 = w.uom_s_size.factor | ||
2844 | 539 | v = { | ||
2845 | 540 | 'product_uom':w.uom_id.id, | ||
2846 | 541 | 'product_uos':w.uos_id and w.uos_id.id or w.uom_id.id, | ||
2847 | 542 | 'size_x':w.size_x or w.size_x_tmpl, | ||
2848 | 543 | 'size_y':w.size_y or w.size_y_tmpl, | ||
2849 | 544 | 'size_z':w.size_z or w.size_z_tmpl, | ||
2850 | 545 | 'density':w.density or w.density_tmpl, | ||
2851 | 546 | 'shape':w.shape, | ||
2852 | 547 | 'diameter':w.diameter or w.diameter_tmpl, | ||
2853 | 548 | 'weight':compute_w(cr, uid, factor1, factor2, factor3, factor4, w.size_x or w.size_x_tmpl, w.size_y or w.size_y_tmpl, w.size_z or w.size_z_tmpl, w.shape, w.density or w.density_tmpl, w.diameter or w.diameter_tmpl)['weight'] | ||
2854 | 549 | } | ||
2855 | 550 | return {'value': v} | ||
2856 | 551 | return {} | ||
2857 | 552 | |||
2858 | 553 | def compute_weight(self, cr, uid, id, product_id, size_x, size_y, size_z, shape, density, diameter): | ||
2859 | 554 | if product_id: | ||
2860 | 555 | product = self.pool.get('product.product').browse(cr, uid, product_id, context='') | ||
2861 | 556 | factor1 = product.uom_d_weight.factor | ||
2862 | 557 | factor2 = product.uom_id.factor | ||
2863 | 558 | factor3 = product.uom_d_size.factor | ||
2864 | 559 | factor4 = product.uom_s_size.factor | ||
2865 | 560 | return {'value': compute_w(cr, uid, factor1, factor2, factor3, factor4, size_x, size_y, size_z, shape, density, diameter)} | ||
2866 | 561 | |||
2867 | 562 | mrp_production_product_line() | ||
2868 | 563 | |||
2869 | 564 | class mrp_production_workcenter_line(osv.osv): | ||
2870 | 565 | _inherit = 'mrp.production.workcenter.line' | ||
2871 | 566 | _columns = { | ||
2872 | 567 | 'move_ids' : fields.many2many('stock.move', 'mrp_production_workcenter_line_stock_move_rel', 'line_id', 'move_id', 'Moves'), | ||
2873 | 568 | } | ||
2874 | 569 | _defaults = { | ||
2875 | 570 | } | ||
2876 | 571 | mrp_production_workcenter_line() | ||
2877 | 572 | |||
2878 | 573 | def print_tab(*args): | ||
2879 | 574 | cc = 0 | ||
2880 | 575 | try: | ||
2881 | 576 | tmp = inspect.stack()[1] | ||
2882 | 577 | for i in tmp[4][0]: | ||
2883 | 578 | if i == ' ': | ||
2884 | 579 | cc+=1 | ||
2885 | 580 | else: | ||
2886 | 581 | break | ||
2887 | 582 | |||
2888 | 583 | if isinstance(args[0],int): | ||
2889 | 584 | print "-"*args[0], | ||
2890 | 585 | args = args[1:] | ||
2891 | 586 | print str(tmp[2]).ljust(4), | ||
2892 | 587 | print " "*cc, | ||
2893 | 588 | except: | ||
2894 | 589 | pass | ||
2895 | 590 | for i in args: | ||
2896 | 591 | print i, | ||
2897 | 592 | |||
2898 | 593 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | ||
2899 | 0 | \ No newline at end of file | 594 | \ No newline at end of file |
2900 | 1 | 595 | ||
2901 | === added file 'asperience_configurator_mrp/mrp_property.py' | |||
2902 | --- asperience_configurator_mrp/mrp_property.py 1970-01-01 00:00:00 +0000 | |||
2903 | +++ asperience_configurator_mrp/mrp_property.py 2017-12-01 14:57:12 +0000 | |||
2904 | @@ -0,0 +1,99 @@ | |||
2905 | 1 | # -*- encoding: utf-8 -*- | ||
2906 | 2 | ############################################################################## | ||
2907 | 3 | # | ||
2908 | 4 | # OpenERP, Open Source Management Solution | ||
2909 | 5 | # Copyright (C) 2007-2014 ASPerience SARL (<http://www.asperience.fr>). | ||
2910 | 6 | # All Rights Reserved | ||
2911 | 7 | # | ||
2912 | 8 | # This program is free software: you can redistribute it and/or modify | ||
2913 | 9 | # it under the terms of the GNU General Public License as published by | ||
2914 | 10 | # the Free Software Foundation, either version 3 of the License, or | ||
2915 | 11 | # (at your option) any later version. | ||
2916 | 12 | # | ||
2917 | 13 | # This program is distributed in the hope that it will be useful, | ||
2918 | 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2919 | 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2920 | 16 | # GNU General Public License for more details. | ||
2921 | 17 | # | ||
2922 | 18 | # You should have received a copy of the GNU General Public License | ||
2923 | 19 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
2924 | 20 | # | ||
2925 | 21 | ############################################################################## | ||
2926 | 22 | from openerp.osv import fields,osv | ||
2927 | 23 | #import openerp.netsvc | ||
2928 | 24 | #import time | ||
2929 | 25 | #import datetime | ||
2930 | 26 | #from mx import DateTime | ||
2931 | 27 | #from openerp.tools.translate import _ | ||
2932 | 28 | #from openerp.tools import ustr | ||
2933 | 29 | |||
2934 | 30 | class mrp_property_group_option(osv.osv): | ||
2935 | 31 | _name = 'mrp.property.group.option' | ||
2936 | 32 | _description = 'GOP / Property' | ||
2937 | 33 | _columns = { | ||
2938 | 34 | 'name': fields.char('Name', size=256, required=True), | ||
2939 | 35 | 'type_group_id': fields.many2one('product.type.property.option', 'GOP', required=True), | ||
2940 | 36 | 'property_id': fields.many2one('mrp.property', 'Property', required=True), | ||
2941 | 37 | } | ||
2942 | 38 | _defaults = { | ||
2943 | 39 | } | ||
2944 | 40 | |||
2945 | 41 | def onchange_group_property(self, cr, uid, id, type_group_id, property_id): | ||
2946 | 42 | res = {'value':{}} | ||
2947 | 43 | if type_group_id and not property_id : | ||
2948 | 44 | type_group = self.pool.get("product.type.property.option").browse(cr,uid,type_group_id) | ||
2949 | 45 | res['value']['name'] = type_group.name+"[X]" | ||
2950 | 46 | elif not type_group_id and property_id : | ||
2951 | 47 | property = self.pool.get("mrp.property").browse(cr,uid,property_id) | ||
2952 | 48 | res['value']['name'] = "X["+property.name+"]" | ||
2953 | 49 | elif type_group_id and property_id : | ||
2954 | 50 | type_group = self.pool.get("product.type.property.option").browse(cr,uid,type_group_id) | ||
2955 | 51 | property = self.pool.get("mrp.property").browse(cr,uid,property_id) | ||
2956 | 52 | res['value']['name'] = type_group.name+"["+property.name+"]" | ||
2957 | 53 | return res | ||
2958 | 54 | |||
2959 | 55 | mrp_property_group_option() | ||
2960 | 56 | |||
2961 | 57 | class mrp_property_group(osv.osv): | ||
2962 | 58 | _inherit = 'mrp.property.group' | ||
2963 | 59 | _columns = { | ||
2964 | 60 | 'property_ids': fields.one2many('mrp.property', 'group_id', 'Properties'), | ||
2965 | 61 | } | ||
2966 | 62 | _defaults = { | ||
2967 | 63 | } | ||
2968 | 64 | mrp_property_group() | ||
2969 | 65 | |||
2970 | 66 | class mrp_property(osv.osv): | ||
2971 | 67 | _inherit = 'mrp.property' | ||
2972 | 68 | |||
2973 | 69 | def name_get(self, cr, uid, ids, context=None): | ||
2974 | 70 | if not ids: | ||
2975 | 71 | return [] | ||
2976 | 72 | reads = self.read(cr, uid, ids, ['name','code'], context) | ||
2977 | 73 | res = [] | ||
2978 | 74 | for record in reads: | ||
2979 | 75 | name = "[%s] %s" % (record['code'],record['name']) | ||
2980 | 76 | res.append((record['id'], name)) | ||
2981 | 77 | return res | ||
2982 | 78 | |||
2983 | 79 | _columns = { | ||
2984 | 80 | 'code': fields.char('Code', size=64, required=True), | ||
2985 | 81 | 'price': fields.float('Price'), | ||
2986 | 82 | 'size_x_tmpl': fields.float('Width', digits=(16, 5)), | ||
2987 | 83 | 'size_y_tmpl': fields.float('Length', digits=(16, 5)), | ||
2988 | 84 | 'size_z_tmpl': fields.float('Thickness', digits=(16, 5)), | ||
2989 | 85 | 'diameter_tmpl': fields.float('Diameter', digits=(16, 5)), | ||
2990 | 86 | 'uom_s_size_tmpl' : fields.many2one('product.uom', 'Size Uom', help="Default united of measure used for operations size"), | ||
2991 | 87 | } | ||
2992 | 88 | _defaults = { | ||
2993 | 89 | 'code': lambda *a: 'XXX', | ||
2994 | 90 | 'price': lambda *a: 0.0, | ||
2995 | 91 | 'size_x_tmpl': lambda *a: 0, | ||
2996 | 92 | 'size_y_tmpl': lambda *a: 0, | ||
2997 | 93 | 'size_z_tmpl': lambda *a: 0, | ||
2998 | 94 | 'diameter_tmpl': lambda *a: 0, | ||
2999 | 95 | 'composition': lambda *a: 'plus', | ||
3000 | 96 | } | ||
3001 | 97 | mrp_property() | ||
3002 | 98 | |||
3003 | 99 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | ||
3004 | 0 | \ No newline at end of file | 100 | \ No newline at end of file |
3005 | 1 | 101 | ||
3006 | === added file 'asperience_configurator_mrp/mrp_report.xml' | |||
3007 | --- asperience_configurator_mrp/mrp_report.xml 1970-01-01 00:00:00 +0000 | |||
3008 | +++ asperience_configurator_mrp/mrp_report.xml 2017-12-01 14:57:12 +0000 | |||
3009 | @@ -0,0 +1,20 @@ | |||
3010 | 1 | <?xml version="1.0" encoding="utf-8"?> | ||
3011 | 2 | <openerp> | ||
3012 | 3 | <data> | ||
3013 | 4 | <report auto="False" | ||
3014 | 5 | header="False" | ||
3015 | 6 | id="report_bom" | ||
3016 | 7 | model="mrp.bom" | ||
3017 | 8 | name="bom" | ||
3018 | 9 | string="BOM Graph"/> | ||
3019 | 10 | |||
3020 | 11 | <report auto="True" | ||
3021 | 12 | header="False" | ||
3022 | 13 | id="mrp.report_bom_structure" | ||
3023 | 14 | model="mrp.bom" | ||
3024 | 15 | name="bom.structure" | ||
3025 | 16 | rml="asperience_mrp/report/bom_structure.rml" | ||
3026 | 17 | string="BOM Structure"/> | ||
3027 | 18 | |||
3028 | 19 | </data> | ||
3029 | 20 | </openerp> | ||
3030 | 0 | 21 | ||
3031 | === added file 'asperience_configurator_mrp/mrp_routing.py' | |||
3032 | --- asperience_configurator_mrp/mrp_routing.py 1970-01-01 00:00:00 +0000 | |||
3033 | +++ asperience_configurator_mrp/mrp_routing.py 2017-12-01 14:57:12 +0000 | |||
3034 | @@ -0,0 +1,54 @@ | |||
3035 | 1 | # -*- encoding: utf-8 -*- | ||
3036 | 2 | ############################################################################## | ||
3037 | 3 | # | ||
3038 | 4 | # OpenERP, Open Source Management Solution | ||
3039 | 5 | # Copyright (C) 2007-2014 ASPerience SARL (<http://www.asperience.fr>). | ||
3040 | 6 | # All Rights Reserved | ||
3041 | 7 | # | ||
3042 | 8 | # This program is free software: you can redistribute it and/or modify | ||
3043 | 9 | # it under the terms of the GNU General Public License as published by | ||
3044 | 10 | # the Free Software Foundation, either version 3 of the License, or | ||
3045 | 11 | # (at your option) any later version. | ||
3046 | 12 | # | ||
3047 | 13 | # This program is distributed in the hope that it will be useful, | ||
3048 | 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
3049 | 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
3050 | 16 | # GNU General Public License for more details. | ||
3051 | 17 | # | ||
3052 | 18 | # You should have received a copy of the GNU General Public License | ||
3053 | 19 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
3054 | 20 | # | ||
3055 | 21 | ############################################################################## | ||
3056 | 22 | from openerp.osv import fields,osv | ||
3057 | 23 | |||
3058 | 24 | class mrp_routing(osv.osv): | ||
3059 | 25 | _inherit = 'mrp.routing' | ||
3060 | 26 | _columns = { | ||
3061 | 27 | 'technical_data': fields.char('Technical Data', size=128), | ||
3062 | 28 | } | ||
3063 | 29 | _defaults = { | ||
3064 | 30 | 'active': lambda *a: 1, | ||
3065 | 31 | } | ||
3066 | 32 | mrp_routing() | ||
3067 | 33 | |||
3068 | 34 | class mrp_routing_workcenter_subproduct(osv.osv): | ||
3069 | 35 | _name = 'mrp.routing.workcenter.subproduct' | ||
3070 | 36 | _description = 'mrp.routing.workcenter.subproduct' | ||
3071 | 37 | _columns = { | ||
3072 | 38 | 'name': fields.float('Percent', required=True), | ||
3073 | 39 | 'subproduct_id': fields.many2one('mrp.subproduct', 'Subproduct', required=True), | ||
3074 | 40 | 'workcenter_line_id': fields.many2one('mrp.routing.workcenter', 'Routing Workcenter', required=True), | ||
3075 | 41 | } | ||
3076 | 42 | mrp_routing_workcenter_subproduct() | ||
3077 | 43 | |||
3078 | 44 | class mrp_routing_workcenter(osv.osv): | ||
3079 | 45 | _inherit = 'mrp.routing.workcenter' | ||
3080 | 46 | _columns = { | ||
3081 | 47 | 'sub_ids': fields.one2many('mrp.routing.workcenter.subproduct', 'workcenter_line_id', 'Sub Product'), | ||
3082 | 48 | 'bom_ids': fields.many2many('mrp.bom', 'routing_workcenter_mrp_bom_rel', 'workcenter_line_id', 'bom_id', 'Components'), | ||
3083 | 49 | } | ||
3084 | 50 | _defaults = { | ||
3085 | 51 | } | ||
3086 | 52 | mrp_routing_workcenter() | ||
3087 | 53 | |||
3088 | 54 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | ||
3089 | 0 | \ No newline at end of file | 55 | \ No newline at end of file |
3090 | 1 | 56 | ||
3091 | === added file 'asperience_configurator_mrp/mrp_subproduct.py' | |||
3092 | --- asperience_configurator_mrp/mrp_subproduct.py 1970-01-01 00:00:00 +0000 | |||
3093 | +++ asperience_configurator_mrp/mrp_subproduct.py 2017-12-01 14:57:12 +0000 | |||
3094 | @@ -0,0 +1,37 @@ | |||
3095 | 1 | # -*- encoding: utf-8 -*- | ||
3096 | 2 | ############################################################################## | ||
3097 | 3 | # | ||
3098 | 4 | # OpenERP, Open Source Management Solution | ||
3099 | 5 | # Copyright (C) 2007-2014 ASPerience SARL (<http://www.asperience.fr>). | ||
3100 | 6 | # All Rights Reserved | ||
3101 | 7 | # | ||
3102 | 8 | # This program is free software: you can redistribute it and/or modify | ||
3103 | 9 | # it under the terms of the GNU General Public License as published by | ||
3104 | 10 | # the Free Software Foundation, either version 3 of the License, or | ||
3105 | 11 | # (at your option) any later version. | ||
3106 | 12 | # | ||
3107 | 13 | # This program is distributed in the hope that it will be useful, | ||
3108 | 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
3109 | 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
3110 | 16 | # GNU General Public License for more details. | ||
3111 | 17 | # | ||
3112 | 18 | # You should have received a copy of the GNU General Public License | ||
3113 | 19 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
3114 | 20 | # | ||
3115 | 21 | ############################################################################## | ||
3116 | 22 | from openerp.osv import fields,osv | ||
3117 | 23 | |||
3118 | 24 | class mrp_subproduct(osv.osv): | ||
3119 | 25 | _inherit = 'mrp.subproduct' | ||
3120 | 26 | _columns={ | ||
3121 | 27 | 'product_efficiency': fields.float('Manufacturing Efficiency', required=True, help="A factor of 0.9 means a loss of 10% within the production process."), | ||
3122 | 28 | 'efficiency_rounding': fields.selection([(1,'1'),(2,'0.1'),(3,'0.01'),(4,'0.001'),(5,'0.0001'),(5,'0.00001')], 'Efficiency rounding', required=True, help= "todo" ), | ||
3123 | 29 | 'type_group_ids': fields.many2many('product.type.property.option', 'mrp_subproduct_options_rel', 'subproduct_id', 'type_id', 'Group by (GOP)',help="Used to map which property option is taken from main product in dissambly chain"), | ||
3124 | 30 | } | ||
3125 | 31 | _defaults={ | ||
3126 | 32 | 'product_efficiency' : lambda *a : 1, | ||
3127 | 33 | 'efficiency_rounding' : lambda *a : 2, | ||
3128 | 34 | } | ||
3129 | 35 | mrp_subproduct() | ||
3130 | 36 | |||
3131 | 37 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | ||
3132 | 0 | \ No newline at end of file | 38 | \ No newline at end of file |
3133 | 1 | 39 | ||
3134 | === added file 'asperience_configurator_mrp/mrp_subproduct_view.xml' | |||
3135 | --- asperience_configurator_mrp/mrp_subproduct_view.xml 1970-01-01 00:00:00 +0000 | |||
3136 | +++ asperience_configurator_mrp/mrp_subproduct_view.xml 2017-12-01 14:57:12 +0000 | |||
3137 | @@ -0,0 +1,33 @@ | |||
3138 | 1 | <?xml version="1.0" encoding="utf-8"?> | ||
3139 | 2 | <openerp> | ||
3140 | 3 | <data> | ||
3141 | 4 | <record id="mrp_subproduct_view_tree" model="ir.ui.view"> | ||
3142 | 5 | <field name="name">mrp.subproduct.tree</field> | ||
3143 | 6 | <field name="model">mrp.subproduct</field> | ||
3144 | 7 | <field name="type">tree</field> | ||
3145 | 8 | <field name="arch" type="xml"> | ||
3146 | 9 | <tree string="Sub products" editable="top"> | ||
3147 | 10 | <field name="product_id" on_change="onchange_product_id(product_id)"/> | ||
3148 | 11 | <field name="product_uom"/> | ||
3149 | 12 | <field name="product_qty"/> | ||
3150 | 13 | <field name="subproduct_type"/> | ||
3151 | 14 | </tree> | ||
3152 | 15 | </field> | ||
3153 | 16 | </record> | ||
3154 | 17 | |||
3155 | 18 | <record id="mrp_subproduct_view_form" model="ir.ui.view"> | ||
3156 | 19 | <field name="name">mrp.subproduct.form</field> | ||
3157 | 20 | <field name="model">mrp.subproduct</field> | ||
3158 | 21 | <field name="type">form</field> | ||
3159 | 22 | <field name="arch" type="xml"> | ||
3160 | 23 | <form string="Sub products"> | ||
3161 | 24 | <field name="product_id" on_change="onchange_product_id(product_id)"/> | ||
3162 | 25 | <field name="product_uom"/> | ||
3163 | 26 | <field name="product_qty"/> | ||
3164 | 27 | <field name="subproduct_type"/> | ||
3165 | 28 | </form> | ||
3166 | 29 | </field> | ||
3167 | 30 | </record> | ||
3168 | 31 | |||
3169 | 32 | </data> | ||
3170 | 33 | </openerp> | ||
3171 | 0 | 34 | ||
3172 | === added file 'asperience_configurator_mrp/mrp_view.xml' | |||
3173 | --- asperience_configurator_mrp/mrp_view.xml 1970-01-01 00:00:00 +0000 | |||
3174 | +++ asperience_configurator_mrp/mrp_view.xml 2017-12-01 14:57:12 +0000 | |||
3175 | @@ -0,0 +1,735 @@ | |||
3176 | 1 | <?xml version="1.0" encoding="utf-8"?> | ||
3177 | 2 | <openerp> | ||
3178 | 3 | <data> | ||
3179 | 4 | ###################################### PROPERTY ####################################### | ||
3180 | 5 | <record id="mrp_property_group_tree_view_asperience_mrp" model="ir.ui.view"> | ||
3181 | 6 | <field name="name">mrp.property.group.tree.asperience_mrp</field> | ||
3182 | 7 | <field name="model">mrp.property.group</field> | ||
3183 | 8 | <field name="arch" type="xml"> | ||
3184 | 9 | <form string="Properties categories"> | ||
3185 | 10 | <separator colspan="4" string="General Information"/> | ||
3186 | 11 | <field colspan="4" name="name"/> | ||
3187 | 12 | <field colspan="4" name="description"/> | ||
3188 | 13 | <field name="property_ids" nolabel="1" colspan="4"/> | ||
3189 | 14 | </form> | ||
3190 | 15 | </field> | ||
3191 | 16 | </record> | ||
3192 | 17 | |||
3193 | 18 | <record id="mrp_property_tree_view_asperience_mrp" model="ir.ui.view"> | ||
3194 | 19 | <field name="name">mrp.property.tree.asperience_mrp</field> | ||
3195 | 20 | <field name="model">mrp.property</field> | ||
3196 | 21 | <field name="inherit_id" ref="mrp.mrp_property_tree_view" /> | ||
3197 | 22 | <field name="arch" type="xml"> | ||
3198 | 23 | <field name="name" position="before"> | ||
3199 | 24 | <field name="code"/> | ||
3200 | 25 | <field name="price"/> | ||
3201 | 26 | <field name="uom_s_size_tmpl"/> | ||
3202 | 27 | <field name="size_x_tmpl"/> | ||
3203 | 28 | <field name="size_y_tmpl"/> | ||
3204 | 29 | <field name="size_z_tmpl"/> | ||
3205 | 30 | <field name="diameter_tmpl"/> | ||
3206 | 31 | </field> | ||
3207 | 32 | <field name="composition" position="replace"/> | ||
3208 | 33 | </field> | ||
3209 | 34 | </record> | ||
3210 | 35 | <record id="mrp_property_form_view_asperience_mrp" model="ir.ui.view"> | ||
3211 | 36 | <field name="name">mrp.property.form.asperience_mrp</field> | ||
3212 | 37 | <field name="model">mrp.property</field> | ||
3213 | 38 | <field name="type">form</field> | ||
3214 | 39 | <field name="inherit_id" ref="mrp.mrp_property_form_view" /> | ||
3215 | 40 | <field name="arch" type="xml"> | ||
3216 | 41 | <field name="name" position="before"> | ||
3217 | 42 | <field name="code"/> | ||
3218 | 43 | </field> | ||
3219 | 44 | <field name="name" position="after"> | ||
3220 | 45 | <newline/> | ||
3221 | 46 | <field name="price"/> | ||
3222 | 47 | <newline/> | ||
3223 | 48 | <field name="size_x_tmpl"/> | ||
3224 | 49 | <field name="size_y_tmpl"/> | ||
3225 | 50 | <field name="size_z_tmpl"/> | ||
3226 | 51 | <field name="diameter_tmpl"/> | ||
3227 | 52 | <field name="uom_s_size_tmpl"/> | ||
3228 | 53 | <newline/> | ||
3229 | 54 | </field> | ||
3230 | 55 | <field name="composition" position="replace"/> | ||
3231 | 56 | </field> | ||
3232 | 57 | </record> | ||
3233 | 58 | |||
3234 | 59 | ###################################### WORKCENTER ####################################### | ||
3235 | 60 | <record id="mrp_workcenter_tree_view_asperience_mrp" model="ir.ui.view"> | ||
3236 | 61 | <field name="name">mrp.workcenter.tree.asperience.mrp</field> | ||
3237 | 62 | <field name="model">mrp.workcenter</field> | ||
3238 | 63 | <field name="inherit_id" ref="mrp.mrp_workcenter_tree_view"/> | ||
3239 | 64 | <field name="arch" type="xml"> | ||
3240 | 65 | <field name="code" position="before"> | ||
3241 | 66 | <field name="sequence"/> | ||
3242 | 67 | </field> | ||
3243 | 68 | </field> | ||
3244 | 69 | </record> | ||
3245 | 70 | |||
3246 | 71 | <record id="mrp_workcenter_view_asperience_mrp" model="ir.ui.view"> | ||
3247 | 72 | <field name="name">mrp.workcenter.form.asperience.mrp</field> | ||
3248 | 73 | <field name="model">mrp.workcenter</field> | ||
3249 | 74 | <field name="inherit_id" ref="mrp.mrp_workcenter_view"/> | ||
3250 | 75 | <field name="arch" type="xml"> | ||
3251 | 76 | <notebook position="inside"> | ||
3252 | 77 | <page string="Properties"> | ||
3253 | 78 | <field name="property_ids" nolabel="1" colspan="4"/> | ||
3254 | 79 | </page> | ||
3255 | 80 | <page string="Hierarchy"> | ||
3256 | 81 | <field name="parent_id" domain="[('type','in', [type_re, type_pc, type_cc])]"/> | ||
3257 | 82 | <field colspan="4" name="child_ids"/> | ||
3258 | 83 | </page> | ||
3259 | 84 | </notebook> | ||
3260 | 85 | <!-- <field name="timesheet_id" position="replace"/> --> | ||
3261 | 86 | <field name="time_start" position="attributes"> | ||
3262 | 87 | <attribute name="attrs">{'invisible': [('type', '!=', 'machine')]}</attribute> | ||
3263 | 88 | </field> | ||
3264 | 89 | <field name="time_stop" position="attributes"> | ||
3265 | 90 | <attribute name="attrs">{'invisible': [('type', '!=', 'machine')]}</attribute> | ||
3266 | 91 | </field> | ||
3267 | 92 | <field name="code" position="before"> | ||
3268 | 93 | <field name="sequence"/> | ||
3269 | 94 | </field> | ||
3270 | 95 | <field name="resource_type" position="before"> | ||
3271 | 96 | <field name="warehouse_id"/> | ||
3272 | 97 | </field> | ||
3273 | 98 | <field name="resource_type" position="after"> | ||
3274 | 99 | <field name="type_workcenter" on_change="onchange_type_workcenter(type_workcenter)"/> | ||
3275 | 100 | <field name="type" invisible="True"/> | ||
3276 | 101 | <newline/> | ||
3277 | 102 | <field name="type_re" on_change="onchange_type(type_re)" attrs="{'invisible':[('type_workcenter','!=', 're')]}"/> | ||
3278 | 103 | <newline/> | ||
3279 | 104 | <field name="type_pc" on_change="onchange_type(type_pc)" attrs="{'invisible':[('type_workcenter','!=', 'pc')]}"/> | ||
3280 | 105 | <newline/> | ||
3281 | 106 | <field name="type_cc" on_change="onchange_type(type_cc)" attrs="{'invisible':[('type_workcenter','!=', 'cc')]}"/> | ||
3282 | 107 | <newline/> | ||
3283 | 108 | <field name="technology" attrs="{'invisible':[('type','not in',['tool', 'machine', 'machine_hr', 'line'])]}"/> | ||
3284 | 109 | <newline/> | ||
3285 | 110 | <field name="scheduling" attrs="{'invisible':[('type','in',['hr','line'])]}"/> | ||
3286 | 111 | <newline/> | ||
3287 | 112 | </field> | ||
3288 | 113 | <field name="capacity_per_cycle" position="after"> | ||
3289 | 114 | <group col="6" attrs="{'invisible':[('type','=', 'hr')]}" groups="analytic.group_analytic_accounting"> | ||
3290 | 115 | <field name="fixed_capacity"/> | ||
3291 | 116 | <field name="external"/> | ||
3292 | 117 | <field name="critical"/> | ||
3293 | 118 | <field name="finite_capacity_qty"/> | ||
3294 | 119 | <field name="finite_capacity"/> | ||
3295 | 120 | </group> | ||
3296 | 121 | </field> | ||
3297 | 122 | </field> | ||
3298 | 123 | </record> | ||
3299 | 124 | |||
3300 | 125 | ###################################### BOM ####################################### | ||
3301 | 126 | |||
3302 | 127 | <record id="mrp_bom_form_view_asperience_mrp" model="ir.ui.view"> | ||
3303 | 128 | <field name="name">mrp.bom.form.asperience.mrp</field> | ||
3304 | 129 | <field name="model">mrp.bom</field> | ||
3305 | 130 | <field name="inherit_id" ref="mrp.mrp_bom_form_view"/> | ||
3306 | 131 | <field name="arch" type="xml"> | ||
3307 | 132 | <field name="property_ids" position="replace" > | ||
3308 | 133 | <field name="property_ids" nolabel="1" colspan="4" /> | ||
3309 | 134 | <field name="type_group_ids" nolabel="1" colspan="4" /> | ||
3310 | 135 | </field> | ||
3311 | 136 | <field name="bom_line_ids" position="after" > | ||
3312 | 137 | <button name="gen_graph" string="Graph" type="object" /> | ||
3313 | 138 | <separator colspan="4" string="Components"/> | ||
3314 | 139 | <!-- <field name="bom_lines_multi" nolabel="1" colspan="4" /> --> | ||
3315 | 140 | <field name="bom_components" nolabel="1" colspan="4" context="{'tree_view_ref':'asperience_mrp.mrp_bom_component_rel_tree_view_component','form_view_ref':'asperience_mrp.mrp_bom_component_rel_form_view_component'}" /> | ||
3316 | 141 | <separator colspan="4" string="Is used in"/> | ||
3317 | 142 | <!-- <field name="bom_parent_multi" nolabel="1" colspan="4" /> --> | ||
3318 | 143 | <field name="bom_components_parent" nolabel="1" colspan="4" context="{'tree_view_ref':'asperience_mrp.mrp_bom_component_rel_tree_view_parent','form_view_ref':'asperience_mrp.mrp_bom_component_rel_form_view_parent'}" /> | ||
3319 | 144 | </field> | ||
3320 | 145 | <field name="type" position="after" > | ||
3321 | 146 | <field name="bom_type" /> | ||
3322 | 147 | </field> | ||
3323 | 148 | </field> | ||
3324 | 149 | </record> | ||
3325 | 150 | |||
3326 | 151 | ###################################### PROD LINE ####################################### | ||
3327 | 152 | <record id="mrp.mrp_production_product_form_view" model="ir.ui.view"> | ||
3328 | 153 | <field name="name">mrp.production.product.line.form.asperience.mrp</field> | ||
3329 | 154 | <field name="model">mrp.production.product.line</field> | ||
3330 | 155 | <field name="priority">15</field> | ||
3331 | 156 | <field name="arch" type="xml"> | ||
3332 | 157 | <form string="Scheduled Products"> | ||
3333 | 158 | <field name="name" /> | ||
3334 | 159 | <field name="product_id" on_change="onchange_product_id(product_id)" /> | ||
3335 | 160 | <field name="product_qty" /> | ||
3336 | 161 | <field name="product_uom" /> | ||
3337 | 162 | <field name="product_uos_qty" /> | ||
3338 | 163 | <field name="product_uos" /> | ||
3339 | 164 | <field name='specific_production' colspan="4" /> | ||
3340 | 165 | <field name='note_production' colspan="4" attrs="{'invisible':[('specific_production','=',False)]}"/> | ||
3341 | 166 | <group colspan="4"> | ||
3342 | 167 | <field name="shape" | ||
3343 | 168 | on_change="compute_weight(product_id,size_x, size_y, size_z, shape, density, diameter)" /> | ||
3344 | 169 | |||
3345 | 170 | <field name="density" | ||
3346 | 171 | on_change="compute_weight(product_id,size_x, size_y, size_z, shape, density, diameter)" /> | ||
3347 | 172 | |||
3348 | 173 | <field name="diameter" on_change="compute_weight(product_id,size_x, size_y, size_z, shape, density, diameter)" attrs="{'invisible':[('shape','in',['quadrangular','other'])]}"/> | ||
3349 | 174 | <field name="weight" /> | ||
3350 | 175 | </group> | ||
3351 | 176 | <group colspan="6" col="10" attrs="{'invisible':[('specific_production','=',False)]}"> | ||
3352 | 177 | <group colspan="2"> | ||
3353 | 178 | <field name='size_x' colspan="2" on_change="compute_weight(product_id,size_x, size_y, size_z, shape, density, diameter)" /> | ||
3354 | 179 | <field name='size_y' colspan="2" on_change="compute_weight(product_id,size_x, size_y, size_z, shape, density, diameter)" /> | ||
3355 | 180 | <field name='size_z' colspan="2" on_change="compute_weight(product_id,size_x, size_y, size_z, shape, density, diameter)" /> | ||
3356 | 181 | </group> | ||
3357 | 182 | <group colspan="2"> | ||
3358 | 183 | <label string='-' colspan="4"/> | ||
3359 | 184 | <label string='-' colspan="4"/> | ||
3360 | 185 | <label string='-' colspan="4"/> | ||
3361 | 186 | </group> | ||
3362 | 187 | <group colspan="2"> | ||
3363 | 188 | <field name='size_x_specific_delta' colspan="2" /> | ||
3364 | 189 | <field name='size_y_specific_delta' colspan="2" /> | ||
3365 | 190 | <field name='size_z_specific_delta' colspan="2" /> | ||
3366 | 191 | </group> | ||
3367 | 192 | <group colspan="2"> | ||
3368 | 193 | <label string='=' colspan="4"/> | ||
3369 | 194 | <label string='=' colspan="4"/> | ||
3370 | 195 | <label string='=' colspan="4"/> | ||
3371 | 196 | </group> | ||
3372 | 197 | <group colspan="2"> | ||
3373 | 198 | <field name='size_x_specific' colspan="2" /> | ||
3374 | 199 | <field name='size_y_specific' colspan="2" /> | ||
3375 | 200 | <field name='size_z_specific' colspan="2" /> | ||
3376 | 201 | </group> | ||
3377 | 202 | </group> | ||
3378 | 203 | |||
3379 | 204 | <field name="property_ids" colspan="4" nolabel="1"/> | ||
3380 | 205 | <field name="group_property_ids" colspan="4" nolabel="1" /> | ||
3381 | 206 | <field name="option_ids" nolabel="1" colspan="4" widget="one2many_list"/> | ||
3382 | 207 | <field name="procurement_id" /> | ||
3383 | 208 | <field name="bom_id" /> | ||
3384 | 209 | </form> | ||
3385 | 210 | </field> | ||
3386 | 211 | </record> | ||
3387 | 212 | |||
3388 | 213 | <record id="mrp_production_product_tree_view_asperience_mrp" model="ir.ui.view"> | ||
3389 | 214 | <field name="name">mrp.production.product.line.tree.asperience.mrp</field> | ||
3390 | 215 | <field name="model">mrp.production.product.line</field> | ||
3391 | 216 | <field name="inherit_id" ref="mrp.mrp_production_product_tree_view"/> | ||
3392 | 217 | <field name="arch" type="xml"> | ||
3393 | 218 | <field name="product_uos" position="after"> | ||
3394 | 219 | <field name="density" /> | ||
3395 | 220 | <field name="shape" /> | ||
3396 | 221 | <field name="diameter" /> | ||
3397 | 222 | <field name="size_x" /> | ||
3398 | 223 | <field name="size_y" /> | ||
3399 | 224 | <field name="size_z" /> | ||
3400 | 225 | <field name="weight" /> | ||
3401 | 226 | <field name="property_ids"/> | ||
3402 | 227 | <field name="group_property_ids" /> | ||
3403 | 228 | <field name="option_ids" nolabel="1" colspan="4" widget="one2many_list"/> | ||
3404 | 229 | <field name="procurement_id" /> | ||
3405 | 230 | <field name="bom_id" /> | ||
3406 | 231 | </field> | ||
3407 | 232 | <field name="product_id" position="before"> | ||
3408 | 233 | <field name="name" /> | ||
3409 | 234 | </field> | ||
3410 | 235 | </field> | ||
3411 | 236 | </record> | ||
3412 | 237 | |||
3413 | 238 | ###################################### WORKCENTER TECHNOLOGY ####################################### | ||
3414 | 239 | <record id="mrp_workcenter_technology_form_view" model="ir.ui.view"> | ||
3415 | 240 | <field name="name">mrp.workcenter.technology.form.view.1</field> | ||
3416 | 241 | <field name="model">mrp.workcenter.technology</field> | ||
3417 | 242 | <field name="type">form</field> | ||
3418 | 243 | <field name="arch" type="xml"> | ||
3419 | 244 | <form string="Workcenter Technology"> | ||
3420 | 245 | <group col="6" colspan="4"> | ||
3421 | 246 | <group col="3" colspan="2"> | ||
3422 | 247 | <field name="name" /> | ||
3423 | 248 | </group> | ||
3424 | 249 | </group> | ||
3425 | 250 | </form> | ||
3426 | 251 | </field> | ||
3427 | 252 | </record> | ||
3428 | 253 | <record id="mrp_workcenter_technology_tree_view" model="ir.ui.view"> | ||
3429 | 254 | <field name="name">mrp.workcenter.technology.tree.view.1</field> | ||
3430 | 255 | <field name="model">mrp.workcenter.technology</field> | ||
3431 | 256 | <field name="type">tree</field> | ||
3432 | 257 | <field name="arch" type="xml"> | ||
3433 | 258 | <tree string="Workcenter Technology"> | ||
3434 | 259 | <field name="name" /> | ||
3435 | 260 | </tree> | ||
3436 | 261 | </field> | ||
3437 | 262 | </record> | ||
3438 | 263 | |||
3439 | 264 | <record model="ir.actions.act_window" id="mrp_workcenter_technology_all_action"> | ||
3440 | 265 | <field name="name">Workcenter Technology</field> | ||
3441 | 266 | <field name="res_model">mrp.workcenter.technology</field> | ||
3442 | 267 | <field name="view_mode">tree,form</field> | ||
3443 | 268 | <field name="view_id" ref="asperience_configurator_mrp.mrp_workcenter_technology_tree_view"/> | ||
3444 | 269 | </record> | ||
3445 | 270 | <record model="ir.actions.act_window.view" id="mrp_workcenter_technology_tree_action"> | ||
3446 | 271 | <field name="sequence" eval="1"/> | ||
3447 | 272 | <field name="view_mode">tree</field> | ||
3448 | 273 | <field name="view_id" ref="asperience_configurator_mrp.mrp_workcenter_technology_tree_view"/> | ||
3449 | 274 | <field name="act_window_id" ref="mrp_workcenter_technology_all_action"/> | ||
3450 | 275 | </record> | ||
3451 | 276 | <record model="ir.actions.act_window.view" id="mrp_workcenter_technology_form_action"> | ||
3452 | 277 | <field name="sequence" eval="2"/> | ||
3453 | 278 | <field name="view_mode">form</field> | ||
3454 | 279 | <field name="view_id" ref="asperience_configurator_mrp.mrp_workcenter_technology_form_view"/> | ||
3455 | 280 | <field name="act_window_id" ref="mrp_workcenter_technology_all_action"/> | ||
3456 | 281 | </record> | ||
3457 | 282 | <menuitem action="mrp_workcenter_technology_all_action" id="menu_mrp_workcenter_technology_all_action" parent="mrp.menu_mrp_configuration" sequence="22"/> | ||
3458 | 283 | |||
3459 | 284 | ###################################### PRODUCTION ####################################### | ||
3460 | 285 | <record id="mrp_production_form_view_asperience_mrp" model="ir.ui.view"> | ||
3461 | 286 | <field name="name">mrp.production.form.asperience.mrp</field> | ||
3462 | 287 | <field name="model">mrp.production</field> | ||
3463 | 288 | <field name="inherit_id" ref="mrp.mrp_production_form_view"/> | ||
3464 | 289 | <field name="arch" type="xml"> | ||
3465 | 290 | <field name="workcenter_lines" position="replace" > | ||
3466 | 291 | <field colspan="4" name="workcenter_lines" nolabel="1" > | ||
3467 | 292 | <form string="Production Workcenters"> | ||
3468 | 293 | <field colspan="4" name="name"/> | ||
3469 | 294 | <field colspan="4" name="workcenter_id" /> | ||
3470 | 295 | <separator/> | ||
3471 | 296 | <field name="sequence"/> | ||
3472 | 297 | <field name="cycle"/> | ||
3473 | 298 | <field name="hour"/> | ||
3474 | 299 | </form> | ||
3475 | 300 | <tree string="Production Workcenters" > | ||
3476 | 301 | <field name="sequence"/> | ||
3477 | 302 | <field name="name"/> | ||
3478 | 303 | <field name="workcenter_id"/> | ||
3479 | 304 | <field name="cycle"/> | ||
3480 | 305 | <field name="hour"/> | ||
3481 | 306 | </tree> | ||
3482 | 307 | </field> | ||
3483 | 308 | </field> | ||
3484 | 309 | <page string="Extra Information" position="after" > | ||
3485 | 310 | <page string="Procurements"> | ||
3486 | 311 | <field name="procurement_ids"/> | ||
3487 | 312 | </page> | ||
3488 | 313 | </page> | ||
3489 | 314 | <field name="move_prod_id" position="after" > | ||
3490 | 315 | <field name='note_production' colspan="4" attrs="{'invisible':[('specific_production','=',False)]}"/> | ||
3491 | 316 | <group colspan="6" col="10" attrs="{'invisible':[('specific_production','=',False)]}"> | ||
3492 | 317 | <group colspan="2"> | ||
3493 | 318 | <field name='size_x' colspan="2"/> | ||
3494 | 319 | <field name='size_y' colspan="2"/> | ||
3495 | 320 | <field name='size_z' colspan="2"/> | ||
3496 | 321 | <field name='diameter' colspan="2"/> | ||
3497 | 322 | </group> | ||
3498 | 323 | <group colspan="2"> | ||
3499 | 324 | <label string='-' colspan="4"/> | ||
3500 | 325 | <label string='-' colspan="4"/> | ||
3501 | 326 | <label string='-' colspan="4"/> | ||
3502 | 327 | <label string='-' colspan="4"/> | ||
3503 | 328 | </group> | ||
3504 | 329 | <group colspan="2"> | ||
3505 | 330 | <field name='size_x_specific_delta' colspan="2" /> | ||
3506 | 331 | <field name='size_y_specific_delta' colspan="2" /> | ||
3507 | 332 | <field name='size_z_specific_delta' colspan="2" /> | ||
3508 | 333 | <field name='diameter_specific_delta' colspan="2" /> | ||
3509 | 334 | </group> | ||
3510 | 335 | <group colspan="2"> | ||
3511 | 336 | <label string='=' colspan="4"/> | ||
3512 | 337 | <label string='=' colspan="4"/> | ||
3513 | 338 | <label string='=' colspan="4"/> | ||
3514 | 339 | <label string='=' colspan="4"/> | ||
3515 | 340 | </group> | ||
3516 | 341 | <group colspan="2"> | ||
3517 | 342 | <field name='size_x_specific' colspan="2" /> | ||
3518 | 343 | <field name='size_y_specific' colspan="2" /> | ||
3519 | 344 | <field name='size_z_specific' colspan="2" /> | ||
3520 | 345 | <field name='diameter_specific' colspan="2" /> | ||
3521 | 346 | </group> | ||
3522 | 347 | </group> | ||
3523 | 348 | <field name='specific_production' colspan="4" /> | ||
3524 | 349 | <separator string="Production" colspan="4" /> | ||
3525 | 350 | </field> | ||
3526 | 351 | <button name="action_compute" position="after" > | ||
3527 | 352 | <button name="action_compute" string="Compute Data" type="object" /> | ||
3528 | 353 | <button name="button_draft" string="Draft" /> | ||
3529 | 354 | </button> | ||
3530 | 355 | </field> | ||
3531 | 356 | </record> | ||
3532 | 357 | |||
3533 | 358 | ###################################### GROUP OPTION ####################################### | ||
3534 | 359 | <record id="mrp_property_group_option_form_view_asperience_mrp_1" model="ir.ui.view"> | ||
3535 | 360 | <field name="name">mrp.property.group.option.form.asperience.mrp.1</field> | ||
3536 | 361 | <field name="model">mrp.property.group.option</field> | ||
3537 | 362 | <field name="type">form</field> | ||
3538 | 363 | <field name="arch" type="xml"> | ||
3539 | 364 | <form string="GOP / Property"> | ||
3540 | 365 | <field colspan="4" name="name"/> | ||
3541 | 366 | <field colspan="4" name="type_group_id" on_change="onchange_group_property(type_group_id,property_id)"/> | ||
3542 | 367 | <field colspan="4" name="property_id" on_change="onchange_group_property(type_group_id,property_id)"/> | ||
3543 | 368 | </form> | ||
3544 | 369 | </field> | ||
3545 | 370 | </record> | ||
3546 | 371 | <record id="mrp_property_group_option_tree_view_asperience_mrp_1" model="ir.ui.view"> | ||
3547 | 372 | <field name="name">mrp.property.group.option.tree.asperience.mrp.1</field> | ||
3548 | 373 | <field name="model">mrp.property.group.option</field> | ||
3549 | 374 | <field name="type">tree</field> | ||
3550 | 375 | <field name="arch" type="xml"> | ||
3551 | 376 | <tree string="GOP / Property" editable="top"> | ||
3552 | 377 | <field colspan="4" name="name"/> | ||
3553 | 378 | <field colspan="4" name="type_group_id" on_change="onchange_group_property(type_group_id,property_id)"/> | ||
3554 | 379 | <field colspan="4" name="property_id" on_change="onchange_group_property(type_group_id,property_id)"/> | ||
3555 | 380 | </tree> | ||
3556 | 381 | </field> | ||
3557 | 382 | </record> | ||
3558 | 383 | |||
3559 | 384 | ###################################### GROUP OPTION ####################################### | ||
3560 | 385 | <record id="mrp_routing_form_view_asperience_mrp_1" model="ir.ui.view"> | ||
3561 | 386 | <field name="name">mrp.routing.form.asperience.mrp.1</field> | ||
3562 | 387 | <field name="model">mrp.routing</field> | ||
3563 | 388 | <field name="inherit_id" ref="mrp.mrp_routing_form_view"/> | ||
3564 | 389 | <field name="type">form</field> | ||
3565 | 390 | <field name="arch" type="xml"> | ||
3566 | 391 | <field name="active" position="after"> | ||
3567 | 392 | <field name="technical_data" colspan="4"/> | ||
3568 | 393 | </field> | ||
3569 | 394 | </field> | ||
3570 | 395 | </record> | ||
3571 | 396 | <record id="mrp_routing_tree_view_asperience_mrp_1" model="ir.ui.view"> | ||
3572 | 397 | <field name="name">mrp.routing.tree.asperience.mrp.1</field> | ||
3573 | 398 | <field name="model">mrp.routing</field> | ||
3574 | 399 | <field name="inherit_id" ref="mrp.mrp_routing_tree_view"/> | ||
3575 | 400 | <field name="type">tree</field> | ||
3576 | 401 | <field name="arch" type="xml"> | ||
3577 | 402 | <field name="name" position="after"> | ||
3578 | 403 | <field name="technical_data" /> | ||
3579 | 404 | </field> | ||
3580 | 405 | </field> | ||
3581 | 406 | </record> | ||
3582 | 407 | |||
3583 | 408 | ###################################### SUBPRODUCT ####################################### | ||
3584 | 409 | <record id="mrp_byproduct.mrp_subproduct_view" model="ir.ui.view"> | ||
3585 | 410 | <field name="name">mrp.bom.sub.product.asperience.mrp.1</field> | ||
3586 | 411 | <field name="model">mrp.bom</field> | ||
3587 | 412 | <field name="inherit_id" ref="mrp.mrp_bom_form_view"/> | ||
3588 | 413 | <field name="arch" type="xml"> | ||
3589 | 414 | <field name="product_id" position="replace"> | ||
3590 | 415 | <field name="product_id" on_change="onchange_product_id(product_id, name,False)"/> | ||
3591 | 416 | </field> | ||
3592 | 417 | <field name="type" position="after"> | ||
3593 | 418 | <group colspan="4"> | ||
3594 | 419 | <field name="shape" | ||
3595 | 420 | on_change="compute_weight(product_id,size_x, size_y, size_z, shape, density, diameter)" /> | ||
3596 | 421 | |||
3597 | 422 | <field name="density" | ||
3598 | 423 | on_change="compute_weight(product_id,size_x, size_y, size_z, shape, density, diameter)" /> | ||
3599 | 424 | |||
3600 | 425 | </group> | ||
3601 | 426 | |||
3602 | 427 | <group colspan="4"> | ||
3603 | 428 | <group attrs="{'invisible':[('shape','in',['cylindrical','other'])]}"> | ||
3604 | 429 | <field name="size_x" | ||
3605 | 430 | on_change="compute_weight(product_id,size_x, size_y, size_z, shape, density, diameter)" /> | ||
3606 | 431 | <field name="size_y" | ||
3607 | 432 | on_change="compute_weight(product_id,size_x, size_y, size_z, shape, density, diameter)" /> | ||
3608 | 433 | </group> | ||
3609 | 434 | |||
3610 | 435 | <group attrs="{'invisible':[('shape','in',['quadrangular','other'])]}"> | ||
3611 | 436 | <field name="diameter" | ||
3612 | 437 | on_change="compute_weight(product_id,size_x, size_y, size_z, shape, density, diameter)" /> | ||
3613 | 438 | </group> | ||
3614 | 439 | |||
3615 | 440 | <group attrs="{'invisible':[('shape','in',['other'])]}"> | ||
3616 | 441 | <field name="size_z" | ||
3617 | 442 | on_change="compute_weight(product_id,size_x, size_y, size_z, shape, density, diameter)" /> | ||
3618 | 443 | </group> | ||
3619 | 444 | |||
3620 | 445 | |||
3621 | 446 | </group> | ||
3622 | 447 | <group colspan="4" attrs="{'invisible':[('shape','in',['other'])]}"> | ||
3623 | 448 | <field name="weight" /> | ||
3624 | 449 | |||
3625 | 450 | </group> | ||
3626 | 451 | </field> | ||
3627 | 452 | <notebook position="inside"> | ||
3628 | 453 | <page string="Byproducts" position="inside"> | ||
3629 | 454 | <field name="sub_products"> | ||
3630 | 455 | <tree string="Byproducts" editable="top"> | ||
3631 | 456 | <field name="product_id" on_change="onchange_product_id(product_id)"/> | ||
3632 | 457 | <field name="product_uom" on_change="onchange_uom(product_id, product_uom)" groups="product.group_uom"/> | ||
3633 | 458 | <field name="product_qty"/> | ||
3634 | 459 | <field name="product_efficiency"/> | ||
3635 | 460 | <field name="efficiency_rounding"/> | ||
3636 | 461 | <field name="subproduct_type"/> | ||
3637 | 462 | <field name="type_group_ids"/> | ||
3638 | 463 | </tree> | ||
3639 | 464 | <form string="Byproducts"> | ||
3640 | 465 | <field name="product_id" on_change="onchange_product_id(product_id)"/> | ||
3641 | 466 | <field name="product_uom" on_change="onchange_uom(product_id, product_uom)" groups="product.group_uom"/> | ||
3642 | 467 | <field name="product_qty"/> | ||
3643 | 468 | <field name="product_efficiency"/> | ||
3644 | 469 | <field name="efficiency_rounding"/> | ||
3645 | 470 | <field name="subproduct_type"/> | ||
3646 | 471 | <field name="type_group_ids"/> | ||
3647 | 472 | </form> | ||
3648 | 473 | </field> | ||
3649 | 474 | </page> | ||
3650 | 475 | </notebook> | ||
3651 | 476 | </field> | ||
3652 | 477 | </record> | ||
3653 | 478 | |||
3654 | 479 | <record id="mrp_bom_tree_view_asperience_mrp" model="ir.ui.view"> | ||
3655 | 480 | <field name="name">mrp.bom.tree.asperience.mrp</field> | ||
3656 | 481 | <field name="model">mrp.bom</field> | ||
3657 | 482 | <field name="inherit_id" ref="mrp.mrp_bom_tree_view" /> | ||
3658 | 483 | <field name="field_parent">child_complete_ids</field> | ||
3659 | 484 | <field name="arch" type="xml"> | ||
3660 | 485 | <field name="product_uom" position="after"> | ||
3661 | 486 | <field name="density" /> | ||
3662 | 487 | <field name="shape" /> | ||
3663 | 488 | <field name="diameter" /> | ||
3664 | 489 | <field name="size_x" /> | ||
3665 | 490 | <field name="size_y" /> | ||
3666 | 491 | <field name="size_z" /> | ||
3667 | 492 | <field name="weight" /> | ||
3668 | 493 | </field> | ||
3669 | 494 | </field> | ||
3670 | 495 | </record> | ||
3671 | 496 | |||
3672 | 497 | <record id="mrp_routing_workcenter_subproduct_form_view" model="ir.ui.view"> | ||
3673 | 498 | <field name="name">mrp.routing.workcenter.subproduct</field> | ||
3674 | 499 | <field name="model">mrp.routing.workcenter.subproduct</field> | ||
3675 | 500 | <field name="type">form</field> | ||
3676 | 501 | <field name="arch" type="xml"> | ||
3677 | 502 | <form string="Subproduct" > | ||
3678 | 503 | <field name="name" colspan="4"/> | ||
3679 | 504 | <field name="workcenter_line_id" colspan="4"/> | ||
3680 | 505 | <field name="subproduct_id" colspan="4"/> | ||
3681 | 506 | </form> | ||
3682 | 507 | </field> | ||
3683 | 508 | </record> | ||
3684 | 509 | |||
3685 | 510 | <record id="mrp_routing_workcenter_subproduct_tree_view" model="ir.ui.view"> | ||
3686 | 511 | <field name="name">mrp.routing.workcenter.subproduct</field> | ||
3687 | 512 | <field name="model">mrp.routing.workcenter.subproduct</field> | ||
3688 | 513 | <field name="type">tree</field> | ||
3689 | 514 | <field name="arch" type="xml"> | ||
3690 | 515 | <tree string="Subproduct" > | ||
3691 | 516 | <field name="name" /> | ||
3692 | 517 | <field name="workcenter_line_id" /> | ||
3693 | 518 | <field name="subproduct_id" /> | ||
3694 | 519 | </tree> | ||
3695 | 520 | </field> | ||
3696 | 521 | </record> | ||
3697 | 522 | |||
3698 | 523 | ###################################### GROUP ROUTING ####################################### | ||
3699 | 524 | <record id="mrp_routing_workcenter_tree_view_asperience_mrp_1" model="ir.ui.view"> | ||
3700 | 525 | <field name="name">mrp.routing.workcenter.tree.asperience.mrp.1</field> | ||
3701 | 526 | <field name="model">mrp.routing.workcenter</field> | ||
3702 | 527 | <field name="inherit_id" ref="mrp.mrp_routing_workcenter_tree_view"/> | ||
3703 | 528 | <field name="type">tree</field> | ||
3704 | 529 | <field name="arch" type="xml"> | ||
3705 | 530 | <field name="hour_nbr" position="after"> | ||
3706 | 531 | <field name="bom_ids"/> | ||
3707 | 532 | <field name="sub_ids"> | ||
3708 | 533 | <form string="Subproduct" > | ||
3709 | 534 | <field name="name" colspan="4"/> | ||
3710 | 535 | <field name="workcenter_line_id" colspan="4"/> | ||
3711 | 536 | <field name="subproduct_id" colspan="4"/> | ||
3712 | 537 | </form> | ||
3713 | 538 | <tree string="Subproduct" > | ||
3714 | 539 | <field name="name" /> | ||
3715 | 540 | <field name="workcenter_line_id" /> | ||
3716 | 541 | <field name="subproduct_id" /> | ||
3717 | 542 | </tree> | ||
3718 | 543 | </field> | ||
3719 | 544 | </field> | ||
3720 | 545 | </field> | ||
3721 | 546 | </record> | ||
3722 | 547 | |||
3723 | 548 | <record id="mrp_routing_workcenter_form_view_asperience_mrp_1" model="ir.ui.view"> | ||
3724 | 549 | <field name="name">mrp.routing.workcenter.form.asperience.mrp.1</field> | ||
3725 | 550 | <field name="model">mrp.routing.workcenter</field> | ||
3726 | 551 | <field name="inherit_id" ref="mrp.mrp_routing_workcenter_form_view"/> | ||
3727 | 552 | <field name="type">form</field> | ||
3728 | 553 | <field name="arch" type="xml"> | ||
3729 | 554 | <field name="hour_nbr" position="after"> | ||
3730 | 555 | <field name="bom_ids" colspan="4"/> | ||
3731 | 556 | <field name="sub_ids" colspan="4"> | ||
3732 | 557 | <form string="Subproduct" > | ||
3733 | 558 | <field name="name" colspan="4"/> | ||
3734 | 559 | <field name="subproduct_id" colspan="4"/> | ||
3735 | 560 | </form> | ||
3736 | 561 | <tree string="Subproduct" > | ||
3737 | 562 | <field name="name" /> | ||
3738 | 563 | <field name="subproduct_id" /> | ||
3739 | 564 | </tree> | ||
3740 | 565 | </field> | ||
3741 | 566 | </field> | ||
3742 | 567 | </field> | ||
3743 | 568 | </record> | ||
3744 | 569 | |||
3745 | 570 | |||
3746 | 571 | ###################################### WORKCENTER LINE ####################################### | ||
3747 | 572 | <record id="mrp_production_form_view_asperience_mrp_5" model="ir.ui.view"> | ||
3748 | 573 | <field name="name">mrp.production.form.asperience.mrp.5</field> | ||
3749 | 574 | <field name="model">mrp.production</field> | ||
3750 | 575 | <field name="inherit_id" ref="mrp.mrp_production_form_view"/> | ||
3751 | 576 | <field name="type">form</field> | ||
3752 | 577 | <field name="arch" type="xml"> | ||
3753 | 578 | <field name="workcenter_lines" position="replace"> | ||
3754 | 579 | <field colspan="4" name="workcenter_lines" nolabel="1"> | ||
3755 | 580 | <form string="Production Workcenters"> | ||
3756 | 581 | <field colspan="4" name="name"/> | ||
3757 | 582 | <field colspan="4" name="workcenter_id"/> | ||
3758 | 583 | <field name="sequence"/> | ||
3759 | 584 | <field name="cycle"/> | ||
3760 | 585 | <field name="hour"/> | ||
3761 | 586 | <newline/> | ||
3762 | 587 | <field name="move_ids"/> | ||
3763 | 588 | </form> | ||
3764 | 589 | <tree string="Production Workcenters"> | ||
3765 | 590 | <field name="sequence"/> | ||
3766 | 591 | <field name="name"/> | ||
3767 | 592 | <field name="workcenter_id"/> | ||
3768 | 593 | <field name="cycle"/> | ||
3769 | 594 | <field name="hour"/> | ||
3770 | 595 | <field name="move_ids"/> | ||
3771 | 596 | </tree> | ||
3772 | 597 | </field> | ||
3773 | 598 | </field> | ||
3774 | 599 | </field> | ||
3775 | 600 | </record> | ||
3776 | 601 | |||
3777 | 602 | <record model="ir.ui.view" id="mrp_production_workcenter_tree_view_inherit_asperience_mrp_1"> | ||
3778 | 603 | <field name="name">mrp.production.workcenter.line.tree.asperience.mrp.1</field> | ||
3779 | 604 | <field name="model">mrp.production.workcenter.line</field> | ||
3780 | 605 | <field name="type">tree</field> | ||
3781 | 606 | <field name="inherit_id" ref="mrp_operations.mrp_production_workcenter_tree_view_inherit"/> | ||
3782 | 607 | <field name="arch" type="xml"> | ||
3783 | 608 | <field name="workcenter_id" position="after"> | ||
3784 | 609 | <field name="move_ids"/> | ||
3785 | 610 | </field> | ||
3786 | 611 | </field> | ||
3787 | 612 | </record> | ||
3788 | 613 | |||
3789 | 614 | <record model="ir.ui.view" id="mrp_production_workcenter_form_view_inherit_asperience_mrp_1"> | ||
3790 | 615 | <field name="name">mrp.production.workcenter.line.form.asperience.mrp.1</field> | ||
3791 | 616 | <field name="model">mrp.production.workcenter.line</field> | ||
3792 | 617 | <field name="type">form</field> | ||
3793 | 618 | <field name="inherit_id" ref="mrp_operations.mrp_production_workcenter_form_view_inherit"/> | ||
3794 | 619 | <field name="arch" type="xml"> | ||
3795 | 620 | <page string="Information" position="after"> | ||
3796 | 621 | <page string="Moves"> | ||
3797 | 622 | <field name="move_ids"/> | ||
3798 | 623 | </page> | ||
3799 | 624 | </page> | ||
3800 | 625 | </field> | ||
3801 | 626 | </record> | ||
3802 | 627 | |||
3803 | 628 | ###################################### BOM REL ####################################### | ||
3804 | 629 | <record id="mrp_bom_component_rel_form_view_component" model="ir.ui.view"> | ||
3805 | 630 | <field name="name">mrp.bom.component.rel.form.view</field> | ||
3806 | 631 | <field name="model">mrp.bom.component.rel</field> | ||
3807 | 632 | <field name="type">form</field> | ||
3808 | 633 | <field name="arch" type="xml"> | ||
3809 | 634 | <form string="Components"> | ||
3810 | 635 | <field name="component_id" /> | ||
3811 | 636 | <!-- <field name="product_component_id" /> --> | ||
3812 | 637 | <field name="qty" /> | ||
3813 | 638 | <field name="mode" /> | ||
3814 | 639 | </form> | ||
3815 | 640 | </field> | ||
3816 | 641 | </record> | ||
3817 | 642 | |||
3818 | 643 | <record id="mrp_bom_component_rel_tree_view_component" model="ir.ui.view"> | ||
3819 | 644 | <field name="name">mrp.bom.component.rel.tree.view</field> | ||
3820 | 645 | <field name="model">mrp.bom.component.rel</field> | ||
3821 | 646 | <field name="type">tree</field> | ||
3822 | 647 | <field name="arch" type="xml"> | ||
3823 | 648 | <tree string="Components" editable="top"> | ||
3824 | 649 | <field name="component_id" /> | ||
3825 | 650 | <!-- <field name="product_component_id" />--> | ||
3826 | 651 | <field name="qty" /> | ||
3827 | 652 | <field name="mode" /> | ||
3828 | 653 | </tree> | ||
3829 | 654 | </field> | ||
3830 | 655 | </record> | ||
3831 | 656 | |||
3832 | 657 | <record id="mrp_bom_component_rel_form_view_parent" model="ir.ui.view"> | ||
3833 | 658 | <field name="name">mrp.bom.component.rel.form.view</field> | ||
3834 | 659 | <field name="model">mrp.bom.component.rel</field> | ||
3835 | 660 | <field name="type">form</field> | ||
3836 | 661 | <field name="arch" type="xml"> | ||
3837 | 662 | <form string="Used in"> | ||
3838 | 663 | <field name="bom_id" /> | ||
3839 | 664 | <field name="qty" /> | ||
3840 | 665 | <field name="mode" /> | ||
3841 | 666 | </form> | ||
3842 | 667 | </field> | ||
3843 | 668 | </record> | ||
3844 | 669 | |||
3845 | 670 | <record id="mrp_bom_component_rel_tree_view_parent" model="ir.ui.view"> | ||
3846 | 671 | <field name="name">mrp.bom.component.rel.tree.view</field> | ||
3847 | 672 | <field name="model">mrp.bom.component.rel</field> | ||
3848 | 673 | <field name="type">tree</field> | ||
3849 | 674 | <field name="arch" type="xml"> | ||
3850 | 675 | <tree string="Used in" editable="top"> | ||
3851 | 676 | <field name="bom_id" /> | ||
3852 | 677 | <field name="qty" /> | ||
3853 | 678 | <field name="mode" /> | ||
3854 | 679 | </tree> | ||
3855 | 680 | </field> | ||
3856 | 681 | </record> | ||
3857 | 682 | |||
3858 | 683 | ###################################### BOM COMPONENTS ####################################### | ||
3859 | 684 | <record id="mrp_bom_component_mode_form_view" model="ir.ui.view"> | ||
3860 | 685 | <field name="name">mrp.bom.component.mode.form.view</field> | ||
3861 | 686 | <field name="model">mrp.bom.component.mode</field> | ||
3862 | 687 | <field name="type">form</field> | ||
3863 | 688 | <field name="arch" type="xml"> | ||
3864 | 689 | <form string="Mode"> | ||
3865 | 690 | <field name="name"/> | ||
3866 | 691 | <field name="dx"/> | ||
3867 | 692 | <field name="dy"/> | ||
3868 | 693 | <field name="dz"/> | ||
3869 | 694 | <field name="dd"/> | ||
3870 | 695 | </form> | ||
3871 | 696 | </field> | ||
3872 | 697 | </record> | ||
3873 | 698 | |||
3874 | 699 | <record id="mrp_bom_component_mode_tree_view" model="ir.ui.view"> | ||
3875 | 700 | <field name="name">mrp.bom.component.mode.tree.view</field> | ||
3876 | 701 | <field name="model">mrp.bom.component.mode</field> | ||
3877 | 702 | <field name="type">tree</field> | ||
3878 | 703 | <field name="arch" type="xml"> | ||
3879 | 704 | <tree string="Mode"> | ||
3880 | 705 | <field name="name" /> | ||
3881 | 706 | <field name="dx" /> | ||
3882 | 707 | <field name="dy" /> | ||
3883 | 708 | <field name="dz" /> | ||
3884 | 709 | <field name="dd" /> | ||
3885 | 710 | </tree> | ||
3886 | 711 | </field> | ||
3887 | 712 | </record> | ||
3888 | 713 | |||
3889 | 714 | <record model="ir.actions.act_window" id="mrp_bom_component_mode_all_action"> | ||
3890 | 715 | <field name="name">Bom Modes</field> | ||
3891 | 716 | <field name="res_model">mrp.bom.component.mode</field> | ||
3892 | 717 | <field name="view_mode">tree,form</field> | ||
3893 | 718 | <field name="view_id" ref="asperience_configurator_mrp.mrp_bom_component_mode_tree_view"/> | ||
3894 | 719 | </record> | ||
3895 | 720 | <record model="ir.actions.act_window.view" id="mrp_bom_component_mode_tree_action"> | ||
3896 | 721 | <field name="sequence" eval="1"/> | ||
3897 | 722 | <field name="view_mode">tree</field> | ||
3898 | 723 | <field name="view_id" ref="asperience_configurator_mrp.mrp_bom_component_mode_tree_view"/> | ||
3899 | 724 | <field name="act_window_id" ref="mrp_bom_component_mode_all_action"/> | ||
3900 | 725 | </record> | ||
3901 | 726 | <record model="ir.actions.act_window.view" id="mrp_bom_component_mode_form_action"> | ||
3902 | 727 | <field name="sequence" eval="2"/> | ||
3903 | 728 | <field name="view_mode">form</field> | ||
3904 | 729 | <field name="view_id" ref="asperience_configurator_mrp.mrp_bom_component_mode_form_view"/> | ||
3905 | 730 | <field name="act_window_id" ref="mrp_bom_component_mode_all_action"/> | ||
3906 | 731 | </record> | ||
3907 | 732 | <menuitem action="mrp_bom_component_mode_all_action" id="menu_mrp_bom_component_mode_all_action" parent="mrp.menu_mrp_configuration"/> | ||
3908 | 733 | |||
3909 | 734 | </data> | ||
3910 | 735 | </openerp> | ||
3911 | 0 | 736 | ||
3912 | === added file 'asperience_configurator_mrp/mrp_workcenter.py' | |||
3913 | --- asperience_configurator_mrp/mrp_workcenter.py 1970-01-01 00:00:00 +0000 | |||
3914 | +++ asperience_configurator_mrp/mrp_workcenter.py 2017-12-01 14:57:12 +0000 | |||
3915 | @@ -0,0 +1,130 @@ | |||
3916 | 1 | # -*- encoding: utf-8 -*- | ||
3917 | 2 | ############################################################################## | ||
3918 | 3 | # | ||
3919 | 4 | # OpenERP, Open Source Management Solution | ||
3920 | 5 | # Copyright (C) 2007-2014 ASPerience SARL (<http://www.asperience.fr>). | ||
3921 | 6 | # All Rights Reserved | ||
3922 | 7 | # | ||
3923 | 8 | # This program is free software: you can redistribute it and/or modify | ||
3924 | 9 | # it under the terms of the GNU General Public License as published by | ||
3925 | 10 | # the Free Software Foundation, either version 3 of the License, or | ||
3926 | 11 | # (at your option) any later version. | ||
3927 | 12 | # | ||
3928 | 13 | # This program is distributed in the hope that it will be useful, | ||
3929 | 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
3930 | 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
3931 | 16 | # GNU General Public License for more details. | ||
3932 | 17 | # | ||
3933 | 18 | # You should have received a copy of the GNU General Public License | ||
3934 | 19 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
3935 | 20 | # | ||
3936 | 21 | ############################################################################## | ||
3937 | 22 | from openerp.osv import fields,osv | ||
3938 | 23 | from openerp.tools.translate import _ | ||
3939 | 24 | #import openerp.netsvc | ||
3940 | 25 | |||
3941 | 26 | class mrp_workcenter_technology(osv.osv): | ||
3942 | 27 | _name = 'mrp.workcenter.technology' | ||
3943 | 28 | _columns = { | ||
3944 | 29 | 'name': fields.char('Description', size=256, required=True), | ||
3945 | 30 | } | ||
3946 | 31 | _defaults = { | ||
3947 | 32 | } | ||
3948 | 33 | mrp_workcenter_technology() | ||
3949 | 34 | |||
3950 | 35 | class mrp_workcenter(osv.osv): | ||
3951 | 36 | _inherit = 'mrp.workcenter' | ||
3952 | 37 | |||
3953 | 38 | def _get_type(self, cr, uid, ids, field_name, arg, context={}): | ||
3954 | 39 | res = {} | ||
3955 | 40 | for id in ids: | ||
3956 | 41 | res[id] = {'type_re': '', 'type_pc': '', 'type_cc': ''} | ||
3957 | 42 | for workcenter in self.browse(cr, uid, ids): | ||
3958 | 43 | if workcenter.type_workcenter == 're': | ||
3959 | 44 | res[id]['type_re'] = workcenter.type | ||
3960 | 45 | elif workcenter.type_workcenter == 'pc': | ||
3961 | 46 | res[id]['type_pc'] = workcenter.type | ||
3962 | 47 | elif workcenter.type_workcenter == 'cc': | ||
3963 | 48 | res[id]['type_cc'] = workcenter.type | ||
3964 | 49 | return res | ||
3965 | 50 | |||
3966 | 51 | def _set_type(self, cr, uid, ids, name, value, arg, context): | ||
3967 | 52 | if not value: | ||
3968 | 53 | return False | ||
3969 | 54 | if isinstance(ids, (int, long)): | ||
3970 | 55 | ids = [ids] | ||
3971 | 56 | for workcenter in self.browse(cr, uid, ids, context): | ||
3972 | 57 | self.write(cr, uid, ids, {'type': value}) | ||
3973 | 58 | return True | ||
3974 | 59 | |||
3975 | 60 | def onchange_type(self, cr, uid, id, type=''): | ||
3976 | 61 | res = {'value':{'type': type}} | ||
3977 | 62 | return res | ||
3978 | 63 | |||
3979 | 64 | def onchange_type_workcenter(self, cr, uid, id, type_workcenter): | ||
3980 | 65 | res = {'value':{'type_re': '','type_pc': '', 'type_cc': '', 'type': ''}} | ||
3981 | 66 | if type_workcenter == 're' or type_workcenter == 'pc': | ||
3982 | 67 | res['value']['type_re'] = 'machine' | ||
3983 | 68 | elif type_workcenter == 'cc': | ||
3984 | 69 | res['value']['type_re'] = 'machine_hr' | ||
3985 | 70 | res['value']['type'] = res['value']['type_re'] | ||
3986 | 71 | return res | ||
3987 | 72 | |||
3988 | 73 | _columns = { | ||
3989 | 74 | 'sequence': fields.integer('Sequence'), | ||
3990 | 75 | 'type': fields.selection([('machine','Machine'),('hr','Human Resource'),('tool','Tool'),('machine_hr','Machine and HR'),('line','Line'),('energy','Energy')], 'Type', required=True), | ||
3991 | 76 | 'type_re': fields.function(_get_type, fnct_inv=_set_type, selection=[('machine',_('Machine')),('hr',_('Human Resource')),('tool',_('Tool')),('energy',_('Energy'))], | ||
3992 | 77 | multi="type",method=True, store=False, type='selection', string='Type'), | ||
3993 | 78 | 'type_pc': fields.function(_get_type, fnct_inv=_set_type, selection=[('machine',_('Machine')),('hr',_('Human Resource')),('machine_hr',_('Machine and HR')),('line',_('Line'))], | ||
3994 | 79 | multi="type",method=True, store=False, type='selection', string='Type'), | ||
3995 | 80 | 'type_cc': fields.function(_get_type, fnct_inv=_set_type, selection=[('machine_hr',_('Machine and HR')),('line',_('Line'))], | ||
3996 | 81 | multi="type",method=True, store=False, type='selection', string='Type'), | ||
3997 | 82 | 'type_workcenter': fields.selection([('re',_('Elementary resource')),('pc',_('Work center')),('cc',_('Work line'))], 'Type workcenter', required=True, size=2), | ||
3998 | 83 | 'scheduling': fields.selection([('machine','Machine'),('hr','Human Resource'),('machine_hr','Machine and HR'),('pg','The greatest')], 'Scheduling'), | ||
3999 | 84 | 'parent_id': fields.many2one('mrp.workcenter', 'Parent'), | ||
4000 | 85 | 'child_ids': fields.one2many('mrp.workcenter', 'parent_id','Childs'), | ||
4001 | 86 | 'technology': fields.many2one('mrp.workcenter.technology', 'Technology'), | ||
4002 | 87 | 'warehouse_id': fields.many2one('stock.warehouse', 'Sector', required=True), | ||
4003 | 88 | 'property_ids': fields.many2many('mrp.property', 'mrp_workcenter_property_rel','workcenter_id', 'property_id', 'Properties'), | ||
4004 | 89 | #A redƩfinir | ||
4005 | 90 | 'external': fields.boolean('External workcenter'), | ||
4006 | 91 | 'fixed_capacity': fields.boolean('Fixed capacity'), | ||
4007 | 92 | #'capacity_qty' : fields.float('Capacity'), | ||
4008 | 93 | 'critical': fields.boolean('Critical'), | ||
4009 | 94 | 'finite_capacity': fields.boolean('Finite Capacity'), | ||
4010 | 95 | 'finite_capacity_qty' : fields.float('Finite Capacity Qty'), | ||
4011 | 96 | } | ||
4012 | 97 | _defaults = { | ||
4013 | 98 | 'sequence': lambda *a: 0, | ||
4014 | 99 | 'time_start': lambda *a: 0, | ||
4015 | 100 | 'time_stop': lambda *a: 0, | ||
4016 | 101 | 'time_cycle': lambda *a: 0, | ||
4017 | 102 | 'type_workcenter': lambda *a: 'pc', | ||
4018 | 103 | } | ||
4019 | 104 | |||
4020 | 105 | def name_search(self, cr, uid, name, args=None, operator='ilike', context=None, limit=80): | ||
4021 | 106 | print "name:",name | ||
4022 | 107 | print "args:",args | ||
4023 | 108 | print "operator:",operator | ||
4024 | 109 | print "context:",context | ||
4025 | 110 | print "limit:",limit | ||
4026 | 111 | if args: | ||
4027 | 112 | if args[0][0] == 'type': | ||
4028 | 113 | for val in args[0][2]: | ||
4029 | 114 | if val: | ||
4030 | 115 | if val in ['line', 'machine_hr']: | ||
4031 | 116 | args = [('type', '=', 'line')] | ||
4032 | 117 | break | ||
4033 | 118 | elif val == 'machine': | ||
4034 | 119 | args = [('type', 'in', ['line','machine_hr','machine'])] | ||
4035 | 120 | break | ||
4036 | 121 | elif val in ['energy', 'hr', 'tool']: | ||
4037 | 122 | args = [('type', 'in', ['line','machine_hr','machine','hr'])] | ||
4038 | 123 | break | ||
4039 | 124 | |||
4040 | 125 | print "args:",args | ||
4041 | 126 | return super(mrp_workcenter, self).name_search(cr, uid, name, args=args, operator=operator, context=context, limit=limit) | ||
4042 | 127 | |||
4043 | 128 | mrp_workcenter() | ||
4044 | 129 | |||
4045 | 130 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | ||
4046 | 0 | \ No newline at end of file | 131 | \ No newline at end of file |
4047 | 1 | 132 | ||
4048 | === added file 'asperience_configurator_mrp/mrp_workflow.xml' | |||
4049 | --- asperience_configurator_mrp/mrp_workflow.xml 1970-01-01 00:00:00 +0000 | |||
4050 | +++ asperience_configurator_mrp/mrp_workflow.xml 2017-12-01 14:57:12 +0000 | |||
4051 | @@ -0,0 +1,26 @@ | |||
4052 | 1 | <?xml version="1.0" encoding="utf-8"?> | ||
4053 | 2 | <openerp> | ||
4054 | 3 | <data> | ||
4055 | 4 | <record id="mrp.prod_act_ready" model="workflow.activity"> | ||
4056 | 5 | <field name="wkf_id" ref="mrp.wkf_prod"/> | ||
4057 | 6 | <field name="name">ready</field> | ||
4058 | 7 | <field name="kind">function</field> | ||
4059 | 8 | <field name="action">action_confirm() and action_ready()</field> | ||
4060 | 9 | </record> | ||
4061 | 10 | |||
4062 | 11 | <record id="mrp.prod_act_cancel" model="workflow.activity"> | ||
4063 | 12 | <field name="wkf_id" ref="mrp.wkf_prod"/> | ||
4064 | 13 | <field name="flow_stop">False</field> | ||
4065 | 14 | <field name="name">cancel</field> | ||
4066 | 15 | <field name="kind">function</field> | ||
4067 | 16 | <field name="action">action_cancel()</field> | ||
4068 | 17 | </record> | ||
4069 | 18 | |||
4070 | 19 | <record id="prod_trans_cancel_draft" model="workflow.transition"> | ||
4071 | 20 | <field name="act_from" ref="mrp.prod_act_cancel"/> | ||
4072 | 21 | <field name="act_to" ref="mrp.prod_act_draft"/> | ||
4073 | 22 | <field name="signal">button_draft</field> | ||
4074 | 23 | </record> | ||
4075 | 24 | |||
4076 | 25 | </data> | ||
4077 | 26 | </openerp> | ||
4078 | 0 | 27 | ||
4079 | === added file 'asperience_configurator_mrp/procurement.py' | |||
4080 | --- asperience_configurator_mrp/procurement.py 1970-01-01 00:00:00 +0000 | |||
4081 | +++ asperience_configurator_mrp/procurement.py 2017-12-01 14:57:12 +0000 | |||
4082 | @@ -0,0 +1,193 @@ | |||
4083 | 1 | # -*- encoding: utf-8 -*- | ||
4084 | 2 | ############################################################################## | ||
4085 | 3 | # | ||
4086 | 4 | # OpenERP, Open Source Management Solution | ||
4087 | 5 | # Copyright (C) 2007-2014 ASPerience SARL (<http://www.asperience.fr>). | ||
4088 | 6 | # All Rights Reserved | ||
4089 | 7 | # | ||
4090 | 8 | # This program is free software: you can redistribute it and/or modify | ||
4091 | 9 | # it under the terms of the GNU General Public License as published by | ||
4092 | 10 | # the Free Software Foundation, either version 3 of the License, or | ||
4093 | 11 | # (at your option) any later version. | ||
4094 | 12 | # | ||
4095 | 13 | # This program is distributed in the hope that it will be useful, | ||
4096 | 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
4097 | 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
4098 | 16 | # GNU General Public License for more details. | ||
4099 | 17 | # | ||
4100 | 18 | # You should have received a copy of the GNU General Public License | ||
4101 | 19 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
4102 | 20 | # | ||
4103 | 21 | ############################################################################## | ||
4104 | 22 | from openerp.osv import fields,osv | ||
4105 | 23 | #import openerp.netsvc | ||
4106 | 24 | #import time | ||
4107 | 25 | #import datetime | ||
4108 | 26 | #from mx import DateTime | ||
4109 | 27 | #from openerp.tools.translate import _ | ||
4110 | 28 | #from openerp.tools import ustr | ||
4111 | 29 | |||
4112 | 30 | class procurement_order(osv.osv): | ||
4113 | 31 | _inherit = 'procurement.order' | ||
4114 | 32 | |||
4115 | 33 | def _size(self, cr, uid, ids, field_name, arg, context): | ||
4116 | 34 | res = {} | ||
4117 | 35 | for proc in self.browse(cr, uid, ids): | ||
4118 | 36 | res[proc.id] = {'size_x': 0.0, 'size_y': 0.0, 'size_z': 0.0 ,'diameter': 0.0} | ||
4119 | 37 | if proc.product_id: | ||
4120 | 38 | res[proc.id]['size_x'] = proc.product_id.size_x or proc.product_id.product_tmpl_id.size_x_tmpl or 0.0 | ||
4121 | 39 | res[proc.id]['size_y'] = proc.product_id.size_y or proc.product_id.product_tmpl_id.size_y_tmpl or 0.0 | ||
4122 | 40 | res[proc.id]['size_z'] = proc.product_id.size_z or proc.product_id.product_tmpl_id.size_z_tmpl or 0.0 | ||
4123 | 41 | res[proc.id]['diameter'] = proc.product_id.diameter or proc.product_id.product_tmpl_id.diameter_tmpl or 0.0 | ||
4124 | 42 | return res | ||
4125 | 43 | |||
4126 | 44 | def get_production(self, cr, uid, ids, context={}): | ||
4127 | 45 | production_obj = self.pool.get('mrp.production') | ||
4128 | 46 | move_obj = self.pool.get('stock.move') | ||
4129 | 47 | result = {} | ||
4130 | 48 | for procurement in self.browse(cr, uid, ids): | ||
4131 | 49 | result[procurement.id] = False | ||
4132 | 50 | if procurement.bom_id and procurement.bom_id.bom_type in ('cut'): | ||
4133 | 51 | print "procurement.bom_id",procurement.bom_id,procurement.bom_id.bom_type | ||
4134 | 52 | production_id = production_obj.search(cr,uid,[('bom_id','=',procurement.bom_id.id),('state','=','draft')]) | ||
4135 | 53 | |||
4136 | 54 | if production_id: | ||
4137 | 55 | result[procurement.id] = production_id[0] | ||
4138 | 56 | self.write(cr,uid,procurement.id,{'production_id':result[procurement.id]}) | ||
4139 | 57 | move_obj.write(cr,uid,procurement.move_id.id,{'production_id':result[procurement.id]}) | ||
4140 | 58 | |||
4141 | 59 | # if procurement.move_id.prodlot_id: | ||
4142 | 60 | # print procurement.move_id.prodlot_id | ||
4143 | 61 | # move_ids = move_obj.search(cr,uid,[('prodlot_id','=',procurement.move_id.prodlot_id.id),('production_id','!=',False),('production_id.state','=','confirmed')]) | ||
4144 | 62 | # print move_ids | ||
4145 | 63 | # if move_ids: | ||
4146 | 64 | # production_id = move_obj.read(cr,uid,move_ids)[0]['production_id'][0] | ||
4147 | 65 | # result[procurement.id] = production_id | ||
4148 | 66 | # print "ok" | ||
4149 | 67 | # self.write(cr,uid,procurement.id,{'production_id':production_id}) | ||
4150 | 68 | |||
4151 | 69 | # property_ids = [i.id for i in procurement.property_ids] | ||
4152 | 70 | # property_ids.sort() | ||
4153 | 71 | # production_ids = production_obj.search(cr,uid,[('state','=','draft'),('product_id','=',procurement.product_id.id),('bom_id.bom_type','=','cut')]) | ||
4154 | 72 | # if production_ids: | ||
4155 | 73 | # production_ptr = production_obj.browse(cr,uid,production_ids,context) | ||
4156 | 74 | # print "",production_ptr.name | ||
4157 | 75 | # print "",production_ptr.move_ids | ||
4158 | 76 | # result[procurement.id] = | ||
4159 | 77 | |||
4160 | 78 | # if line_prodlot_id and line.bom_id.bom_type in ('cut'): | ||
4161 | 79 | # move_ids = move_obj.search(cr,uid,[('prodlot_id','=',line_prodlot_id),('production_id','!=',False),('production_id.state','=','confirmed')]) | ||
4162 | 80 | # if move_ids: | ||
4163 | 81 | # production_id = move_obj.read(cr,uid,move_ids)[0]['production_id'][0] | ||
4164 | 82 | return result | ||
4165 | 83 | |||
4166 | 84 | def action_produce_assign_product(self, cr, uid, ids, context={}): | ||
4167 | 85 | print "action_produce_assign_product nouveau" | ||
4168 | 86 | wf_service = netsvc.LocalService("workflow") | ||
4169 | 87 | move_obj = self.pool.get('stock.move') | ||
4170 | 88 | produce_id = False | ||
4171 | 89 | company = self.pool.get('res.users').browse(cr, uid, uid, context).company_id | ||
4172 | 90 | result = {} | ||
4173 | 91 | production_ids = self.get_production(cr,uid,ids,context) | ||
4174 | 92 | for procurement in self.browse(cr, uid, ids): | ||
4175 | 93 | res_id = procurement.move_id.id | ||
4176 | 94 | loc_id = procurement.location_id.id | ||
4177 | 95 | newdate = DateTime.strptime(procurement.date_planned, '%Y-%m-%d %H:%M:%S') - DateTime.RelativeDateTime(days=procurement.product_id.product_tmpl_id.produce_delay or 0.0) | ||
4178 | 96 | newdate = newdate - DateTime.RelativeDateTime(days=company.manufacturing_lead) | ||
4179 | 97 | print production_ids[procurement.id] | ||
4180 | 98 | if production_ids[procurement.id]: | ||
4181 | 99 | result[procurement.id] = production_ids[procurement.id] | ||
4182 | 100 | else: | ||
4183 | 101 | # if not procurement.production_id: | ||
4184 | 102 | result[procurement.id] = self.pool.get('mrp.production').create(cr, uid, { | ||
4185 | 103 | 'origin': procurement.origin, | ||
4186 | 104 | 'product_id': procurement.product_id.id, | ||
4187 | 105 | 'product_qty': procurement.product_qty, | ||
4188 | 106 | 'product_uom': procurement.product_uom.id, | ||
4189 | 107 | 'product_uos_qty': procurement.product_uos and procurement.product_uos_qty or False, | ||
4190 | 108 | 'product_uos': procurement.product_uos and procurement.product_uos.id or False, | ||
4191 | 109 | 'location_src_id': procurement.location_id.id, | ||
4192 | 110 | 'location_dest_id': procurement.move_id.location_id.id, | ||
4193 | 111 | 'bom_id': procurement.bom_id and procurement.bom_id.id or False, | ||
4194 | 112 | 'date_planned': newdate.strftime('%Y-%m-%d %H:%M:%S'), | ||
4195 | 113 | 'move_prod_id': res_id, | ||
4196 | 114 | 'procurement_id': procurement.id, | ||
4197 | 115 | 'specific_production': procurement.specific_production, | ||
4198 | 116 | 'note_production': procurement.note_production, | ||
4199 | 117 | 'size_x_specific': procurement.size_x_specific, | ||
4200 | 118 | 'size_y_specific': procurement.size_y_specific, | ||
4201 | 119 | 'size_z_specific': procurement.size_z_specific, | ||
4202 | 120 | 'diameter_specific': procurement.diameter_specific, | ||
4203 | 121 | 'size_x_specific_delta': procurement.size_x_specific_delta, | ||
4204 | 122 | 'size_y_specific_delta': procurement.size_y_specific_delta, | ||
4205 | 123 | 'size_z_specific_delta': procurement.size_z_specific_delta, | ||
4206 | 124 | 'diameter_specific_delta': procurement.diameter_specific_delta, | ||
4207 | 125 | }) | ||
4208 | 126 | # else: | ||
4209 | 127 | # result[procurement.id] = procurement.production_id.id | ||
4210 | 128 | produce_id = result[procurement.id] | ||
4211 | 129 | self.write(cr, uid, [procurement.id], {'state':'running', 'production_id':result[procurement.id]}) | ||
4212 | 130 | childs = [line.id for line in procurement.procurement_line] | ||
4213 | 131 | #self.action_produce_assign_product(cr, uid, childs) | ||
4214 | 132 | for child in childs: | ||
4215 | 133 | wf_service.trg_validate(uid, 'procurement.order',child, 'button_confirm', cr) | ||
4216 | 134 | |||
4217 | 135 | # bom_result = self.pool.get('mrp.production').action_compute(cr, uid,[result[procurement.id]], context) | ||
4218 | 136 | |||
4219 | 137 | #================================================ | ||
4220 | 138 | # Confirmation des productions OU Ajout | ||
4221 | 139 | #================================================ | ||
4222 | 140 | if not procurement.bom_id or not procurement.bom_id.bom_type in ('cut'): | ||
4223 | 141 | wf_service.trg_validate(uid, 'mrp.production', result[procurement.id], 'button_confirm', cr) | ||
4224 | 142 | else: | ||
4225 | 143 | move_obj.write(cr,uid,procurement.move_id.id,{'production_id':result[procurement.id]}) | ||
4226 | 144 | procurement = self.browse(cr,uid,procurement.id,context) | ||
4227 | 145 | print "okokok" | ||
4228 | 146 | #=================================================================== | ||
4229 | 147 | # transfere de la sortie des procurement enfant dans l'entrƩe de la production | ||
4230 | 148 | #=================================================================== | ||
4231 | 149 | moves = [] | ||
4232 | 150 | for line in procurement.procurement_line: | ||
4233 | 151 | print "line",line,line.production_id | ||
4234 | 152 | print "line",line,line.purchase_id | ||
4235 | 153 | if line.production_id: | ||
4236 | 154 | moves.extend([i.id for i in line.production_id.move_created_ids]) | ||
4237 | 155 | for i in moves: | ||
4238 | 156 | if i not in [j.id for j in self.pool.get('mrp.production').browse(cr,uid,result[procurement.id]).move_lines]: | ||
4239 | 157 | self.pool.get('mrp.production').write(cr, uid, result[procurement.id], {'move_lines': [(4,i)]}) | ||
4240 | 158 | return produce_id | ||
4241 | 159 | |||
4242 | 160 | _columns = { | ||
4243 | 161 | 'procurement_id': fields.many2one('procurement.order', 'Procurement Ref', ondelete='cascade', select=True, readonly=True, states={'draft':[('readonly',False)]}), | ||
4244 | 162 | 'procurement_line': fields.one2many('procurement.order', 'procurement_id', 'Procurement Lines', readonly=True, states={'draft': [('readonly', False)]}), | ||
4245 | 163 | 'group_property_ids': fields.many2many('mrp.property.group.option', 'mrp_procurement_group_property_rel','procurement_id', 'group_id', 'Product Property Group Rel '), | ||
4246 | 164 | 'parent_option_id': fields.many2one('product.links', 'Parent Option'), | ||
4247 | 165 | 'option_ids': fields.many2many('product.links', 'mrp_procurement_options_rel','procurement_id', 'links_id', 'Option'), | ||
4248 | 166 | 'specific_production':fields.boolean('Specific Production'), | ||
4249 | 167 | 'note_production':fields.text('Production Note'), | ||
4250 | 168 | 'size_x': fields.function(_size, multi="size", method=True, string='Width', digits=(16, 5), type='float'), | ||
4251 | 169 | 'size_y': fields.function(_size, multi="size", method=True, string='Length', digits=(16, 5), type='float'), | ||
4252 | 170 | 'size_z': fields.function(_size, multi="size", method=True, string='Thickness', digits=(16, 5), type='float'), | ||
4253 | 171 | 'diameter': fields.function(_size, multi="size", method=True, string='Diameter', digits=(16, 5), type='float'), | ||
4254 | 172 | 'size_x_specific': fields.float('Width specific', digits=(16, 5), readonly=True ), | ||
4255 | 173 | 'size_y_specific': fields.float('Length specific', digits=(16, 5), readonly=True), | ||
4256 | 174 | 'size_z_specific': fields.float('Thickness specific', digits=(16, 5), readonly=True), | ||
4257 | 175 | 'diameter_specific': fields.float('Diameter specific', digits=(16, 5), readonly=True), | ||
4258 | 176 | 'size_x_specific_delta': fields.float('Width specific delta', digits=(16, 5), readonly=True), | ||
4259 | 177 | 'size_y_specific_delta': fields.float('Length specific delta', digits=(16, 5), readonly=True), | ||
4260 | 178 | 'size_z_specific_delta': fields.float('Thickness specific delta', digits=(16, 5), readonly=True), | ||
4261 | 179 | 'diameter_specific_delta': fields.float('Diameter specific delta', digits=(16, 5), readonly=True), | ||
4262 | 180 | 'production_id': fields.many2one('mrp.production', 'Production', select=True), | ||
4263 | 181 | } | ||
4264 | 182 | _defaults = { | ||
4265 | 183 | } | ||
4266 | 184 | _order = 'id desc' | ||
4267 | 185 | |||
4268 | 186 | def check_wkf(self, cr, uid, ids, context={}): | ||
4269 | 187 | wf_service = netsvc.LocalService("workflow") | ||
4270 | 188 | for i in ids : | ||
4271 | 189 | wf_service.trg_write(uid, 'procurement.order', i, cr) | ||
4272 | 190 | return True | ||
4273 | 191 | |||
4274 | 192 | procurement_order() | ||
4275 | 193 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | ||
4276 | 0 | \ No newline at end of file | 194 | \ No newline at end of file |
4277 | 1 | 195 | ||
4278 | === added file 'asperience_configurator_mrp/procurement_view.xml' | |||
4279 | --- asperience_configurator_mrp/procurement_view.xml 1970-01-01 00:00:00 +0000 | |||
4280 | +++ asperience_configurator_mrp/procurement_view.xml 2017-12-01 14:57:12 +0000 | |||
4281 | @@ -0,0 +1,155 @@ | |||
4282 | 1 | <?xml version="1.0" encoding="utf-8"?> | ||
4283 | 2 | <openerp> | ||
4284 | 3 | <data> | ||
4285 | 4 | |||
4286 | 5 | ###################################### PROCUREMENT ####################################### | ||
4287 | 6 | <record id="mrp_procurement_tree_view_asperience_mrp" model="ir.ui.view"> | ||
4288 | 7 | <field name="name">procurement.order.tree.asperience.mrp</field> | ||
4289 | 8 | <field name="model">procurement.order</field> | ||
4290 | 9 | <field name="inherit_id" ref="procurement.procurement_tree_view"/> | ||
4291 | 10 | <field name="arch" type="xml"> | ||
4292 | 11 | <field name="state" position="after"> | ||
4293 | 12 | <field name="production_id"/> | ||
4294 | 13 | <button name="button_confirm" states="draft" string="Confirm"/> | ||
4295 | 14 | <button name="button_check" states="confirmed" string="Run procurement"/> | ||
4296 | 15 | </field> | ||
4297 | 16 | </field> | ||
4298 | 17 | </record> | ||
4299 | 18 | |||
4300 | 19 | <record id="mrp_procurement_form_view_asperience_mrp" model="ir.ui.view"> | ||
4301 | 20 | <field name="name">procurement.order.form.asperience.mrp</field> | ||
4302 | 21 | <field name="model">procurement.order</field> | ||
4303 | 22 | <field name="type">form</field> | ||
4304 | 23 | <field name="inherit_id" ref="procurement.procurement_form_view"/> | ||
4305 | 24 | <field name="arch" type="xml"> | ||
4306 | 25 | <page string="Notes" position="after"> | ||
4307 | 26 | <page string="Advanced informations"> | ||
4308 | 27 | <separator string="Hierarchy" colspan="4" /> | ||
4309 | 28 | <field name="procurement_id" /> | ||
4310 | 29 | <field name="procurement_line" nolabel="1" colspan="4" widget="one2many_list"/> | ||
4311 | 30 | <separator string="Properties" colspan="4" /> | ||
4312 | 31 | <field name="parent_option_id" colspan="4"/> | ||
4313 | 32 | <field name="option_ids" nolabel="1" colspan="4" widget="one2many_list"/> | ||
4314 | 33 | <field name="group_property_ids" nolabel="1" colspan="4" widget="one2many_list"/> | ||
4315 | 34 | <separator string="Production" colspan="4" /> | ||
4316 | 35 | <field name="production_id" /> | ||
4317 | 36 | <field name='specific_production' colspan="4" /> | ||
4318 | 37 | <field name='note_production' colspan="4" attrs="{'invisible':[('specific_production','=',False)]}"/> | ||
4319 | 38 | <group colspan="6" col="10" attrs="{'invisible':[('specific_production','=',False)]}"> | ||
4320 | 39 | <group colspan="2"> | ||
4321 | 40 | <field name='size_x' colspan="2"/> | ||
4322 | 41 | <field name='size_y' colspan="2"/> | ||
4323 | 42 | <field name='size_z' colspan="2"/> | ||
4324 | 43 | <field name='diameter' colspan="2"/> | ||
4325 | 44 | </group> | ||
4326 | 45 | <group colspan="2"> | ||
4327 | 46 | <label string='-' colspan="4"/> | ||
4328 | 47 | <label string='-' colspan="4"/> | ||
4329 | 48 | <label string='-' colspan="4"/> | ||
4330 | 49 | <label string='-' colspan="4"/> | ||
4331 | 50 | </group> | ||
4332 | 51 | <group colspan="2"> | ||
4333 | 52 | <field name='size_x_specific_delta' colspan="2" /> | ||
4334 | 53 | <field name='size_y_specific_delta' colspan="2" /> | ||
4335 | 54 | <field name='size_z_specific_delta' colspan="2" /> | ||
4336 | 55 | <field name='diameter_specific_delta' colspan="2"/> | ||
4337 | 56 | </group> | ||
4338 | 57 | <group colspan="2"> | ||
4339 | 58 | <label string='=' colspan="4"/> | ||
4340 | 59 | <label string='=' colspan="4"/> | ||
4341 | 60 | <label string='=' colspan="4"/> | ||
4342 | 61 | <label string='=' colspan="4"/> | ||
4343 | 62 | </group> | ||
4344 | 63 | <group colspan="2"> | ||
4345 | 64 | <field name='size_x_specific' colspan="2" /> | ||
4346 | 65 | <field name='size_y_specific' colspan="2" /> | ||
4347 | 66 | <field name='size_z_specific' colspan="2" /> | ||
4348 | 67 | <field name='diameter_specific' colspan="2" /> | ||
4349 | 68 | </group> | ||
4350 | 69 | </group> | ||
4351 | 70 | </page> | ||
4352 | 71 | </page> | ||
4353 | 72 | <field name="state" position="before" > | ||
4354 | 73 | <button name="check_wkf" string="Check" type="object" /> | ||
4355 | 74 | </field> | ||
4356 | 75 | </field> | ||
4357 | 76 | </record> | ||
4358 | 77 | |||
4359 | 78 | <record id="procurement.do_view_procurements" model="ir.actions.act_window"> | ||
4360 | 79 | <field name="name">Group's Procurements</field> | ||
4361 | 80 | <field name="res_model">procurement.order</field> | ||
4362 | 81 | <field name="view_type">form</field> | ||
4363 | 82 | <field name="view_mode">tree,form</field> | ||
4364 | 83 | <field name="domain">[('group_id','=',active_id),('procurement_id','=',False)]</field> | ||
4365 | 84 | </record> | ||
4366 | 85 | |||
4367 | 86 | <record id="procurement.procurement_action5" model="ir.actions.act_window"> | ||
4368 | 87 | <field name="name">Procurement Exceptions</field> | ||
4369 | 88 | <field name="type">ir.actions.act_window</field> | ||
4370 | 89 | <field name="res_model">procurement.order</field> | ||
4371 | 90 | <field name="view_type">form</field> | ||
4372 | 91 | <field name="view_mode">tree,form</field> | ||
4373 | 92 | <field name="domain">[('state','=','exception'),('procurement_id','=',False)]</field> | ||
4374 | 93 | </record> | ||
4375 | 94 | |||
4376 | 95 | <!-- | ||
4377 | 96 | <record id="mrp_procurement_form_view" model="ir.ui.view"> | ||
4378 | 97 | <field name="name">procurement.order.form</field> | ||
4379 | 98 | <field name="model">procurement.order</field> | ||
4380 | 99 | <field name="type">form</field> | ||
4381 | 100 | <field name="arch" type="xml"> | ||
4382 | 101 | <form string="Procurement"> | ||
4383 | 102 | <group col="2" colspan="2"> | ||
4384 | 103 | <separator colspan="2" string="References"/> | ||
4385 | 104 | <field name="name" select="1" string="Procurement Reason"/> | ||
4386 | 105 | <field name="origin" select="2"/> | ||
4387 | 106 | </group> | ||
4388 | 107 | <group col="2" colspan="2"> | ||
4389 | 108 | <separator colspan="2" string="Planification"/> | ||
4390 | 109 | <field name="date_planned" select="1"/> | ||
4391 | 110 | <field name="procure_method" select="2"/> | ||
4392 | 111 | <field name="priority" groups="base.group_extended"/> | ||
4393 | 112 | </group> | ||
4394 | 113 | <notebook colspan="4"> | ||
4395 | 114 | <page string="Procurement Details"> | ||
4396 | 115 | <separator colspan="4" string="Product & Location"/> | ||
4397 | 116 | <field name="product_id" select="1" on_change="onchange_product_id(product_id)"/> | ||
4398 | 117 | <field name="location_id" select="2"/> | ||
4399 | 118 | <field name="product_qty"/> | ||
4400 | 119 | <field name="product_uom"/> | ||
4401 | 120 | |||
4402 | 121 | <field name="product_uos_qty" groups="product.group_uos"/> | ||
4403 | 122 | <field name="product_uos" groups="product.group_uos"/> | ||
4404 | 123 | |||
4405 | 124 | <separator colspan="4" string="Status"/> | ||
4406 | 125 | <field colspan="4" name="message" readonly="1"/> | ||
4407 | 126 | <field name="state" readonly="1" select="2"/> | ||
4408 | 127 | <group col="7" colspan="2"> | ||
4409 | 128 | <button name="button_confirm" states="draft" string="Confirm"/> | ||
4410 | 129 | <button name="button_restart" states="exception" string="Retry"/> | ||
4411 | 130 | <button name="button_cancel" states="draft,exception,waiting" string="Cancel"/> | ||
4412 | 131 | <button name="button_check" states="confirmed" string="Run procurement"/> | ||
4413 | 132 | </group> | ||
4414 | 133 | </page> | ||
4415 | 134 | <page string="Extra Information"> | ||
4416 | 135 | <separator colspan="4" string="Details"/> | ||
4417 | 136 | <field name="bom_id" select="2" domain="[('product_id','=',product_id),('bom_id','=',False)]"/> | ||
4418 | 137 | <field name="move_id" groups="base.group_extended"/> | ||
4419 | 138 | <field name="date_close" select="2"/> | ||
4420 | 139 | <field name="close_move" groups="base.group_extended"/> | ||
4421 | 140 | <field name="purchase_id"/> | ||
4422 | 141 | <separator colspan="4" string="Properties"/> | ||
4423 | 142 | <field colspan="4" name="property_ids" nolabel="1" groups="base.group_extended"/> | ||
4424 | 143 | </page> | ||
4425 | 144 | <page string="Notes"> | ||
4426 | 145 | <separator colspan="4" string="Note" /> | ||
4427 | 146 | <field name="note" colspan="4" nolabel="1"/> | ||
4428 | 147 | </page> | ||
4429 | 148 | </notebook> | ||
4430 | 149 | </form> | ||
4431 | 150 | </field> | ||
4432 | 151 | </record> | ||
4433 | 152 | --> | ||
4434 | 153 | |||
4435 | 154 | </data> | ||
4436 | 155 | </openerp> | ||
4437 | 0 | 156 | ||
4438 | === added file 'asperience_configurator_mrp/product.py' | |||
4439 | --- asperience_configurator_mrp/product.py 1970-01-01 00:00:00 +0000 | |||
4440 | +++ asperience_configurator_mrp/product.py 2017-12-01 14:57:12 +0000 | |||
4441 | @@ -0,0 +1,375 @@ | |||
4442 | 1 | # -*- encoding: utf-8 -*- | ||
4443 | 2 | ############################################################################## | ||
4444 | 3 | # | ||
4445 | 4 | # OpenERP, Open Source Management Solution | ||
4446 | 5 | # Copyright (C) 2007-2014 ASPerience SARL (<http://www.asperience.fr>). | ||
4447 | 6 | # All Rights Reserved | ||
4448 | 7 | # | ||
4449 | 8 | # This program is free software: you can redistribute it and/or modify | ||
4450 | 9 | # it under the terms of the GNU General Public License as published by | ||
4451 | 10 | # the Free Software Foundation, either version 3 of the License, or | ||
4452 | 11 | # (at your option) any later version. | ||
4453 | 12 | # | ||
4454 | 13 | # This program is distributed in the hope that it will be useful, | ||
4455 | 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
4456 | 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
4457 | 16 | # GNU General Public License for more details. | ||
4458 | 17 | # | ||
4459 | 18 | # You should have received a copy of the GNU General Public License | ||
4460 | 19 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
4461 | 20 | # | ||
4462 | 21 | ############################################################################## | ||
4463 | 22 | #import openerp.netsvc | ||
4464 | 23 | from openerp.osv import fields, osv | ||
4465 | 24 | #from openerp.tools import ustr | ||
4466 | 25 | #from openerp.tools.translate import _ | ||
4467 | 26 | #import datetime | ||
4468 | 27 | #from sets import * | ||
4469 | 28 | |||
4470 | 29 | def name_serial(x, y, z, p, f, d): | ||
4471 | 30 | |||
4472 | 31 | lote = '_' | ||
4473 | 32 | if (f == 'quadrangular'): | ||
4474 | 33 | lote = (str(x) + 'x' + str(y) + 'x' + str(z) + '_' + str(p)) | ||
4475 | 34 | elif (f == 'cylindrical'): | ||
4476 | 35 | lote = (str(d) + 'x' + str(z) + '_' + str(p)) | ||
4477 | 36 | |||
4478 | 37 | return lote | ||
4479 | 38 | |||
4480 | 39 | def compute_w(cr, uid, factor1, factor2, factor3, factor4, size_x, size_y, size_z, shape, density, diameter): | ||
4481 | 40 | resu = {} | ||
4482 | 41 | |||
4483 | 42 | size_x = size_x or 0 | ||
4484 | 43 | size_y = size_y or 0 | ||
4485 | 44 | size_z = size_z or 0 | ||
4486 | 45 | density = density or 1 | ||
4487 | 46 | diameter = diameter or 0 | ||
4488 | 47 | |||
4489 | 48 | weight = 0 | ||
4490 | 49 | if shape == 'quadrangular': | ||
4491 | 50 | weight = ((size_x * size_y * size_z) * density * factor2 * (math.pow(factor3, 3))) / (factor1 * (math.pow(factor4, 3))) | ||
4492 | 51 | diameter = 0 | ||
4493 | 52 | volume = size_x * size_y * size_z | ||
4494 | 53 | elif shape == 'cylindrical': | ||
4495 | 54 | radius = diameter / 2.0 | ||
4496 | 55 | weight = ((math.pow(radius, 2) * math.pi * size_z) * density * factor2 * (math.pow(factor3, 3))) / (factor1 * (math.pow(factor4, 3))) | ||
4497 | 56 | volume = math.pow(radius, 2) * math.pi * size_z | ||
4498 | 57 | size_x = 0 | ||
4499 | 58 | size_y = 0 | ||
4500 | 59 | else: | ||
4501 | 60 | weight = 0 | ||
4502 | 61 | volume = 0 | ||
4503 | 62 | size_x = 0 | ||
4504 | 63 | size_y = 0 | ||
4505 | 64 | size_z = 0 | ||
4506 | 65 | |||
4507 | 66 | |||
4508 | 67 | v = { 'weight':weight, | ||
4509 | 68 | 'volume':volume, | ||
4510 | 69 | 'size_x':size_x, | ||
4511 | 70 | 'size_y':size_y, | ||
4512 | 71 | 'size_z':size_z, | ||
4513 | 72 | 'diameter':diameter, | ||
4514 | 73 | 'density':density, | ||
4515 | 74 | } | ||
4516 | 75 | return v | ||
4517 | 76 | |||
4518 | 77 | class product_template(osv.osv): | ||
4519 | 78 | _inherit ='product.template' | ||
4520 | 79 | _columns = { | ||
4521 | 80 | 'size_x_tmpl': fields.float('Width', digits=(16, 5)), | ||
4522 | 81 | 'size_y_tmpl': fields.float('Length', digits=(16, 5)), | ||
4523 | 82 | 'size_z_tmpl': fields.float('Thickness', digits=(16, 5)), | ||
4524 | 83 | 'density_tmpl': fields.float('Density', digits=(16, 5), help='Density unit= (uom of weight/(uom of size)^3)'), | ||
4525 | 84 | 'shape' : fields.selection([('quadrangular', 'Quadrangular'), ('cylindrical', 'Cylindrical'), ('other', 'Other')], 'Shape', help="Weight Formula for Quadrangular = width*length*thickness*density \n Weight Formula for Cylindrical= (diameter/2)Ā²*pi*thickness*density", required=True), | ||
4526 | 85 | 'diameter_tmpl': fields.float('Diameter', digits=(16, 5)), | ||
4527 | 86 | 'uom_d_size' : fields.many2one('product.uom', 'Size density Uom Ā³', help="Default united of measure density used for operations size to cube", required=True, readonly=True), | ||
4528 | 87 | 'uom_d_weight': fields.many2one('product.uom', 'Weight density Uom', help="Default united of measure density used for operations weight", required=True, readonly=True), | ||
4529 | 88 | 'uom_s_size' : fields.many2one('product.uom', 'Size Uom', help="Default united of measure used for operations size", required=True, readonly=True), | ||
4530 | 89 | } | ||
4531 | 90 | def _get_uom_d_size(self, cr, uid, *args): | ||
4532 | 91 | return self.pool.get('ir.property').get(cr, uid, 'uom_d_size', 'product.template') | ||
4533 | 92 | |||
4534 | 93 | def _get_uom_d_weight(self, cr, uid, *args): | ||
4535 | 94 | return self.pool.get('ir.property').get(cr, uid, 'uom_d_weight', 'product.template') | ||
4536 | 95 | |||
4537 | 96 | def _get_uom_s_size(self, cr, uid, *args): | ||
4538 | 97 | return self.pool.get('ir.property').get(cr, uid, 'uom_s_size', 'product.template') | ||
4539 | 98 | |||
4540 | 99 | def compute_weight(self, cr, uid, id, uom_d_weight, uom_id, uom_d_size, uom_s_size, size_x, size_y, size_z, shape, density, diameter, size_x_tmpl, size_y_tmpl, size_z_tmpl, density_tmpl, diameter_tmpl): | ||
4541 | 100 | value = {} | ||
4542 | 101 | |||
4543 | 102 | if (not uom_id) or (not uom_d_weight) or(not uom_d_size) or (not uom_s_size): | ||
4544 | 103 | return 0 | ||
4545 | 104 | if (shape): | ||
4546 | 105 | factor1 = self.pool.get('product.uom').browse(cr, uid, uom_d_weight, context='').factor | ||
4547 | 106 | factor2 = self.pool.get('product.uom').browse(cr, uid, uom_id, context='').factor | ||
4548 | 107 | factor3 = self.pool.get('product.uom').browse(cr, uid, uom_d_size, context='').factor | ||
4549 | 108 | factor4 = self.pool.get('product.uom').browse(cr, uid, uom_s_size, context='').factor | ||
4550 | 109 | return {'value': compute_w(cr, uid, factor1, factor2, factor3, factor4, size_x or size_x_tmpl, size_y or size_y_tmpl, size_z or size_z_tmpl, shape, density, diameter or diameter_tmpl)} | ||
4551 | 110 | |||
4552 | 111 | _defaults = { | ||
4553 | 112 | 'size_x_tmpl': lambda * a: 0.0, | ||
4554 | 113 | 'size_y_tmpl': lambda * a: 0.0, | ||
4555 | 114 | 'size_z_tmpl': lambda * a: 0.0, | ||
4556 | 115 | 'density_tmpl': lambda * a: 0.0, | ||
4557 | 116 | 'shape': lambda * a: 'other', | ||
4558 | 117 | 'diameter_tmpl': lambda * a: 0.0, | ||
4559 | 118 | 'uom_d_size': _get_uom_d_size, | ||
4560 | 119 | 'uom_d_weight' : _get_uom_d_weight, | ||
4561 | 120 | 'uom_s_size' : _get_uom_s_size, | ||
4562 | 121 | } | ||
4563 | 122 | product_template() | ||
4564 | 123 | |||
4565 | 124 | class product_product(osv.osv): | ||
4566 | 125 | _inherit ='product.product' | ||
4567 | 0 | 126 | ||
4568 | 127 | def generate_bom(self,cr,uid,ids,context={}): | ||
4569 | 128 | print "generate_bom",ids,context | ||
4570 | 129 | pre = "generate_bom " | ||
4571 | 130 | result = {} | ||
4572 | 131 | if "product_qty" not in context : | ||
4573 | 132 | context["product_qty"]=1 | ||
4574 | 133 | if "options" not in context : | ||
4575 | 134 | context["options"]=[] | ||
4576 | 135 | if "rec" not in context : | ||
4577 | 136 | context["rec"]=0 | ||
4578 | 137 | if "bom_parent" not in context : | ||
4579 | 138 | context["bom_parent"]=[] | ||
4580 | 139 | product_qty = context["product_qty"] | ||
4581 | 140 | |||
4582 | 141 | for product in self.browse(cr,uid,ids,context): | ||
4583 | 142 | print pre+"product ",product.name | ||
4584 | 143 | result[product.id] = False | ||
4585 | 144 | option_name = "" | ||
4586 | 145 | bom_components_parent = [] | ||
4587 | 146 | bom_components = [] | ||
4588 | 147 | |||
4589 | 148 | if product.bom_ids and context["options"]: | ||
4590 | 149 | self.generate_bom(cr,uid,[product.id]) | ||
4591 | 150 | context["bom_parent"] = self.pool.get('mrp.bom')._bom_find(cr, uid, product.id, product.uom_id.id, [], []) | ||
4592 | 151 | bom_components_parent = [(0, 0, {'qty':product_qty, 'bom_id':context["bom_parent"]})] | ||
4593 | 152 | if context["options"]: | ||
4594 | 153 | option_name = "." | ||
4595 | 154 | option_name += ".".join([i.shortcut for i in self.pool.get('product.type.property.option').browse(cr,uid,context["options"])]) | ||
4596 | 155 | property_ids = [], | ||
4597 | 156 | # A MODIFIER | ||
4598 | 157 | self.pool.get('product.type.property.option').write(cr,uid,context["options"],{'execution_filter':True}) | ||
4599 | 158 | # /A MODIFIER | ||
4600 | 159 | type_group_ids = [(6, 1, context["options"])] | ||
4601 | 160 | if not context["bom_parent"]: | ||
4602 | 161 | raise | ||
4603 | 162 | else: | ||
4604 | 163 | # Probable bug | ||
4605 | 164 | # bom_components = [(0, 0, {'bom_id':context["bom_parent"]})] | ||
4606 | 165 | bom_components_parent = [(0, 0, {'qty':context["product_qty"], 'bom_id':context["bom_parent"]})] | ||
4607 | 166 | type = 'phantom' | ||
4608 | 167 | else: | ||
4609 | 168 | property_ids = [(6, 1, [i.id for i in product.bom_property_ids])], | ||
4610 | 169 | type_group_ids = [(6, 1, [i.id for i in product.bom_type_group_ids])], | ||
4611 | 170 | type = 'normal' | ||
4612 | 171 | vals ={ | ||
4613 | 172 | 'name': product.code+" ["+option_name+"("+"-".join([i.code for i in product.bom_property_ids])+")]", | ||
4614 | 173 | 'code': product.code, | ||
4615 | 174 | 'active': True, | ||
4616 | 175 | 'type': 'normal', | ||
4617 | 176 | 'date_start': datetime.datetime.now(), | ||
4618 | 177 | 'product_id': product.id, | ||
4619 | 178 | 'product_uos_qty': product_qty, | ||
4620 | 179 | 'product_uos': product.uos_id.id, | ||
4621 | 180 | 'product_qty': product_qty, | ||
4622 | 181 | 'product_uom': product.uom_id.id, | ||
4623 | 182 | 'product_rounding': 1, | ||
4624 | 183 | 'product_efficiency': 1, | ||
4625 | 184 | 'shape': product.shape, | ||
4626 | 185 | 'property_ids': property_ids, | ||
4627 | 186 | 'type_group_ids': type_group_ids, | ||
4628 | 187 | 'size_x': product.size_x, | ||
4629 | 188 | 'size_y': product.size_y, | ||
4630 | 189 | 'size_z': product.size_z, | ||
4631 | 190 | 'density': product.density, | ||
4632 | 191 | 'shape' : product.shape, | ||
4633 | 192 | 'diameter' : product.diameter, | ||
4634 | 193 | 'weight': product.weight, | ||
4635 | 194 | 'bom_components': bom_components, | ||
4636 | 195 | 'bom_components_parent' :bom_components_parent, | ||
4637 | 196 | 'type': type, | ||
4638 | 197 | } | ||
4639 | 198 | result[product.id] = self.pool.get('mrp.bom').create(cr,uid,vals) | ||
4640 | 199 | ######################################################################################################################################## | ||
4641 | 200 | #INTEGRATION DES LIGNES EN bundle_base | ||
4642 | 201 | bom_components = [] | ||
4643 | 202 | print pre+"bom_components avant",bom_components | ||
4644 | 203 | if not context["bom_parent"]: | ||
4645 | 204 | for i in product.linked_product_ids: | ||
4646 | 205 | if not i.used : | ||
4647 | 206 | continue | ||
4648 | 207 | elif i.link_type in ('bundle_base') : | ||
4649 | 208 | if i.product_id.id == product.id : | ||
4650 | 209 | s = result[product.id] | ||
4651 | 210 | else: | ||
4652 | 211 | s = self.generate_bom(cr,uid,[i.product_id.id],{"rec":context['rec']+1,"product_qty":i.product_qty,"options":[]})[i.product_id.id] | ||
4653 | 212 | else: | ||
4654 | 213 | continue | ||
4655 | 214 | if s not in bom_components: | ||
4656 | 215 | bom_components.append(s) | ||
4657 | 216 | for i in product.linked_product_tmpl_ids: | ||
4658 | 217 | if not i.used : | ||
4659 | 218 | continue | ||
4660 | 219 | elif i.link_type in ('bundle_base') : | ||
4661 | 220 | if i.product_id.id == product.id : | ||
4662 | 221 | s = result[product.id] | ||
4663 | 222 | else: | ||
4664 | 223 | s = self.generate_bom(cr,uid,[i.product_id.id],{"rec":context['rec']+1,"product_qty":i.product_qty,"options":[]})[i.product_id.id] | ||
4665 | 224 | else: | ||
4666 | 225 | continue | ||
4667 | 226 | if s not in bom_components: | ||
4668 | 227 | bom_components.append(s) | ||
4669 | 228 | print pre+"bom_components apres bundle",bom_components | ||
4670 | 229 | ######################################################################################################################################## | ||
4671 | 230 | ######################################################################################################################################## | ||
4672 | 231 | #CREATION DES BOM OPTION | ||
4673 | 232 | if not context["bom_parent"]: | ||
4674 | 233 | nb = 0 | ||
4675 | 234 | for i in product.linked_product_ids: | ||
4676 | 235 | # if nb == 10 : break | ||
4677 | 236 | nb+=1 | ||
4678 | 237 | s = None | ||
4679 | 238 | if not i.used : | ||
4680 | 239 | continue | ||
4681 | 240 | if i.product_id.id == product.id : | ||
4682 | 241 | if context["options"] and i.type_group.id in context["options"] : | ||
4683 | 242 | s = result[product.id] | ||
4684 | 243 | if not s and i.link_type in ('option') : | ||
4685 | 244 | s = self.pool.get('mrp.bom')._bom_find(cr, uid, i.product_id.id, i.product_id.uom_id.id, [], i.type_group and [i.type_group.id] or []) | ||
4686 | 245 | else: | ||
4687 | 246 | continue | ||
4688 | 247 | if s not in bom_components: | ||
4689 | 248 | bom_components.append(s) | ||
4690 | 249 | nb = 0 | ||
4691 | 250 | for i in product.linked_product_tmpl_ids: | ||
4692 | 251 | # if nb == 10 : break | ||
4693 | 252 | nb+=1 | ||
4694 | 253 | s = None | ||
4695 | 254 | if not i.used : | ||
4696 | 255 | continue | ||
4697 | 256 | if i.product_id.id == product.id : | ||
4698 | 257 | if context["options"] and i.type_group.id in context["options"] : | ||
4699 | 258 | s = result[product.id] | ||
4700 | 259 | if not s and i.link_type in ('option') : | ||
4701 | 260 | s = self.pool.get('mrp.bom')._bom_find(cr, uid, i.product_id.id, i.product_id.uom_id.id, [], i.type_group and [i.type_group.id] or []) | ||
4702 | 261 | else: | ||
4703 | 262 | continue | ||
4704 | 263 | if s not in bom_components: | ||
4705 | 264 | bom_components.append(s) | ||
4706 | 265 | # else: | ||
4707 | 266 | # bom_lines_multi.append(context["bom_parent"]) | ||
4708 | 267 | print pre+"bom_components apres options",bom_components | ||
4709 | 268 | if bom_components: | ||
4710 | 269 | for i in bom_components: | ||
4711 | 270 | vals = { | ||
4712 | 271 | "bom_id":result[product.id], | ||
4713 | 272 | "component_id":i, | ||
4714 | 273 | "qty":product_qty, | ||
4715 | 274 | } | ||
4716 | 275 | self.pool.get('mrp.bom.component.rel').create(cr,uid,vals) | ||
4717 | 276 | # self.pool.get('mrp.bom').write(cr,uid,result[product.id],{'bom_components':[(6,1,bom_components)]}) | ||
4718 | 277 | ######################################################################################################################################## | ||
4719 | 278 | |||
4720 | 279 | # | ||
4721 | 280 | # match_criterias_field = ['product_id','product_uos_qty','product_uos','product_qty','product_uom','product_rounding','product_efficiency','shape','size_x','size_y','size_z','density','shape','diameter','weight'] | ||
4722 | 281 | # match_criterias = [(a,'=',vals[a]) for a in match_criterias_field] | ||
4723 | 282 | # match_ids = self.pool.get('mrp.bom').search(cr,uid,match_criterias) | ||
4724 | 283 | # for match_bom in self.pool.get('mrp.bom').browse(cr,uid,match_ids): | ||
4725 | 284 | # if not Set([i.id for i in match_bom.property_ids]) == Set(vals['property_ids'][0][2]) : | ||
4726 | 285 | # match_ids.remove(match_bom.id) | ||
4727 | 286 | # continue | ||
4728 | 287 | # if not Set([i.id for i in match_bom.type_group_ids]) == Set(vals['type_group_ids'][0][2]) : | ||
4729 | 288 | # match_ids.remove(match_bom.id) | ||
4730 | 289 | # continue | ||
4731 | 290 | # if match_ids : | ||
4732 | 291 | # result[product.id] = match_ids[0] | ||
4733 | 292 | # elif context["options"] : | ||
4734 | 293 | # result[product.id] = self.pool.get('mrp.bom').create(cr,uid,vals) | ||
4735 | 294 | # else: | ||
4736 | 295 | # result[product.id] = self.pool.get('mrp.bom').create(cr,uid,vals) | ||
4737 | 296 | # bom_option_ids = [] | ||
4738 | 297 | # for i in product.linked_product_ids: | ||
4739 | 298 | # if not i.used : | ||
4740 | 299 | # continue | ||
4741 | 300 | # # if i.product_id.id == product.id : | ||
4742 | 301 | # # continue | ||
4743 | 302 | # if i.link_type in ('option') : | ||
4744 | 303 | # s = self.generate_bom(cr,uid,[i.product_id.id],{"rec":context['rec']+1,"product_qty":i.product_qty,"options":i.type_group and [i.type_group.id] or []})[i.product_id.id] | ||
4745 | 304 | # elif i.link_type in ('bundle_base') : | ||
4746 | 305 | # s = self.generate_bom(cr,uid,[i.product_id.id],{"rec":context['rec']+1,"product_qty":i.product_qty,"options":[]})[i.product_id.id] | ||
4747 | 306 | # else: | ||
4748 | 307 | # continue | ||
4749 | 308 | # if s not in bom_option_ids: | ||
4750 | 309 | # bom_option_ids.append(s) | ||
4751 | 310 | # for i in product.linked_product_tmpl_ids: | ||
4752 | 311 | # if not i.used : | ||
4753 | 312 | # continue | ||
4754 | 313 | # # if i.product_id.id == product.id : | ||
4755 | 314 | # # continue | ||
4756 | 315 | # if i.link_type in ('option') : | ||
4757 | 316 | # s = self.generate_bom(cr,uid,[i.product_id.id],{"rec":context['rec']+1,"product_qty":i.product_qty,"options":i.type_group and [i.type_group.id] or []})[i.product_id.id] | ||
4758 | 317 | # elif i.link_type in ('bundle_base') : | ||
4759 | 318 | # s = self.generate_bom(cr,uid,[i.product_id.id],{"rec":context['rec']+1,"product_qty":i.product_qty,"options":[]})[i.product_id.id] | ||
4760 | 319 | # else: | ||
4761 | 320 | # continue | ||
4762 | 321 | # if s not in bom_option_ids: | ||
4763 | 322 | # bom_option_ids.append(s) | ||
4764 | 323 | # if bom_option_ids: | ||
4765 | 324 | # vals ={ | ||
4766 | 325 | # 'bom_components': [(6, 1, bom_option_ids)], | ||
4767 | 326 | # } | ||
4768 | 327 | # self.pool.get('mrp.bom').write(cr,uid,result[product.id],vals) | ||
4769 | 328 | # | ||
4770 | 329 | # vals = { | ||
4771 | 330 | # 'bom' : True, | ||
4772 | 331 | # } | ||
4773 | 332 | # self.write(cr,uid,ids,vals) | ||
4774 | 333 | if context['rec']==0 : | ||
4775 | 334 | return True | ||
4776 | 335 | cr.commit() | ||
4777 | 336 | return result | ||
4778 | 337 | |||
4779 | 338 | _columns = { | ||
4780 | 339 | #Dimensions | ||
4781 | 340 | 'size_x': fields.float('Width'), | ||
4782 | 341 | 'size_y': fields.float('Length'), | ||
4783 | 342 | 'size_z': fields.float('Thickness'), | ||
4784 | 343 | 'density': fields.float('Density', help='Density unit= (uom of weight/(uom of size)^3)'), | ||
4785 | 344 | 'diameter' : fields.float('Diameter'), | ||
4786 | 345 | #Production | ||
4787 | 346 | 'bom': fields.boolean('BoM Generated'), | ||
4788 | 347 | 'opp': fields.boolean('Rupture assembly'), | ||
4789 | 348 | 'bom_ids': fields.one2many('mrp.bom', 'product_id', 'BoM'), | ||
4790 | 349 | 'bom_sub_ids': fields.one2many('mrp.subproduct', 'product_id', 'Sub products'), | ||
4791 | 350 | 'bom_type_group_ids': fields.many2many('product.type.property.option', 'product_product_group_option_rel', 'product_id','group_id', 'Bom (GOP or GOO)'), | ||
4792 | 351 | 'bom_property_ids': fields.many2many('mrp.property', 'product_product_property_rel', 'product_id','property_id', 'Bom Properties'), | ||
4793 | 352 | } | ||
4794 | 353 | _defaults = { | ||
4795 | 354 | 'bom': lambda *a: False, | ||
4796 | 355 | 'size_x': lambda * a: 0.0, | ||
4797 | 356 | 'size_y': lambda * a: 0.0, | ||
4798 | 357 | 'size_z': lambda * a: 0.0, | ||
4799 | 358 | 'density': lambda * a: 0.0, | ||
4800 | 359 | 'diameter': lambda * a: 0.0, | ||
4801 | 360 | } | ||
4802 | 361 | |||
4803 | 362 | def compute_weight(self, cr, uid, id, uom_d_weight, uom_id, uom_d_size, uom_s_size, size_x, size_y, size_z, shape, density, diameter, size_x_tmpl, size_y_tmpl, size_z_tmpl, density_tmpl, diameter_tmpl): | ||
4804 | 363 | value = {} | ||
4805 | 364 | |||
4806 | 365 | if (not uom_id) or (not uom_d_weight) or(not uom_d_size) or (not uom_s_size): | ||
4807 | 366 | return 0 | ||
4808 | 367 | if (shape): | ||
4809 | 368 | factor1 = self.pool.get('product.uom').browse(cr, uid, uom_d_weight, context='').factor | ||
4810 | 369 | factor2 = self.pool.get('product.uom').browse(cr, uid, uom_id, context='').factor | ||
4811 | 370 | factor3 = self.pool.get('product.uom').browse(cr, uid, uom_d_size, context='').factor | ||
4812 | 371 | factor4 = self.pool.get('product.uom').browse(cr, uid, uom_s_size, context='').factor | ||
4813 | 372 | return {'value': compute_w(cr, uid, factor1, factor2, factor3, factor4, size_x or size_x_tmpl, size_y or size_y_tmpl, size_z or size_z_tmpl, shape, density, diameter or diameter_tmpl)} | ||
4814 | 373 | |||
4815 | 374 | product_product() | ||
4816 | 375 | |||
4817 | 376 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | ||
4818 | 1 | \ No newline at end of file | 377 | \ No newline at end of file |
4819 | 2 | 378 | ||
4820 | === added file 'asperience_configurator_mrp/product_view.xml' | |||
4821 | --- asperience_configurator_mrp/product_view.xml 1970-01-01 00:00:00 +0000 | |||
4822 | +++ asperience_configurator_mrp/product_view.xml 2017-12-01 14:57:12 +0000 | |||
4823 | @@ -0,0 +1,207 @@ | |||
4824 | 1 | <?xml version="1.0" encoding="utf-8"?> | ||
4825 | 2 | <openerp> | ||
4826 | 3 | <data> | ||
4827 | 4 | ######################################### Product variant ############################################ | ||
4828 | 5 | <record id="product_variant_form_view_asperience_mrp" model="ir.ui.view"> | ||
4829 | 6 | <field name="name">product.variant.form.asperience.mrp</field> | ||
4830 | 7 | <field name="model">product.product</field> | ||
4831 | 8 | <field name="inherit_id" ref="asperience_product_attributes.product_product_form_view_attributes_variant_1" /> | ||
4832 | 9 | <field name="arch" type="xml"> | ||
4833 | 10 | <field name="linked_product_ids" position="after" > | ||
4834 | 11 | <button icon="gtk-ok" name="reinit_links" string="Reinit Links and Properties with Category" type="object" /> | ||
4835 | 12 | <field name="property_ids" colspan="4" nolabel="1" context="{'tree_view_ref':'asperience_configurator_mrp.product_property_tree','form_view_ref':'asperience_configurator_mrp.product_property_form'}"/> | ||
4836 | 13 | <separator string="BOM"/> | ||
4837 | 14 | <group col="6" colspan="4" string="Generate"> | ||
4838 | 15 | <button name="generate_bom" type="object" string="Generate BoM"/> | ||
4839 | 16 | <field name="bom" readonly="1"/> | ||
4840 | 17 | <field name="opp"/> | ||
4841 | 18 | <field name="bom_type_group_ids" nolabel="1" colspan="6"/> | ||
4842 | 19 | <field name="bom_property_ids" nolabel="1" colspan="6"/> | ||
4843 | 20 | <field name="bom_ids" nolabel="1" colspan="6"/> | ||
4844 | 21 | <field name="bom_sub_ids" nolabel="1" colspan="6" readonly="True"/> | ||
4845 | 22 | </group> | ||
4846 | 23 | </field> | ||
4847 | 24 | </field> | ||
4848 | 25 | </record> | ||
4849 | 26 | |||
4850 | 27 | ######################################### Product normal ############################################ | ||
4851 | 28 | <record id="product_product_normal_form_view_asperience_mrp" model="ir.ui.view"> | ||
4852 | 29 | <field name="name">product.normal.form.asperience.mrp</field> | ||
4853 | 30 | <field name="model">product.product</field> | ||
4854 | 31 | <field name="inherit_id" ref="asperience_product_attributes.product_product_normal_form_view_attributes" /> | ||
4855 | 32 | <field name="arch" type="xml"> | ||
4856 | 33 | <field name="uom_id" position="replace"> | ||
4857 | 34 | <field name="uom_id" | ||
4858 | 35 | on_change="compute_weight(uom_d_weight,uom_id,uom_d_size,uom_s_size,size_x, size_y, size_z, shape, density, diameter, size_x_tmpl, size_y_tmpl, size_z_tmpl, density_tmpl, diameter_tmpl)" /> | ||
4859 | 36 | </field> | ||
4860 | 37 | <field name="linked_product_ids" position="after" > | ||
4861 | 38 | <button icon="gtk-ok" name="reinit_links" string="Reinit Links and Properties with Category" type="object" /> | ||
4862 | 39 | <field name="property_tmpl_ids" colspan="4" nolabel="1" context="{'tree_view_ref':'asperience_configurator_mrp.product_property_tree_tmpl','form_view_ref':'asperience_configurator_mrp.product_property_form_tmpl'}"/> | ||
4863 | 40 | <field name="property_ids" colspan="4" nolabel="1" context="{'tree_view_ref':'asperience_configurator_mrp.product_property_tree','form_view_ref':'asperience_configurator_mrp.product_property_form'}"/> | ||
4864 | 41 | </field> | ||
4865 | 42 | <page string="Attributes and Options" position="after" > | ||
4866 | 43 | <page string="BoM"> | ||
4867 | 44 | <group col="6" colspan="6" string="Generate"> | ||
4868 | 45 | <button name="generate_bom" type="object" string="Generate BoM"/> | ||
4869 | 46 | <field name="bom" readonly="1"/> | ||
4870 | 47 | <field name="opp"/> | ||
4871 | 48 | </group> | ||
4872 | 49 | <group col="2" colspan="6"> | ||
4873 | 50 | <field name="bom_type_group_ids" nolabel="1" colspan="6"/> | ||
4874 | 51 | <field name="bom_property_ids" nolabel="1" colspan="6"/> | ||
4875 | 52 | </group> | ||
4876 | 53 | <group col="2" colspan="6"> | ||
4877 | 54 | <field name="bom_ids" nolabel="1" colspan="6"/> | ||
4878 | 55 | <field name="bom_sub_ids" nolabel="1" colspan="6" readonly="True"/> | ||
4879 | 56 | </group> | ||
4880 | 57 | </page> | ||
4881 | 58 | <page string="Dimensions"> | ||
4882 | 59 | <group colspan="4"> | ||
4883 | 60 | <group colspan="2"> | ||
4884 | 61 | <separator colspan="2" string="Shape type" /> | ||
4885 | 62 | <field colspan="2" name="shape" select="2" | ||
4886 | 63 | on_change="compute_weight(uom_d_weight,uom_id,uom_d_size,uom_s_size,size_x, size_y, size_z, shape, density, diameter, size_x_tmpl, size_y_tmpl, size_z_tmpl, density_tmpl, diameter_tmpl)" /> | ||
4887 | 64 | </group> | ||
4888 | 65 | </group> | ||
4889 | 66 | |||
4890 | 67 | <separator colspan="4" string="Variables" /> | ||
4891 | 68 | <group colspan="4"> | ||
4892 | 69 | |||
4893 | 70 | <group colspan="2"> | ||
4894 | 71 | <separator colspan="4" string="Density" /> | ||
4895 | 72 | <group colspan="6" col="6"> | ||
4896 | 73 | <group colspan="2"> | ||
4897 | 74 | <field name="density" nolabel="1" | ||
4898 | 75 | on_change="compute_weight(uom_d_weight,uom_id,uom_d_size,uom_s_size,size_x, size_y, size_z, shape, density, diameter, size_x_tmpl, size_y_tmpl, size_z_tmpl, density_tmpl, diameter_tmpl)" /> | ||
4899 | 76 | </group> | ||
4900 | 77 | <group colspan="2"> | ||
4901 | 78 | <field name='uom_d_weight' string="Weight" | ||
4902 | 79 | on_change="compute_weight(uom_d_weight,uom_id,uom_d_size,uom_s_size,size_x, size_y, size_z, shape, density, diameter, size_x_tmpl, size_y_tmpl, size_z_tmpl, density_tmpl, diameter_tmpl)" /> | ||
4903 | 80 | </group> | ||
4904 | 81 | <group colspan="2"> | ||
4905 | 82 | <field name='uom_d_size' string="SizeĀ³" | ||
4906 | 83 | on_change="compute_weight(uom_d_weight,uom_id,uom_d_size,uom_s_size,size_x, size_y, size_z, shape, density, diameter, size_x_tmpl, size_y_tmpl, size_z_tmpl, density_tmpl, diameter_tmpl)" /> | ||
4907 | 84 | </group> | ||
4908 | 85 | </group> | ||
4909 | 86 | </group> | ||
4910 | 87 | |||
4911 | 88 | <group colspan="2"> | ||
4912 | 89 | <separator colspan="4" string="Size" /> | ||
4913 | 90 | <group colspan="2"> | ||
4914 | 91 | <group colspan="4" | ||
4915 | 92 | attrs="{'invisible':[('shape','in',['cylindrical','other'])]}"> | ||
4916 | 93 | <field name="size_x" | ||
4917 | 94 | on_change="compute_weight(uom_d_weight,uom_id,uom_d_size,uom_s_size,size_x, size_y, size_z, shape, density, diameter, size_x_tmpl, size_y_tmpl, size_z_tmpl, density_tmpl, diameter_tmpl)" /> | ||
4918 | 95 | </group> | ||
4919 | 96 | <group colspan="4" | ||
4920 | 97 | attrs="{'invisible':[('shape','in',['cylindrical','other'])]}"> | ||
4921 | 98 | <field name="size_y" | ||
4922 | 99 | on_change="compute_weight(uom_d_weight,uom_id,uom_d_size,uom_s_size,size_x, size_y, size_z, shape, density, diameter, size_x_tmpl, size_y_tmpl, size_z_tmpl, density_tmpl, diameter_tmpl)" /> | ||
4923 | 100 | </group> | ||
4924 | 101 | <group colspan="4" attrs="{'invisible':[('shape','in',['other'])]}"> | ||
4925 | 102 | <field name="size_z" | ||
4926 | 103 | on_change="compute_weight(uom_d_weight,uom_id,uom_d_size,uom_s_size,size_x, size_y, size_z, shape, density, diameter, size_x_tmpl, size_y_tmpl, size_z_tmpl, density_tmpl, diameter_tmpl)" /> | ||
4927 | 104 | </group> | ||
4928 | 105 | <group colspan="4" | ||
4929 | 106 | attrs="{'invisible':[('shape','in',['quadrangular','other'])]}"> | ||
4930 | 107 | <field name="diameter" | ||
4931 | 108 | on_change="compute_weight(uom_d_weight,uom_id,uom_d_size,uom_s_size,size_x, size_y, size_z, shape, density, diameter, size_x_tmpl, size_y_tmpl, size_z_tmpl, density_tmpl, diameter_tmpl)" /> | ||
4932 | 109 | </group> | ||
4933 | 110 | <group colspan="4"> | ||
4934 | 111 | <field name="uom_s_size" string="Size" | ||
4935 | 112 | on_change="compute_weight(uom_d_weight,uom_id,uom_d_size,uom_s_size,size_x, size_y, size_z, shape, density, diameter, size_x_tmpl, size_y_tmpl, size_z_tmpl, density_tmpl, diameter_tmpl)" /> | ||
4936 | 113 | </group> | ||
4937 | 114 | |||
4938 | 115 | </group> | ||
4939 | 116 | |||
4940 | 117 | </group> | ||
4941 | 118 | </group> | ||
4942 | 119 | |||
4943 | 120 | </page> | ||
4944 | 121 | </page> | ||
4945 | 122 | </field> | ||
4946 | 123 | </record> | ||
4947 | 124 | |||
4948 | 125 | ######################################### Product template ############################################ | ||
4949 | 126 | <record id="product_template_form_view_asperience_mrp" model="ir.ui.view"> | ||
4950 | 127 | <field name="name">product.template.product.form.asperience.mrp</field> | ||
4951 | 128 | <field name="model">product.template</field> | ||
4952 | 129 | <field name="type">form</field> | ||
4953 | 130 | <field name="inherit_id" ref="asperience_product_attributes.product_template_only_form_view_attributes" /> | ||
4954 | 131 | <field name="arch" type="xml"> | ||
4955 | 132 | <field name="linked_product_tmpl_ids" position="after" > | ||
4956 | 133 | <field name="property_tmpl_ids" colspan="4" nolabel="1" context="{'tree_view_ref':'asperience_configurator_mrp.product_property_tree_tmpl','form_view_ref':'asperience_configurator_mrp.product_property_form_tmpl'}"/> | ||
4957 | 134 | </field> | ||
4958 | 135 | <page string="Variants" position="after" > | ||
4959 | 136 | <page string="Dimensions"> | ||
4960 | 137 | <group colspan="4"> | ||
4961 | 138 | <group colspan="2"> | ||
4962 | 139 | <separator colspan="2" string="Shape type" /> | ||
4963 | 140 | <field colspan="2" name="shape" select="2" | ||
4964 | 141 | on_change="compute_weight(uom_d_weight, uom_id, uom_d_size, uom_s_size, size_x, size_y, size_z, shape, density, diameter, size_x_tmpl, size_y_tmpl, size_z_tmpl, density_tmpl, diameter_tmpl)" /> | ||
4965 | 142 | </group> | ||
4966 | 143 | </group> | ||
4967 | 144 | |||
4968 | 145 | <separator colspan="4" string="Variables" /> | ||
4969 | 146 | <group colspan="4"> | ||
4970 | 147 | |||
4971 | 148 | <group colspan="2"> | ||
4972 | 149 | <separator colspan="4" string="Density" /> | ||
4973 | 150 | <group colspan="6" col="6"> | ||
4974 | 151 | <group colspan="2"> | ||
4975 | 152 | <field name="density_tmpl" nolabel="1"/> | ||
4976 | 153 | </group> | ||
4977 | 154 | <group colspan="2"> | ||
4978 | 155 | <field name='uom_d_weight' string="Weight"/> | ||
4979 | 156 | </group> | ||
4980 | 157 | <group colspan="2"> | ||
4981 | 158 | <field name='uom_d_size' string="SizeĀ³"/> | ||
4982 | 159 | </group> | ||
4983 | 160 | </group> | ||
4984 | 161 | </group> | ||
4985 | 162 | |||
4986 | 163 | <group colspan="2"> | ||
4987 | 164 | <separator colspan="4" string="Size" /> | ||
4988 | 165 | <group colspan="2"> | ||
4989 | 166 | <group colspan="4" | ||
4990 | 167 | attrs="{'invisible':[('shape','in',['cylindrical','other'])]}"> | ||
4991 | 168 | <field name="size_x_tmpl"/> | ||
4992 | 169 | </group> | ||
4993 | 170 | <group colspan="4" | ||
4994 | 171 | attrs="{'invisible':[('shape','in',['cylindrical','other'])]}"> | ||
4995 | 172 | <field name="size_y_tmpl"/> | ||
4996 | 173 | </group> | ||
4997 | 174 | <group colspan="4" attrs="{'invisible':[('shape','in',['other'])]}"> | ||
4998 | 175 | <field name="size_z_tmpl"/> | ||
4999 | 176 | </group> | ||
5000 | 177 | <group colspan="4" |