Skip to content

Commit

Permalink
[MIG] pos_partner_birthdate: Migration to 17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
etobella committed Dec 4, 2023
1 parent 1890ee2 commit 8fd605b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 22 deletions.
4 changes: 2 additions & 2 deletions pos_partner_birthdate/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
"name": "Point of Sale - Partner contact birthdate",
"summary": "Adds the birthdate in the customer screen of POS",
"version": "16.0.1.0.4",
"version": "17.0.1.0.0",
"development_status": "Beta",
"category": "Point of sale",
"website": "https://github.com/OCA/pos",
Expand All @@ -13,7 +13,7 @@
"installable": True,
"depends": ["point_of_sale", "partner_contact_birthdate"],
"assets": {
"point_of_sale.assets": [
"point_of_sale._assets_pos": [
"pos_partner_birthdate/static/src/xml/ClientDetailsEdit.xml",
"pos_partner_birthdate/static/src/js/ClientDetailsEdit.esm.js",
]
Expand Down
26 changes: 11 additions & 15 deletions pos_partner_birthdate/static/src/js/ClientDetailsEdit.esm.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
/** @odoo-module **/
const {useState} = owl;
import PartnerDetailsEdit from "point_of_sale.PartnerDetailsEdit";
import Registries from "point_of_sale.Registries";
import {PartnerDetailsEdit} from "@point_of_sale/app/screens/partner_list/partner_editor/partner_editor";
import {patch} from "@web/core/utils/patch";

const PartnerDetailsEditBirthdate = (OriginalPartnerDetailsEdit) =>
class extends OriginalPartnerDetailsEdit {
setup() {
super.setup();
this.changes = useState({
...this.changes,
birthdate_date: this.props.partner.birthdate_date || null,
});
}
};

Registries.Component.extend(PartnerDetailsEdit, PartnerDetailsEditBirthdate);
patch(PartnerDetailsEdit.prototype, {
setup() {
super.setup(...arguments);
this.changes.birthdate_date = this.props.partner.birthdate_date || null;
},
_today() {
return new Date().toISOString().split("T")[0];
},
});
12 changes: 7 additions & 5 deletions pos_partner_birthdate/static/src/xml/ClientDetailsEdit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,17 @@
t-inherit-mode="extension"
owl="1"
>
<xpath expr="//div[hasclass('partner-details-left')]" position="inside">
<div class="partner-detail">
<span class="label">Birthdate</span>
<xpath expr="//div[hasclass('partner-details-box')]" position="inside">

<div class="partner-detail col">
<label class="form-label label" for="birthdate_date">Birthdate</label>
<input
class="detail"
class="detail birthdate_date form-control"
id="birthdate_date"
name="birthdate_date"
type="date"
t-att-max="_today()"
t-model="changes.birthdate_date"
t-on-change="captureChange"
placeholder="Birthdate"
/>
</div>
Expand Down

0 comments on commit 8fd605b

Please sign in to comment.