Ajay Javiya
5 years ago
committed by
Alexei Rivera
10 changed files with 140 additions and 88 deletions
-
3partner_label/README.rst
-
12partner_label/__manifest__.py
-
13partner_label/models/res_company.py
-
50partner_label/models/res_config_settings.py
-
4partner_label/readme/CONFIGURE.rst
-
2partner_label/readme/CONTRIBUTERS.rst
-
2partner_label/readme/USAGE.rst
-
27partner_label/reports/res_partner.xml
-
22partner_label/tests/test_partner_label.py
-
93partner_label/views/base_config_settings.xml
@ -1,18 +1,14 @@ |
|||||
# Copyright 2019 Therp BV <https://therp.nl> |
# Copyright 2019 Therp BV <https://therp.nl> |
||||
|
# Copyright 2019-2020: Druidoo (<https://www.druidoo.io>) |
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). |
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). |
||||
{ |
{ |
||||
"name": "Partner labels", |
"name": "Partner labels", |
||||
"version": "12.0.1.0.0", |
|
||||
|
"version": "13.0.1.0.0", |
||||
"author": "Therp BV,Odoo Community Association (OCA)", |
"author": "Therp BV,Odoo Community Association (OCA)", |
||||
"license": "AGPL-3", |
"license": "AGPL-3", |
||||
"category": "Base", |
"category": "Base", |
||||
"summary": "Print partner labels", |
"summary": "Print partner labels", |
||||
"depends": [ |
|
||||
'base_setup', |
|
||||
], |
|
||||
"data": [ |
|
||||
"views/base_config_settings.xml", |
|
||||
"reports/res_partner.xml", |
|
||||
], |
|
||||
|
"depends": ["base_setup"], |
||||
|
"data": ["views/base_config_settings.xml", "reports/res_partner.xml"], |
||||
"installable": True, |
"installable": True, |
||||
} |
} |
@ -1,66 +1,58 @@ |
|||||
# Copyright 2017-2019 Therp BV <https://therp.nl> |
# Copyright 2017-2019 Therp BV <https://therp.nl> |
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). |
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). |
||||
from odoo import api, fields, models |
|
||||
|
from odoo import fields, models |
||||
|
|
||||
|
|
||||
class ResConfigSettings(models.TransientModel): |
class ResConfigSettings(models.TransientModel): |
||||
_inherit = 'res.config.settings' |
|
||||
|
_inherit = "res.config.settings" |
||||
|
|
||||
partner_labels_width = fields.Float( |
partner_labels_width = fields.Float( |
||||
related='company_id.partner_labels_width', required=True, |
|
||||
readonly=False, |
|
||||
|
related="company_id.partner_labels_width", required=True, readonly=False, |
||||
) |
) |
||||
partner_labels_height = fields.Float( |
partner_labels_height = fields.Float( |
||||
related='company_id.partner_labels_height', required=True, |
|
||||
readonly=False, |
|
||||
|
related="company_id.partner_labels_height", required=True, readonly=False, |
||||
) |
) |
||||
partner_labels_padding = fields.Float( |
partner_labels_padding = fields.Float( |
||||
related='company_id.partner_labels_padding', required=True, |
|
||||
readonly=False, |
|
||||
|
related="company_id.partner_labels_padding", required=True, readonly=False, |
||||
) |
) |
||||
partner_labels_margin_top = fields.Float( |
partner_labels_margin_top = fields.Float( |
||||
related='company_id.partner_labels_margin_top', |
|
||||
required=True, readonly=False, |
|
||||
|
related="company_id.partner_labels_margin_top", required=True, readonly=False, |
||||
) |
) |
||||
partner_labels_margin_bottom = fields.Float( |
partner_labels_margin_bottom = fields.Float( |
||||
related='company_id.partner_labels_margin_bottom', |
|
||||
required=True, readonly=False, |
|
||||
|
related="company_id.partner_labels_margin_bottom", |
||||
|
required=True, |
||||
|
readonly=False, |
||||
) |
) |
||||
partner_labels_margin_left = fields.Float( |
partner_labels_margin_left = fields.Float( |
||||
related='company_id.partner_labels_margin_left', |
|
||||
required=True, readonly=False, |
|
||||
|
related="company_id.partner_labels_margin_left", required=True, readonly=False, |
||||
) |
) |
||||
partner_labels_margin_right = fields.Float( |
partner_labels_margin_right = fields.Float( |
||||
related='company_id.partner_labels_margin_right', |
|
||||
required=True, readonly=False, |
|
||||
|
related="company_id.partner_labels_margin_right", required=True, readonly=False, |
||||
) |
) |
||||
partner_labels_paperformat_id = fields.Many2one( |
partner_labels_paperformat_id = fields.Many2one( |
||||
'report.paperformat', string='Paperformat', required=True, |
|
||||
|
"report.paperformat", |
||||
|
string="Paperformat", |
||||
|
required=True, |
||||
default=lambda self: self.env.ref( |
default=lambda self: self.env.ref( |
||||
'partner_label.report_res_partner_label' |
|
||||
|
"partner_label.report_res_partner_label" |
||||
).paperformat_id, |
).paperformat_id, |
||||
compute='_compute_partner_labels_paperformat_id', |
|
||||
inverse='_inverse_partner_labels_paperformat_id', |
|
||||
|
compute="_compute_partner_labels_paperformat_id", |
||||
|
inverse="_inverse_partner_labels_paperformat_id", |
||||
) |
) |
||||
|
|
||||
@api.multi |
|
||||
def _compute_partner_labels_paperformat_id(self): |
def _compute_partner_labels_paperformat_id(self): |
||||
for this in self: |
for this in self: |
||||
this.partner_labels_paperformat_id = self.env.ref( |
this.partner_labels_paperformat_id = self.env.ref( |
||||
'partner_label.report_res_partner_label' |
|
||||
|
"partner_label.report_res_partner_label" |
||||
).paperformat_id |
).paperformat_id |
||||
|
|
||||
@api.multi |
|
||||
def _inverse_partner_labels_paperformat_id(self): |
def _inverse_partner_labels_paperformat_id(self): |
||||
for this in self: |
for this in self: |
||||
self.env.ref( |
self.env.ref( |
||||
'partner_label.report_res_partner_label' |
|
||||
|
"partner_label.report_res_partner_label" |
||||
).paperformat_id = this.partner_labels_paperformat_id |
).paperformat_id = this.partner_labels_paperformat_id |
||||
|
|
||||
@api.multi |
|
||||
def action_partner_labels_preview(self): |
def action_partner_labels_preview(self): |
||||
return self.env.ref( |
|
||||
'partner_label.report_res_partner_label' |
|
||||
).report_action( |
|
||||
self.env['res.partner'].search([], limit=100), |
|
||||
|
return self.env.ref("partner_label.report_res_partner_label").report_action( |
||||
|
self.env["res.partner"].search([], limit=100), |
||||
) |
) |
@ -0,0 +1,4 @@ |
|||||
|
#. go to `Settings / General settings` |
||||
|
#. scroll to header `Labels configuration` |
||||
|
#. change width, height, padding and margin to fit your label stickers, if necessary change the paper format |
||||
|
#. you can preview your changes by pressing the `Preview` button |
@ -0,0 +1,2 @@ |
|||||
|
* Holger Brunn <hbrunn@therp.nl> |
||||
|
* Druidoo <https://www.druidoo.io> |
@ -0,0 +1,2 @@ |
|||||
|
#. mark partners |
||||
|
#. print your labels |
Write
Preview
Loading…
Cancel
Save
Reference in new issue