Merge lp:~dorian-kemps/unifield-server/US-2445 into lp:~jfb-tempo-consulting/unifield-server/jfb-int

Proposed by jftempo
Status: Merged
Merged at revision: 5527
Proposed branch: lp:~dorian-kemps/unifield-server/US-2445
Merge into: lp:~jfb-tempo-consulting/unifield-server/jfb-int
Diff against target: 135 lines (+63/-1)
4 files modified
bin/addons/msf_doc_import/initial_stock_inventory.py (+11/-0)
bin/addons/msf_profile/i18n/fr_MF.po (+6/-0)
bin/addons/specific_rules/stock_view.xml (+1/-1)
bin/addons/stock/stock.py (+45/-0)
To merge this branch: bzr merge lp:~dorian-kemps/unifield-server/US-2445
Reviewer Review Type Date Requested Status
jftempo Pending
Review via email: mp+371100@code.launchpad.net
To post a comment you must log in.
Revision history for this message
jftempo (jfb-tempo-consulting) :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'bin/addons/msf_doc_import/initial_stock_inventory.py'
--- bin/addons/msf_doc_import/initial_stock_inventory.py 2019-07-30 09:13:43 +0000
+++ bin/addons/msf_doc_import/initial_stock_inventory.py 2019-10-22 09:02:04 +0000
@@ -635,6 +635,7 @@
635 location_obj = self.pool.get('stock.location')635 location_obj = self.pool.get('stock.location')
636 obj_data = self.pool.get('ir.model.data')636 obj_data = self.pool.get('ir.model.data')
637637
638
638 vals = {}639 vals = {}
639 vals['inventory_line_id'] = []640 vals['inventory_line_id'] = []
640 msg_to_return = _("All lines successfully imported")641 msg_to_return = _("All lines successfully imported")
@@ -647,6 +648,7 @@
647 product_non_stockable_cache = {}648 product_non_stockable_cache = {}
648 product_error = []649 product_error = []
649 no_product_error = []650 no_product_error = []
651 wrong_location = []
650652
651 fileobj = SpreadsheetXML(xmlstring=base64.decodestring(obj.file_to_import))653 fileobj = SpreadsheetXML(xmlstring=base64.decodestring(obj.file_to_import))
652654
@@ -751,6 +753,10 @@
751 location_not_found = True753 location_not_found = True
752 else:754 else:
753 location_id = loc_ids[0]755 location_id = loc_ids[0]
756 loc = location_obj.browse(cr, uid, location_id, fields_to_fetch=['initial_stock_inv_display', 'usage'],
757 context=context)
758 if not loc.initial_stock_inv_display or loc.usage != 'internal':
759 wrong_location.append(_('Line #%s: The location "%s" is not allowed') % (line_num, location_name))
754 except Exception:760 except Exception:
755 location_id = False761 location_id = False
756762
@@ -903,6 +909,11 @@
903 len(no_product_error) > 1 and 's' or '',909 len(no_product_error) > 1 and 's' or '',
904 ' / '.join(tools.ustr(x) for x in no_product_error)),910 ' / '.join(tools.ustr(x) for x in no_product_error)),
905 )911 )
912 if wrong_location:
913 raise osv.except_osv(
914 _('Error'),
915 '\n'.join(wrong_location)
916 )
906917
907 # write order line on Inventory918 # write order line on Inventory
908 vals.update({'file_to_import': False})919 vals.update({'file_to_import': False})
909920
=== modified file 'bin/addons/msf_profile/i18n/fr_MF.po'
--- bin/addons/msf_profile/i18n/fr_MF.po 2019-10-18 15:58:30 +0000
+++ bin/addons/msf_profile/i18n/fr_MF.po 2019-10-22 09:02:04 +0000
@@ -106911,6 +106911,12 @@
106911msgid "Stop report"106911msgid "Stop report"
106912msgstr "Arrêter le rapport"106912msgstr "Arrêter le rapport"
106913106913
106914#. module: msf_doc_import
106915#: code:addons/msf_doc_import/initial_stock_inventory.py:648
106916#, python-format
106917msgid "Line #%s: The location \"%s\" is not allowed"
106918msgstr "Ligne #%s: La Zone \"%s\" n'est pas autorisée"
106919
106914#. module: stock106920#. module: stock
106915#: code:addons/stock/stock.py:1780106921#: code:addons/stock/stock.py:1780
106916#, python-format106922#, python-format
106917106923
=== modified file 'bin/addons/specific_rules/stock_view.xml'
--- bin/addons/specific_rules/stock_view.xml 2016-05-23 12:40:15 +0000
+++ bin/addons/specific_rules/stock_view.xml 2019-10-22 09:02:04 +0000
@@ -51,7 +51,7 @@
51 on_change="product_change(product_id, location_id, 'product_id', True, prod_lot_id)" />51 on_change="product_change(product_id, location_id, 'product_id', True, prod_lot_id)" />
52 <field name="average_cost" />52 <field name="average_cost" />
53 <field name="currency_id" />53 <field name="currency_id" />
54 <field name="location_id" domain="[('usage', '=', 'internal')]" on_change="product_change(product_id, location_id, 'location_id', prod_lot_id)" required="True" />54 <field name="location_id" domain="['&amp;', ('usage', '=', 'internal'), ('initial_stock_inv_display', '!=', False)]" on_change="product_change(product_id, location_id, 'location_id', prod_lot_id)" required="True" />
55 <field name="prodlot_name"55 <field name="prodlot_name"
56 attrs="{'required': [('hidden_batch_management_mandatory', '=', True)], 'readonly': [('hidden_batch_management_mandatory', '=', False)]}" />56 attrs="{'required': [('hidden_batch_management_mandatory', '=', True)], 'readonly': [('hidden_batch_management_mandatory', '=', False)]}" />
57 <field name="expiry_date"57 <field name="expiry_date"
5858
=== modified file 'bin/addons/stock/stock.py'
--- bin/addons/stock/stock.py 2019-09-25 14:20:09 +0000
+++ bin/addons/stock/stock.py 2019-10-22 09:02:04 +0000
@@ -155,6 +155,50 @@
155 result[loc_id][f] += amount155 result[loc_id][f] += amount
156 return result156 return result
157157
158 def _get_loc_ids_to_hide(self, cr, uid, ids, context=None):
159 if context is None:
160 context = {}
161
162 loc_to_hide = [
163 'msf_cross_docking_stock_location_input',
164 'stock_stock_location_stock',
165 'stock_stock_location_output',
166 'msf_outgoing_stock_location_packing',
167 'msf_outgoing_stock_location_dispatch',
168 'msf_outgoing_stock_location_distribution',
169 'stock_location_quarantine_view',
170 ]
171
172 data_domain = [('model', '=', 'stock.location'), ('name', 'in', loc_to_hide)]
173 if ids:
174 data_domain.append(('res_id', 'in', ids))
175 loc_ids_to_hide = self.pool.get('ir.model.data').search(cr, uid, data_domain, context=context)
176
177 return [x.get('res_id') for x in self.pool.get('ir.model.data').read(cr, uid, loc_ids_to_hide, ['res_id'], context=context)]
178
179 def _get_initial_stock_inv_display(self, cr, uid, ids, name, args, context=None):
180 if context is None:
181 context = {}
182
183 res = {}
184
185 loc_ids_to_hide = self._get_loc_ids_to_hide(cr, uid, ids, context=context)
186 for _id in ids:
187 res[_id] = True
188 if _id in loc_ids_to_hide:
189 res[_id] = False
190
191 return res
192
193 def _search_initial_stock_inv_display(self, cr, uid, obj, name, args, context=None):
194 '''
195 Returns locations allowed in the Initial Stock Inventory
196 '''
197 if context is None:
198 context = {}
199
200 return [('id', 'not in', self._get_loc_ids_to_hide(cr, uid, [], context=context))]
201
158 _columns = {202 _columns = {
159 'name': fields.char('Location Name', size=64, required=True, translate=True),203 'name': fields.char('Location Name', size=64, required=True, translate=True),
160 'active': fields.boolean('Active', help="By unchecking the active field, you may hide a location without deleting it."),204 'active': fields.boolean('Active', help="By unchecking the active field, you may hide a location without deleting it."),
@@ -214,6 +258,7 @@
214 'scrap_location': fields.boolean('Scrap Location', help='Check this box to allow using this location to put scrapped/damaged goods.'),258 'scrap_location': fields.boolean('Scrap Location', help='Check this box to allow using this location to put scrapped/damaged goods.'),
215 'valuation_in_account_id': fields.many2one('account.account', 'Stock Input Account',domain = [('type','=','other')], help='This account will be used to value stock moves that have this location as destination, instead of the stock output account from the product.'),259 'valuation_in_account_id': fields.many2one('account.account', 'Stock Input Account',domain = [('type','=','other')], help='This account will be used to value stock moves that have this location as destination, instead of the stock output account from the product.'),
216 'valuation_out_account_id': fields.many2one('account.account', 'Stock Output Account',domain = [('type','=','other')], help='This account will be used to value stock moves that have this location as source, instead of the stock input account from the product.'),260 'valuation_out_account_id': fields.many2one('account.account', 'Stock Output Account',domain = [('type','=','other')], help='This account will be used to value stock moves that have this location as source, instead of the stock input account from the product.'),
261 'initial_stock_inv_display': fields.function(_get_initial_stock_inv_display, method=True, type='boolean', store=False, fnct_search=_search_initial_stock_inv_display, string='Display in Initial stock inventory', readonly=True),
217 }262 }
218 _defaults = {263 _defaults = {
219 'active': True,264 'active': True,

Subscribers

People subscribed via source and target branches

to all changes: