using the Party module

58 views
Skip to first unread message

Cato Nano

unread,
Dec 19, 2017, 12:07:25 PM12/19/17
to tryton
I d like to establish a relation between my entity (Bolletta) and the parties represented by the Party module

I m not sure I undertsand how to do that

The manual doesn t mention the possibility it seems. Does it ?

The "sale" module has a model like this

class PartyReplace:
__metaclass__ = PoolMeta
__name__ = 'party.replace'

@classmethod
def fields_to_replace(cls):
return super(PartyReplace, cls).fields_to_replace() + [
('sale.sale', 'party'),
('sale.sale', 'shipment_party'),
]


but I m not sure what this is and what it does

Thanks in advance

Sergi Almacellas Abellana

unread,
Dec 20, 2017, 4:26:51 AM12/20/17
to try...@googlegroups.com
El 19/12/17 a les 18:07, Cato Nano ha escrit:
> I d like to establish a relation between my entity (Bolletta) and the parties represented by the Party module

You can have a look at the party_relationship module which have the
model for storing relationships between parties.
>
> I m not sure I undertsand how to do that
>
> The manual doesn t mention the possibility it seems. Does it ?
>
> The "sale" module has a model like this
>
> class PartyReplace:
> __metaclass__ = PoolMeta
> __name__ = 'party.replace'
>
> @classmethod
> def fields_to_replace(cls):
> return super(PartyReplace, cls).fields_to_replace() + [
> ('sale.sale', 'party'),
> ('sale.sale', 'shipment_party'),
> ]
>
>
> but I m not sure what this is and what it does
On the party module there is a wizard to replace on party with another.
This wizard is designed to be extended by other modules in order to move
the documents related to the old party to the new party.

That's what this code do.


--
Sergi Almacellas Abellana
www.koolpi.com
Twitter: @pokoli_srk

Cato Nano

unread,
Dec 23, 2017, 2:07:12 AM12/23/17
to tryton
Il giorno mercoledì 20 dicembre 2017 10:26:51 UTC+1, Sergi Almacellas Abellana ha scritto:
> El 19/12/17 a les 18:07, Cato Nano ha escrit:
> > I d like to establish a relation between my entity (Bolletta) and the parties represented by the Party module
>
> You can have a look at the party_relationship module which have the
> model for storing relationships between parties.

I managed to connect my entity (bolletta) to the parties defined in the Party module

It' s simpler than I thought, I was just confused and thought that something more was necessary

This is almost all I used

party = fields.Many2One('party.party', 'Party', required=True, select=True,)

and I shamelessly copied this from the sale module

It works ! :-)

Now the views are a bit awkward, I will refine them in the next few days but you can take a look, if you want !

Here
http://52.59.227.113:8000/index.html

user admin
pwd tryton



> > I m not sure I undertsand how to do that
> >
> > The manual doesn t mention the possibility it seems. Does it ?
> >
> > The "sale" module has a model like this
> >
> > class PartyReplace:
> > __metaclass__ = PoolMeta
> > __name__ = 'party.replace'
> >
> > @classmethod
> > def fields_to_replace(cls):
> > return super(PartyReplace, cls).fields_to_replace() + [
> > ('sale.sale', 'party'),
> > ('sale.sale', 'shipment_party'),
> > ]
> >
> >
> > but I m not sure what this is and what it does
> On the party module there is a wizard to replace on party with another.
> This wizard is designed to be extended by other modules in order to move
> the documents related to the old party to the new party.
>
> That's what this code do.

Thank you

I still haven't considered Wizards and state transitions

Merry Christmas !

Reply all
Reply to author
Forward
0 new messages