1

How would I set the "payment_term_id" to default to a custom payment term? The payment term's ID is 11.

I attempted to do this with a system parameter, but I was unsure of the syntax. I tried: key: "x_default_payment_term_on_quotes"
value: "sale.order.payment_term_id,11" (is my syntax correct)

I've also tried to set the default term using the developer tools "set defaults". Which worked..... kinda.

When I manually create a quote the default sales term entry works.

But when quotes are automatically made from my ecommerce. The default gets set to the "payment term" with the value "1" (Immediate Payment, one of the defaults odoo makes).

This site is a single purpose ecommece. They only sell one product and require a down payment on all sales.

How would I get the quotes created by the ecommerce to default to a specific payment method?

TxTechnician
  • 318
  • 1
  • 11

1 Answers1

2

I see two possibilities:

  1. Trying to get a default setting for the property payment term field on partner creation. You will see later on why.

  2. Or overriding the following method

@api.model
def sale_get_payment_term(self, partner):
    pt = self.env.ref('account.account_payment_term_immediate', False)
    if pt:
        pt = pt.sudo()
        pt = (not pt.company_id.id or self.company_id.id == pt.company_id.id) and pt
    return (
        partner.property_payment_term_id or
        pt or
        self.env['account.payment.term'].sudo().search([('company_id', '=', self.company_id.id)], limit=1)
    ).id

There you can see, that the payment term is either get from the partner or "immediate" is used or the first found payment term of the company is used.

Actually in a nearly standard setup of odoo all three possibilities should yield the same payment term, because it's the default for partners or the first created one.

CZoellner
  • 13,553
  • 3
  • 25
  • 38
  • I should be able to test option 1 by just changing an existing partner's payment terms. Right? – TxTechnician Aug 08 '23 at 17:08
  • I assumed you mostly get new customers with one shop cart. That's why a default could work. And for a quick test or existing customers, you have to set the payment term manually. – CZoellner Aug 09 '23 at 07:27