How to set price list on party

I am almost done with creating a complete party.

i tried to set a price list and a tax_rule for a party but i did not succeed.
i search the proteus-demo but found nothing
i tried to copy the same way as address or contact mechanism or category or identifiers but nothing worked

where can i fond some hints to succed in that ?

I think it would be easier if we try to solve one issue at a time.

For me it is a better approach to define what the end is, and then ask how to get there.

For example: When I do a sale to party1, I want price_list1 to be used for computing the prices.

In this case you need sale_price_list module installed and activated.
sale_price_list module will add sale_price_list field to Party Model where you can set the price_list for Party, in this example price_list1 for party1.

Now when you create a sale, price_list1 will be the default price_list used for the Sale.
The Sale model field is price_list.

When you create a sale for party1, do you get the Sale with price_list1 you specified on party1?

Please do try to inform us exactly what failed, then we can try to figure out what went wrong, but a simple did not succeed is not very helpful.

I find Administration/Models very useful to browse the models/fields in the database.

ok.
everything is working with SAO. i have the price list, it works when i do a sale.

what i want to achieve is adding a party with proteus.
i know how to do it directly in postgresql. now i am struggling with proteus.

i read al the code in the demo and it helps with almost everything but price list and tax rule.

Reduc=Model.get('party.party.sale_price_list')
Preduc=Model.get('product.price_list')
party.sale_price_lists.append(Preduc(name=args.reduc,company=2))
    party.sale_price_lists.append(Preduc(name=args.reduc,company=2))
  File "/usr/lib/python3/dist-packages/proteus/__init__.py", line 579, in append
    self.__check([record])
  File "/usr/lib/python3/dist-packages/proteus/__init__.py", line 555, in __check
    assert record.__class__.__name__ == self.model_name
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError

I apologize if I do not understand what you are trying to do.

In my database this works:

Party = Model.get('party.party')
PriceList = Model.get('product.price_list')

pricelist, = PriceList.find([('name','=','price-0.8')])
party = Party(name='Partyname',sale_price_list=pricelist)
party.save()

Again, please try to separate the big issue into smaller issues.

  1. How to find and instantiate the price list.
  2. How to create a new party with the instantiated price list
  3. How to save the party

and this way we can solve each without confusion

no need to apoligize i understand that some times i am not really clear.
the problem was to assign the price list…
seems so simple. i’ll look what i’ve done. it is not really clear for me

you are the best :slight_smile:

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.