-
-
Notifications
You must be signed in to change notification settings - Fork 596
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MIG] Migrate module pos_partner_firstname to v14.
- Loading branch information
Showing
11 changed files
with
149 additions
and
165 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
# See https://github.com/OCA/odoo-community.org/blob/master/website/Contribution/CONTRIBUTING.rst#oca_dependencies-txt | ||
partner-contact |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
* Roberto Fichera <roberto.fichera@levelprime.com> | ||
* Lorenzo Battistini (https://takobi.online) | ||
* Dhara Solanki <dhara.solanki@initos.com> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
odoo.define("pos_partner_firstname.ClientDetailsEdit", function (require) { | ||
"use strict"; | ||
|
||
const {_t} = require("web.core"); | ||
const ClientDetailsEdit = require("point_of_sale.ClientDetailsEdit"); | ||
const Registries = require("point_of_sale.Registries"); | ||
|
||
const PosClientDetailsEdit = (ClientDetailsEdit) => | ||
class extends ClientDetailsEdit { | ||
constructor() { | ||
super(...arguments); | ||
var self = this; | ||
this.partner_names_order = "last_first"; | ||
this.rpc({ | ||
model: "res.partner", | ||
method: "get_names_order", | ||
args: [], | ||
}).then(function (partner_names_order) { | ||
if (partner_names_order) { | ||
self.partner_names_order = partner_names_order; | ||
} | ||
}); | ||
} | ||
_update_client_name(checked) { | ||
if (!checked) { | ||
var lastname = this.props.partner.lastname; | ||
var firstname = this.props.partner.firstname; | ||
var name = null; | ||
if (this.partner_names_order === "last_first_comma") { | ||
name = lastname + ", " + firstname; | ||
} else if (this.partner_names_order === "first_last") { | ||
name = firstname + " " + lastname; | ||
} else { | ||
name = lastname + " " + firstname; | ||
} | ||
this.props.partner.name = name.trim(); | ||
} | ||
} | ||
saveChanges() { | ||
if (!this.props.partner.is_company) { | ||
if (!this.props.partner.firstname || !this.props.partner.lastname) { | ||
return this.showPopup("ErrorPopup", { | ||
title: _t("Both Customer First and Last Name Are Required"), | ||
}); | ||
} | ||
if (!this.props.partner.name) { | ||
this._update_client_name(false); | ||
} | ||
} | ||
super.saveChanges(); | ||
} | ||
captureChange(event) { | ||
super.captureChange(event); | ||
if (event.target.name === "is_company") { | ||
var checked = event.currentTarget.checked; | ||
$(".is_person") | ||
.toArray() | ||
.forEach(function (el) { | ||
$(el).css("display", !checked ? "block" : "none"); | ||
}); | ||
|
||
this.changes[event.target.name] = checked; | ||
$(".client-name").attr("readonly", !checked); | ||
if (!checked) { | ||
this._update_client_name(checked); | ||
} | ||
} | ||
} | ||
}; | ||
|
||
Registries.Component.extend(ClientDetailsEdit, PosClientDetailsEdit); | ||
|
||
return ClientDetailsEdit; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
odoo.define("pos_partner_firstname.ClientScreen", function (require) { | ||
"use strict"; | ||
|
||
var ClientScreenEdit = require("point_of_sale.ClientListScreen"); | ||
const Registries = require("point_of_sale.Registries"); | ||
|
||
const PosClientScreenEdit = (ClientScreenEdit) => | ||
class extends ClientScreenEdit { | ||
back() { | ||
super.back(); | ||
if (this.props.client) { | ||
if (this.props.client.id == this.state.selectedClient.id) { | ||
this.props.client.name = this.state.selectedClient.name; | ||
} | ||
} | ||
} | ||
}; | ||
Registries.Component.extend(ClientScreenEdit, PosClientScreenEdit); | ||
return ClientScreenEdit; | ||
}); |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.