Companies have agreements with parties on which conditions apply to their comercial operations with the company. For example is common to have an agreement on which payment term use for customer invoices. This conditions can depend on a lot of criteria, for example:
- The party country
- The country where the goods are delivered
- The warehouse from where the goods are picked.
So we need a flexible way to define this conditions and more important allow third party modules to add more criteria and fields on conditions.
party.comercial_conditon model which will have a name and all the comercial conditions:
- Account (For receivable and Payable)
- Customer Tax Rule
- Payment Term
- Sale Price List (Only for sales)
- Credit Limit Amount (Only for sales)
Note: Each module should add each on comercial condition.
A a new
party.comercial_condition.rule model that will be a MatchMixin to specify the match rules with the conditions.
The match rule should have the following fields:
- Kind (Sale/Purchase)
- Condition to be used.
As order is important in company and party fields, we should show first the records which have not null values for this fields, then the ones which have a null value for party and finally the ones that have both fields as null.
From the party form we should be able to edit its commercial conditions, and from the company form we should be able to edit the default conditions for the company (where party is null)
How to limit comercial conditions only available for sale or purchase? We should add the kind also on the comercial condition and hide non applicable fields depending on the kind?