Merge lp:~jfb-tempo-consulting/unifield-server/us-2270 into lp:unifield-server

Proposed by jftempo
Status: Merged
Merged at revision: 5015
Proposed branch: lp:~jfb-tempo-consulting/unifield-server/us-2270
Merge into: lp:unifield-server
Diff against target: 211 lines (+108/-12) (has conflicts)
3 files modified
bin/addons/msf_outgoing/msf_outgoing.py (+74/-9)
bin/addons/msf_outgoing/msf_outgoing_view.xml (+5/-3)
bin/addons/msf_profile/i18n/fr_MF.po (+29/-0)
Text conflict in bin/addons/msf_profile/i18n/fr_MF.po
To merge this branch: bzr merge lp:~jfb-tempo-consulting/unifield-server/us-2270
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+350940@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_outgoing/msf_outgoing.py'
2--- bin/addons/msf_outgoing/msf_outgoing.py 2018-07-17 12:45:33 +0000
3+++ bin/addons/msf_outgoing/msf_outgoing.py 2018-08-07 08:48:35 +0000
4@@ -303,7 +303,7 @@
5 'shipment_actual_date': fields.datetime(string='Actual Ship Date', readonly=True,),
6 'transport_type': fields.selection(TRANSPORT_TYPE,
7 string="Transport Type", readonly=False),
8- 'address_id': fields.many2one('res.partner.address', 'Address', help="Address of customer"),
9+ 'address_id': fields.many2one('res.partner.address', 'Address', help="Address of customer", required=1),
10 'sequence_id': fields.many2one('ir.sequence', 'Shipment Sequence', help="This field contains the information related to the numbering of the shipment.", ondelete='cascade'),
11 # cargo manifest things
12 'cargo_manifest_reference': fields.char(string='Cargo Manifest Reference', size=1024,),
13@@ -556,6 +556,12 @@
14 )
15
16 for shipment in self.browse(cr, uid, ids, context=context):
17+ if not shipment.address_id.id:
18+ raise osv.except_osv(
19+ _('Processing Error'),
20+ _('Please fill the Address field on %s') % (shipment.name),
21+ )
22+
23 # search for an existing shipment saved as draft ... :
24 wiz_ids = self.pool.get('shipment.processor').search(cr, uid, [('shipment_id', '=', shipment.id), ('draft', '=', True)], context=context)
25 if wiz_ids:
26@@ -1823,25 +1829,80 @@
27
28 if not partner_id:
29 v.update({'address_id': False})
30- else:
31+ address_id = False
32+ elif address_id:
33 d.update({'address_id': [('partner_id', '=', partner_id)]})
34
35-
36+ addr = False
37 if address_id:
38 addr = self.pool.get('res.partner.address').browse(cr, uid, address_id, context=context)
39
40- if not address_id or addr.partner_id.id != partner_id:
41+ if partner_id and (not address_id or (addr and addr.partner_id.id != partner_id)):
42 addr = self.pool.get('res.partner').address_get(cr, uid, partner_id, ['delivery', 'default'])
43 if not addr.get('delivery'):
44 addr = addr.get('default')
45 else:
46 addr = addr.get('delivery')
47
48+ address_id = addr
49+
50 v.update({'address_id': addr})
51
52-
53- return {'value': v,
54- 'domain': d}
55+ if address_id:
56+ error = self.on_change_address_id(cr, uid, ids, address_id, context=context)
57+ if error:
58+ error['value'] = {'address_id': False}
59+ error['domain'] = d
60+ return error
61+
62+ warning = {
63+ 'title': _('Warning'),
64+ 'message': _('The field you are modifying may impact the shipment mechanism, please check the correct process.'),
65+ }
66+
67+ return {'value': v, 'domain': d, 'warning': warning}
68+
69+ def on_change_shipper_name(self, cr, uid, ids, shipper_name):
70+ return {
71+ 'value': {'shipper_name': shipper_name},
72+ 'warning': {
73+ 'title': _('Warning'),
74+ 'message': _('The field you are modifying may impact the shipment mechanism, please check the correct process.'),
75+ }
76+ }
77+
78+ def on_change_consignee_name(self, cr, uid, ids, consignee_name, context=None):
79+ if context is None:
80+ context = {}
81+
82+ message = _('The field you are modifying may impact the shipment mechanism, please check the correct process.')
83+ if ids and self.search_exist(cr, uid, [('id', '!=', ids[0]), ('consignee_name', '=', consignee_name),
84+ ('state', '=', 'draft')], context=context):
85+ consignee_name = self.read(cr, uid, ids[0], ['consignee_name'], context=context)['consignee_name']
86+ message = _('Another Draft Shipment exists with this Consignee.')
87+
88+ return {
89+ 'value': {'consignee_name': consignee_name},
90+ 'warning': {
91+ 'title': _('Warning'),
92+ 'message': message,
93+ }
94+ }
95+
96+ def on_change_address_id(self, cr, uid, ids, address_id, context=None):
97+ other_ids = self.search(cr, uid, [('id', 'not in', ids), ('state', '=', 'draft'), ('address_id', '=', address_id)], context=context)
98+ if other_ids:
99+ other = []
100+ for ship in self.read(cr, uid, other_ids, ['name']):
101+ other.append(ship['name'])
102+ return {
103+ 'value': {'address_id': False},
104+ 'warning': {
105+ 'title': _('Warning'),
106+ 'message': _('You can only have one draft shipment for a given address, please check %s') % (', '.join(other))
107+ }
108+ }
109+ return {}
110
111 _columns = {
112 'pack_family_memory_ids': fields.one2many('pack.family.memory', 'shipment_id', string='Memory Families'),
113@@ -2978,8 +3039,12 @@
114 shipment_ids = []
115
116 # only one 'draft' shipment should be available
117- assert len(shipment_ids) in (0, 1), 'Only one draft shipment should be available for a given address at a time - %s' % len(shipment_ids)
118-
119+ if len(shipment_ids) > 1:
120+ other = shipment_obj.read(cr, uid, shipment_ids, ['name'], context=context)
121+ raise osv.except_osv(
122+ _('Error'),
123+ _('You can only have one draft shipment for a given address, please check %s') % ', '.join(x['name'] for x in other),
124+ )
125 # get rts of corresponding sale order
126 sale_id = self.read(cr, uid, [new_packing_id], ['sale_id'], context=context)
127 sale_id = sale_id[0]['sale_id']
128
129=== modified file 'bin/addons/msf_outgoing/msf_outgoing_view.xml'
130--- bin/addons/msf_outgoing/msf_outgoing_view.xml 2018-03-23 10:28:59 +0000
131+++ bin/addons/msf_outgoing/msf_outgoing_view.xml 2018-08-07 08:48:35 +0000
132@@ -1243,7 +1243,9 @@
133 attrs="{'readonly': [('state', 'not in', ['draft', 'waiting', 'confirmed', 'assigned'])]}" />
134 <field name="address_id" context="{'contact_display':'partner'}"
135 domain="[('partner_id', '=', partner_id2)]"
136- attrs="{'readonly': ['|', ('partner_id2', '=', False), ('state', 'in', ('done', 'cancel', 'delivered'))]}" />
137+ attrs="{'readonly': ['|', ('partner_id2', '=', False), ('state', 'in', ('done', 'cancel', 'delivered'))]}"
138+ on_change="on_change_address_id(address_id)"
139+ />
140 <field name="in_ref" readonly="True" />
141 <field name="partner_type" invisible="True" readonly="True" />
142 </group>
143@@ -1340,7 +1342,7 @@
144 <page string="Transport Information">
145 <group col="2" colspan="1" attrs="{'readonly': [('state', 'in', ('done', 'cancel', 'delivered'))]}">
146 <separator string="Shipper" colspan="2" />
147- <field name="shipper_name" />
148+ <field name="shipper_name" on_change="on_change_shipper_name(shipper_name)" />
149 <field name="shipper_contact" />
150 <field name="shipper_address" />
151 <field name="shipper_phone" />
152@@ -1360,7 +1362,7 @@
153 </group>
154 <group col="2" colspan="1" attrs="{'readonly': [('state', 'in', ('done', 'cancel', 'delivered'))]}">
155 <separator string="Consignee" colspan="2" />
156- <field name="consignee_name" />
157+ <field name="consignee_name" on_change="on_change_consignee_name(consignee_name)" />
158 <field name="consignee_contact" />
159 <field name="consignee_address" />
160 <field name="consignee_phone" />
161
162=== modified file 'bin/addons/msf_profile/i18n/fr_MF.po'
163--- bin/addons/msf_profile/i18n/fr_MF.po 2018-07-25 16:06:03 +0000
164+++ bin/addons/msf_profile/i18n/fr_MF.po 2018-08-07 08:48:35 +0000
165@@ -82659,6 +82659,12 @@
166 msgstr "Erreur de traitement"
167
168 #. module: msf_outgoing
169+#: code:addons/msf_outgoing/msf_outgoing.py:562
170+#, python-format
171+msgid "Please fill the Address field on %s"
172+msgstr "Veuillez remplir le champ Adresse sur %s"
173+
174+#. module: msf_outgoing
175 #: model:process.transition,name:msf_outgoing.process_transition_draft_pick_draft_done
176 #: model:process.transition,name:msf_outgoing.process_transition_draft_ship_draft_done
177 #: model:process.transition,note:msf_outgoing.process_transition_draft_pick_draft_done
178@@ -101379,6 +101385,7 @@
179 #, python-format
180 msgid "You can't change a payment method used at least in one employee"
181 msgstr "Vous ne pouvez pas modifier une méthode de paiement utilisée sur au moins un employé"
182+<<<<<<< TREE
183
184 #. module: msf_doc_import
185 #: code:addons/msf_doc_import/check_line.py:238
186@@ -101386,3 +101393,25 @@
187 #, python-format
188 msgid "The Location \"%s\" on line level is not the same as the Location \"%s\" on header level."
189 msgstr "La Zone \"%s\" au niveau de la ligne n'est pas la même que la Zone \"%s\" au niveau de l'entête."
190+=======
191+
192+#. module: msf_outgoing
193+#: code:addons/msf_outgoing/msf_outgoing.py:1865
194+#, python-format
195+msgid "Another Draft Shipment exists with this Consignee."
196+msgstr "Une autre Expédition en Brouillon existe avec ce Destinataire"
197+
198+#. module: msf_outgoing
199+#: code:addons/msf_outgoing/msf_outgoing.py:1843
200+#: code:addons/msf_outgoing/msf_outgoing.py:1853
201+#: code:addons/msf_outgoing/msf_outgoing.py:1861
202+#, python-format
203+msgid "The field you are modifying may impact the shipment mechanism, please check the correct process."
204+msgstr "Le champ que vous modifiez pourrait avoir un impact sur le mécanisme d'expédition, veuillez vérifier le bon processus."
205+
206+#. module: msf_outgoing
207+#: code:addons/msf_outgoing/msf_outgoing.py:1896
208+#, python-format
209+msgid "You can only have one draft shipment for a given address, please check %s"
210+msgstr "Vous ne pouvez avoir qu'une seule Expédition en brouillon pour la même adresse, veuillez vérifier %s "
211+>>>>>>> MERGE-SOURCE

Subscribers

People subscribed via source and target branches