Merge lp:~jfb-tempo-consulting/unifield-server/US-9014 into lp:unifield-server
- US-9014
- Merge into trunk
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 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
UniField Reviewer Team | Pending | ||
Review via email: mp+407698@code.launchpad.net |
Commit message
Description of the change
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/consumption_calculation/weekly_forecast_report.py' | |||
2 | --- bin/addons/consumption_calculation/weekly_forecast_report.py 2021-05-31 15:26:49 +0000 | |||
3 | +++ bin/addons/consumption_calculation/weekly_forecast_report.py 2021-08-26 07:25:55 +0000 | |||
4 | @@ -799,7 +799,7 @@ | |||
5 | 799 | SELECT | 799 | SELECT |
6 | 800 | pol.product_id AS product_id, | 800 | pol.product_id AS product_id, |
7 | 801 | sum(pol.product_qty/u1.factor/u2.factor) AS qty, | 801 | sum(pol.product_qty/u1.factor/u2.factor) AS qty, |
9 | 802 | coalesce(pol.confirmed_delivery_date, pol.date_planned) AS date | 802 | coalesce(pol.confirmed_delivery_date, pol.esti_dd, pol.date_planned) AS date |
10 | 803 | FROM | 803 | FROM |
11 | 804 | purchase_order_line pol | 804 | purchase_order_line pol |
12 | 805 | LEFT JOIN product_product p ON p.id = pol.product_id | 805 | LEFT JOIN product_product p ON p.id = pol.product_id |
13 | @@ -810,8 +810,8 @@ | |||
14 | 810 | pol.location_dest_id IN %(location_ids)s AND | 810 | pol.location_dest_id IN %(location_ids)s AND |
15 | 811 | pol.product_id IN %(product_ids)s AND | 811 | pol.product_id IN %(product_ids)s AND |
16 | 812 | pol.state IN ('validated', 'validated_n', 'sourced_sy', 'sourced_v', 'sourced_n') AND | 812 | pol.state IN ('validated', 'validated_n', 'sourced_sy', 'sourced_v', 'sourced_n') AND |
19 | 813 | coalesce(pol.confirmed_delivery_date, pol.date_planned) <= %(max_date)s | 813 | coalesce(pol.confirmed_delivery_date, pol.esti_dd, pol.date_planned) <= %(max_date)s |
20 | 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) |
21 | 815 | UNION | 815 | UNION |
22 | 816 | SELECT | 816 | SELECT |
23 | 817 | p.id AS product_id, | 817 | p.id AS product_id, |
24 | 818 | 818 | ||
25 | === modified file 'bin/addons/procurement_cycle/replenishment.py' | |||
26 | --- bin/addons/procurement_cycle/replenishment.py 2021-08-09 17:12:00 +0000 | |||
27 | +++ bin/addons/procurement_cycle/replenishment.py 2021-08-26 07:25:55 +0000 | |||
28 | @@ -898,7 +898,7 @@ | |||
29 | 898 | 898 | ||
30 | 899 | 899 | ||
31 | 900 | _columns = { | 900 | _columns = { |
33 | 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)]"), |
34 | 902 | 'name_seg': fields.char('Reference', size=64, readonly=1, select=1), | 902 | 'name_seg': fields.char('Reference', size=64, readonly=1, select=1), |
35 | 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), |
36 | 904 | 904 | ||
37 | @@ -906,7 +906,7 @@ | |||
38 | 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'), |
39 | 907 | 'product_list_id': fields.many2one('product.list', 'Primary product list'), | 907 | 'product_list_id': fields.many2one('product.list', 'Primary product list'), |
40 | 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), |
42 | 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'), |
43 | 910 | 'safety_stock': fields.float_null('Safety Stock', computation=-1), | 910 | 'safety_stock': fields.float_null('Safety Stock', computation=-1), |
44 | 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'), |
45 | 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}), |
46 | @@ -1021,7 +1021,7 @@ | |||
47 | 1021 | loc_ids = [x.id for x in seg.local_location_ids] | 1021 | loc_ids = [x.id for x in seg.local_location_ids] |
48 | 1022 | cr.execute(''' | 1022 | cr.execute(''' |
49 | 1023 | select prod_id, min(date) from ( | 1023 | select prod_id, min(date) from ( |
51 | 1024 | select pol.product_id as prod_id, min(coalesce(pol.confirmed_delivery_date, pol.date_planned)) as date | 1024 | select pol.product_id as prod_id, min(coalesce(pol.confirmed_delivery_date, pol.esti_dd, pol.date_planned)) as date |
52 | 1025 | from | 1025 | from |
53 | 1026 | purchase_order_line pol, replenishment_segment_line l | 1026 | purchase_order_line pol, replenishment_segment_line l |
54 | 1027 | where | 1027 | where |
55 | @@ -1195,15 +1195,15 @@ | |||
56 | 1195 | 1195 | ||
57 | 1196 | cr.execute(''' | 1196 | cr.execute(''' |
58 | 1197 | select date, sum(qty) from ( | 1197 | select date, sum(qty) from ( |
60 | 1198 | select coalesce(pol.confirmed_delivery_date, pol.date_planned) as date, sum(pol.product_qty) as qty | 1198 | select coalesce(pol.confirmed_delivery_date, pol.esti_dd, pol.date_planned) as date, sum(pol.product_qty) as qty |
61 | 1199 | from | 1199 | from |
62 | 1200 | purchase_order_line pol | 1200 | purchase_order_line pol |
63 | 1201 | where | 1201 | where |
64 | 1202 | pol.product_id=%(product_id)s and | 1202 | pol.product_id=%(product_id)s and |
65 | 1203 | pol.state in ('validated', 'validated_n', 'sourced_sy', 'sourced_v', 'sourced_n') and | 1203 | pol.state in ('validated', 'validated_n', 'sourced_sy', 'sourced_v', 'sourced_n') and |
66 | 1204 | location_dest_id in %(location_id)s and | 1204 | location_dest_id in %(location_id)s and |
69 | 1205 | coalesce(pol.confirmed_delivery_date, pol.date_planned) <= %(date)s | 1205 | coalesce(pol.confirmed_delivery_date, pol.esti_dd, pol.date_planned) <= %(date)s |
70 | 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) |
71 | 1207 | UNION | 1207 | UNION |
72 | 1208 | 1208 | ||
73 | 1209 | select date(m.date) as date, sum(product_qty) as product_qty from stock_move m, stock_picking p | 1209 | select date(m.date) as date, sum(product_qty) as product_qty from stock_move m, stock_picking p |
74 | @@ -1712,6 +1712,7 @@ | |||
75 | 1712 | updated = 0 | 1712 | updated = 0 |
76 | 1713 | ignored = 0 | 1713 | ignored = 0 |
77 | 1714 | for row in file_data.getRows(): | 1714 | for row in file_data.getRows(): |
78 | 1715 | cr.execute("SAVEPOINT seg_line") | ||
79 | 1715 | idx += 1 | 1716 | idx += 1 |
80 | 1716 | if idx < 8: | 1717 | if idx < 8: |
81 | 1717 | # header | 1718 | # header |
82 | @@ -1863,12 +1864,19 @@ | |||
83 | 1863 | error += line_error | 1864 | error += line_error |
84 | 1864 | ignored += 1 | 1865 | ignored += 1 |
85 | 1865 | continue | 1866 | continue |
92 | 1866 | if 'product_id' in data_towrite: | 1867 | try: |
93 | 1867 | seg_line_obj.create(cr, uid, data_towrite, context=context) | 1868 | if 'product_id' in data_towrite: |
94 | 1868 | created += 1 | 1869 | seg_line_obj.create(cr, uid, data_towrite, context=context) |
95 | 1869 | else: | 1870 | created += 1 |
96 | 1870 | seg_line_obj.write(cr, uid, line_id, data_towrite, context=context) | 1871 | else: |
97 | 1871 | updated += 1 | 1872 | seg_line_obj.write(cr, uid, line_id, data_towrite, context=context) |
98 | 1873 | updated += 1 | ||
99 | 1874 | except osv.except_osv as e: | ||
100 | 1875 | error.append(_('Line %d: %s' % (idx+1, misc.ustr(e.value)))) | ||
101 | 1876 | ignored += 1 | ||
102 | 1877 | cr.execute("ROLLBACK TO SAVEPOINT seg_line") | ||
103 | 1878 | continue | ||
104 | 1879 | cr.execute("RELEASE SAVEPOINT seg_line") | ||
105 | 1872 | 1880 | ||
106 | 1873 | except Exception, e: | 1881 | except Exception, e: |
107 | 1874 | cr.rollback() | 1882 | cr.rollback() |
108 | @@ -2378,6 +2386,7 @@ | |||
109 | 2378 | 2386 | ||
110 | 2379 | def _valid_fmc(self, cr, uid, ids, context=None): | 2387 | def _valid_fmc(self, cr, uid, ids, context=None): |
111 | 2380 | error = [] | 2388 | error = [] |
112 | 2389 | has_error = False | ||
113 | 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) |
114 | 2382 | if not line_ids: | 2391 | if not line_ids: |
115 | 2383 | return True | 2392 | return True |
116 | @@ -2392,7 +2401,11 @@ | |||
117 | 2392 | if rr_from: | 2401 | if rr_from: |
118 | 2393 | rr_from = datetime.strptime(rr_from, '%Y-%m-%d') | 2402 | rr_from = datetime.strptime(rr_from, '%Y-%m-%d') |
119 | 2394 | if rr_from.day != 1: | 2403 | if rr_from.day != 1: |
121 | 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: |
122 | 2405 | error.append(_('%s, FMC FROM %d must start the 1st day of the month') % (line.product_id.default_code, x)) | ||
123 | 2406 | else: | ||
124 | 2407 | # do not display error for computed value | ||
125 | 2408 | has_error = True | ||
126 | 2396 | if not rr_to: | 2409 | if not rr_to: |
127 | 2397 | if not rr_fmc: | 2410 | if not rr_fmc: |
128 | 2398 | continue | 2411 | continue |
129 | @@ -2410,7 +2423,7 @@ | |||
130 | 2410 | if prev_to > rr_from: | 2423 | if prev_to > rr_from: |
131 | 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)) |
132 | 2412 | prev_to = rr_to | 2425 | prev_to = rr_to |
134 | 2413 | if error: | 2426 | if error or has_error: |
135 | 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))) |
136 | 2415 | 2428 | ||
137 | 2416 | fmc_version = hashlib.md5(''.join(md5_data)).hexdigest() | 2429 | fmc_version = hashlib.md5(''.join(md5_data)).hexdigest() |
138 | 2417 | 2430 | ||
139 | === modified file 'bin/addons/procurement_cycle/replenishment_view.xml' | |||
140 | --- bin/addons/procurement_cycle/replenishment_view.xml 2021-04-19 14:30:16 +0000 | |||
141 | +++ bin/addons/procurement_cycle/replenishment_view.xml 2021-08-26 07:25:55 +0000 | |||
142 | @@ -44,6 +44,7 @@ | |||
143 | 44 | <field name="name">replenishment.location.config.tree</field> | 44 | <field name="name">replenishment.location.config.tree</field> |
144 | 45 | <field name="model">replenishment.location.config</field> | 45 | <field name="model">replenishment.location.config</field> |
145 | 46 | <field name="type">tree</field> | 46 | <field name="type">tree</field> |
146 | 47 | <field name="priority" eval="100"/> | ||
147 | 47 | <field name="arch" type="xml"> | 48 | <field name="arch" type="xml"> |
148 | 48 | <tree string="Location Configuration" colors="red:not review_active"> | 49 | <tree string="Location Configuration" colors="red:not review_active"> |
149 | 49 | <field name="name" /> | 50 | <field name="name" /> |
150 | @@ -56,6 +57,23 @@ | |||
151 | 56 | </field> | 57 | </field> |
152 | 57 | </record> | 58 | </record> |
153 | 58 | 59 | ||
154 | 60 | <record id="replenishment_location_config_tree_hide_new" model="ir.ui.view"> | ||
155 | 61 | <field name="name">replenishment.location.config.tree_hide_new</field> | ||
156 | 62 | <field name="model">replenishment.location.config</field> | ||
157 | 63 | <field name="type">tree</field> | ||
158 | 64 | <field name="priority" eval="20"/> | ||
159 | 65 | <field name="arch" type="xml"> | ||
160 | 66 | <tree string="Location Configuration" colors="red:not review_active" hide_new_button="1"> | ||
161 | 67 | <field name="name" /> | ||
162 | 68 | <field name="description" /> | ||
163 | 69 | <field name="synched" /> | ||
164 | 70 | <field name="main_instance" /> | ||
165 | 71 | <field name="active" /> | ||
166 | 72 | <field name="review_active" /> | ||
167 | 73 | </tree> | ||
168 | 74 | </field> | ||
169 | 75 | </record> | ||
170 | 76 | |||
171 | 59 | <record id="replenishment_location_config_search" model="ir.ui.view"> | 77 | <record id="replenishment_location_config_search" model="ir.ui.view"> |
172 | 60 | <field name="name">replenishment.location.config.search</field> | 78 | <field name="name">replenishment.location.config.search</field> |
173 | 61 | <field name="model">replenishment.location.config</field> | 79 | <field name="model">replenishment.location.config</field> |
174 | @@ -78,6 +96,7 @@ | |||
175 | 78 | <field name="res_model">replenishment.location.config</field> | 96 | <field name="res_model">replenishment.location.config</field> |
176 | 79 | <field name="view_type">form</field> | 97 | <field name="view_type">form</field> |
177 | 80 | <field name="view_mode">tree,form</field> | 98 | <field name="view_mode">tree,form</field> |
178 | 99 | <field name="view_id" ref="replenishment_location_config_tree" /> | ||
179 | 81 | <field name="domain">[('is_current_instance', '=', True)]</field> | 100 | <field name="domain">[('is_current_instance', '=', True)]</field> |
180 | 82 | </record> | 101 | </record> |
181 | 83 | 102 | ||
182 | 84 | 103 | ||
183 | === modified file 'bin/addons/purchase/purchase_view.xml' | |||
184 | --- bin/addons/purchase/purchase_view.xml 2021-08-09 17:27:06 +0000 | |||
185 | +++ bin/addons/purchase/purchase_view.xml 2021-08-26 07:25:55 +0000 | |||
186 | @@ -1042,6 +1042,7 @@ | |||
187 | 1042 | <field name="product_qty"/> | 1042 | <field name="product_qty"/> |
188 | 1043 | <field name="product_uom"/> | 1043 | <field name="product_uom"/> |
189 | 1044 | <field name="date_planned" widget="date" /> | 1044 | <field name="date_planned" widget="date" /> |
190 | 1045 | <field name="esti_dd" widget="date" /> | ||
191 | 1045 | <field name="confirmed_delivery_date" widget="date" /> | 1046 | <field name="confirmed_delivery_date" widget="date" /> |
192 | 1046 | <field name="state" /> | 1047 | <field name="state" /> |
193 | 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" /> |
194 | 1048 | 1049 | ||
195 | === modified file 'bin/addons/stock/product.py' | |||
196 | --- bin/addons/stock/product.py 2021-05-31 15:26:49 +0000 | |||
197 | +++ bin/addons/stock/product.py 2021-08-26 07:25:55 +0000 | |||
198 | @@ -244,7 +244,7 @@ | |||
199 | 244 | date_values = False | 244 | date_values = False |
200 | 245 | where = [tuple(location_ids), tuple(location_ids), tuple(ids), tuple(states)] | 245 | where = [tuple(location_ids), tuple(location_ids), tuple(ids), tuple(states)] |
201 | 246 | 246 | ||
203 | 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)' |
204 | 248 | date_pol_str = '' | 248 | date_pol_str = '' |
205 | 249 | date_pol_cond = {} | 249 | date_pol_cond = {} |
206 | 250 | if from_strict_date and to_date: | 250 | if from_strict_date and to_date: |
207 | 251 | 251 | ||
208 | === modified file 'bin/addons/sync_so/picking.py' | |||
209 | --- bin/addons/sync_so/picking.py 2021-08-10 16:18:43 +0000 | |||
210 | +++ bin/addons/sync_so/picking.py 2021-08-26 07:25:55 +0000 | |||
211 | @@ -605,9 +605,9 @@ | |||
212 | 605 | 605 | ||
213 | 606 | in_name = self.browse(cr, uid, new_picking, context=context)['name'] | 606 | in_name = self.browse(cr, uid, new_picking, context=context)['name'] |
214 | 607 | if po_id: | 607 | if po_id: |
216 | 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!" |
217 | 609 | else: | 609 | else: |
219 | 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!" |
220 | 611 | if ignored_lines: | 611 | if ignored_lines: |
221 | 612 | message = "\n".join([message]+ignored_lines) | 612 | message = "\n".join([message]+ignored_lines) |
222 | 613 | context['partial_sync_run'] = True | 613 | context['partial_sync_run'] = True |