mirror of
https://gitlab.com/sonalarora/tra_backend.git
synced 2025-12-17 10:19:09 +02:00
work on laundary mgt
This commit is contained in:
4
laundary_mgt/__init__.py
Normal file
4
laundary_mgt/__init__.py
Normal file
@@ -0,0 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import models
|
||||
25
laundary_mgt/__manifest__.py
Normal file
25
laundary_mgt/__manifest__.py
Normal file
@@ -0,0 +1,25 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
{
|
||||
'name': 'Laundary Management',
|
||||
'version': '1.1',
|
||||
'category': 'Sales/Sales',
|
||||
'summary': 'Laundary Management',
|
||||
'description': """
|
||||
This module contains all the common features of Laundary Management.
|
||||
""",
|
||||
'depends': ['sale'],
|
||||
'data': [
|
||||
'security/ir.model.access.csv',
|
||||
'data/ir_sequence_data.xml',
|
||||
'views/sale_views.xml',
|
||||
],
|
||||
'demo': [
|
||||
],
|
||||
'qweb': [
|
||||
|
||||
],
|
||||
'installable': True,
|
||||
'auto_install': False
|
||||
}
|
||||
BIN
laundary_mgt/__pycache__/__init__.cpython-36.pyc
Normal file
BIN
laundary_mgt/__pycache__/__init__.cpython-36.pyc
Normal file
Binary file not shown.
15
laundary_mgt/data/ir_sequence_data.xml
Normal file
15
laundary_mgt/data/ir_sequence_data.xml
Normal file
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data noupdate="1">
|
||||
|
||||
<!-- Sequences for sale.order -->
|
||||
<record id="seq_sale_order_line" model="ir.sequence">
|
||||
<field name="name">Sales Order Line</field>
|
||||
<field name="code">sale.order.line</field>
|
||||
<field name="prefix">Trac</field>
|
||||
<field name="padding">3</field>
|
||||
<field name="company_id" eval="False"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</odoo>
|
||||
4
laundary_mgt/models/__init__.py
Normal file
4
laundary_mgt/models/__init__.py
Normal file
@@ -0,0 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import sale
|
||||
BIN
laundary_mgt/models/__pycache__/__init__.cpython-36.pyc
Normal file
BIN
laundary_mgt/models/__pycache__/__init__.cpython-36.pyc
Normal file
Binary file not shown.
BIN
laundary_mgt/models/__pycache__/sale.cpython-36.pyc
Normal file
BIN
laundary_mgt/models/__pycache__/sale.cpython-36.pyc
Normal file
Binary file not shown.
49
laundary_mgt/models/sale.py
Normal file
49
laundary_mgt/models/sale.py
Normal file
@@ -0,0 +1,49 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from datetime import datetime, timedelta
|
||||
from functools import partial
|
||||
from itertools import groupby
|
||||
|
||||
from odoo import api, fields, models, SUPERUSER_ID, _
|
||||
from odoo.exceptions import AccessError, UserError, ValidationError
|
||||
from odoo.tools.misc import formatLang, get_lang
|
||||
from odoo.osv import expression
|
||||
from odoo.tools import float_is_zero, float_compare
|
||||
|
||||
|
||||
|
||||
from werkzeug.urls import url_encode
|
||||
|
||||
class SaleOrder(models.Model):
|
||||
_inherit = 'sale.order'
|
||||
|
||||
check_trackcode = fields.Boolean(string='Check Track code', readonly=True, default=False, copy=False)
|
||||
|
||||
def action_generate_tracking_code(self):
|
||||
for order in self:
|
||||
order.check_trackcode = True
|
||||
company_id = default=lambda self: self.env.company
|
||||
seq_date = fields.Datetime.now()
|
||||
for line in order.order_line:
|
||||
line.tracking_code = self.env['ir.sequence'].next_by_code('sale.order.line', sequence_date=seq_date) or _('New')
|
||||
|
||||
|
||||
class SaleOrderLine(models.Model):
|
||||
_inherit = 'sale.order.line'
|
||||
_description = 'Sales Order Line'
|
||||
|
||||
wash_type = fields.Many2one('wash.type', string='Wash Type')
|
||||
cloth_name = fields.Char(string='Cloth Name',copy=False)
|
||||
tracking_code = fields.Char(string='Tracking Code',copy=False,readonly="1")
|
||||
remark = fields.Text('Remark',copy=False)
|
||||
upload_image = fields.Image("Upload Image")
|
||||
|
||||
|
||||
|
||||
|
||||
class WashType(models.Model):
|
||||
_name = 'wash.type'
|
||||
_description = 'Wash Type'
|
||||
|
||||
name = fields.Char(string='Name')
|
||||
2
laundary_mgt/security/ir.model.access.csv
Normal file
2
laundary_mgt/security/ir.model.access.csv
Normal file
@@ -0,0 +1,2 @@
|
||||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
||||
access_wash_type,wash.type,model_wash_type,sales_team.group_sale_salesman,1,1,1,1
|
||||
|
22
laundary_mgt/views/sale_views.xml
Normal file
22
laundary_mgt/views/sale_views.xml
Normal file
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<record id="view_template_sale_tree_inheritt" model="ir.ui.view">
|
||||
<field name="name">sale.order.form.inherit</field>
|
||||
<field name="model">sale.order</field>
|
||||
<field name="inherit_id" ref="sale.view_order_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr = "//header" position = "inside">
|
||||
<button name="action_generate_tracking_code" type="object" string="Generate Tracking Code" attrs="{'invisible': ['|',('check_trackcode', '=', True),('state', '!=', 'sale')]}"/>
|
||||
<field name="check_trackcode" invisible="1"/>
|
||||
</xpath>
|
||||
<xpath expr = "//notebook/page/field[@name = 'order_line']/tree/field[@name = 'name']" position = "after">
|
||||
<field name="cloth_name"/>
|
||||
<field name="wash_type"/>
|
||||
<field name="tracking_code"/>
|
||||
</xpath>
|
||||
<xpath expr = "//notebook/page/field[@name='order_line']/tree/field[@name='price_subtotal']" position = "after">
|
||||
<field name="upload_image"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user