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

[3337][ADD] vendor_bill_final_price_check #41

Open
wants to merge 2 commits into
base: 16.0
Choose a base branch
from

Conversation

AungKoKoLin1997
Copy link
Contributor

@rinaldifirdaus
Copy link
Contributor

rinaldifirdaus commented Apr 12, 2023

@AungKoKoLin1997 I think we should add some log in the chatter once the manager click confirm bool and save the record. this is to notify the accounting user that the invoice he/she handled has been confirmed since the boolean itself is only can be seen by the manager. how do you think?

the scenario would be:

  1. Bill price changed
    expected result:
    a. show warning and accounting user cannot confirmed the bill
    b. the bill shown on "Bills to allow price change" menu item
  2. manager confirmed the final price
    expected result:
    a. add log in the chatter to notify accounting users
    b. bill able to be confirmed by the accounting users
    c. bill not displayed anymore in the "Bills to allow price change" menu item

Comment on lines 10 to 20
@api.onchange("price_unit")
def _onchange_price_unit(self):
for line in self:
if not line.move_id.move_type == "in_invoice":
return

if not line.purchase_line_id:
return

if line.product_id and line.product_id.cost_method != "standard":
line._origin.move_id.write({"is_change_price": True})
Copy link
Member

Choose a reason for hiding this comment

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

This only covers a partial (minor) scenario and we cannot rely on this approach. This logic doesn't cover, for example, the case where SVL is generated due to exchange rate difference between receipt and vendor bill. What I had in mind was to insert a check where SVL record is created.

@rinaldifirdaus
Copy link
Contributor

rinaldifirdaus commented May 17, 2023

Hi @AungKoKoLin1997

Here are the Functional test result:

  1. Test Scenario 1 - Change price direct on vendor bills.
    a. show warning and accounting user cannot confirmed the bill -> OK
    b. the bill shown on "Bills to allow price change" menu item -> After users click on create bills in PO, the records shown in "Bills to allow price change" menu item, but when the users fill the bill date or change the accounting date to any date, "is_update_svl" value changed to false so it will not shown in "Bills to allow price change" menu item anymore and the bills still couldn't be validated. I think changing the date should not remove change "is_update_svl". maybe we can remove @api.depends("date") on this code?
    @api.depends("date")
    def _compute_svl_check(self):
        for line in self.filtered(lambda move: move.state != "posted").invoice_line_ids:
            line._check_svl_create()
  1. Test Scenario 2 - Different exchange rate used when receipt goods and validating vendor bills
    a. show warning and accounting user cannot confirmed the bill -> OK
    b. the bill shown on "Bills to allow price change" menu item -> same result with above scenario

  2. Test Scenario 3 - Change price on PO after receipt before create bill
    a. show warning and accounting user cannot confirmed the bill -> OK
    b. the bill shown on "Bills to allow price change" menu item -> same result with above scenario

  3. Test Scenario 4 - when exchange rate is updated each day - Create vendor bills on later day but set the bill date and accounting date same with receipt date
    a. user able to confirm the bill without warning (no svl update) ✅
    b. when user select the bill date & accounting date same with receipt date and validate the bill, "is_update_svl" remain true and still displayed on "Bills to allow price change" menu item ✖ (on this scenario, i think "is_update_svl" should be false so that it would not remain on the menu. How about add condition if confirm final price is false but status is posted, "is_update_svl" become false?)

  4. manager confirmed the final price
    a. add log in the chatter to notify accounting users -> OK
    b. bill able to be confirmed by the accounting users -> OK
    c. bill not displayed anymore in the "Bills to allow price change" menu item -> OK, except scenario 4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants