Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[17.0][MIG] contract_variable_quantity: Migration to version 17.0 #1103

Merged
merged 48 commits into from
Aug 19, 2024

Conversation

juanjosesegui-tecnativa
Copy link
Contributor

@Tecnativa TT50113

pedrobaeza and others added 30 commits July 22, 2024 11:49
=================================================
Variable quantity in contract recurrent invoicing
=================================================

With this module, you will be able to define in recurring contracts some
lines with variable quantity according a provided formula.

Configuration
=============

* Go to Sales > Configuration > Contracts > Formulas (quantity).
* Define any formula based on Python code that stores at some moment a
  float/integer value of the quantity to invoice in the variable 'result'.

  You can use these variables to compute your formula:

  * *env*: Environment variable for getting other models.
  * *context*: Current context dictionary.
  * *user*: Current user.
  * *line*: Contract recurring invoice line that triggers this formula.
  * *contract*: Contract whose line belongs to.
  * *invoice*: Invoice (header) being created.

Usage
=====

To use this module, you need to:

* Go to Sales -> Contracts and select or create a new contract.
* Check *Generate recurring invoices automatically*.
* Add a new recurring invoicing line.
* Select "Variable quantity" in column "Qty. type".
* Select one of the possible formulas to use (previously created).
* Bump version
* Change openerp references to odoo
* Installable to True
* Change permissions & views to accounting dependency
Add template functionality for contracts
* [IMP] Add variable qty to contract template view

* Bump minor version
If you have contract lines with automatic price and your pricelist
contains different prices per quantity, the price is not changed
when computing quantity.

This PR fixes this.
Bug description
---------------

`account.analytic.contract.line` inherits
`account.analytic.invoice.line`

`account.analytic.invoice.line` defines field `analytic_account_id`:
   - comodel='account.analytic.account'

`account.analytic.contract.line` redefines field `analytic_account_id`:
   - comodel='account.analytic.contract'

On attempt to extend `account.analytic.invoice.line` model adding
field that depends on `analytic_account_id.date_start`
Odoo fails to update, because it adds this field to
`account.analytic.contract.line` through inheritance,
and `account.analytic.contract` model have no this field.

What is done
------------

Change inheritance order:
- `account.analytic.invoice.line` inherits
`account.analytic.contract.line`
- no file renames at this stage (this wil be done in next commit)
- contract
- contract_variable_quantity
@juanjosesegui-tecnativa
Copy link
Contributor Author

ping @pedrobaeza

Copy link
Contributor

@carolinafernandez-tecnativa carolinafernandez-tecnativa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1- Please squash administrative commits.
2- When creating a new customer contract i got this error message

image

Please check this contract configuration that is not working

image

Attributes invisible,required are not well defined so im not able for example as introducing qty formula

Thanks

@@ -0,0 +1,8 @@
To use this module, you need to:

1. Go to Invoicing \> Sales \> Contracts and select or create a new

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be: Go to Invoicing > Customers > Customers Contracts

contract_variable_quantity/views/contract_line_views.xml Outdated Show resolved Hide resolved
contract_variable_quantity/views/contract_template.xml Outdated Show resolved Hide resolved
Currently translated at 100.0% (35 of 35 strings)

Translation: contract-16.0/contract-16.0-contract_variable_quantity
Translate-URL: https://translation.odoo-community.org/projects/contract-16-0/contract-16-0-contract_variable_quantity/it/
Currently translated at 68.5% (24 of 35 strings)

Translation: contract-16.0/contract-16.0-contract_variable_quantity
Translate-URL: https://translation.odoo-community.org/projects/contract-16-0/contract-16-0-contract_variable_quantity/hr/
Currently translated at 100.0% (35 of 35 strings)

Translation: contract-16.0/contract-16.0-contract_variable_quantity
Translate-URL: https://translation.odoo-community.org/projects/contract-16-0/contract-16-0-contract_variable_quantity/sv/
@juanjosesegui-tecnativa juanjosesegui-tecnativa force-pushed the 17.0-mig-contract_variable_quantity branch from 02887a0 to 233b77a Compare August 7, 2024 16:23
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check pressing Send by email button in a customer contact, it is displaying error message, thanks

contract_variable_quantity/views/contract.xml Show resolved Hide resolved
</h1>
</div>
<group string="Code">
<div style="margin-top: 4px;">

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is displaying weird, please review it, something must be changed, review with others module version

@juanjosesegui-tecnativa juanjosesegui-tecnativa force-pushed the 17.0-mig-contract_variable_quantity branch from 233b77a to 42457f5 Compare August 16, 2024 07:44
@juanjosesegui-tecnativa
Copy link
Contributor Author

All changes have been made.

@carolinafernandez-tecnativa

@pedrobaeza
Copy link
Member

/ocabot migration contract_variable_quantity

@OCA-git-bot OCA-git-bot added this to the 17.0 milestone Aug 19, 2024
@OCA-git-bot OCA-git-bot mentioned this pull request Aug 19, 2024
12 tasks
Copy link
Member

@pedrobaeza pedrobaeza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code and functional review.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functional review LGTM, Thanks :)

@pedrobaeza
Copy link
Member

/ocabot merge nobump

@OCA-git-bot
Copy link
Contributor

What a great day to merge this nice PR. Let's do it!
Prepared branch 17.0-ocabot-merge-pr-1103-by-pedrobaeza-bump-nobump, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit e3c47a1 into OCA:17.0 Aug 19, 2024
7 checks passed
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at 5a66776. Thanks a lot for contributing to OCA. ❤️

@pedrobaeza pedrobaeza deleted the 17.0-mig-contract_variable_quantity branch August 19, 2024 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.