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

[12.0][MIG] - contract variable quantity #211

Closed
wants to merge 20 commits into from

Conversation

sbejaoui
Copy link
Contributor

@sbejaoui sbejaoui commented Nov 6, 2018

No description provided.

@sbejaoui
Copy link
Contributor Author

sbejaoui commented Nov 6, 2018

FYI @gva-acsone

Copy link

@gva-acsone gva-acsone left a comment

Choose a reason for hiding this comment

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

Functional test 👍

@rafaelbn rafaelbn added this to the 12.0 milestone Nov 22, 2018
@sbejaoui sbejaoui force-pushed the 12.0-mig-contract_variable_quantity branch 2 times, most recently from ec6df19 to 88ada17 Compare November 26, 2018 11:53
@emagdalenaC2i emagdalenaC2i mentioned this pull request Dec 28, 2018
19 tasks
@sbejaoui sbejaoui force-pushed the 12.0-mig-contract_variable_quantity branch from ac76528 to e7f5650 Compare March 12, 2019 10:19
@AaronHForgeFlow
Copy link
Contributor

I am not sure what I am missing. I have a very simple formula in the template: result=15

When creating the invoice, the formula changes to result=0. Any ideas?

@sbejaoui
Copy link
Contributor Author

I am not sure what I am missing. I have a very simple formula in the template: result=15

When creating the invoice, the formula changes to result=0. Any ideas?

Hi @aheficent ,
You are getting this in runbot?

@AaronHForgeFlow
Copy link
Contributor

Hi @aheficent ,
You are getting this in runbot?

No, in my local. I am debugging into the code and in this line:

self.qty_formula_id.code.strip(),
I get result=0 as self.qty_formula_id.code

I am not sure if I am missing something

@sbejaoui
Copy link
Contributor Author

Hi @aheficent ,
You are getting this in runbot?

No, in my local. I am debugging into the code and in this line:

self.qty_formula_id.code.strip(),

I get result=0 as self.qty_formula_id.code
I am not sure if I am missing something

Can you take a look in runbot how I configured the formula and some contracts
I create a formula with result=line.sequence and result=15.
And it works fine,

@AaronHForgeFlow
Copy link
Contributor

@sbejaoui What runbot are you using?

I used this one in this PR: http://3371960-211-e7f565.runbot1-2.odoo-community.org/web

and I got the same thing than in my local. But this must be a different runbot you tested because I did not see any formula result=15 I had to create one

@sbejaoui
Copy link
Contributor Author

@sbejaoui What runbot are you using?

I used this one in this PR: http://3371960-211-e7f565.runbot1-2.odoo-community.org/web

and I got the same thing than in my local. But this must be a different runbot you tested because I did not see any formula result=15 I had to create one

oh I see now,
you should set result=15 to code field not to the name.

1
-->
2

@AaronHForgeFlow
Copy link
Contributor

@sbejaoui haha honestly as the field was not required and the background was white I thought that was part of the explanation and not anc actual editable field haha

@sbejaoui
Copy link
Contributor Author

@sbejaoui haha honestly as the field was not required and the background was white I thought that was part of the explanation and not anc actual editable field haha

yes, it's confusing :D

Copy link
Contributor

@AaronHForgeFlow AaronHForgeFlow left a comment

Choose a reason for hiding this comment

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

👍 Functional tests

@pedrobaeza
Copy link
Member

Can you check Travis status?

Copy link
Contributor

@hparfr hparfr left a comment

Choose a reason for hiding this comment

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

From my understanding there should be no dependencies to account.analytic because of the PR #207

@sbejaoui sbejaoui force-pushed the 12.0-mig-contract_variable_quantity branch 2 times, most recently from 7a6bb93 to d42b146 Compare September 30, 2019 10:02
@sbejaoui
Copy link
Contributor Author

@OCA/core-maintainers
This PR can be merged

@moylop260
Copy link
Contributor

/ocabot merge

@OCA-git-bot
Copy link
Contributor

What a great day to merge this nice PR. Let's do it!
Prepared branch 12.0-ocabot-merge-pr-211-by-moylop260-bump-no, awaiting test results.

OCA-git-bot added a commit that referenced this pull request Sep 30, 2019
Signed-off-by moylop260
@pedrobaeza
Copy link
Member

@sbejaoui please squash together adjacent OCA Transbot updated translations from Transifex commits, and also squash your migration commits.

@sbejaoui sbejaoui force-pushed the 12.0-mig-contract_variable_quantity branch from d42b146 to 54a4052 Compare September 30, 2019 14:41
pedrobaeza and others added 20 commits September 30, 2019 16:45
=================================================
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).
OCA Transbot updated translations from Transifex
OCA Transbot updated translations from Transifex
* Bump version
* Change openerp references to odoo
* Installable to True
* Change permissions & views to accounting dependency

OCA Transbot updated translations from Transifex
Add template functionality for contracts
* [IMP] Add variable qty to contract template view

* Bump minor version

OCA Transbot updated translations from Transifex
OCA Transbot updated translations from Transifex
OCA Transbot updated translations from Transifex
OCA Transbot updated translations from Transifex

OCA Transbot updated translations from Transifex
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.

OCA Transbot updated translations from Transifex

[UPD] Update contract_variable_quantity.pot
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)

Update addon versions

- contract
- contract_variable_quantity

[UPD] Update contract_variable_quantity.pot
[IMP] Adapt unit test

[ADD] setup.py

[IMP] - Add ace-widget with python mode

[IMP] - Adapt contract_variable_quantity to contract new views

[IMP] - refresh contract_variable_quantity.pot

[REF] Contract: invoice in prepare_invoice_line is optional

[IMP] - Skip zero should ignore lines with qty zero even for fixed qty

[FIX] - Fix unit tests

[FIX] fix unit tests

[FIX] - fix check quantity = 0

[REF] - Use method _get_quantity_to_invoice.
@sbejaoui sbejaoui force-pushed the 12.0-mig-contract_variable_quantity branch from 54a4052 to 43a1d84 Compare September 30, 2019 14:45
@sbejaoui
Copy link
Contributor Author

@sbejaoui please squash together adjacent OCA Transbot updated translations from Transifex commits, and also squash your migration commits.

Squash done.

Copy link
Sponsor Contributor

@rousseldenis rousseldenis left a comment

Choose a reason for hiding this comment

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

Code review. Do you plan to squash some commits?

@OCA-git-bot
Copy link
Contributor

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

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.