Make identifiers deactivatable and replace it
issue10567 review346941002
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
* Make identifiers deactivatable
|
||||
* Replace party on identifier when replacing parties
|
||||
* Add au_abn and au_acn as tax identifiers
|
||||
* Add at, ua and vn party identifiers
|
||||
|
||||
|
||||
@@ -564,7 +564,7 @@ TAX_IDENTIFIER_TYPES = [
|
||||
]
|
||||
|
||||
|
||||
class Identifier(sequence_ordered(), ModelSQL, ModelView):
|
||||
class Identifier(sequence_ordered(), DeactivableMixin, ModelSQL, ModelView):
|
||||
'Party Identifier'
|
||||
__name__ = 'party.identifier'
|
||||
_rec_name = 'code'
|
||||
@@ -754,6 +754,7 @@ class Replace(Wizard):
|
||||
pool = Pool()
|
||||
Address = pool.get('party.address')
|
||||
ContactMechanism = pool.get('party.contact_mechanism')
|
||||
Identifier = pool.get('party.identifier')
|
||||
transaction = Transaction()
|
||||
|
||||
self.check_similarity()
|
||||
@@ -766,6 +767,9 @@ class Replace(Wizard):
|
||||
ContactMechanism.write(list(source.contact_mechanisms), {
|
||||
'active': False,
|
||||
})
|
||||
Identifier.write(list(source.identifiers), {
|
||||
'active': False,
|
||||
})
|
||||
source.replaced_by = destination
|
||||
source.active = False
|
||||
source.save()
|
||||
@@ -801,6 +805,7 @@ class Replace(Wizard):
|
||||
return [
|
||||
('party.address', 'party'),
|
||||
('party.contact_mechanism', 'party'),
|
||||
('party.identifier', 'party'),
|
||||
]
|
||||
|
||||
|
||||
|
||||
@@ -15,14 +15,22 @@ Create a party::
|
||||
|
||||
>>> Party = Model.get('party.party')
|
||||
>>> party1 = Party(name='Pam')
|
||||
>>> identifier1 = party1.identifiers.new()
|
||||
>>> identifier1.type = 'eu_vat'
|
||||
>>> identifier1.code = 'BE0897290877'
|
||||
>>> party1.save()
|
||||
>>> address1, = party1.addresses
|
||||
>>> identifier1, = party1.identifiers
|
||||
|
||||
Create a second party similar party::
|
||||
|
||||
>>> party2 = Party(name='Pam')
|
||||
>>> identifier2 = party2.identifiers.new()
|
||||
>>> identifier2.type = 'eu_vat'
|
||||
>>> identifier2.code = 'BE0897290877'
|
||||
>>> party2.save()
|
||||
>>> address2, = party2.addresses
|
||||
>>> identifier2, = party2.identifiers
|
||||
|
||||
Replace the second by the first party::
|
||||
|
||||
@@ -36,6 +44,12 @@ Replace the second by the first party::
|
||||
>>> bool(party2.active)
|
||||
False
|
||||
|
||||
>>> identifier2.reload()
|
||||
>>> identifier2.party == party1
|
||||
True
|
||||
>>> bool(identifier2.active)
|
||||
False
|
||||
|
||||
>>> address2.reload()
|
||||
>>> address2.party == party1
|
||||
True
|
||||
|
||||
@@ -4,8 +4,12 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<form>
|
||||
<label name="party"/>
|
||||
<field name="party"/>
|
||||
<label name="sequence"/>
|
||||
<field name="sequence"/>
|
||||
<group colspan="2" col="-1" id="checkboxes">
|
||||
<label name="active"/>
|
||||
<field name="active"/>
|
||||
<label name="sequence"/>
|
||||
<field name="sequence"/>
|
||||
</group>
|
||||
<label name="type"/>
|
||||
<field name="type"/>
|
||||
<label name="code"/>
|
||||
|
||||
Reference in New Issue
Block a user