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

[10.0] pos_invoice_pay: store POS session in payment record #1457

Open
wants to merge 1 commit into
base: 10.0
Choose a base branch
from

Conversation

em230418
Copy link
Contributor

В стороннем модуле клиента есть функционал печати отчета об операциях в POS сессии. Для добавления возможности вывода в этот отчет произведенные оплаты инвойсов, делаются изменения ниже.

@trojikman trojikman self-assigned this Sep 1, 2021
Copy link
Collaborator

@yelizariev yelizariev left a comment

Choose a reason for hiding this comment

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

Предыдущий функционал не теряется, а только добавляется новая информация. В целом норм

@@ -5,7 +5,7 @@
"summary": """Handle the payment process for Sale Orders/Invoices over Point of Sale""",
"category": "Point of Sale",
"images": ["images/pos_invoice_pay_main.png"],
"version": "10.0.1.0.6",
"version": "10.0.1.1.0",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Лучше капитально поменять версию, т.к. там поля добавляются и нужно нажимать "Обновить модуль"

Suggested change
"version": "10.0.1.1.0",
"version": "10.0.2.0.0",

Copy link
Contributor Author

Choose a reason for hiding this comment

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

там поля добавляются и нужно нажимать "Обновить модуль"

https://gitlab.com/itpp/handbook/-/blob/master/technical-docs/__manifest__.md#version

The x.y.z version numbers follow the semantics breaking.feature.fix:

  • x increments when the data model or the views had significant
    changes. Data migration might be needed, or depending modules might
    be affected.
  • y increments when non-breaking new features are added. A module
    upgrade will probably be needed.

Попадает под y.

@@ -66,9 +67,15 @@ def process_invoices_creation(self, sale_order_id):
class AccountPayment(models.Model):
_inherit = "account.payment"

paid_by_pos = fields.Boolean(default=False)
paid_by_pos = fields.Boolean(compute="_compute_paid_by_pos", store=True)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Если поле не используется для поиска\фильтрации, то не обязательно сохранять в таблице значения

Suggested change
paid_by_pos = fields.Boolean(compute="_compute_paid_by_pos", store=True)
paid_by_pos = fields.Boolean(compute="_compute_paid_by_pos")

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Это поле используется для поиска

payments = self.env["account.payment"].search(
[
("payment_date", ">=", date_start),
("payment_date", "<=", date_stop),
("paid_by_pos", "=", True),
]
)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Может напрямую по новому полю искать?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Может напрямую по новому полю искать?

Действительно можно, но дело в другом. Если какой-то сторонний модуль зависит от этого модуля и использует paid_by_pos, который изначально в базе хранится, то этот сторонний модуль сломается.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Может сторонний модуль сделает store=True ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ладно, я устал спорить. Просто обозначу как 10.0.2.0.0 и без store=True.

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.

None yet

3 participants