BVR are Ok.
bzr revid: pinky-74eb14f963b500478b874717482441d93a178c5b
This commit is contained in:
parent
d03c2d0378
commit
c1ea220060
|
@ -165,6 +165,7 @@
|
|||
<field name="tax_line" nolabel="1" widget="one2many_list" colspan="4"/>
|
||||
</page>
|
||||
<page string="Other Information">
|
||||
<field name="bank_id"/>
|
||||
<field name="reference" select="1"/>
|
||||
<field name="origin"/>
|
||||
<field name="address_contact_id" domain="[('partner_id','=',partner_id)]" colspan="3"/>
|
||||
|
|
|
@ -111,7 +111,8 @@ class account_invoice(osv.osv):
|
|||
help='The date of the first cash discount'),
|
||||
|
||||
'partner_id': fields.many2one('res.partner', 'Partner', change_default=True, readonly=True, required=True, states={'draft':[('readonly',False)]}, relate=True),
|
||||
'partner_bank_id': fields.many2one('res.partner.bank', 'Partner bank', states={'draft':[('readonly',False)]}),
|
||||
'partner_bank_id': fields.many2one('res.partner.bank', 'Partner bank'),
|
||||
'bank_id': fields.many2one('res.partner.bank', 'Company bank'),
|
||||
'address_contact_id': fields.many2one('res.partner.address', 'Contact Address', readonly=True, states={'draft':[('readonly',False)]}),
|
||||
'address_invoice_id': fields.many2one('res.partner.address', 'Invoice Address', readonly=True, required=True, states={'draft':[('readonly',False)]}),
|
||||
|
||||
|
|
|
@ -30,3 +30,4 @@ import bvr
|
|||
import dta
|
||||
import v11
|
||||
import partner
|
||||
import company
|
||||
|
|
|
@ -16,7 +16,8 @@
|
|||
"v11/v11_wizard.xml","v11/v11_view.xml",
|
||||
"account_vat.xml","base_config.xml","account_config.xml",
|
||||
"bvr/bvr_report.xml",
|
||||
#"company_view.xml",
|
||||
"bvr/bvr_wizard.xml",
|
||||
"company_view.xml",
|
||||
#"partner_view.xml",
|
||||
],
|
||||
"active": False,
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0"?>
|
||||
<terp>
|
||||
<data>
|
||||
|
||||
<wizard
|
||||
string="Print BVR"
|
||||
model="account.invoice"
|
||||
name="l10n_ch.bvr.check"
|
||||
id="wizard_bvr_check_report"/>
|
||||
|
||||
</data>
|
||||
</terp>
|
|
@ -31,13 +31,28 @@ from report import report_sxw
|
|||
class account_invoice_bvr(report_sxw.rml_parse):
|
||||
def __init__(self, cr, uid, name, context):
|
||||
super(account_invoice_bvr, self).__init__(cr, uid, name, context)
|
||||
raise 'a'
|
||||
self.localcontext.update({
|
||||
'time': time,
|
||||
'user':self.pool.get("res.users").browse(cr,uid,uid),
|
||||
'mod10r': self._mod10r,
|
||||
'_space': self._space,
|
||||
'_get_ref': self._get_ref,
|
||||
})
|
||||
|
||||
def _space(self,nbr, nbrspc=5):
|
||||
res = ''
|
||||
for i in range(len(nbr)):
|
||||
res = res + nbr[i]
|
||||
if not (i-1) % nbrspc:
|
||||
res = res + ' '
|
||||
return res
|
||||
|
||||
def _get_ref(self, o):
|
||||
res = ''
|
||||
if o.bank_id.bank_code:
|
||||
res = o.bank_id.bank_code
|
||||
return self._mod10r(res+o.number.rjust(26-len(res), '0'))
|
||||
|
||||
def _mod10r(self,nbr):
|
||||
"""
|
||||
Input arg : account or invoice number
|
||||
|
|
|
@ -115,10 +115,10 @@
|
|||
-->
|
||||
<illustration width="200mm" height="106mm">
|
||||
<setFont name="Times-Roman" size="11"/>
|
||||
<drawString x="6mm" y="79mm">[[ user.company_id.partner_id.name ]]</drawString>
|
||||
<drawString x="6mm" y="74mm">[[ user.company_id.partner_id.address[0].street ]]</drawString>
|
||||
<drawString x="6mm" y="69mm">[[ (user.company_id.partner_id.address[0].street2 or '')]]</drawString>
|
||||
<drawString x="6mm" y="64mm">[[ user.company_id.partner_id.address[0].zip ]] [[ user.company_id.partner_id.address[0].city ]]</drawString>
|
||||
<drawString x="5.5mm" y="79mm">[[ user.company_id.partner_id.name ]]</drawString>
|
||||
<drawString x="5.5mm" y="74mm">[[ user.company_id.partner_id.address[0].street ]]</drawString>
|
||||
<drawString x="5.5mm" y="69mm">[[ (user.company_id.partner_id.address[0].street2 or '')]]</drawString>
|
||||
<drawString x="5.5mm" y="64mm">[[ user.company_id.partner_id.address[0].zip ]] [[ user.company_id.partner_id.address[0].city ]]</drawString>
|
||||
|
||||
<drawString x="62mm" y="79mm">[[ user.company_id.partner_id.name ]]</drawString>
|
||||
<drawString x="62mm" y="74mm">[[ user.company_id.partner_id.address[0].street ]]</drawString>
|
||||
|
@ -127,20 +127,22 @@
|
|||
|
||||
<setFont name="ocrb" size="9"/>
|
||||
|
||||
<drawString x="6mm" y="34mm">[[ o.partner_id.name ]]</drawString>
|
||||
<drawString x="6mm" y="30mm">[[ o.address_invoice_id.street ]]</drawString>
|
||||
<drawString x="6mm" y="26mm">[[ (o.address_invoice_id.street2 or '')]]</drawString>
|
||||
<drawString x="6mm" y="22mm">[[ o.address_invoice_id.zip ]] [[ o.address_invoice_id.city ]]</drawString>
|
||||
<drawString x="5.5mm" y="34mm">[[ o.partner_id.name ]]</drawString>
|
||||
<drawString x="5.5mm" y="30mm">[[ o.address_invoice_id.street ]]</drawString>
|
||||
<drawString x="5.5mm" y="26mm">[[ (o.address_invoice_id.street2 or '')]]</drawString>
|
||||
<drawString x="5.5mm" y="22mm">[[ o.address_invoice_id.zip ]] [[ o.address_invoice_id.city ]]</drawString>
|
||||
|
||||
<drawString x="6mm" y="40mm">[[ mod10r(o.number).rjust(27,'0')]]</drawString>
|
||||
<drawString x="5.5mm" y="40mm">[[ _get_ref(o) ]]</drawString>
|
||||
|
||||
<drawString x="126mm" y="51mm">[[ o.partner_id.name ]]</drawString>
|
||||
<drawString x="126mm" y="47mm">[[ o.address_invoice_id.street ]]</drawString>
|
||||
<drawString x="126mm" y="43mm">[[ (o.address_invoice_id.street2 or '')]]</drawString>
|
||||
<drawString x="126mm" y="39mm">[[ o.address_invoice_id.zip ]] [[ o.address_invoice_id.city ]]</drawString>
|
||||
|
||||
<setFont name="ocrb" size="11"/>
|
||||
<drawString x="124mm" y="67.5mm">[[ _space(_get_ref(o)) ]]</drawString>
|
||||
|
||||
<setFont name="ocrb" size="12"/>
|
||||
<drawString x="126mm" y="67.5mm">[[ mod10r(o.number).rjust(27,'0') ]]</drawString>
|
||||
|
||||
<drawRightString x="39mm" y="50mm">[[ ('%.2f' % o.amount_total)[:-3] ]]</drawRightString>
|
||||
<drawRightString x="100mm" y="50mm">[[ ('%.2f' % o.amount_total)[:-3] ]]</drawRightString>
|
||||
|
@ -154,104 +156,10 @@
|
|||
|
||||
-->
|
||||
|
||||
<drawString x="66.72mm" y="16.20mm">01[[mod10r('%.2f' % o.amount_total).rjust(11,'0')]]>[[ mod10r(o.number).rjust(27,'0')]]+ [[o.partner_bank_id.bvr_number.split('-')[0]+(o.partner_bank_id.bvr_number.split('-')[1]).rjust(6,'0')+o.partner_bank_id.bvr_number.split('-')[2] ]]></drawString>
|
||||
|
||||
<setFont name="ocrb" size="11.5"/>
|
||||
<drawString x="66.72mm" y="16.20mm">01[[mod10r('%.2f' % o.amount_total).rjust(11,'0')]]>[[ _get_ref(o) ]]+ [[o.bank_id.bvr_number.split('-')[0]+(o.bank_id.bvr_number.split('-')[1]).rjust(6,'0')+o.bank_id.bvr_number.split('-')[2] ]]></drawString>
|
||||
|
||||
</illustration>
|
||||
<!--
|
||||
<blockTable colWidths="144.0,151.0,243.0" rowheights="3cm,1cm,1cm,1cm,3cm,1cm" style="Table1">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="PBVR"></para>
|
||||
<para style="PBVR"></para>
|
||||
<para style="PBVR"></para>
|
||||
<para style="PBVR"></para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="PBVR">[[ user.company_id.partner_id.name ]]</para>
|
||||
<para style="PBVR">[[ user.company_id.partner_id.address[0].street ]]</para>
|
||||
<para style="PBVR">[[ user.company_id.partner_id.address[0].street2 or '' ]]</para>
|
||||
<para style="PBVR">[[ user.company_id.partner_id.address[0].zip ]] [[ user.company_id.partner_id.address[0].city ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="PBVR">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="PBVR">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="PBVR"></para>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<para style="PBVR">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="PBVR">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<para style="PBVR">[[ ('%.2f' % o.amount_total)[:-3] +' . '+ ('%.2f' % o.amount_total)[-2:] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="PBVR">[[ ('%.2f' % o.amount_total)[:-3] +' . '+ ('%.2f' % o.amount_total)[-2:] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="PBVR">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<para style="PBVR">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="PBVR">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="PBVR">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<para style="PBVR">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<para style="PBVR">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
-->
|
||||
<frameEnd/>
|
||||
</story>
|
||||
</document>
|
||||
|
|
|
@ -26,10 +26,16 @@
|
|||
##############################################################################
|
||||
|
||||
import wizard
|
||||
import pooler
|
||||
import re
|
||||
|
||||
def _check(self, cr, uid, data, context):
|
||||
for invoice in self.pool.get('account.invoice').browse(cr, uid, data['ids'], context):
|
||||
pass
|
||||
for invoice in pooler.get_pool(cr.dbname).get('account.invoice').browse(cr, uid, data['ids'], context):
|
||||
if not invoice.bank_id:
|
||||
raise wizard.except_wizard('UserError','The invoice "%s" has no bank associated !' % (invoice.number,))
|
||||
if not re.compile('[0-9][0-9]?\-[0-9]+-[0-9]+').match(invoice.bank_id.bvr_number or ''):
|
||||
raise wizard.except_wizard('UserError','Your bank BVR number should be of the form 0X-XXX-X !\nSee invoice "%s".' % (invoice.number,))
|
||||
|
||||
return {}
|
||||
|
||||
class wizard_report(wizard.interface):
|
||||
|
|
|
@ -34,10 +34,8 @@ from osv import fields, osv
|
|||
class res_company(osv.osv):
|
||||
_inherit = "res.company"
|
||||
_columns = {
|
||||
'bvr_number': fields.char('BVR Number', size=9),
|
||||
'bvr_delta_horz': fields.float('BVR Horz. Delta (mm)', size=(16,2)),
|
||||
'bvr_delta_vert': fields.float('BVR Vert. Delta (mm)', size=(16,2)),
|
||||
'dta_number': fields.char('DTA Number', size=9),
|
||||
}
|
||||
res_company()
|
||||
|
||||
|
|
|
@ -8,10 +8,8 @@
|
|||
<field name="inherit_id" ref="base.view_company_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="rml_footer2" position="after">
|
||||
<field name="bvr_number"/>
|
||||
<field name="bvr_delta_horz"/>
|
||||
<field name="bvr_delta_vert"/>
|
||||
<field name="dta_number"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
|
|
@ -98,7 +98,7 @@ class purchase_order(osv.osv):
|
|||
|
||||
'pricelist_id':fields.many2one('product.pricelist', 'Pricelist', required=True, states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)]}),
|
||||
|
||||
'state': fields.selection([('draft', 'Request for Quotation'), ('wait', 'Waiting'), ('confirmed', 'Confirmed'), ('approved', 'Approved'),('except_ship', 'Shipping Exception'), ('except_invoice', 'Invoice Exception'), ('done', 'Done'), ('cancel', 'Cancelled')], 'Order State', readonly=True, help="The state of the purchase order or the quotation request. A quotation is a purchase order in a 'Draft' state. Then the order has to be confirmed by the user, the state switch to 'Confirmed'. Then the supplier must confirm the order to change the state to 'Approved'. When the purchase order is paid and received, the state becomes 'Done'. If a cancel action occurs in the invoice or in the reception of goods, the state becomes in exception.", select=True),
|
||||
'state': fields.selection([('draft', 'Request for Quotation'), ('wait', 'Waiting'), ('confirmed', 'Confirmed'), ('approved', 'Approved'),('except_picking', 'Shipping Exception'), ('except_invoice', 'Invoice Exception'), ('done', 'Done'), ('cancel', 'Cancelled')], 'Order State', readonly=True, help="The state of the purchase order or the quotation request. A quotation is a purchase order in a 'Draft' state. Then the order has to be confirmed by the user, the state switch to 'Confirmed'. Then the supplier must confirm the order to change the state to 'Approved'. When the purchase order is paid and received, the state becomes 'Done'. If a cancel action occurs in the invoice or in the reception of goods, the state becomes in exception.", select=True),
|
||||
'order_line': fields.one2many('purchase.order.line', 'order_id', 'Order State', states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)]}),
|
||||
'validator' : fields.many2one('res.users', 'Validated by', readonly=True),
|
||||
'notes': fields.text('Notes'),
|
||||
|
|
Loading…
Reference in New Issue