-
-
Notifications
You must be signed in to change notification settings - Fork 602
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by legalsylvain
- Loading branch information
Showing
16 changed files
with
146 additions
and
0 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
TODO :) |
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 @@ | ||
from . import models |
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 @@ | ||
{ | ||
"name": "PoS Order To Sale Order: Report", | ||
"version": "16.0.1.0.0", | ||
"category": "Sales/Point of Sale", | ||
"summary": "Report will be downloaded after the sales order is created.", | ||
"depends": ["pos_order_to_sale_order"], | ||
"website": "https://github.com/OCA/pos", | ||
"author": "Cetmix,Odoo Community Association (OCA)", | ||
"maintainers": ["GabbasovDinar", "CetmixGitDrone"], | ||
"data": [ | ||
"views/res_config_settings_view.xml", | ||
], | ||
"installable": True, | ||
"assets": { | ||
"point_of_sale.assets": [ | ||
"pos_order_to_sale_order_report/static/src/js/**/*.js", | ||
], | ||
}, | ||
"license": "AGPL-3", | ||
} |
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,2 @@ | ||
from . import pos_config | ||
from . import res_config_settings |
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 @@ | ||
from odoo import api, fields, models | ||
|
||
|
||
class PosConfig(models.Model): | ||
_inherit = "pos.config" | ||
|
||
@api.model | ||
def _domain_iface_sale_order_report_id(self): | ||
""" | ||
Return domain to select report to print via PoS after create Sale Order | ||
""" | ||
return [ | ||
("model", "=", "sale.order"), | ||
("report_type", "=", "qweb-pdf"), | ||
] | ||
|
||
iface_sale_order_report_id = fields.Many2one( | ||
"ir.actions.report", | ||
domain=lambda self: self._domain_iface_sale_order_report_id(), | ||
) |
14 changes: 14 additions & 0 deletions
14
pos_order_to_sale_order_report/models/res_config_settings.py
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,14 @@ | ||
from odoo import fields, models | ||
|
||
|
||
class ResConfigSettings(models.TransientModel): | ||
_inherit = "res.config.settings" | ||
|
||
pos_iface_sale_order_report_id = fields.Many2one( | ||
"ir.actions.report", | ||
related="pos_config_id.iface_sale_order_report_id", | ||
readonly=False, | ||
) | ||
pos_iface_create_sale_order = fields.Boolean( | ||
related="pos_config_id.iface_create_sale_order", | ||
) |
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,2 @@ | ||
Select PoS > Configuration > Settings > Sale Order Creation > specify "Sale Order Report": | ||
.. image:: ../static/img/pos_config.png |
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,2 @@ | ||
* Dinar Gabbasov <https://github.com/GabbasovDinar> | ||
* Cetmix <https://cetmix.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
This module extends the functionality of the pos_order_to_sale_order module | ||
which allows download a report from Point of Sale after creating a sales order. |
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 @@ | ||
If the report is specified in the pos config then the report will be downloaded automatically when the sales order is created. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 39 additions & 0 deletions
39
pos_order_to_sale_order_report/static/src/js/Popups/CreateOrderPopup.esm.js
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,39 @@ | ||
/** @odoo-module **/ | ||
|
||
import CreateOrderPopup from "point_of_sale.CreateOrderPopup"; | ||
import Registries from "point_of_sale.Registries"; | ||
|
||
const PosSaleOrderReportCreateOrderPopup = (CreateOrderPopup) => | ||
class extends CreateOrderPopup { | ||
async _downloadSaleOrderReport(saleOrderId) { | ||
try { | ||
const report = this.env.pos.config.iface_sale_order_report_id; | ||
if (saleOrderId && report) { | ||
await this.env.legacyActionManager.do_action(report[0], { | ||
additional_context: { | ||
active_ids: [saleOrderId], | ||
}, | ||
}); | ||
} | ||
} catch (error) { | ||
if (error instanceof Error) { | ||
throw error; | ||
} else { | ||
this.showPopup("ErrorPopup", { | ||
title: this.env._t("Network Error"), | ||
body: this.env._t("Unable to download report."), | ||
}); | ||
} | ||
} | ||
} | ||
// @override | ||
async _createSaleOrder(order_state) { | ||
const data = await super._createSaleOrder(order_state); | ||
if (data) { | ||
await this._downloadSaleOrderReport(data.sale_order_id); | ||
} | ||
return data; | ||
} | ||
}; | ||
|
||
Registries.Component.extend(CreateOrderPopup, PosSaleOrderReportCreateOrderPopup); |
35 changes: 35 additions & 0 deletions
35
pos_order_to_sale_order_report/views/res_config_settings_view.xml
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,35 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<odoo> | ||
|
||
<record id="view_res_config_settings_form" model="ir.ui.view"> | ||
<field name="name">res.config.settings.view.form</field> | ||
<field name="model">res.config.settings</field> | ||
<field | ||
name="inherit_id" | ||
ref="pos_order_to_sale_order.view_res_config_settings_form" | ||
/> | ||
<field name="arch" type="xml"> | ||
<xpath | ||
expr="//field[@name='pos_iface_create_invoiced_sale_order']/../.." | ||
position="after" | ||
> | ||
<div class="col-12 col-lg-6 o_setting_box"> | ||
<div class="o_setting_right_pane"> | ||
<span class="o_form_label">Report</span> | ||
<div class="text-muted"> | ||
This report will be downloaded after the sales order is created. | ||
</div> | ||
<div class="content-group mt16"> | ||
<field name="pos_iface_create_sale_order" invisible="1" /> | ||
<field | ||
name="pos_iface_sale_order_report_id" | ||
attrs="{'invisible': [('pos_iface_create_sale_order', '=', False)]}" | ||
/> | ||
</div> | ||
</div> | ||
</div> | ||
</xpath> | ||
</field> | ||
</record> | ||
|
||
</odoo> |
1 change: 1 addition & 0 deletions
1
setup/pos_order_to_sale_order_report/odoo/addons/pos_order_to_sale_order_report
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 @@ | ||
../../../../pos_order_to_sale_order_report |
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,6 @@ | ||
import setuptools | ||
|
||
setuptools.setup( | ||
setup_requires=['setuptools-odoo'], | ||
odoo_addon=True, | ||
) |