Merge lp:~dorian-kemps/unifield-server/US-8428 into lp:unifield-server

Proposed by jftempo
Status: Merged
Merged at revision: 6280
Proposed branch: lp:~dorian-kemps/unifield-server/US-8428
Merge into: lp:unifield-server
Diff against target: 308 lines (+94/-44) (has conflicts)
6 files modified
bin/addons/msf_profile/data/patches.xml (+8/-0)
bin/addons/msf_profile/i18n/fr_MF.po (+28/-15)
bin/addons/msf_profile/msf_profile.py (+12/-0)
bin/addons/stock/physical_inventory.py (+38/-20)
bin/addons/stock/physical_inventory_view.xml (+7/-8)
bin/addons/stock/wizard/physical_inventory_select_products.py (+1/-1)
Text conflict in bin/addons/msf_profile/data/patches.xml
Text conflict in bin/addons/msf_profile/i18n/fr_MF.po
Text conflict in bin/addons/msf_profile/msf_profile.py
To merge this branch: bzr merge lp:~dorian-kemps/unifield-server/US-8428
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+425392@code.launchpad.net
To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/addons/msf_profile/data/patches.xml'
2--- bin/addons/msf_profile/data/patches.xml 2022-05-30 15:32:49 +0000
3+++ bin/addons/msf_profile/data/patches.xml 2022-06-27 14:49:29 +0000
4@@ -787,9 +787,17 @@
5 <field name="method">us_5722_update_accruals</field>
6 </record>
7
8+<<<<<<< TREE
9 <record id="us_8259_remove_currency_table_wkf" model="patch.scripts">
10 <field name="method">us_8259_remove_currency_table_wkf</field>
11 </record>
12
13+=======
14+ <!-- UF26.0 -->
15+ <record id="us_8428_pi_type_migration" model="patch.scripts">
16+ <field name="method">us_8428_pi_type_migration</field>
17+ </record>
18+
19+>>>>>>> MERGE-SOURCE
20 </data>
21 </openerp>
22
23=== modified file 'bin/addons/msf_profile/i18n/fr_MF.po'
24--- bin/addons/msf_profile/i18n/fr_MF.po 2022-06-20 12:58:24 +0000
25+++ bin/addons/msf_profile/i18n/fr_MF.po 2022-06-27 14:49:29 +0000
26@@ -10132,11 +10132,6 @@
27 msgid "Nauru"
28 msgstr "Nauru"
29
30-#. module: stock
31-#: field:physical.inventory.select.products,full_inventory:0
32-msgid "Full Inventory"
33-msgstr "Inventaire Complet"
34-
35 #. module: purchase
36 #: model:ir.actions.act_window,name:purchase.action_purchase_order_report_all
37 #: model:ir.ui.menu,name:purchase.menu_action_purchase_order_report_all
38@@ -45790,11 +45785,6 @@
39 msgid "Anguilla"
40 msgstr "Anguille"
41
42-#. module: stock
43-#: view:physical.inventory:0
44-msgid "Set as full inventory"
45-msgstr "Marquer comme inventaire complet"
46-
47 #. module: msf_doc_import
48 #: code:addons/msf_doc_import/wizard/wizard_import_fo_line.py:134
49 #: code:addons/msf_doc_import/wizard/wizard_import_product_line.py:124
50@@ -79033,11 +79023,6 @@
51 msgid "Sourced"
52 msgstr "Sourcé"
53
54-#. module: stock
55-#: view:physical.inventory:0
56-msgid "Setting as 'full inventory' is irreversible. Do you confirm ?"
57-msgstr "Marquer comme étant 'inventaire complet' est irréversible. Voulez-vous continuer ?"
58-
59 #. module: consumption_calculation
60 #: model:ir.actions.report.xml,name:consumption_calculation.report_incoming_consumption_xls
61 #: model:ir.actions.server,name:consumption_calculation.action_incoming_print_xml_export
62@@ -115057,6 +115042,7 @@
63 #, python-format
64 msgid "Cannot update these products, ED/BN attributes have not changed since the KCL creation"
65 msgstr "Impossible de mettre à jour ces produits. Les attributs NL/DE n'ont pas changé depuis la création du Kit"
66+<<<<<<< TREE
67
68 #. module: board
69 #: report:addons/board/report/integrity.mako:83
70@@ -115185,3 +115171,30 @@
71 #, python-format
72 msgid "Import error for account \"%s\" : Listing both Accounts/Destinations and G/L Accounts is not allowed"
73 msgstr "Erreur lors de l'import du compte \"%s\" : Lister à la fois les Comptes/Destinations et les Comptes Grand Livre n'est pas permis"
74+=======
75+
76+#. module: stock
77+#: selection:physical.inventory,type:0
78+msgid "Full Inventory count (planned)"
79+msgstr "Comptage complet de l'Inventaire (planifié)"
80+
81+#. module: stock
82+#: selection:physical.inventory,type:0
83+msgid "Partial Inventory count (planned)"
84+msgstr "Comptage partiel de l'Inventaire (planifié)"
85+
86+#. module: stock
87+#: selection:physical.inventory,type:0
88+msgid "Stock correction (unplanned)"
89+msgstr "Correction du Stock (non planifiée)"
90+
91+#. module: stock
92+#: field:physical.inventory,products_added:0
93+msgid "Has products"
94+msgstr "A des produits"
95+
96+#. module: stock
97+#: field:physical.inventory,type:0
98+msgid "Inventory Type"
99+msgstr "Type d'Inventaire"
100+>>>>>>> MERGE-SOURCE
101
102=== modified file 'bin/addons/msf_profile/msf_profile.py'
103--- bin/addons/msf_profile/msf_profile.py 2022-05-30 15:32:49 +0000
104+++ bin/addons/msf_profile/msf_profile.py 2022-06-27 14:49:29 +0000
105@@ -56,12 +56,24 @@
106 'model': lambda *a: 'patch.scripts',
107 }
108
109+<<<<<<< TREE
110 def us_8259_remove_currency_table_wkf(self, cr, uid, *a, **b):
111 cr.execute("delete from wkf_workitem where act_id in (select id from wkf_activity where wkf_id = (select id from wkf where name='wkf.res.currency.table' and osv='res.currency.table'))")
112 cr.execute("delete from wkf_activity where wkf_id = (select id from wkf where name='wkf.res.currency.table' and osv='res.currency.table')")
113 cr.execute("delete from wkf where name='wkf.res.currency.table' and osv='res.currency.table'")
114 return True
115
116+=======
117+ # UF26.0
118+ def us_8428_pi_type_migration(self, cr, uid, *a, **b):
119+ '''
120+ In PIs, if full_inventory == True, set the type to 'full'
121+ '''
122+ cr.execute("""UPDATE physical_inventory SET type = 'full' WHERE full_inventory = 't'""")
123+
124+ return True
125+
126+>>>>>>> MERGE-SOURCE
127 # UF25.0
128 def us_8451_split_rr(self, cr, uid, *a, **b):
129 if not cr.column_exists('replenishment_segment_line', 'rr_fmc_1') or not cr.column_exists('replenishment_segment_line', 'rr_max_1'):
130
131=== modified file 'bin/addons/stock/physical_inventory.py'
132--- bin/addons/stock/physical_inventory.py 2022-05-19 09:23:30 +0000
133+++ bin/addons/stock/physical_inventory.py 2022-06-27 14:49:29 +0000
134@@ -105,6 +105,25 @@
135
136 return totals
137
138+ def _get_products_added(self, cr, uid, ids, field_name, arg, context=None):
139+ if not ids:
140+ return False
141+
142+ cr.execute("""
143+ SELECT pi.id, count(rel.product_id)
144+ FROM
145+ physical_inventory pi
146+ LEFT JOIN
147+ physical_inventory_product_rel rel ON rel.product_id = pi.id
148+ WHERE
149+ pi.id in %s
150+ GROUP BY pi.id
151+ """, (tuple(ids), ))
152+ ret = {}
153+ for x in cr.fetchall():
154+ ret[x[0]] = x[1] > 0
155+
156+ return ret
157
158 _columns = {
159 'ref': fields.char('Reference', size=64, readonly=True, sort_column='id'),
160@@ -113,6 +132,7 @@
161 'responsible': fields.char('Responsible', size=128, required=False, states={'closed': [('readonly',True)], 'cancel': [('readonly',True)]}),
162 'date_done': fields.datetime('Date done', readonly=True),
163 'date_confirmed': fields.datetime('Date confirmed', readonly=True),
164+ # 'inventory_id' and 'product_id' seem to be inverted in product_ids
165 'product_ids': fields.many2many('product.product', 'physical_inventory_product_rel',
166 'product_id', 'inventory_id', string="Product selection", domain=[('type', 'not in', ['service_recep', 'consu'])], order_by="default_code"),
167 'discrepancy_line_ids': fields.one2many('physical.inventory.discrepancy', 'inventory_id', 'Discrepancy lines',
168@@ -127,6 +147,8 @@
169 'company_id': fields.many2one('res.company', 'Company', readonly=True, select=True, required=True,
170 states={'draft': [('readonly', False)]}),
171 'full_inventory': fields.boolean('Full inventory', readonly=True),
172+ 'type': fields.selection([('full', 'Full Inventory count (planned)'), ('partial', 'Partial Inventory count (planned)'),
173+ ('correction', 'Stock correction (unplanned)')], 'Inventory Type', required=True, select=True),
174 'discrepancies_generated': fields.boolean('Discrepancies Generated', readonly=True),
175 'file_to_import': fields.binary(string='File to import', filters='*.xml'),
176 'file_to_import2': fields.binary(string='File to import', filters='*.xml'),
177@@ -143,8 +165,9 @@
178 'discrepancy_lines_percent_absvalue': fields.function(_inventory_totals, multi="inventory_total", method=True, type='float', string=_("Percent of absolute value of discrepancies")),
179 'bad_stock_msg': fields.text('Bad Stock', readonly=1),
180 'has_bad_stock': fields.boolean('Has bad Stock', readonly=1),
181- 'max_filter_months': fields.integer('Months selected in "Products with recent movement at location" during Product Selection', readonly=1),
182- 'multiple_filter_months': fields.boolean('Multiple Selection', readonly=1),
183+ 'max_filter_months': fields.integer('Months selected in "Products with recent movement at location" during Product Selection'),
184+ 'multiple_filter_months': fields.boolean('Multiple Selection'),
185+ 'products_added': fields.function(_get_products_added, method=True, type='boolean', string='Has products'),
186 }
187
188 _defaults = {
189@@ -152,14 +175,15 @@
190 'date': lambda *a: time.strftime(DEFAULT_SERVER_DATETIME_FORMAT),
191 'state': 'draft',
192 'full_inventory': False,
193+ 'type': 'partial',
194 'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'physical.inventory', context=c),
195 'has_bad_stock': False,
196 'discrepancies_generated': False,
197 'max_filter_months': -1,
198 'multiple_filter_months': False,
199+ 'products_added': False,
200 }
201
202-
203 def create(self, cr, uid, values, context):
204 context = context is None and {} or context
205 values["ref"] = self.pool.get('ir.sequence').get(cr, uid, 'physical.inventory')
206@@ -170,7 +194,6 @@
207 raise osv.except_osv(_('Warning'), _("Location is inactive"))
208 return new_id
209
210-
211 def copy(self, cr, uid, id_, default=None, context=None):
212 default = default is None and {} or default
213 context = context is None and {} or context
214@@ -178,6 +201,7 @@
215
216 default['state'] = 'draft'
217 default['date'] = time.strftime(DEFAULT_SERVER_DATETIME_FORMAT)
218+ default['type'] = 'partial'
219 fields_to_empty = ["ref",
220 "full_inventory",
221 "date_done",
222@@ -197,19 +221,14 @@
223
224 return super(PhysicalInventory, self).copy(cr, uid, id_, default, context=context)
225
226-
227 def perm_write(self, cr, user, ids, fields, context=None):
228 pass
229
230-
231- def set_full_inventory(self, cr, uid, ids, context=None):
232- context = context is None and {} or context
233-
234- # Set full inventory as true and unlink all products already selected
235- self.write(cr, uid, ids, {'full_inventory': True,
236- 'product_ids': [(5)]}, context=context)
237- return {}
238-
239+ def onchange_products(self, cr, uid, ids, product_ids, context=None):
240+ res = {'value': {'products_added': product_ids != [(6, 0, [])]}}
241+ if product_ids == [(6, 0, [])]:
242+ res['value'].update({'max_filter_months': -1, 'multiple_filter_months': False})
243+ return res
244
245 def action_select_products(self, cr, uid, ids, context=None):
246 """
247@@ -229,13 +248,12 @@
248 assert len(ids) == 1
249 inventory_id = ids[0]
250
251- # Is it a full inventory ?
252- full_inventory = read_single(self._name, inventory_id, 'full_inventory')
253-
254- # Create the wizard
255+ # Create the wizard, check if it is a full inventory
256 wiz_model = 'physical.inventory.select.products'
257- wiz_values = {"inventory_id": inventory_id,
258- "full_inventory": full_inventory }
259+ wiz_values = {
260+ "inventory_id": inventory_id,
261+ "full_inventory": read_single(self._name, inventory_id, 'type') == 'full'
262+ }
263 wiz_id = create(wiz_model, wiz_values)
264 context['wizard_id'] = wiz_id
265
266
267=== modified file 'bin/addons/stock/physical_inventory_view.xml'
268--- bin/addons/stock/physical_inventory_view.xml 2020-11-30 15:46:46 +0000
269+++ bin/addons/stock/physical_inventory_view.xml 2022-06-27 14:49:29 +0000
270@@ -25,18 +25,17 @@
271 <field name="date" attrs="{'readonly': [('state', '!=', 'draft')]}"/>
272 <field name="responsible"/>
273 <field name="date_done"/>
274- <field name="full_inventory"/>
275+ <field name="type" attrs="{'readonly': ['|', ('state', '!=', 'draft'), ('products_added', '=', True)]}"/>
276 <field name="discrepancies_generated" invisible="1" readonly="1"/>
277- <button colspan="2" name="set_full_inventory" states="draft" string="Set as full inventory" type="object"
278- icon="gtk-about"
279- confirm="Setting as 'full inventory' is irreversible. Do you confirm ?"
280- attrs="{'invisible': [('full_inventory', '=', True)]}"/>
281+ <field name="max_filter_months" invisible="1"/>
282+ <field name="multiple_filter_months" invisible="1"/>
283+ <field name="products_added" invisible="1" readonly="1"/>
284 <notebook colspan="4">
285 <page string="Products" attrs="{'readonly': [('state', 'not in', ['draft'])]}">
286 <button name="action_select_products" states="draft" string="Products Selection" type="object"
287- icon="gtk-add"/>
288- <field colspan="4" name="product_ids" nolabel="1"
289- attrs="{'readonly': ['|', ('full_inventory', '=', True), ('state', 'not in', ['draft'])]}">
290+ icon="gtk-add" attrs="{'invisible': [('type', '=', 'correction')]}"/>
291+ <field colspan="4" name="product_ids" nolabel="1" on_change="onchange_products(product_ids)"
292+ attrs="{'readonly': ['|', ('type', '=', 'full'), ('state', '!=', 'draft')]}">
293 <tree string="Products" noteditable="1">
294 <field name="default_code"/>
295 <field name="name"/>
296
297=== modified file 'bin/addons/stock/wizard/physical_inventory_select_products.py'
298--- bin/addons/stock/wizard/physical_inventory_select_products.py 2021-08-16 15:44:14 +0000
299+++ bin/addons/stock/wizard/physical_inventory_select_products.py 2022-06-27 14:49:29 +0000
300@@ -393,7 +393,7 @@
301 product_ids = self.pool.get("product.product").search(cr, uid, [("id", 'in', product_ids)], context=context)
302
303 # '6' is the code for 'replace all'
304- vals = {'product_ids': [(6, 0, product_ids)]}
305+ vals = {'product_ids': [(6, 0, product_ids)], 'products_added': True}
306
307 # Check if 'recent_movements' has been used
308 if wiz_data['products_preview'] and (wiz_data['first_filter'] == 'recent_movements' or wiz_data['full_inventory'] and wiz_data['recent_moves_months_fullinvo']):

Subscribers

People subscribed via source and target branches