mirror of
https://github.com/bringout/oca-pos.git
synced 2026-04-22 16:42:01 +02:00
Move all OCA POS modules from oca-technical to dedicated oca-pos submodule
Reorganized 74 POS-related modules for better structure: - Moved all odoo-bringout-oca-pos-* packages from packages/oca-technical/ - Now organized in dedicated packages/oca-pos/ submodule - Includes payment, receipt, loyalty, order, product, and partner modules - Maintains all module functionality while improving project organization This creates a cleaner separation between general technical modules and Point of Sale specific functionality. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
3791451dc1
commit
377f346a99
2675 changed files with 93308 additions and 0 deletions
|
|
@ -0,0 +1,76 @@
|
|||
odoo.define("pos_partner_firstname.PartnerDetailsEdit", function (require) {
|
||||
"use strict";
|
||||
|
||||
const {useState} = owl;
|
||||
const {_t} = require("web.core");
|
||||
const PartnerDetailsEdit = require("point_of_sale.PartnerDetailsEdit");
|
||||
const Registries = require("point_of_sale.Registries");
|
||||
|
||||
const PosPartnerDetailsEdit = (OriginalPartnerDetailsEdit) =>
|
||||
class extends OriginalPartnerDetailsEdit {
|
||||
setup() {
|
||||
super.setup();
|
||||
this.changes = useState({
|
||||
...this.changes,
|
||||
firstname: this.props.partner.firstname || null,
|
||||
lastname: this.props.partner.lastname || null,
|
||||
is_company: this.props.partner.is_company || false,
|
||||
});
|
||||
}
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.rpc({
|
||||
model: "res.partner",
|
||||
method: "get_names_order",
|
||||
args: [],
|
||||
}).then((res) => (this.partner_names_order = res || "last_first"));
|
||||
}
|
||||
_update_partner_name(lastname, firstname) {
|
||||
let 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;
|
||||
}
|
||||
return name.trim();
|
||||
}
|
||||
saveChanges() {
|
||||
const processedChanges = {};
|
||||
for (const [key, value] of Object.entries(this.changes)) {
|
||||
if (this.intFields.includes(key)) {
|
||||
processedChanges[key] = parseInt(value, 10) || false;
|
||||
} else {
|
||||
processedChanges[key] = value;
|
||||
}
|
||||
}
|
||||
const checked = this.changes.is_company;
|
||||
if (!checked) {
|
||||
if (
|
||||
(!this.props.partner.firstname &&
|
||||
!processedChanges.firstname) ||
|
||||
processedChanges.firstname === "" ||
|
||||
(!this.props.partner.lastname && !processedChanges.lastname) ||
|
||||
processedChanges.lastname === ""
|
||||
) {
|
||||
return this.showPopup("ErrorPopup", {
|
||||
title: _t("Both Customer First and Last Name Are Required"),
|
||||
});
|
||||
}
|
||||
this.changes.name = this._update_partner_name(
|
||||
processedChanges.lastname,
|
||||
processedChanges.firstname
|
||||
);
|
||||
processedChanges.name = this.changes.name;
|
||||
} else if (checked) {
|
||||
this.changes.lastname = this.changes.firstname = undefined;
|
||||
}
|
||||
super.saveChanges();
|
||||
}
|
||||
};
|
||||
|
||||
Registries.Component.extend(PartnerDetailsEdit, PosPartnerDetailsEdit);
|
||||
|
||||
return PartnerDetailsEdit;
|
||||
});
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
odoo.define("pos_partner_firstname.PartnerListScreen", function (require) {
|
||||
"use strict";
|
||||
|
||||
const PartnerListScreen = require("point_of_sale.PartnerListScreen");
|
||||
const Registries = require("point_of_sale.Registries");
|
||||
|
||||
const PosPartnerListScreen = (OriginalPartnerListScreen) =>
|
||||
class extends OriginalPartnerListScreen {
|
||||
back() {
|
||||
super.back();
|
||||
if (this.props.partner) {
|
||||
if (this.props.partner.id === this.state.selectedPartner.id) {
|
||||
this.props.partner.name = this.state.selectedPartner.name;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
Registries.Component.extend(PartnerListScreen, PosPartnerListScreen);
|
||||
return PartnerListScreen;
|
||||
});
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<templates id="template" xml:space="preserve">
|
||||
|
||||
<t t-inherit="point_of_sale.PartnerDetailsEdit" t-inherit-mode="extension">
|
||||
<xpath expr="//input[@name='name']" position="attributes">
|
||||
<attribute
|
||||
name="t-attf-style"
|
||||
>display: {{changes.is_company ? 'block': 'none'}}</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//div[hasclass('partner-details-left')]/div[1]" position="before">
|
||||
<div class="partner-detail">
|
||||
<span class='label'>Company</span>
|
||||
<input
|
||||
type='checkbox'
|
||||
class='detail o_checkbox checkbox is_company'
|
||||
name='is_company'
|
||||
t-att-checked="changes.is_company ? 'checked' : null"
|
||||
t-on-change="captureChange"
|
||||
t-model="changes.is_company"
|
||||
/>
|
||||
<div
|
||||
class="is_person"
|
||||
t-on-change="captureChange"
|
||||
t-attf-style="display: {{!changes.is_company ? 'block': 'none'}};"
|
||||
>
|
||||
<div class='partner-detail'>
|
||||
<span class='label'>Last Name</span>
|
||||
<input
|
||||
class='detail lastname person'
|
||||
name="lastname"
|
||||
t-on-change="captureChange"
|
||||
t-model="changes.lastname"
|
||||
placeholder="LastName"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="is_person"
|
||||
t-on-change="captureChange"
|
||||
t-attf-style="display: {{!changes.is_company ? 'block': 'none'}};"
|
||||
>
|
||||
<div class='partner-detail'>
|
||||
<span class='label'>First Name</span>
|
||||
<input
|
||||
class='detail firstname person'
|
||||
name="firstname"
|
||||
t-on-change="captureChange"
|
||||
t-model="changes.firstname"
|
||||
placeholder="FirstName"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</xpath>
|
||||
</t>
|
||||
|
||||
</templates>
|
||||
Loading…
Add table
Add a link
Reference in a new issue