Skip to Content
Menu
This question has been flagged
6 Replies
23813 Views

Where can I set the default payment term to use, insted of blank?

Avatar
Discard
Best Answer

Hello Tor,


If you want same payment term in all the customers by default, you have to add following code in your python file.


class res_partner(osv.Model):

     _inherit = "res.partner"


     _defaults = {

        'property_payment_term' : '15 Days'

     }


Its for 15 Days, you can set another one as of your choice.


Thanks,

Avatar
Discard

Good point, but coding in this case is not needed, thanks to the flexibility of Odoo. Dealing with default parameters from the interface (or XML records) is more maintainable than dealing with code that overrides base models (plus, you are using old API).

Yes, i agree with you. but in this you have to do the same for all databases manually so isn't code is more flexible than this.

Best Answer

Late reply, but the question is still valid.

In Odoo 8, for setting the default customer payment term to the "30 Days Net" value, for every company, for any customer:

From web client: Settings > Technical > Parameters > Company Properties

Create new

Name: property_payment_term
Field: (choose) Customer Payment Term
Resource: [leave empty]
Value: account.payment.term,3
Company: [leave empty]

Via data file:

<record id="payment_term_default_30" model="ir.property">
<field name="name">property_payment_term</field>
<field name="fields_id" search="[('model','=','res.partner'),('name','=','property_payment_term')]" />
<field name="value">account.payment.term,3</field>
</record>

As previously pointed out by Priyesh Solanki (pso), leaving blank the resource and the company makes the value in "Value" field as default for any instance ("document" in Odoo lexicon) of the model that the field ("Customer Payment Term", in this case) is referred to (res.partner, in this case). 

Avatar
Discard
Best Answer

I am assuming that you want to set default payment term in Partner form. In Partner, You will find Customer Payment Term and Supplier Payment Term.

If it is, Go to Settings --> Technical --> Parameters --> Configuration Parameters. For Customer Payment Term, create a new record with this name 'property_payment_term' and set related field, company, object and value, you want to show as default in that field. For Supplier Payment Term, create a new record with this name 'property_supplier_payment_term' and set related field, company, object and value, you want to show as default in that field.

Make sure You are not selecting any resource (Partner/Product) otherwise it will be come for that particular resource value.

Thanks, Priyesh Solanki

Avatar
Discard

How its work??

Best Answer

Default sales order payment term Odoo 9.0

This will set a default payment term for any customer that does not have a default payment term on they properties:

1. Edit sale.py SaleOrder class at def onchange_partner_id(self) section, where you find the following line:

'payment_term_id': self.partner_id.property_payment_term_id and self.partner_id.property_payment_term_id.id or False

and replace False for 1 so it will look like:

'payment_term_id': self.partner_id.property_payment_term_id and self.partner_id.property_payment_term_id.id or 1

This will make default the first option defined as payment term in Accounting - Configuration - Management - Payment terms if there is no default payment term assigned for that customer. You can also replace False for 'whatever you want as payment term'

Avatar
Discard
Best Answer

I know this is a very old question, but I still have the issue in v12 to set a default value for my quotation orders, and I didn't find the full solution there.

He is my contribution :

- default value for payment_term_id (I am in v12) can be set in two places :

   - in the user-defined defaults (i.e. the "normal" default values)

   - in the field "payment_terms" in the part "Sales" (on the left) of the tab "sales & purshase" in the Contacts form


In the sale.order form, the issue is that :

- if the is customer not defined, the python code don't look if a default value exists for payment term at  the user level and initializes the value empty

- if the customer is defined (in fact, it is a "contact"), its default value is got, even if it is empty

so in both cases, the user-defined default value is simply ignored.


So, a possible workaround is :

1) define the user-defined default value for payment term in the Contacts form instead of the "normal" user-defined value for a quotation order

2) and update the sales payment term value for all the existing contacts


If you want to really use the user-defined default for payment_term, you need to fix it in sale.py code (explained in the other answers), or better in a addons module


Avatar
Discard
Best Answer

You need to have the Accounting module installed and have developer mode enabled. Then go to Accounting > Configuration > Management > Payment Terms. Here you can edit existing terms or create new ones. 

Avatar
Discard
Related Posts Replies Views Activity
0
Mar 15
7710
1
Mar 15
9770
3
Jan 25
2027
2
Mar 25
917
2
Mar 24
4534