Make identifiers deactivatable and replace it

issue10567
review346941002
This commit is contained in:
David Blanco Bautista
2021-10-08 19:34:33 +02:00
parent 5512c34e13
commit 355fbc8ef5
4 changed files with 28 additions and 3 deletions
+2
View File
@@ -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
+6 -1
View File
@@ -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'),
]
+14
View File
@@ -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
+6 -2
View File
@@ -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"/>