Merge lp:~dorian-kemps/unifield-server/US-10522 into lp:unifield-server
- US-10522
- Merge into trunk
Proposed by
jftempo
Status: | Merged |
---|---|
Merged at revision: | 6328 |
Proposed branch: | lp:~dorian-kemps/unifield-server/US-10522 |
Merge into: | lp:unifield-server |
Diff against target: |
195 lines (+85/-78) 2 files modified
bin/addons/msf_profile/i18n/fr_MF.po (+6/-0) bin/addons/stock/physical_inventory.py (+79/-78) |
To merge this branch: | bzr merge lp:~dorian-kemps/unifield-server/US-10522 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
UniField Reviewer Team | Pending | ||
Review via email: mp+430434@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/msf_profile/i18n/fr_MF.po' | |||
2 | --- bin/addons/msf_profile/i18n/fr_MF.po 2022-08-23 13:15:58 +0000 | |||
3 | +++ bin/addons/msf_profile/i18n/fr_MF.po 2022-10-07 12:13:16 +0000 | |||
4 | @@ -84381,6 +84381,12 @@ | |||
5 | 84381 | msgid "UoM %s unknown" | 84381 | msgid "UoM %s unknown" |
6 | 84382 | msgstr "UdM %s inconnue" | 84382 | msgstr "UdM %s inconnue" |
7 | 84383 | 84383 | ||
8 | 84384 | #. module: stock | ||
9 | 84385 | #: code:addons/stock/physical_inventory.py:785 | ||
10 | 84386 | #, python-format | ||
11 | 84387 | msgid "UoM is mandatory" | ||
12 | 84388 | msgstr "L'UdM est obligatoire" | ||
13 | 84389 | |||
14 | 84384 | #. module: account_chart | 84390 | #. module: account_chart |
15 | 84385 | #: model:ir.module.module,shortdesc:account_chart.module_meta_information | 84391 | #: model:ir.module.module,shortdesc:account_chart.module_meta_information |
16 | 84386 | msgid "Charts of Accounts" | 84392 | msgid "Charts of Accounts" |
17 | 84387 | 84393 | ||
18 | === modified file 'bin/addons/stock/physical_inventory.py' | |||
19 | --- bin/addons/stock/physical_inventory.py 2022-08-09 15:55:05 +0000 | |||
20 | +++ bin/addons/stock/physical_inventory.py 2022-10-07 12:13:16 +0000 | |||
21 | @@ -775,11 +775,14 @@ | |||
22 | 775 | 775 | ||
23 | 776 | # Check UoM | 776 | # Check UoM |
24 | 777 | product_uom_id = False | 777 | product_uom_id = False |
28 | 778 | product_uom = row.cells[3].data.lower() | 778 | if row.cells[3].data: |
29 | 779 | if product_uom not in all_uom: | 779 | product_uom = row.cells[3].data.lower() |
30 | 780 | add_error(_("""UoM %s unknown""") % product_uom, row_index, 3) | 780 | if product_uom not in all_uom: |
31 | 781 | add_error(_("""UoM %s unknown""") % product_uom, row_index, 3) | ||
32 | 782 | else: | ||
33 | 783 | product_uom_id = all_uom[product_uom] | ||
34 | 781 | else: | 784 | else: |
36 | 782 | product_uom_id = all_uom[product_uom] | 785 | add_error(_("""UoM is mandatory"""), row_index, 3) |
37 | 783 | 786 | ||
38 | 784 | # Check quantity | 787 | # Check quantity |
39 | 785 | quantity = row.cells[4].data | 788 | quantity = row.cells[4].data |
40 | @@ -795,84 +798,82 @@ | |||
41 | 795 | quantity = 0.0 | 798 | quantity = 0.0 |
42 | 796 | add_error(_('Quantity %s is not valid') % quantity, row_index, 4) | 799 | add_error(_('Quantity %s is not valid') % quantity, row_index, 4) |
43 | 797 | 800 | ||
45 | 798 | if product_id: | 801 | if product_id and product_uom_id: |
46 | 799 | product_info = product_obj.read(cr, uid, product_id, ['batch_management', 'perishable', 'default_code', 'uom_id']) | 802 | product_info = product_obj.read(cr, uid, product_id, ['batch_management', 'perishable', 'default_code', 'uom_id']) |
113 | 800 | else: | 803 | |
114 | 801 | product_info = {'batch_management': False, 'perishable': False, 'default_code': product_code, 'uom_id': False} | 804 | if product_info['uom_id'] and product_info['uom_id'][0] != product_uom_id: |
115 | 802 | 805 | add_error(_("""Product %s, UoM %s does not conform to that of product in stock""") % (product_info['default_code'], product_uom), row_index, 3) | |
116 | 803 | if product_info['uom_id'] and product_uom_id and product_info['uom_id'][0] != product_uom_id: | 806 | |
117 | 804 | add_error(_("""Product %s, UoM %s does not conform to that of product in stock""") % (product_info['default_code'], product_uom), row_index, 3) | 807 | # Check batch number |
118 | 805 | 808 | batch_name = row.cells[5].data | |
119 | 806 | # Check batch number | 809 | if not batch_name and product_info['batch_management'] and quantity is not None: |
120 | 807 | batch_name = row.cells[5].data | 810 | add_error(_('Batch number is required'), row_index, 5) |
121 | 808 | if not batch_name and product_info['batch_management'] and quantity is not None: | 811 | |
122 | 809 | add_error(_('Batch number is required'), row_index, 5) | 812 | if batch_name and not product_info['batch_management']: |
123 | 810 | 813 | add_error(_("Product %s is not BN managed, BN ignored") % (product_info['default_code'], ), row_index, 5, is_warning=True) | |
124 | 811 | if batch_name and not product_info['batch_management']: | 814 | batch_name = False |
125 | 812 | add_error(_("Product %s is not BN managed, BN ignored") % (product_info['default_code'], ), row_index, 5, is_warning=True) | 815 | |
126 | 813 | batch_name = False | 816 | # Check expiry date |
127 | 814 | 817 | expiry_date = row.cells[6].data | |
128 | 815 | # Check expiry date | 818 | if expiry_date and not product_info['perishable']: |
129 | 816 | expiry_date = row.cells[6].data | 819 | add_error(_("Product %s is not ED managed, ED ignored") % (product_info['default_code'], ), row_index, 6, is_warning=True) |
130 | 817 | if expiry_date and not product_info['perishable']: | 820 | expiry_date = False |
131 | 818 | add_error(_("Product %s is not ED managed, ED ignored") % (product_info['default_code'], ), row_index, 6, is_warning=True) | 821 | elif expiry_date: |
132 | 819 | expiry_date = False | 822 | expiry_date_type = row.cells[6].type |
133 | 820 | elif expiry_date: | 823 | year = False |
134 | 821 | expiry_date_type = row.cells[6].type | 824 | try: |
135 | 822 | year = False | 825 | if expiry_date_type == 'datetime': |
136 | 823 | try: | 826 | expiry_date = expiry_date.strftime(DEFAULT_SERVER_DATE_FORMAT) |
137 | 824 | if expiry_date_type == 'datetime': | 827 | year = row.cells[6].data.year |
138 | 825 | expiry_date = expiry_date.strftime(DEFAULT_SERVER_DATE_FORMAT) | 828 | elif expiry_date_type == 'str': |
139 | 826 | year = row.cells[6].data.year | 829 | expiry_date_dt = parse(expiry_date) |
140 | 827 | elif expiry_date_type == 'str': | 830 | year = expiry_date_dt.year |
141 | 828 | expiry_date_dt = parse(expiry_date) | 831 | expiry_date = expiry_date_dt.strftime(DEFAULT_SERVER_DATE_FORMAT) |
142 | 829 | year = expiry_date_dt.year | 832 | else: |
143 | 830 | expiry_date = expiry_date_dt.strftime(DEFAULT_SERVER_DATE_FORMAT) | 833 | raise ValueError() |
144 | 831 | else: | 834 | except ValueError: |
145 | 832 | raise ValueError() | 835 | if not year or year >= 1900: |
146 | 833 | except ValueError: | 836 | add_error(_("""Expiry date %s is not valid""") % expiry_date, row_index, 6) |
147 | 834 | if not year or year >= 1900: | 837 | |
148 | 835 | add_error(_("""Expiry date %s is not valid""") % expiry_date, row_index, 6) | 838 | if year and year < 1900: |
149 | 836 | 839 | add_error(_('Expiry date: year must be after 1899'), row_index, 6) | |
150 | 837 | if year and year < 1900: | 840 | |
151 | 838 | add_error(_('Expiry date: year must be after 1899'), row_index, 6) | 841 | if not expiry_date and product_info['perishable'] and quantity is not None: |
152 | 839 | 842 | add_error(_('Expiry date is required'), row_index, 6) | |
153 | 840 | if not expiry_date and product_info['perishable'] and quantity is not None: | 843 | |
154 | 841 | add_error(_('Expiry date is required'), row_index, 6) | 844 | # Check duplicate line (Same product_id, batch_number, expirty_date) |
155 | 842 | 845 | item = '%d-%s-%s' % (product_id or -1, batch_name or '', expiry_date or '') | |
156 | 843 | # Check duplicate line (Same product_id, batch_number, expirty_date) | 846 | if item in line_items: |
157 | 844 | item = '%d-%s-%s' % (product_id or -1, batch_name or '', expiry_date or '') | 847 | add_error(_("""Product %s, Duplicate line (same product, batch number and expiry date)""") % product_info['default_code'], row_index) |
158 | 845 | if item in line_items: | 848 | elif quantity is not None: |
159 | 846 | add_error(_("""Product %s, Duplicate line (same product, batch number and expiry date)""") % product_info['default_code'], row_index) | 849 | line_items.append(item) |
160 | 847 | elif quantity is not None: | 850 | |
161 | 848 | line_items.append(item) | 851 | data = { |
162 | 849 | 852 | 'product_id': product_id, | |
163 | 850 | data = { | 853 | 'batch_number': batch_name, |
164 | 851 | 'product_id': product_id, | 854 | 'expiry_date': expiry_date, |
165 | 852 | 'batch_number': batch_name, | 855 | 'quantity': False, |
166 | 853 | 'expiry_date': expiry_date, | 856 | 'product_uom_id': product_uom_id, |
167 | 854 | 'quantity': False, | 857 | } |
168 | 855 | 'product_uom_id': product_uom_id, | 858 | |
169 | 856 | } | 859 | if quantity is not None: |
170 | 857 | 860 | data['quantity'] = quantity | |
171 | 858 | if quantity is not None: | 861 | # Check if line exist |
106 | 859 | data['quantity'] = quantity | ||
107 | 860 | # Check if line exist | ||
108 | 861 | line_ids = counting_obj.search(cr, uid, [('inventory_id', '=', inventory_rec.id), | ||
109 | 862 | ('product_id', '=', product_id), | ||
110 | 863 | ('batch_number', '=', batch_name), | ||
111 | 864 | ('expiry_date', '=', expiry_date)], context=context) | ||
112 | 865 | if not line_ids and (batch_name or expiry_date): # Search for empty BN/ED lines | ||
172 | 866 | line_ids = counting_obj.search(cr, uid, [('inventory_id', '=', inventory_rec.id), | 862 | line_ids = counting_obj.search(cr, uid, [('inventory_id', '=', inventory_rec.id), |
173 | 867 | ('product_id', '=', product_id), | 863 | ('product_id', '=', product_id), |
176 | 868 | ('batch_number', '=', False), | 864 | ('batch_number', '=', batch_name), |
177 | 869 | ('expiry_date', '=', False)], context=context) | 865 | ('expiry_date', '=', expiry_date)], context=context) |
178 | 866 | if not line_ids and (batch_name or expiry_date): # Search for empty BN/ED lines | ||
179 | 867 | line_ids = counting_obj.search(cr, uid, [('inventory_id', '=', inventory_rec.id), | ||
180 | 868 | ('product_id', '=', product_id), | ||
181 | 869 | ('batch_number', '=', False), | ||
182 | 870 | ('expiry_date', '=', False)], context=context) | ||
183 | 870 | 871 | ||
189 | 871 | if line_ids: | 872 | if line_ids: |
190 | 872 | counting_obj.write(cr, uid, line_ids[0], data, context=context) | 873 | counting_obj.write(cr, uid, line_ids[0], data, context=context) |
191 | 873 | else: | 874 | else: |
192 | 874 | data['inventory_id'] = inventory_rec.id | 875 | data['inventory_id'] = inventory_rec.id |
193 | 875 | counting_obj.create(cr, uid, data, context=context) | 876 | counting_obj.create(cr, uid, data, context=context) |
194 | 876 | 877 | ||
195 | 877 | # endfor | 878 | # endfor |
196 | 878 | 879 |