[18.0][MIG] pos_payment_credit: Migration to 18.0#12
Conversation
b4a1729 to
88e28de
Compare
|
Dear anh @nguyenminhchien, please help me to review this PR |
pos_payment_credit/__manifest__.py
Outdated
|
|
||
| { | ||
| "name": "Point of Sale Payment Credit", | ||
| "version": "18.0.1.0.1", |
There was a problem hiding this comment.
| "version": "18.0.1.0.1", | |
| "version": "18.0.1.0.0", |
| <page string="Credit" name="page_credit"> | ||
| <group name="payment_credit_amount"> | ||
| <field name="credit_amount" /> | ||
| <field name="credit_amount" readonly="0" /> |
| if (this.pos.paymentCreditInProgress && paymentMethod.is_credit) { | ||
| this.dialog.add(AlertDialog, { | ||
| title: _t("Error"), | ||
| body: _t("There is already an credit payment in progress."), |
There was a problem hiding this comment.
| body: _t("There is already an credit payment in progress."), | |
| body: _t("There is already a credit payment in progress."), |
| class AccountJournal(models.Model): | ||
| _inherit = "account.journal" | ||
|
|
||
| is_credit = fields.Boolean(string="Allow to add credit for members") |
There was a problem hiding this comment.
no need to config from Journal anymore but Payment Method
| class PosPaymentMethod(models.Model): | ||
| _inherit = "pos.payment.method" | ||
|
|
||
| is_credit = fields.Boolean(related="journal_id.is_credit") |
There was a problem hiding this comment.
| is_credit = fields.Boolean(related="journal_id.is_credit") | |
| is_credit = fields.Boolean() |
|
@P-H-Phuc |
| @@ -0,0 +1,11 @@ | |||
| <?xml version="1.0" encoding="utf-8" ?> | |||
| <odoo noupdate="1"> | |||
| <record id="credit_journal" model="account.journal"> | |||
There was a problem hiding this comment.
No need data for account journal but for payment method.
all things must be in english, add french translation then.
88e28de to
8b5d624
Compare
| "successful": False, | ||
| "payload": { | ||
| "message": self.env._("Customer not found."), | ||
| "updated_credit_amount": partner.credit_amount, |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
| if (paymentMethod.is_credit && !this.currentOrder.get_partner()) { | ||
| this.dialog.add(AlertDialog, { | ||
| title: _t("Please select the Customer"), | ||
| body: _t("You need to select a customer first."), |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
| .reduce((sum, line) => sum + line.amount, 0); | ||
| const partner = this.currentOrder.get_partner(); | ||
| if (partner) { | ||
| const {successful, payload} = await this.pos.data.call( |
8b5d624 to
dd9de66
Compare
nguyenminhchien
left a comment
There was a problem hiding this comment.
Don't allow paying by credit in offline-mode.
| super.setup(...arguments); | ||
| this.pos.paymentCreditInProgress = false; | ||
| this.pos.paymentCreditText = ""; | ||
| onMounted(() => { |
There was a problem hiding this comment.
dd9de66 to
3fa1603
Compare
|
@nguyenminhchienI have updated the code. In addition, I used a bus channel to automatically update the customer’s credit amount when an order is refunded on the Odoo backend. |



CONFIGURATION
Go to Point of Sale > Configuration > Payment Methods
In Payment Method form, create a new method and check a is credit as "Partner Credit Payment Method"
Go to Point of Sale > Configuration > Settings
Automatically Apply Credit Amount