Merge lp:~jfb-tempo-consulting/unifield-server/US-9014 into lp:unifield-server

Proposed by jftempo
Status: Merged
Merged at revision: 6077
Proposed branch: lp:~jfb-tempo-consulting/unifield-server/US-9014
Merge into: lp:unifield-server
Diff against target: 222 lines (+53/-20)
6 files modified
bin/addons/consumption_calculation/weekly_forecast_report.py (+3/-3)
bin/addons/procurement_cycle/replenishment.py (+27/-14)
bin/addons/procurement_cycle/replenishment_view.xml (+19/-0)
bin/addons/purchase/purchase_view.xml (+1/-0)
bin/addons/stock/product.py (+1/-1)
bin/addons/sync_so/picking.py (+2/-2)
To merge this branch: bzr merge lp:~jfb-tempo-consulting/unifield-server/US-9014
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+407698@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
=== modified file 'bin/addons/consumption_calculation/weekly_forecast_report.py'
--- bin/addons/consumption_calculation/weekly_forecast_report.py 2021-05-31 15:26:49 +0000
+++ bin/addons/consumption_calculation/weekly_forecast_report.py 2021-08-26 07:25:55 +0000
@@ -799,7 +799,7 @@
799 SELECT799 SELECT
800 pol.product_id AS product_id,800 pol.product_id AS product_id,
801 sum(pol.product_qty/u1.factor/u2.factor) AS qty,801 sum(pol.product_qty/u1.factor/u2.factor) AS qty,
802 coalesce(pol.confirmed_delivery_date, pol.date_planned) AS date802 coalesce(pol.confirmed_delivery_date, pol.esti_dd, pol.date_planned) AS date
803 FROM803 FROM
804 purchase_order_line pol804 purchase_order_line pol
805 LEFT JOIN product_product p ON p.id = pol.product_id805 LEFT JOIN product_product p ON p.id = pol.product_id
@@ -810,8 +810,8 @@
810 pol.location_dest_id IN %(location_ids)s AND810 pol.location_dest_id IN %(location_ids)s AND
811 pol.product_id IN %(product_ids)s AND811 pol.product_id IN %(product_ids)s AND
812 pol.state IN ('validated', 'validated_n', 'sourced_sy', 'sourced_v', 'sourced_n') AND812 pol.state IN ('validated', 'validated_n', 'sourced_sy', 'sourced_v', 'sourced_n') AND
813 coalesce(pol.confirmed_delivery_date, pol.date_planned) <= %(max_date)s813 coalesce(pol.confirmed_delivery_date, pol.esti_dd, pol.date_planned) <= %(max_date)s
814 GROUP BY pol.product_id, coalesce(pol.confirmed_delivery_date, pol.date_planned)814 GROUP BY pol.product_id, coalesce(pol.confirmed_delivery_date, pol.esti_dd, pol.date_planned)
815 UNION815 UNION
816 SELECT816 SELECT
817 p.id AS product_id,817 p.id AS product_id,
818818
=== modified file 'bin/addons/procurement_cycle/replenishment.py'
--- bin/addons/procurement_cycle/replenishment.py 2021-08-09 17:12:00 +0000
+++ bin/addons/procurement_cycle/replenishment.py 2021-08-26 07:25:55 +0000
@@ -898,7 +898,7 @@
898898
899899
900 _columns = {900 _columns = {
901 'parent_id': fields.many2one('replenishment.parent.segment', 'Parent', required=1, ondelete='cascade', select=1, domain="[('hidden', '=', False), ('state_parent', 'in', ['complete', 'draft'])]"),901 'parent_id': fields.many2one('replenishment.parent.segment', 'Parent', required=1, ondelete='cascade', select=1, domain="[('hidden', '=', False), ('state_parent', 'in', ['complete', 'draft']), ('is_current_instance', '=', True)]"),
902 'name_seg': fields.char('Reference', size=64, readonly=1, select=1),902 'name_seg': fields.char('Reference', size=64, readonly=1, select=1),
903 'description_seg': fields.char('Replenishment Segment Description', required=1, size=28, select=1),903 'description_seg': fields.char('Replenishment Segment Description', required=1, size=28, select=1),
904904
@@ -906,7 +906,7 @@
906 'rule_alert': fields.function(_get_rule_alert, method=1, string='Replenishment Rule (Alert Theshold)', type='char'),906 'rule_alert': fields.function(_get_rule_alert, method=1, string='Replenishment Rule (Alert Theshold)', type='char'),
907 'product_list_id': fields.many2one('product.list', 'Primary product list'),907 'product_list_id': fields.many2one('product.list', 'Primary product list'),
908 'state': fields.selection([('draft', 'Draft'), ('complete', 'Complete'), ('cancel', 'Cancelled'), ('archived', 'Archived')], 'State', readonly=1),908 'state': fields.selection([('draft', 'Draft'), ('complete', 'Complete'), ('cancel', 'Cancelled'), ('archived', 'Archived')], 'State', readonly=1),
909 'fake_state': fields.related('state', string='State internal', readonly=1, write_relate=False),909 'fake_state': fields.related('state', string='State internal', readonly=1, write_relate=False, type='char'),
910 'safety_stock': fields.float_null('Safety Stock', computation=-1),910 'safety_stock': fields.float_null('Safety Stock', computation=-1),
911 'safety_stock_month': fields.function(_get_ss_month, type='float', method=True, string='Safety Stock in months'),911 'safety_stock_month': fields.function(_get_ss_month, type='float', method=True, string='Safety Stock in months'),
912 'line_ids': fields.one2many('replenishment.segment.line', 'segment_id', 'Products', context={'default_code_only': 1}),912 'line_ids': fields.one2many('replenishment.segment.line', 'segment_id', 'Products', context={'default_code_only': 1}),
@@ -1021,7 +1021,7 @@
1021 loc_ids = [x.id for x in seg.local_location_ids]1021 loc_ids = [x.id for x in seg.local_location_ids]
1022 cr.execute('''1022 cr.execute('''
1023 select prod_id, min(date) from (1023 select prod_id, min(date) from (
1024 select pol.product_id as prod_id, min(coalesce(pol.confirmed_delivery_date, pol.date_planned)) as date1024 select pol.product_id as prod_id, min(coalesce(pol.confirmed_delivery_date, pol.esti_dd, pol.date_planned)) as date
1025 from1025 from
1026 purchase_order_line pol, replenishment_segment_line l1026 purchase_order_line pol, replenishment_segment_line l
1027 where1027 where
@@ -1195,15 +1195,15 @@
11951195
1196 cr.execute('''1196 cr.execute('''
1197 select date, sum(qty) from (1197 select date, sum(qty) from (
1198 select coalesce(pol.confirmed_delivery_date, pol.date_planned) as date, sum(pol.product_qty) as qty1198 select coalesce(pol.confirmed_delivery_date, pol.esti_dd, pol.date_planned) as date, sum(pol.product_qty) as qty
1199 from1199 from
1200 purchase_order_line pol1200 purchase_order_line pol
1201 where1201 where
1202 pol.product_id=%(product_id)s and1202 pol.product_id=%(product_id)s and
1203 pol.state in ('validated', 'validated_n', 'sourced_sy', 'sourced_v', 'sourced_n') and1203 pol.state in ('validated', 'validated_n', 'sourced_sy', 'sourced_v', 'sourced_n') and
1204 location_dest_id in %(location_id)s and1204 location_dest_id in %(location_id)s and
1205 coalesce(pol.confirmed_delivery_date, pol.date_planned) <= %(date)s1205 coalesce(pol.confirmed_delivery_date, pol.esti_dd, pol.date_planned) <= %(date)s
1206 group by coalesce(pol.confirmed_delivery_date, pol.date_planned)1206 group by coalesce(pol.confirmed_delivery_date, pol.esti_dd, pol.date_planned)
1207 UNION1207 UNION
12081208
1209 select date(m.date) as date, sum(product_qty) as product_qty from stock_move m, stock_picking p1209 select date(m.date) as date, sum(product_qty) as product_qty from stock_move m, stock_picking p
@@ -1712,6 +1712,7 @@
1712 updated = 01712 updated = 0
1713 ignored = 01713 ignored = 0
1714 for row in file_data.getRows():1714 for row in file_data.getRows():
1715 cr.execute("SAVEPOINT seg_line")
1715 idx += 11716 idx += 1
1716 if idx < 8:1717 if idx < 8:
1717 # header1718 # header
@@ -1863,12 +1864,19 @@
1863 error += line_error1864 error += line_error
1864 ignored += 11865 ignored += 1
1865 continue1866 continue
1866 if 'product_id' in data_towrite:1867 try:
1867 seg_line_obj.create(cr, uid, data_towrite, context=context)1868 if 'product_id' in data_towrite:
1868 created += 11869 seg_line_obj.create(cr, uid, data_towrite, context=context)
1869 else:1870 created += 1
1870 seg_line_obj.write(cr, uid, line_id, data_towrite, context=context)1871 else:
1871 updated += 11872 seg_line_obj.write(cr, uid, line_id, data_towrite, context=context)
1873 updated += 1
1874 except osv.except_osv as e:
1875 error.append(_('Line %d: %s' % (idx+1, misc.ustr(e.value))))
1876 ignored += 1
1877 cr.execute("ROLLBACK TO SAVEPOINT seg_line")
1878 continue
1879 cr.execute("RELEASE SAVEPOINT seg_line")
18721880
1873 except Exception, e:1881 except Exception, e:
1874 cr.rollback()1882 cr.rollback()
@@ -2378,6 +2386,7 @@
23782386
2379 def _valid_fmc(self, cr, uid, ids, context=None):2387 def _valid_fmc(self, cr, uid, ids, context=None):
2380 error = []2388 error = []
2389 has_error = False
2381 line_ids = self.search(cr, uid, [('id', 'in', ids), ('segment_id.rule', '=', 'cycle')], context=context)2390 line_ids = self.search(cr, uid, [('id', 'in', ids), ('segment_id.rule', '=', 'cycle')], context=context)
2382 if not line_ids:2391 if not line_ids:
2383 return True2392 return True
@@ -2392,7 +2401,11 @@
2392 if rr_from:2401 if rr_from:
2393 rr_from = datetime.strptime(rr_from, '%Y-%m-%d')2402 rr_from = datetime.strptime(rr_from, '%Y-%m-%d')
2394 if rr_from.day != 1:2403 if rr_from.day != 1:
2395 error.append(_('%s, FMC FROM %d must start the 1st day of the month') % (line.product_id.default_code, x))2404 if x == 1:
2405 error.append(_('%s, FMC FROM %d must start the 1st day of the month') % (line.product_id.default_code, x))
2406 else:
2407 # do not display error for computed value
2408 has_error = True
2396 if not rr_to:2409 if not rr_to:
2397 if not rr_fmc:2410 if not rr_fmc:
2398 continue2411 continue
@@ -2410,7 +2423,7 @@
2410 if prev_to > rr_from:2423 if prev_to > rr_from:
2411 error.append(_("%s, FMC FROM %d must be later than FMC TO %d") % (line.product_id.default_code, x, x-1))2424 error.append(_("%s, FMC FROM %d must be later than FMC TO %d") % (line.product_id.default_code, x, x-1))
2412 prev_to = rr_to2425 prev_to = rr_to
2413 if error:2426 if error or has_error:
2414 raise osv.except_osv(_('Error'), _('Please correct the following FMC values:\n%s') % ("\n".join(error)))2427 raise osv.except_osv(_('Error'), _('Please correct the following FMC values:\n%s') % ("\n".join(error)))
24152428
2416 fmc_version = hashlib.md5(''.join(md5_data)).hexdigest()2429 fmc_version = hashlib.md5(''.join(md5_data)).hexdigest()
24172430
=== modified file 'bin/addons/procurement_cycle/replenishment_view.xml'
--- bin/addons/procurement_cycle/replenishment_view.xml 2021-04-19 14:30:16 +0000
+++ bin/addons/procurement_cycle/replenishment_view.xml 2021-08-26 07:25:55 +0000
@@ -44,6 +44,7 @@
44 <field name="name">replenishment.location.config.tree</field>44 <field name="name">replenishment.location.config.tree</field>
45 <field name="model">replenishment.location.config</field>45 <field name="model">replenishment.location.config</field>
46 <field name="type">tree</field>46 <field name="type">tree</field>
47 <field name="priority" eval="100"/>
47 <field name="arch" type="xml">48 <field name="arch" type="xml">
48 <tree string="Location Configuration" colors="red:not review_active">49 <tree string="Location Configuration" colors="red:not review_active">
49 <field name="name" />50 <field name="name" />
@@ -56,6 +57,23 @@
56 </field>57 </field>
57 </record>58 </record>
5859
60 <record id="replenishment_location_config_tree_hide_new" model="ir.ui.view">
61 <field name="name">replenishment.location.config.tree_hide_new</field>
62 <field name="model">replenishment.location.config</field>
63 <field name="type">tree</field>
64 <field name="priority" eval="20"/>
65 <field name="arch" type="xml">
66 <tree string="Location Configuration" colors="red:not review_active" hide_new_button="1">
67 <field name="name" />
68 <field name="description" />
69 <field name="synched" />
70 <field name="main_instance" />
71 <field name="active" />
72 <field name="review_active" />
73 </tree>
74 </field>
75 </record>
76
59 <record id="replenishment_location_config_search" model="ir.ui.view">77 <record id="replenishment_location_config_search" model="ir.ui.view">
60 <field name="name">replenishment.location.config.search</field>78 <field name="name">replenishment.location.config.search</field>
61 <field name="model">replenishment.location.config</field>79 <field name="model">replenishment.location.config</field>
@@ -78,6 +96,7 @@
78 <field name="res_model">replenishment.location.config</field>96 <field name="res_model">replenishment.location.config</field>
79 <field name="view_type">form</field>97 <field name="view_type">form</field>
80 <field name="view_mode">tree,form</field>98 <field name="view_mode">tree,form</field>
99 <field name="view_id" ref="replenishment_location_config_tree" />
81 <field name="domain">[('is_current_instance', '=', True)]</field>100 <field name="domain">[('is_current_instance', '=', True)]</field>
82 </record>101 </record>
83102
84103
=== modified file 'bin/addons/purchase/purchase_view.xml'
--- bin/addons/purchase/purchase_view.xml 2021-08-09 17:27:06 +0000
+++ bin/addons/purchase/purchase_view.xml 2021-08-26 07:25:55 +0000
@@ -1042,6 +1042,7 @@
1042 <field name="product_qty"/>1042 <field name="product_qty"/>
1043 <field name="product_uom"/>1043 <field name="product_uom"/>
1044 <field name="date_planned" widget="date" />1044 <field name="date_planned" widget="date" />
1045 <field name="esti_dd" widget="date" />
1045 <field name="confirmed_delivery_date" widget="date" />1046 <field name="confirmed_delivery_date" widget="date" />
1046 <field name="state" />1047 <field name="state" />
1047 <button type="object" name="open_po_form" icon="terp-gtk-go-back-rtl" string="View PO" />1048 <button type="object" name="open_po_form" icon="terp-gtk-go-back-rtl" string="View PO" />
10481049
=== modified file 'bin/addons/stock/product.py'
--- bin/addons/stock/product.py 2021-05-31 15:26:49 +0000
+++ bin/addons/stock/product.py 2021-08-26 07:25:55 +0000
@@ -244,7 +244,7 @@
244 date_values = False244 date_values = False
245 where = [tuple(location_ids), tuple(location_ids), tuple(ids), tuple(states)]245 where = [tuple(location_ids), tuple(location_ids), tuple(ids), tuple(states)]
246246
247 pol_query_date = 'coalesce(pol.confirmed_delivery_date, pol.date_planned)'247 pol_query_date = 'coalesce(pol.confirmed_delivery_date, pol.esti_dd, pol.date_planned)'
248 date_pol_str = ''248 date_pol_str = ''
249 date_pol_cond = {}249 date_pol_cond = {}
250 if from_strict_date and to_date:250 if from_strict_date and to_date:
251251
=== modified file 'bin/addons/sync_so/picking.py'
--- bin/addons/sync_so/picking.py 2021-08-10 16:18:43 +0000
+++ bin/addons/sync_so/picking.py 2021-08-26 07:25:55 +0000
@@ -605,9 +605,9 @@
605605
606 in_name = self.browse(cr, uid, new_picking, context=context)['name']606 in_name = self.browse(cr, uid, new_picking, context=context)['name']
607 if po_id:607 if po_id:
608 message = "The INcoming " + in_name + "(" + po_name + ") is now become shipped available!"608 message = "The INcoming " + in_name + "(" + po_name + ") has now become shipped available!"
609 else:609 else:
610 message = "The INcoming " + in_name + "(no PO) is now become shipped available!"610 message = "The INcoming " + in_name + "(no PO) has now become shipped available!"
611 if ignored_lines:611 if ignored_lines:
612 message = "\n".join([message]+ignored_lines)612 message = "\n".join([message]+ignored_lines)
613 context['partial_sync_run'] = True613 context['partial_sync_run'] = True

Subscribers

People subscribed via source and target branches