Skip to content
Snippets Groups Projects
  • Thomas Lefebvre (thle)'s avatar
    61b5dd38
    [FIX] membership: add payment terms on the invoice · 61b5dd38
    Thomas Lefebvre (thle) authored
    
    Versions:
    ---------
    - 14.0
    - 15.0
    
    Steps to reproduce:
    -------------------
    - in Members app, add a membership product;
    - add a "Payment Terms" on a contact (Sales & Purchase tab);
    - in Membership tab click on "Buy Membership";
    - add the membership product and invoice;
    
    Issue:
    ------
    There is no payment term on the invoice.
    
    Cause:
    ------
    In the invoice creation flow, the following logic is not triggered:
    ```py
    if self.is_sale_document(include_receipts=True) and self.partner_id:
    	self.invoice_payment_term_id = self.partner_id.property_payment_term_id or self.invoice_payment_term_id
    ```
    Consequently, we have no invoice_payment_term_id.
    
    Solution:
    ---------
    Specify `invoice_payment_term_id` in the values used for invoice creation.
    
    Note:
    -----
    This FIX solution only handles the invoice creation
    from the membership module, to be as non-invasive as possible.
    
    In version 16.0, this is handled by the account module,
    which has made the `invoice_payment_term_id` field computed and dependent on `partner_id`.
    
    opw-3382398
    
    closes odoo/odoo#130998
    
    Signed-off-by: default avatarAndrea Grazioso (agr) <agr@odoo.com>
    61b5dd38
    History
    [FIX] membership: add payment terms on the invoice
    Thomas Lefebvre (thle) authored
    
    Versions:
    ---------
    - 14.0
    - 15.0
    
    Steps to reproduce:
    -------------------
    - in Members app, add a membership product;
    - add a "Payment Terms" on a contact (Sales & Purchase tab);
    - in Membership tab click on "Buy Membership";
    - add the membership product and invoice;
    
    Issue:
    ------
    There is no payment term on the invoice.
    
    Cause:
    ------
    In the invoice creation flow, the following logic is not triggered:
    ```py
    if self.is_sale_document(include_receipts=True) and self.partner_id:
    	self.invoice_payment_term_id = self.partner_id.property_payment_term_id or self.invoice_payment_term_id
    ```
    Consequently, we have no invoice_payment_term_id.
    
    Solution:
    ---------
    Specify `invoice_payment_term_id` in the values used for invoice creation.
    
    Note:
    -----
    This FIX solution only handles the invoice creation
    from the membership module, to be as non-invasive as possible.
    
    In version 16.0, this is handled by the account module,
    which has made the `invoice_payment_term_id` field computed and dependent on `partner_id`.
    
    opw-3382398
    
    closes odoo/odoo#130998
    
    Signed-off-by: default avatarAndrea Grazioso (agr) <agr@odoo.com>