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 | SELECT |
6 | pol.product_id AS product_id, |
7 | sum(pol.product_qty/u1.factor/u2.factor) AS qty, |
8 | - coalesce(pol.confirmed_delivery_date, pol.date_planned) AS date |
9 | + coalesce(pol.confirmed_delivery_date, pol.esti_dd, pol.date_planned) AS date |
10 | FROM |
11 | purchase_order_line pol |
12 | LEFT JOIN product_product p ON p.id = pol.product_id |
13 | @@ -810,8 +810,8 @@ |
14 | pol.location_dest_id IN %(location_ids)s AND |
15 | pol.product_id IN %(product_ids)s AND |
16 | pol.state IN ('validated', 'validated_n', 'sourced_sy', 'sourced_v', 'sourced_n') AND |
17 | - coalesce(pol.confirmed_delivery_date, pol.date_planned) <= %(max_date)s |
18 | - GROUP BY pol.product_id, coalesce(pol.confirmed_delivery_date, pol.date_planned) |
19 | + coalesce(pol.confirmed_delivery_date, pol.esti_dd, pol.date_planned) <= %(max_date)s |
20 | + GROUP BY pol.product_id, coalesce(pol.confirmed_delivery_date, pol.esti_dd, pol.date_planned) |
21 | UNION |
22 | SELECT |
23 | p.id AS product_id, |
24 | |
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 | |
30 | |
31 | _columns = { |
32 | - 'parent_id': fields.many2one('replenishment.parent.segment', 'Parent', required=1, ondelete='cascade', select=1, domain="[('hidden', '=', False), ('state_parent', 'in', ['complete', 'draft'])]"), |
33 | + '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 | 'name_seg': fields.char('Reference', size=64, readonly=1, select=1), |
35 | 'description_seg': fields.char('Replenishment Segment Description', required=1, size=28, select=1), |
36 | |
37 | @@ -906,7 +906,7 @@ |
38 | 'rule_alert': fields.function(_get_rule_alert, method=1, string='Replenishment Rule (Alert Theshold)', type='char'), |
39 | 'product_list_id': fields.many2one('product.list', 'Primary product list'), |
40 | 'state': fields.selection([('draft', 'Draft'), ('complete', 'Complete'), ('cancel', 'Cancelled'), ('archived', 'Archived')], 'State', readonly=1), |
41 | - 'fake_state': fields.related('state', string='State internal', readonly=1, write_relate=False), |
42 | + 'fake_state': fields.related('state', string='State internal', readonly=1, write_relate=False, type='char'), |
43 | 'safety_stock': fields.float_null('Safety Stock', computation=-1), |
44 | 'safety_stock_month': fields.function(_get_ss_month, type='float', method=True, string='Safety Stock in months'), |
45 | 'line_ids': fields.one2many('replenishment.segment.line', 'segment_id', 'Products', context={'default_code_only': 1}), |
46 | @@ -1021,7 +1021,7 @@ |
47 | loc_ids = [x.id for x in seg.local_location_ids] |
48 | cr.execute(''' |
49 | select prod_id, min(date) from ( |
50 | - select pol.product_id as prod_id, min(coalesce(pol.confirmed_delivery_date, pol.date_planned)) as date |
51 | + select pol.product_id as prod_id, min(coalesce(pol.confirmed_delivery_date, pol.esti_dd, pol.date_planned)) as date |
52 | from |
53 | purchase_order_line pol, replenishment_segment_line l |
54 | where |
55 | @@ -1195,15 +1195,15 @@ |
56 | |
57 | cr.execute(''' |
58 | select date, sum(qty) from ( |
59 | - select coalesce(pol.confirmed_delivery_date, pol.date_planned) as date, sum(pol.product_qty) as qty |
60 | + select coalesce(pol.confirmed_delivery_date, pol.esti_dd, pol.date_planned) as date, sum(pol.product_qty) as qty |
61 | from |
62 | purchase_order_line pol |
63 | where |
64 | pol.product_id=%(product_id)s and |
65 | pol.state in ('validated', 'validated_n', 'sourced_sy', 'sourced_v', 'sourced_n') and |
66 | location_dest_id in %(location_id)s and |
67 | - coalesce(pol.confirmed_delivery_date, pol.date_planned) <= %(date)s |
68 | - group by coalesce(pol.confirmed_delivery_date, pol.date_planned) |
69 | + coalesce(pol.confirmed_delivery_date, pol.esti_dd, pol.date_planned) <= %(date)s |
70 | + group by coalesce(pol.confirmed_delivery_date, pol.esti_dd, pol.date_planned) |
71 | UNION |
72 | |
73 | 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 | updated = 0 |
76 | ignored = 0 |
77 | for row in file_data.getRows(): |
78 | + cr.execute("SAVEPOINT seg_line") |
79 | idx += 1 |
80 | if idx < 8: |
81 | # header |
82 | @@ -1863,12 +1864,19 @@ |
83 | error += line_error |
84 | ignored += 1 |
85 | continue |
86 | - if 'product_id' in data_towrite: |
87 | - seg_line_obj.create(cr, uid, data_towrite, context=context) |
88 | - created += 1 |
89 | - else: |
90 | - seg_line_obj.write(cr, uid, line_id, data_towrite, context=context) |
91 | - updated += 1 |
92 | + try: |
93 | + if 'product_id' in data_towrite: |
94 | + seg_line_obj.create(cr, uid, data_towrite, context=context) |
95 | + created += 1 |
96 | + else: |
97 | + seg_line_obj.write(cr, uid, line_id, data_towrite, context=context) |
98 | + updated += 1 |
99 | + except osv.except_osv as e: |
100 | + error.append(_('Line %d: %s' % (idx+1, misc.ustr(e.value)))) |
101 | + ignored += 1 |
102 | + cr.execute("ROLLBACK TO SAVEPOINT seg_line") |
103 | + continue |
104 | + cr.execute("RELEASE SAVEPOINT seg_line") |
105 | |
106 | except Exception, e: |
107 | cr.rollback() |
108 | @@ -2378,6 +2386,7 @@ |
109 | |
110 | def _valid_fmc(self, cr, uid, ids, context=None): |
111 | error = [] |
112 | + has_error = False |
113 | line_ids = self.search(cr, uid, [('id', 'in', ids), ('segment_id.rule', '=', 'cycle')], context=context) |
114 | if not line_ids: |
115 | return True |
116 | @@ -2392,7 +2401,11 @@ |
117 | if rr_from: |
118 | rr_from = datetime.strptime(rr_from, '%Y-%m-%d') |
119 | if rr_from.day != 1: |
120 | - error.append(_('%s, FMC FROM %d must start the 1st day of the month') % (line.product_id.default_code, x)) |
121 | + if x == 1: |
122 | + error.append(_('%s, FMC FROM %d must start the 1st day of the month') % (line.product_id.default_code, x)) |
123 | + else: |
124 | + # do not display error for computed value |
125 | + has_error = True |
126 | if not rr_to: |
127 | if not rr_fmc: |
128 | continue |
129 | @@ -2410,7 +2423,7 @@ |
130 | if prev_to > rr_from: |
131 | error.append(_("%s, FMC FROM %d must be later than FMC TO %d") % (line.product_id.default_code, x, x-1)) |
132 | prev_to = rr_to |
133 | - if error: |
134 | + if error or has_error: |
135 | raise osv.except_osv(_('Error'), _('Please correct the following FMC values:\n%s') % ("\n".join(error))) |
136 | |
137 | fmc_version = hashlib.md5(''.join(md5_data)).hexdigest() |
138 | |
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 | <field name="name">replenishment.location.config.tree</field> |
144 | <field name="model">replenishment.location.config</field> |
145 | <field name="type">tree</field> |
146 | + <field name="priority" eval="100"/> |
147 | <field name="arch" type="xml"> |
148 | <tree string="Location Configuration" colors="red:not review_active"> |
149 | <field name="name" /> |
150 | @@ -56,6 +57,23 @@ |
151 | </field> |
152 | </record> |
153 | |
154 | + <record id="replenishment_location_config_tree_hide_new" model="ir.ui.view"> |
155 | + <field name="name">replenishment.location.config.tree_hide_new</field> |
156 | + <field name="model">replenishment.location.config</field> |
157 | + <field name="type">tree</field> |
158 | + <field name="priority" eval="20"/> |
159 | + <field name="arch" type="xml"> |
160 | + <tree string="Location Configuration" colors="red:not review_active" hide_new_button="1"> |
161 | + <field name="name" /> |
162 | + <field name="description" /> |
163 | + <field name="synched" /> |
164 | + <field name="main_instance" /> |
165 | + <field name="active" /> |
166 | + <field name="review_active" /> |
167 | + </tree> |
168 | + </field> |
169 | + </record> |
170 | + |
171 | <record id="replenishment_location_config_search" model="ir.ui.view"> |
172 | <field name="name">replenishment.location.config.search</field> |
173 | <field name="model">replenishment.location.config</field> |
174 | @@ -78,6 +96,7 @@ |
175 | <field name="res_model">replenishment.location.config</field> |
176 | <field name="view_type">form</field> |
177 | <field name="view_mode">tree,form</field> |
178 | + <field name="view_id" ref="replenishment_location_config_tree" /> |
179 | <field name="domain">[('is_current_instance', '=', True)]</field> |
180 | </record> |
181 | |
182 | |
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 | <field name="product_qty"/> |
188 | <field name="product_uom"/> |
189 | <field name="date_planned" widget="date" /> |
190 | + <field name="esti_dd" widget="date" /> |
191 | <field name="confirmed_delivery_date" widget="date" /> |
192 | <field name="state" /> |
193 | <button type="object" name="open_po_form" icon="terp-gtk-go-back-rtl" string="View PO" /> |
194 | |
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 | date_values = False |
200 | where = [tuple(location_ids), tuple(location_ids), tuple(ids), tuple(states)] |
201 | |
202 | - pol_query_date = 'coalesce(pol.confirmed_delivery_date, pol.date_planned)' |
203 | + pol_query_date = 'coalesce(pol.confirmed_delivery_date, pol.esti_dd, pol.date_planned)' |
204 | date_pol_str = '' |
205 | date_pol_cond = {} |
206 | if from_strict_date and to_date: |
207 | |
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 | |
213 | in_name = self.browse(cr, uid, new_picking, context=context)['name'] |
214 | if po_id: |
215 | - message = "The INcoming " + in_name + "(" + po_name + ") is now become shipped available!" |
216 | + message = "The INcoming " + in_name + "(" + po_name + ") has now become shipped available!" |
217 | else: |
218 | - message = "The INcoming " + in_name + "(no PO) is now become shipped available!" |
219 | + message = "The INcoming " + in_name + "(no PO) has now become shipped available!" |
220 | if ignored_lines: |
221 | message = "\n".join([message]+ignored_lines) |
222 | context['partial_sync_run'] = True |